From 3bd2c3970d20a808701defa6599badd3a082b54e Mon Sep 17 00:00:00 2001 From: lion <120344285@qq.com> Date: Thu, 14 Sep 2023 17:21:37 +0800 Subject: [PATCH] up --- .env.development | 16 +- .env.production | 2 +- src/api/mater.js | 9 + src/utils/request.js | 1 + .../inventorys/components/addInventorys.vue | 305 ++++++++ src/views/inventorys/index.vue | 671 +++++++++++------- src/views/materialfile/component/addMater.vue | 521 ++++++++++++++ src/views/materialfile/index.vue | 355 +++++++++ .../outbounds/component/addoutbounds.vue | 36 +- src/views/outbounds/index.vue | 3 +- src/views/stocks/component/addRuku.vue | 233 +++++- src/views/stocks/index.vue | 40 +- 12 files changed, 1877 insertions(+), 315 deletions(-) create mode 100644 src/api/mater.js create mode 100644 src/views/inventorys/components/addInventorys.vue create mode 100644 src/views/materialfile/component/addMater.vue create mode 100644 src/views/materialfile/index.vue diff --git a/.env.development b/.env.development index 1d25804..3d31e78 100644 --- a/.env.development +++ b/.env.development @@ -2,15 +2,15 @@ ENV='development' # base api -#VUE_APP_BASE_API = http://192.168.60.99:9004/ -#VUE_APP_UPLOAD_API = http://192.168.60.99:9004/api/admin/upload-file -#VUE_APP_OA_URL = http://192.168.60.18:2021 -#VUE_APP_OA_URL_TYPE = '{"领用":"37","处置":"38","应急":"39"}' +VUE_APP_BASE_API = http://192.168.60.99:9004/ +VUE_APP_UPLOAD_API = http://192.168.60.99:9004/api/admin/upload-file +VUE_APP_OA_URL = http://192.168.60.18:2021 +VUE_APP_OA_URL_TYPE = '{"领用":"37","处置":"38","应急":"39"}' -VUE_APP_BASE_API = http://hd-wuziguanli-test.ali251.langye.net/ -VUE_APP_UPLOAD_API = http://hd-wuziguanli-test.ali251.langye.net/api/admin/upload-file -VUE_APP_OA_URL= http://suzhouhedaooa.langye.net -VUE_APP_OA_URL_TYPE = '{"领用":"31","处置":"32","应急":"33"}' +#VUE_APP_BASE_API = http://hd-wuziguanli-test.ali251.langye.net/ +#VUE_APP_UPLOAD_API = http://hd-wuziguanli-test.ali251.langye.net/api/admin/upload-file +#VUE_APP_OA_URL= http://suzhouhedaooa.langye.net +#VUE_APP_OA_URL_TYPE = '{"领用":"31","处置":"32","应急":"33"}' diff --git a/.env.production b/.env.production index c66d5c7..15029bc 100644 --- a/.env.production +++ b/.env.production @@ -10,7 +10,7 @@ VUE_APP_OA_URL_TYPE = '{"领用":"37","处置":"38","应急":"39"}' #VUE_APP_BASE_API = http://hd-wuziguanli-test.ali251.langye.net/ #VUE_APP_UPLOAD_API = http://hd-wuziguanli-test.ali251.langye.net/api/admin/upload-file #VUE_APP_OA_URL= http://suzhouhedaooa.langye.net -#VUE_APP_OA_URL_TYPE = '{"领用":"31","处置":"32","应急":"33"}' +#VUE_APP_OA_URL_TYPE = '{"领用":"31","处置":"32"}' diff --git a/src/api/mater.js b/src/api/mater.js new file mode 100644 index 0000000..f437e68 --- /dev/null +++ b/src/api/mater.js @@ -0,0 +1,9 @@ + +import request from '@/utils/request' + +export function getWzbm() { + return request({ + url: '/api/admin/other/wuzibianma', + method: 'get' + }) +} \ No newline at end of file diff --git a/src/utils/request.js b/src/utils/request.js index 8763ba8..e402aa4 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -17,6 +17,7 @@ if(window.location.origin.indexOf('localhost')>-1){ }else{ baseUrl = window.location.origin + '/' } + const service = axios.create({ baseURL: baseUrl, // url = base url + request url // withCredentials: true, // send cookies when cross-domain requests diff --git a/src/views/inventorys/components/addInventorys.vue b/src/views/inventorys/components/addInventorys.vue new file mode 100644 index 0000000..bdd6fcb --- /dev/null +++ b/src/views/inventorys/components/addInventorys.vue @@ -0,0 +1,305 @@ + + + + + diff --git a/src/views/inventorys/index.vue b/src/views/inventorys/index.vue index a682c5d..053f6e1 100644 --- a/src/views/inventorys/index.vue +++ b/src/views/inventorys/index.vue @@ -5,12 +5,27 @@
- - +
+ 资产名称: + +
+
+ 入库数量: + + + +
+
+ 在库数量: + + + +
+ + + - + @click="exportExcel(new Date().getTime().toString())">导出
@@ -18,30 +33,27 @@
- - - -
-
-
- - + +
+
+
+ + @@ -52,232 +64,355 @@ import { index, destroy - } from "@/api/system/baseForm.js" - // import addRuku from "./component/addRuku.vue" + } from "@/api/system/baseForm.js" + import { + getInfo + } from "@/api/user.js" + import addInventorys from "./components/addInventorys.vue" import QRCode from 'qrcodejs2'; import { Message } from 'element-ui' - import imports from "@/views/component/imports.vue" - import { index as fieldIndex } from "@/api/system/customFormField"; - import { getparameter } from "@/api/system/dictionary"; - import * as XLSX from "xlsx"; - import { saveAs } from "file-saver"; + import imports from "@/views/component/imports.vue" + import { + index as fieldIndex + } from "@/api/system/customFormField"; + import { + getparameter + } from "@/api/system/dictionary"; + import * as XLSX from "xlsx"; + import { + saveAs + } from "file-saver"; import Cookies from 'js-cookie' export default { components: { - imports + imports, + addInventorys }, data() { - return { - loading:false, + return { + loading: false, + userName:'', + authName:'', + roleName:'', + isCkName:'', select: { pageSize: 10, pageIndex: 1, - keyword: "", - is_export:0 - }, - showcode:false, - customForm: { - customFormId: "", - tableName: "" - }, - form:[], + keyword: "", + is_export: 0, + min: '', + max: '', + rmin: '', + rmax: '' + }, + showcode: false, + customForm: { + customFormId: "", + tableName: "inventorys" + }, + form: [], total: 0, list: [], - table: [ - { - type:'selection' - },{ - label:'序号', - type:'index', - fixed:'left', - width:80, - }, - { - label: "物资编码", - width: 180, - prop: 'wuzibianma', - align: 'center' - }, - { - label: "固定资产编号", - width: 180, - prop: 'gudingzichanbianhao', - align: 'center' - }, - { - label: "资产名称", - prop: 'zichanmingcheng', - align: 'center' - }, - { - label: "规格型号", - prop: 'guigexinghao', - align: 'center', - width: 180 - }, + table: [{ + type: 'selection' + }, { + label: '序号', + type: 'index', + fixed: 'left', + width: 80, + }, + { + label: "物资编码", + width: 180, + prop: 'wuzibianma', + align: 'center', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.wuzibianma){ + return cell.wuzibianma_material_infos_wuzibianma_relation.wuzibianma + }else{ + return value + } + } + }, + { + label: "资产名称", + prop: 'zichanmingcheng', + align: 'center', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.zichanmingcheng){ + return cell.wuzibianma_material_infos_wuzibianma_relation.zichanmingcheng + }else{ + return value + } + } + }, + { + label: "规格型号", + prop: 'guigexinghao', + align: 'center', + width: 180, + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.guigexinghao){ + return cell.wuzibianma_material_infos_wuzibianma_relation.guigexinghao + }else{ + return value + } + } + }, { label: "物资类型", width: 120, prop: 'wuzileixing', - align: 'center' + align: 'center', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.wuzileixing){ + return cell.wuzibianma_material_infos_wuzibianma_relation.wuzileixing + }else{ + return value + } + } }, { label: "计量单位", width: 120, prop: 'jiliangdanwei', - align: 'center' + align: 'center', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.jiliangdanwei){ + return cell.wuzibianma_material_infos_wuzibianma_relation.jiliangdanwei + }else{ + return value + } + } }, { label: "入库数量", width: 120, prop: 'rukushuliang' - }, - { - label: "在库数量", - width: 120, - prop: 'zaikushuliang' - }, - { - label: "入库批次", - width: 120, - prop: 'rukupici' - }, - { - label: "所在仓库", - width: 180, - prop: 'suozaicangku' - }, - { - label: "所在货架", - width: 180, - prop: 'suozaihuojia' - }, - // { - // label: "二维码", - // width: 180, - // prop: 'erweima', - // customFn: (row) => { - // return () - // } + }, + { + label: "在库数量", + width: 120, + prop: 'zaikushuliang' + }, + { + label: "入库批次", + width: 120, + prop: 'rukupici' + }, + { + label: "固定资产编号", + width: 180, + prop: 'gudingzichanbianhao', + align: 'center', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.gudingzichanbianhao){ + return cell.wuzibianma_material_infos_wuzibianma_relation.gudingzichanbianhao + }else{ + return value + } + } + }, + { + label: "所在仓库", + width: 180, + prop: 'suozaicangku', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.suozaicangku){ + return cell.wuzibianma_material_infos_wuzibianma_relation.suozaicangku + }else{ + return value + } + } + }, + { + label: "所在货架", + width: 180, + prop: 'suozaihuojia', + formatter: (cell, data, value, index) => { + if(cell.wuzibianma_material_infos_wuzibianma_relation?.suozaihuojia){ + return cell.wuzibianma_material_infos_wuzibianma_relation.suozaihuojia + }else{ + return value + } + } + }, + // { + // label: "二维码", + // width: 180, + // prop: 'erweima', + // customFn: (row) => { + // return () + // } // }, - ], - printObj:[], - printArr:[] + ], + printObj: [], + printArr: [] } + }, + mounted() { + this.getField() + this.getindex() + this.getUserName() }, methods: { - selectionChange(e){ - console.log(e) - let _arrs = [] - if(e.length>0){ - for(var m of e){ - _arrs.push(m.id) - } - console.log(_arrs) - // this.printObj = e - this.printArr = _arrs.join(",") - } - - - }, - toprint(){ - if(this.printArr.length<1){ - Message({ - type: 'warning', - message: '请先选择' - }) - return - } - // let _obj = JSON.parse(JSON.stringify(this.printObj)) - // let _objs = [] - // for(var m of this.printObj){ - // _objs.push({ - // 'wuzibianma':encodeURI(encodeURI(m['wuzibianma'])), - // 'zichanmingcheng':encodeURI(encodeURI(m['zichanmingcheng'])), - // 'wuzileixing':encodeURI(encodeURI(m['wuzileixing'])) - // }) - // } - // Cookies.remove('objs') - // Cookies.set('objs',JSON.stringify(_objs)) - window.open('/admin/print.html?ids='+this.printArr,'_blank') - }, - async exportExcel(sheetName) { - const res = await index(Object.assign(this.select,{ page: 1,page_size: 9999,table_name: 'inventorys'})) - if(res.data){ - let headers = this.form.map(i => { - return { - key: i.field, - title: i.name + async getUserName(){ + getInfo().then(res => { + console.log("res",res) + this.userName = res.username + this.authName = res.name + for(var k of res.role){ + if(k.name=='系统管理员'){ + this.roleName = k.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`); - } - }, - showCode(e,row){ - console.log(e,row) - this.showcode = true - this.$nextTick(function(){ - new QRCode(this.$refs.qrCodeDiv, { - text: row.wuzibianma+'-'+row.id, - width: 200, - height: 200, - colorDark: "#333333", //二维码颜色 - colorLight: "#ffffff", //二维码背景色 - correctLevel: QRCode.CorrectLevel.L//容错率,L/M/H - }) - }) - + if(k.name=='仓库管理员'){ + this.isCkName = '仓库管理员' + } + } - }, - closeCode(){ - this.$refs.qrCodeDiv.innerHTML = "" - this.showcode = false + }).catch(error => {}) + }, + selectionChange(e) { + console.log(e) + let _arrs = [] + if (e.length > 0) { + for (var m of e) { + _arrs.push(m.id) + } + console.log(_arrs) + // this.printObj = e + this.printArr = _arrs.join(",") + } + + + }, + toprint() { + if (this.printArr.length < 1) { + Message({ + type: 'warning', + message: '请先选择' + }) + return + } + // let _obj = JSON.parse(JSON.stringify(this.printObj)) + // let _objs = [] + // for(var m of this.printObj){ + // _objs.push({ + // 'wuzibianma':encodeURI(encodeURI(m['wuzibianma'])), + // 'zichanmingcheng':encodeURI(encodeURI(m['zichanmingcheng'])), + // 'wuzileixing':encodeURI(encodeURI(m['wuzileixing'])) + // }) + // } + // Cookies.remove('objs') + // Cookies.set('objs',JSON.stringify(_objs)) + window.open('/admin/print.html?ids=' + this.printArr, '_blank') + }, + async exportExcel(sheetName) { + const res = await index(Object.assign(this.select, { + page: 1, + page_size: 9999, + table_name: 'inventorys' + })) + if (res.data) { + let headers = this.form.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 getindex() { - this.loading = true + showCode(e, row) { + console.log(e, row) + this.showcode = true + this.$nextTick(function() { + new QRCode(this.$refs.qrCodeDiv, { + text: row.wuzibianma + '-' + row.id, + width: 200, + height: 200, + colorDark: "#333333", //二维码颜色 + colorLight: "#ffffff", //二维码背景色 + correctLevel: QRCode.CorrectLevel.L //容错率,L/M/H + }) + }) + + + }, + closeCode() { + this.$refs.qrCodeDiv.innerHTML = "" + this.showcode = false + }, + async getindex() { + this.loading = true + let min = this.select.min?this.select.min:1 + let max = this.select.max?this.select.max:99999 + let rmin = this.select.rmin?this.select.rmin:1 + let rmax = this.select.rmax?this.select.rmax:99999 const res = await index({ page_size: this.select.pageSize, page: this.select.pageIndex, - table_name: 'inventorys', - // is_export:this.select.is_export, - filter:[{"key":"zichanmingcheng","op":"like","value":this.select.keyword}], + table_name: 'inventorys', + // is_export:this.select.is_export, + filter: [{ + "key": "zichanmingcheng", + "op": "like", + "value": this.select.keyword, + }, + { + "key": "rukushuliang", + "op": "range", + "value": rmin + "," + rmax, + }, + { + "key": "zaikushuliang", + "op": "range", + "value": min + "," + max, + }, + ], }) this.list = res.data - this.total = res.total + this.total = res.total this.loading = false - }, + }, pageChange(e) { - this.select.pageIndex = e + this.select.pageIndex = e this.getindex() - }, - editorRuku(id,type){ - this.$refs['addRuku'].id = id - this.$refs['addRuku'].isShow = true - this.$refs['addRuku'].type = type }, - deleteRuku(row) { - console.log(row.id) + editorIn(id, type) { + this.$refs['addInventorys'].id = id + this.$refs['addInventorys'].isShow = true + this.$refs['addInventorys'].type = type + }, + deleteIn(row) { + console.log(row.id) // return destroy({ - id: row.id, - table_name:this.customForm.tableName + id: row.id, + table_name: this.customForm.tableName }).then(res => { Message({ type: 'success', @@ -285,79 +420,77 @@ }) this.getindex() }) - }, - async getField() { - if(this.$route.meta.params?.custom_form) { - let decode = decodeURIComponent(this.$route.meta.params?.custom_form) - try { - let custom_form = JSON.parse(decode) - this.customForm.customFormId = custom_form.custom_form_id - this.customForm.tableName = custom_form.table_name - console.log("123",this.customForm) - // this.select.table_name = custom_form.table_name - }catch (err) { - console.warn(err) - } - } - const res = await fieldIndex({ - page: 1, - page_size: 999, - custom_form_id: this.customForm.customFormId, - sort_name: 'sort', - sort_type: 'asc', - }) - if(res.data && res.data instanceof Array) { - res.data.forEach(i => { - if (i.field) { - if ( - (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") && - i.parameter_id - ) { - getparameter({ id: i.parameter_id }).then((res) => { - i._paramters = res.detail ?? []; - }); - } - if ( - (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") && - i.link_table_name - ) { - index({ - page: 1, - page_size: 999, - table_name: i.link_table_name, - }).then((res) => { - i._paramters = res.data ?? []; - }); - } - } - }) - } - this.form = res.data }, - }, - mounted() { - this.getField() - this.getindex() + async getField() { + if (this.$route.meta.params?.custom_form) { + let decode = decodeURIComponent(this.$route.meta.params?.custom_form) + try { + let custom_form = JSON.parse(decode) + this.customForm.customFormId = custom_form.custom_form_id + this.customForm.tableName = custom_form.table_name + console.log("123", this.customForm) + // this.select.table_name = custom_form.table_name + } catch (err) { + console.warn(err) + } + } + const res = await fieldIndex({ + page: 1, + page_size: 999, + custom_form_id: this.customForm.customFormId, + sort_name: 'sort', + sort_type: 'asc', + }) + if (res.data && res.data instanceof Array) { + res.data.forEach(i => { + if (i.field) { + if ( + (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") && + i.parameter_id + ) { + getparameter({ + id: i.parameter_id + }).then((res) => { + i._paramters = res.detail ?? []; + }); + } + if ( + (i.edit_input === "checkbox" || i.edit_input === "radio" || i.edit_input === "select") && + i.link_table_name + ) { + index({ + page: 1, + page_size: 999, + table_name: i.link_table_name, + }).then((res) => { + i._paramters = res.data ?? []; + }); + } + } + }) + } + this.form = res.data + }, } } - diff --git a/src/views/materialfile/component/addMater.vue b/src/views/materialfile/component/addMater.vue new file mode 100644 index 0000000..bcf241c --- /dev/null +++ b/src/views/materialfile/component/addMater.vue @@ -0,0 +1,521 @@ + + + + + diff --git a/src/views/materialfile/index.vue b/src/views/materialfile/index.vue new file mode 100644 index 0000000..ed8612e --- /dev/null +++ b/src/views/materialfile/index.vue @@ -0,0 +1,355 @@ + + + + + diff --git a/src/views/outbounds/component/addoutbounds.vue b/src/views/outbounds/component/addoutbounds.vue index 4a5d27b..a0ed4fb 100644 --- a/src/views/outbounds/component/addoutbounds.vue +++ b/src/views/outbounds/component/addoutbounds.vue @@ -109,8 +109,10 @@ - - - - { + Message({ + type: 'success', + message: '删除成功' + }) + this.mingxiList.splice(index, 1) + }) + }else{ + Message({ + type: 'success', + message: '删除成功' + }) + this.mingxiList.splice(index, 1) + } }, showWuzi() { console.log("123") @@ -685,4 +705,4 @@ ::v-deep .el-input-number .el-input__inner { text-align: left !important; } - \ No newline at end of file + diff --git a/src/views/outbounds/index.vue b/src/views/outbounds/index.vue index 61dbe21..b7ef0b0 100644 --- a/src/views/outbounds/index.vue +++ b/src/views/outbounds/index.vue @@ -258,7 +258,8 @@ // return destroy({ id: row.id, - table_name: 'outbounds' + table_name: 'outbounds', + destroy_relation:['id_outbounds_items_outbounds_id_relation'], }).then(res => { Message({ type: 'success', diff --git a/src/views/stocks/component/addRuku.vue b/src/views/stocks/component/addRuku.vue index 188f03f..a4f0e95 100644 --- a/src/views/stocks/component/addRuku.vue +++ b/src/views/stocks/component/addRuku.vue @@ -25,6 +25,17 @@ style="width: 300px;"> + + -