diff --git a/src/utils/request.js b/src/utils/request.js index c0fe050..7a848ca 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -21,7 +21,7 @@ if(window.location.origin.indexOf('localhost')>-1){ const service = axios.create({ baseURL: baseUrl, // url = base url + request url // withCredentials: true, // send cookies when cross-domain requests - timeout: 15000, // request timeout + timeout: 15000000, // request timeout isLoading:true }) diff --git a/src/views/inventorys/index.vue b/src/views/inventorys/index.vue index e6012e3..39d6f9a 100644 --- a/src/views/inventorys/index.vue +++ b/src/views/inventorys/index.vue @@ -122,13 +122,8 @@ list: [], table: [{ type: 'selection' - }, { - - label: '创建时间', - prop: 'created_at', - fixed: 'left', - width: 180, - },{ + }, + { label: '序号', type: 'index', fixed: 'left', @@ -488,7 +483,13 @@ } }) } - this.form = res.data + // this.form = res.data + this.form = res.data + ?.filter((i) => i.list_show) + .map((i) => { + return i + }) + console.log(this.form) }, } diff --git a/src/views/inventorys/outbounds.vue b/src/views/inventorys/outbounds.vue index 79f2881..172df3f 100644 --- a/src/views/inventorys/outbounds.vue +++ b/src/views/inventorys/outbounds.vue @@ -5,7 +5,7 @@
- + @@ -89,11 +89,41 @@ form: [], total: 0, list: [], - table: [ { + table: [{ label: '序号', type: 'index', fixed: 'left', width: 80, + }, + { + label: '出库时间', + prop:'outbounds_chukushijian', + width: 180, + }, + { + label: '出库类型', + prop:'outbounds_chukuleixing', + width: 180, + }, + { + label: '出库状态', + prop:'outbounds_zhuangtai', + width: 180, + }, + { + label: '借用仓库', + prop:'outbounds_jieyongcangku', + width: 180, + }, + { + label: '借用部门', + prop:'outbounds_jieyongbumen', + width: 180, + }, + { + label: '经办人', + prop:'outbounds_jilurenyuan', + width: 180, }, { label: "物资编码", @@ -129,14 +159,12 @@ { label: "出库数量", width: 120, - prop: 'jieyongshuliang', - + prop: 'jieyongshuliang', }, { - label: "出库时间", + label: "备注", width: 180, - prop: 'created_at', - + prop: 'outbounds_beizhu', } // { // label: "二维码", @@ -157,24 +185,49 @@ } }, mounted() { - this.getField() + // this.getField() this.getindex() }, methods: { - async exportExcel(sheetName) { + async exportExcel(sheetName) { + this.loading = true const res = await index(Object.assign('', { - page: 1, - page_size: 9999, - table_name: this.customForm.tableName + page_size: 99999, + page: 1, + table_name: this.customForm.tableName, + // is_export:this.select.is_export, + filter: [{ + "key": "wuzibianma", + "op": "like", + "value": this.select.wzbm, + },{ + "key": "zichanmingcheng", + "op": "like", + "value": this.select.keyword, + }, + ], })) if (res.data) { - let headers = this.form.map(i => { - return { - key: i.field, - title: i.name + let headers = this.table.filter(f=>f.type!='index').map(i => { + if(i.type!='index'){ + return { + key: i.prop, + title: i.label + } } - }) + }) + for(var k of res.data){ + if(k.outbounds_id_outbounds_items_id_relation){ + k.outbounds_chukushijian = k.outbounds_id_outbounds_items_id_relation.chukushijian + k.outbounds_chukuleixing = k.outbounds_id_outbounds_items_id_relation.chukuleixing + k.outbounds_zhuangtai = k.outbounds_id_outbounds_items_id_relation.zhuangtai + k.outbounds_jieyongbumen = k.outbounds_id_outbounds_items_id_relation.jieyongbumen + k.outbounds_jieyongcangku = k.outbounds_id_outbounds_items_id_relation.jieyongcangku + k.outbounds_jilurenyuan = k.outbounds_id_outbounds_items_id_relation.jilurenyuan + k.outbounds_beizhu = k.outbounds_id_outbounds_items_id_relation.beizhu + } + } const data = res.data.map(row => headers.map(header => row[header.key])); data.unshift(headers.map(header => header.title)); const wb = XLSX.utils.book_new(); @@ -187,7 +240,8 @@ }); saveAs(new Blob([wbout], { type: 'application/octet-stream' - }), `${sheetName}.xlsx`); + }), `${sheetName}.xlsx`); + this.loading = false } }, async getindex() { @@ -206,9 +260,19 @@ "op": "like", "value": this.select.keyword, }, - ], - }) + }) + for(var k of res.data){ + if(k.outbounds_id_outbounds_items_id_relation){ + k.outbounds_chukushijian = k.outbounds_id_outbounds_items_id_relation.chukushijian + k.outbounds_chukuleixing = k.outbounds_id_outbounds_items_id_relation.chukuleixing + k.outbounds_zhuangtai = k.outbounds_id_outbounds_items_id_relation.zhuangtai + k.outbounds_jieyongbumen = k.outbounds_id_outbounds_items_id_relation.jieyongbumen + k.outbounds_jieyongcangku = k.outbounds_id_outbounds_items_id_relation.jieyongcangku + k.outbounds_jilurenyuan = k.outbounds_id_outbounds_items_id_relation.jilurenyuan + k.outbounds_beizhu = k.outbounds_id_outbounds_items_id_relation.beizhu + } + } this.list = res.data this.total = res.total this.loading = false diff --git a/src/views/inventorys/stocks.vue b/src/views/inventorys/stocks.vue index ad654ef..b6856a0 100644 --- a/src/views/inventorys/stocks.vue +++ b/src/views/inventorys/stocks.vue @@ -5,7 +5,7 @@
- + @@ -80,15 +80,11 @@ keyword: "", wzbm:'', is_export: 0, - min: '', - max: '', - rmin: '', - rmax: '' }, showcode: false, customForm: { customFormId: 11, - tableName: "stocks_item_links" + tableName: "stocks_items" }, form: [], total: 0, @@ -98,6 +94,36 @@ type: 'index', fixed: 'left', width: 80, + }, + { + label: '入库时间', + prop:'stocks_rukushijian', + width: 180 + }, + { + label: '入库类型', + prop:'stocks_rukuleixing', + width: 180, + }, + { + label: '关联记录', + prop:'stocks_guanlianjilu', + width: 180, + }, + { + label: '经办人', + prop:'stocks_jingbanren', + width: 180, + }, + { + label: '记录人员', + prop:'stocks_jilurenyuan', + width: 180, + }, + { + label: '保管人员', + prop:'stocks_baoguanrenyuan', + width: 180, }, { label: "物资编码", @@ -175,7 +201,12 @@ return value } } - } + }, + { + label: '备注', + prop:'stocks_beizhu', + width: 180, + }, // { // label: "二维码", // width: 180, @@ -200,19 +231,45 @@ }, methods: { - async exportExcel(sheetName) { + async exportExcel(sheetName) { + this.loading = true const res = await index(Object.assign('', { - page: 1, - page_size: 9999, - table_name: this.customForm.tableName + page_size: 99999, + page: 1, + table_name: this.customForm.tableName, + filter: [{ + "key": "wuzibianma", + "op": "like", + "value": this.select.wzbm, + },{ + "key": "zichanmingcheng", + "op": "like", + "value": this.select.keyword, + } + ], })) if (res.data) { - let headers = this.form.map(i => { - return { - key: i.field, - title: i.name + let headers = this.table.filter(f=>f.type!='index').map(i => { + if(i.type!='index'){ + return { + key: i.prop, + title: i.label + } } - }) + }) + for(var k of res.data){ + if(k.stocks_id_stocks_items_id_relation){ + k.stocks_rukushijian = k.stocks_id_stocks_items_id_relation.rukushijian?.substring(0,10) + k.stocks_rukuleixing = k.stocks_id_stocks_items_id_relation.rukuleixing + let rowname = k.stocks_rukuleixing=='采购'? 'caigouhetong':(k.stocks_rukuleixing=='请示'?'qingshiliucheng':(k.stocks_rukuleixing=='应急采购'?'yingjicaigou':'')) + + k.stocks_guanlianjilu = k.stocks_id_stocks_items_id_relation[rowname] + k.stocks_jingbanren = k.stocks_id_stocks_items_id_relation.jingbanren + k.stocks_jilurenyuan = k.stocks_id_stocks_items_id_relation.jilurenyuan + k.stocks_baoguanrenyuan = k.stocks_id_stocks_items_id_relation.baoguanrenyuan + k.stocks_beizhu = k.stocks_id_stocks_items_id_relation.beizhu + } + } const data = res.data.map(row => headers.map(header => row[header.key])); data.unshift(headers.map(header => header.title)); const wb = XLSX.utils.book_new(); @@ -225,7 +282,8 @@ }); saveAs(new Blob([wbout], { type: 'application/octet-stream' - }), `${sheetName}.xlsx`); + }), `${sheetName}.xlsx`); + this.loading = false } }, async getindex() { @@ -238,18 +296,30 @@ page_size: this.select.pageSize, page: this.select.pageIndex, table_name: this.customForm.tableName, - is_export:this.select.is_export, - // filter: [{ - // "key": "wuzibianma", - // "op": "like", - // "value": this.select.wzbm, - // },{ - // "key": "zichanmingcheng", - // "op": "like", - // "value": this.select.keyword, - // } - // ], - }) + filter: [{ + "key": "wuzibianma", + "op": "like", + "value": this.select.wzbm, + },{ + "key": "zichanmingcheng", + "op": "like", + "value": this.select.keyword, + } + ], + }) + for(var k of res.data){ + if(k.stocks_id_stocks_items_id_relation){ + k.stocks_rukushijian = k.stocks_id_stocks_items_id_relation.rukushijian?.substring(0,10) + k.stocks_rukuleixing = k.stocks_id_stocks_items_id_relation.rukuleixing + let rowname = k.stocks_rukuleixing=='采购'? 'caigouhetong':(k.stocks_rukuleixing=='请示'?'qingshiliucheng':(k.stocks_rukuleixing=='应急采购'?'yingjicaigou':'')) + + k.stocks_guanlianjilu = k.stocks_id_stocks_items_id_relation[rowname] + k.stocks_jingbanren = k.stocks_id_stocks_items_id_relation.jingbanren + k.stocks_jilurenyuan = k.stocks_id_stocks_items_id_relation.jilurenyuan + k.stocks_baoguanrenyuan = k.stocks_id_stocks_items_id_relation.baoguanrenyuan + k.stocks_beizhu = k.stocks_id_stocks_items_id_relation.beizhu + } + } this.list = res.data this.total = res.total this.loading = false diff --git a/src/views/materialfile/index.vue b/src/views/materialfile/index.vue index ed8612e..eb9a6c4 100644 --- a/src/views/materialfile/index.vue +++ b/src/views/materialfile/index.vue @@ -10,8 +10,9 @@ - + @click="$refs['imports'].show()">导入 +
@@ -88,7 +89,11 @@ } from "@/api/system/customFormField"; import { getparameter - } from "@/api/system/dictionary"; + } from "@/api/system/dictionary"; + import * as XLSX from "xlsx"; + import { + saveAs + } from "file-saver"; export default { components: { addMater, @@ -290,6 +295,34 @@ }) this.getindex() }) + }, + async exportExcel(sheetName) { + const res = await index(Object.assign(this.select, { + page: 1, + page_size: 99999, + table_name: this.customForm.tableName + })) + if (res.data) { + let headers = this.importForm.map(i => { + return { + key: i.field, + title: i.name + } + }) + const data = res.data.map(row => headers.map(header => row[header.key])); + data.unshift(headers.map(header => header.title)); + const wb = XLSX.utils.book_new(); + const ws = XLSX.utils.aoa_to_sheet(data); + XLSX.utils.book_append_sheet(wb, ws, sheetName); + const wbout = XLSX.write(wb, { + bookType: 'xlsx', + bookSST: true, + type: 'array' + }); + saveAs(new Blob([wbout], { + type: 'application/octet-stream' + }), `${sheetName}.xlsx`); + } }, async getField() { const res = await fieldIndex({ @@ -326,7 +359,8 @@ } } }) - } + } + this.form = res.data this.importForm = res.data ?.filter((i) => i.list_show) .map((i) => { @@ -334,8 +368,10 @@ }) }, }, - mounted() { - this.getindex() + mounted() { + this.getField() + this.getindex() + } }