diff --git a/package.json b/package.json index d57a016..3069b25 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "babel-plugin-import": "^1.13.0", "clipboard": "^2.0.4", "core-js": "^2.6.5", + "downloadjs": "^1.4.7", "echarts": "5.1.1", "element-ui": "2.11.1", "file-saver": "2.0.1", diff --git a/src/api/common.js b/src/api/common.js index ce4dd91..61b27ef 100644 --- a/src/api/common.js +++ b/src/api/common.js @@ -198,4 +198,15 @@ export function addBorrowFn(params) { return require('qs').stringify(data, { indices: false }) } }) +} +export function uploadFileFn(params) { + return preview({ + url: '/inspectionSystemFile', + method: 'post', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + data: params, + responseType: 'blob' + }) } diff --git a/src/api/data.js b/src/api/data.js index 87ee29c..530b4d5 100644 --- a/src/api/data.js +++ b/src/api/data.js @@ -1,9 +1,15 @@ import api from '@/utils/api' import qs from 'qs' - +import preview from '@/utils/preview' export function initData(url, params) { return api({ url: url + '?' + qs.stringify(params, { indices: false }), method: 'get' }) +} +export function initData1(url, params) { + return preview({ + url: url + '?' + qs.stringify(params, { indices: false }), + method: 'get' + }) } diff --git a/src/components/Crud/crud.js b/src/components/Crud/crud.js index a4407a3..e739560 100644 --- a/src/components/Crud/crud.js +++ b/src/components/Crud/crud.js @@ -1,4 +1,4 @@ -import { initData } from '@/api/data' +import { initData, initData1 } from '@/api/data' import Vue from 'vue' /** @@ -10,6 +10,8 @@ function CRUD(options) { const defaultOptions = { // 标题 title: '', + // 接口根路由 + rootApi: 0, // 请求数据的url url: '', // 表格数据 @@ -116,20 +118,37 @@ function CRUD(options) { } return new Promise((resolve) => { // 请求数据 - initData(crud.url, crud.getQueryParams()).then(data => { - crud.page.total = data.total - if (data.list) { - crud.data = data.list - } else { - crud.data = data - } - crud.resetDataStatus() - // time 毫秒后显示表格 - setTimeout(() => { - callVmHook(crud, CRUD.HOOK.afterRefresh) - }, crud.time) - resolve(data) - }) + if (crud.rootApi) { + initData1(crud.url, crud.getQueryParams()).then(data => { + crud.page.total = data.total + if (data.list) { + crud.data = data.list + } else { + crud.data = data + } + crud.resetDataStatus() + // time 毫秒后显示表格 + setTimeout(() => { + callVmHook(crud, CRUD.HOOK.afterRefresh) + }, crud.time) + resolve(data) + }) + } else { + initData(crud.url, crud.getQueryParams()).then(data => { + crud.page.total = data.total + if (data.list) { + crud.data = data.list + } else { + crud.data = data + } + crud.resetDataStatus() + // time 毫秒后显示表格 + setTimeout(() => { + callVmHook(crud, CRUD.HOOK.afterRefresh) + }, crud.time) + resolve(data) + }) + } }) }, /** diff --git a/src/utils/index.js b/src/utils/index.js index 2ad4b6c..f6b73c7 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -160,7 +160,7 @@ export function html2Text(val) { export function objectMerge(target, source) { /* Merges two objects, - giving the last one precedence */ + giving the last one precedence */ if (typeof target !== 'object') { target = {} @@ -411,6 +411,7 @@ export function downloadFile(obj, name, suffix) { * @param suffix */ export function downloadFileUrl(url, name, suffix) { + console.log(url) buildClick(url, name, suffix) } diff --git a/src/views/borrow/borrow-history.vue b/src/views/borrow/borrow-history.vue index f758aef..b682892 100644 --- a/src/views/borrow/borrow-history.vue +++ b/src/views/borrow/borrow-history.vue @@ -230,24 +230,6 @@ export default { this.departmentId = 0 this.ifMeasure = false }, - // EXCEL上传方法 - beforeUpload(file) { - const isExcel = - file.type === 'application/vnd.ms-excel' || - file.type === - 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' - if (!isExcel) { - this.$notify.error('只能上传xls/xlsx格式的文件') - return false - } - const fd = new FormData() - fd.append('file', file) - fd.append('type', 3) - // uploadInstrumentData(fd).then(() => { - // this.$notify.success('导入数据成功。') - // this.crud.toQuery() - // }) - }, // 关闭所有弹窗 resetChecks() { diff --git a/src/views/document/index.vue b/src/views/document/index.vue index dcdc619..40ed97c 100644 --- a/src/views/document/index.vue +++ b/src/views/document/index.vue @@ -2,85 +2,114 @@
-
- + - - + + 上传文件 - + +
+
- - + + + + + + + + + + +
+ diff --git a/src/views/ysjl/components/manufacture_yb_list.vue b/src/views/ysjl/components/manufacture_yb_list.vue index 5487586..2e5a6d6 100644 --- a/src/views/ysjl/components/manufacture_yb_list.vue +++ b/src/views/ysjl/components/manufacture_yb_list.vue @@ -3,9 +3,9 @@
- - - + + + 查询 @@ -93,11 +93,10 @@ export default { pageRow: 20, // 每页条数 order: undefined, // 排序字段 sort: undefined, // 排序方式 - searchYsjl: { - shebeizhongleidaima: '2000', - jianyanleibie: 'ZJ', - hasLook: 2 - } + shebeizhongleidaima: '2000', + jianyanleibie: 'ZJ', + hasLook: 2 + }, multipleSelection: [], dialogFormVisible: false, @@ -118,7 +117,7 @@ export default { }, methods: { getList() { - this.listQuery.searchYsjl.cjState = 'bggl' + this.listQuery.cjState = 'bggl' this.api({ url: '/ysjl/getList', method: 'get', diff --git a/src/views/ysjl/components/original_yb_list.vue b/src/views/ysjl/components/original_yb_list.vue index 999091b..194b2f5 100644 --- a/src/views/ysjl/components/original_yb_list.vue +++ b/src/views/ysjl/components/original_yb_list.vue @@ -10,10 +10,10 @@ - - - - + + + +
查看类型: - + 只看创建人 @@ -130,9 +130,7 @@ export default { pageRow: 20, // 每页条数 order: undefined, // 排序字段 sort: undefined, // 排序方式 - searchYsjl: { - createBy: this.$store.getters.departmentId === 70 ? this.$store.getters.userId : undefined - }, + createBy: this.$store.getters.departmentId === 70 ? this.$store.getters.userId : undefined, hasChild: true, copyPage: false, link: 2 @@ -158,7 +156,7 @@ export default { }, methods: { getList() { - this.listQuery.searchYsjl.cjState = 'bggl' + this.listQuery.cjState = 'bggl' this.api({ url: '/ysjl/getList', method: 'get', @@ -190,9 +188,7 @@ export default { this.multipleSelection = val }, clearQuery() { - this.$set(this.listQuery, 'searchYsjl', { - createBy: this.$store.getters.userId - }) + this.$set(this.listQuery, {}) this.getList() }, generatePdf(viewType) {