{"remainingRequest":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Manage\\material\\components\\MaterialIntoWareHoseManageDialog.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\src\\views\\Manage\\material\\components\\MaterialIntoWareHoseManageDialog.vue","mtime":1694568792046},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\bzzgj-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport step from '@/components/step.vue'\nimport materialIntoManage from '@/api/manager/material/materialIntoWarehouseManage.js'\nimport SelectMaterialDialog from '@/views/Manage/material/components/SelectMaterialDialog.vue'\nimport dictContracts from '@/components/dict/DictSelectUtils.js'\nimport CommonApi from '@/views/Manage/CommonApi.js'\nimport ordersDialog from './ordersDialog.vue'\nexport default {\n\tname: 'MaterialIntoManageDialog',\n\tcomponents: {\n\t\tSelectMaterialDialog,\n\t\tstep,\n\t\tordersDialog\n\t},\n\tprops: {},\n\tdata() {\n\t\treturn {\n\t\t\thandleSaveShow: false,\n\t\t\tstatusInput: false,\n\t\t\ttitle: '新增',\n\t\t\twidth: '197px',\n\t\t\tactive: 0,\n\t\t\tstepArr: [{\n\t\t\t\t\ttitle: '入库单信息'\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttitle: '入库物资明细'\n\t\t\t\t}\n\t\t\t],\n\t\t\tuserSelectOptions: [],\n\t\t\tshowFormDia: false,\n\t\t\tisEdit: false,\n\t\t\tparams: {\n\t\t\t\tid: null,\n\t\t\t\t// applicant: '',\n\t\t\t\t// applicantName: '',\n\t\t\t\torg: '',\n\t\t\t\t// orgName: '',\n\t\t\t\twarehouse: '',\n\t\t\t\t// approvedDate: null,\n\t\t\t\t// inoutDate: null,\n\t\t\t\t// signAmount: 0,\n\t\t\t\tsupplierName: '',\n\t\t\t\torderId: '',\n\t\t\t\torderName: '',\n\t\t\t\tstatus: '2'\n\t\t\t},\n\t\t\trules: {\n\t\t\t\tapplicant: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入签收人',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\torgName: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入签收部门',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\tapprovedDate: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入签收时间',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\tinoutDate: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请输入入库时间',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\twarehouse: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请选择仓库',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\torderName: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请选择采购订单',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}],\n\t\t\t\tsupplierName: [{\n\t\t\t\t\trequired: true,\n\t\t\t\t\tmessage: '请选择供应商',\n\t\t\t\t\ttrigger: 'change'\n\t\t\t\t}]\n\t\t\t\t// status: [\n\t\t\t\t// {\n\t\t\t\t// required: true,\n\t\t\t\t// message: '请选择入库状态',\n\t\t\t\t// trigger: 'change'\n\t\t\t\t// }\n\t\t\t\t// ]\n\t\t\t},\n\t\t\twarehouses: [],\n\t\t\tpurchasingDetailList: [],\n\t\t\tgys: [], // 供应商\n\t\t\taddData: false,\n\t\t\tupdateOrderOrigin: '' //更新时的原订单\n\t\t}\n\t},\n\tcreated() {\n\t\tCommonApi.loadSelectOptions({\n\t\t\t\tname: 'manageCommonService.getAllUsers',\n\t\t\t\tquery: '96240625-934F-490B-8AA6-0BC775B18468'\n\t\t\t},\n\n\t\t\tres => {\n\t\t\t\tthis.userSelectOptions = res\n\t\t\t}\n\t\t)\n\t\tthis.warehouses = dictContracts.getDictItemsFromCache('cmgt_ckmc')\n\t\tmaterialIntoManage.findAllCustom(res => {\n\t\t\tthis.gys = res\n\t\t})\n\t},\n\tupdated() {\n\t\tthis.$nextTick(() => {\n\t\t\tif (this.$refs.table) {\n\t\t\t\tthis.$refs.table.doLayout()\n\t\t\t}\n\t\t})\n\t},\n\tmethods: {\n\t\torderData(data) {\n\t\t\tthis.params.orderId = data.id\n\t\t\tthis.params.orderName = data.planTitle\n\t\t},\n\t\topenDialog() {\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.$refs.ordersDialog.open()\n\t\t\t})\n\t\t},\n\t\t//签收人\n\t\tuserChange(v, s) {\n\t\t\tconst vobj = this.userSelectOptions.find(u => {\n\t\t\t\treturn u.id === v\n\t\t\t})\n\t\t\tif (vobj) {\n\t\t\t\t// this.params.applicantName = vobj.fullname\n\t\t\t\tthis.params.org = vobj.orgId\n\t\t\t\t// this.params.orgName = vobj.orgName\n\t\t\t}\n\t\t},\n\t\tpreviousStep() {\n\t\t\tif (this.active == 0) {\n\t\t\t\t// this.toWorktable()\n\t\t\t\tthis.handleClose()\n\t\t\t} else {\n\t\t\t\tthis.active -= 1\n\t\t\t}\n\t\t},\n\t\tnextStep() {\n\t\t\tconsole.log(this.active)\n\t\t\tif (this.active == 1) {\n\t\t\t\tthis.handleSave()\n\t\t\t} else {\n\t\t\t\tthis.$refs.formInfo.validate(valid => {\n\t\t\t\t\tif (valid) {\n\t\t\t\t\t\tthis.active += 1\n\t\t\t\t\t\t// 新增是每次点击都查询\n\t\t\t\t\t\t// 如果是编辑只在更改了订单时查询\n\t\t\t\t\t\tif (this.title == '新增') {\n\t\t\t\t\t\t\tthis.getDetailList()\n\t\t\t\t\t\t} else if (this.updateOrderOrigin !== this.params.orderId) {\n\t\t\t\t\t\t\tthis.getDetailList()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (this.statusInput == true) {\n\t\t\t\t\t\t\tthis.handleSaveShow = true\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t\tconsole.log(this.active)\n\t\t},\n\t\tgetDetailList() {\n\t\t\tthis.purchasingDetailList = []\n\t\t\tmaterialIntoManage.getDetailList(this.params.orderId).then(res => {\n\t\t\t\tif (res && res.detailList && res.detailList.length) {\n\t\t\t\t\tres.detailList.forEach(item => {\n\t\t\t\t\t\t// item.price = 0\n\t\t\t\t\t\titem.number = item.quantity\n\t\t\t\t\t\titem.amount = parseFloat((item.quantity * item.price).toFixed(2))\n\t\t\t\t\t})\n\t\t\t\t\tconsole.log(res.detailList)\n\t\t\t\t\tthis.purchasingDetailList = res.detailList\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\tadd() {\n\t\t\tconst userinfo = this.$store.state.user.currentUserDetail\n\t\t\tconsole.log(userinfo)\n\t\t\t// this.params.orgName = userinfo.org[0].orgName\n\t\t\tthis.params.org = userinfo.org[0].orgId\n\t\t\t// this.params.applicant = userinfo.user.id\n\t\t\t// this.params.applicantName = userinfo.user.fullname\n\t\t\tthis.params.warehouse = '1'\n\t\t\tthis.params.supplierName = this.gys[0] ? this.gys[0].name : ''\n\t\t\tvar date = new Date()\n\t\t\t// this.params.inoutDate = date.format('yyyy-MM-dd')\n\t\t\t// this.params.approvedDate = date.format('yyyy-MM-dd')\n\t\t\tthis.showFormDia = true\n\t\t\tthis.$nextTick(() => {\n\t\t\t\tthis.$refs.formInfo.clearValidate()\n\t\t\t})\n\t\t},\n\t\tUpdate(row) {\n\t\t\tconsole.log(row)\n\t\t\tthis.title = '修改'\n\t\t\tthis.statusInput = true\n\t\t\tthis.showFormDia = true\n\t\t\tthis.params = row\n\t\t\tthis.updateOrderOrigin = row.orderId\n\t\t\tthis.purchasingDetailList = row.detailList\n\t\t\t// if (row.status == '2' || row.status == '3') {\n\t\t\t// this.statusInput = true\n\t\t\t// }\n\t\t\tthis.$refs.formInfo.clearValidate()\n\t\t},\n\t\thandleClose() {\n\t\t\tthis.params = {\n\t\t\t\tid: null,\n\t\t\t\t// applicant: '',\n\t\t\t\t// applicantName: '',\n\t\t\t\torg: '',\n\t\t\t\t// orgName: '',\n\t\t\t\twarehouse: '',\n\t\t\t\t// approvedDate: null,\n\t\t\t\t// inoutDate: null,\n\t\t\t\t// signAmount: 0,\n\t\t\t\tsupplierName: '',\n\t\t\t\torderId: '',\n\t\t\t\torderName: '',\n\t\t\t\tapplyTitle: '',\n\t\t\t\tstatus: '2'\n\t\t\t}\n\t\t\tthis.active = 0\n\t\t\tthis.purchasingDetailList = []\n\t\t\tthis.title = '新增'\n\t\t\tthis.showFormDia = false\n\t\t\tthis.statusInput = false\n\t\t\tthis.handleSaveShow = false\n\t\t},\n\t\thandleSave() {\n\t\t\tlet method\n\t\t\tif (!this.params.id) {\n\t\t\t\t// 新增\n\t\t\t\tmethod = materialIntoManage.addIntoWarehouse\n\t\t\t}\n\t\t\tif (this.params.id) {\n\t\t\t\t// 修改\n\t\t\t\tmethod = materialIntoManage.editIntoWarehouse\n\t\t\t}\n\t\t\tlet list = this.purchasingDetailList.map(item => {\n\t\t\t\tlet obj = {\n\t\t\t\t\tmaterialId: item.materialId,\n\t\t\t\t\tname: item.name,\n\t\t\t\t\tunit: item.unit,\n\t\t\t\t\tmodel: item.model,\n\t\t\t\t\tquantity: item.quantity,\n\t\t\t\t\tdescription: item.description,\n\t\t\t\t\tsignWarehouseId: item.signWarehouseId,\n\t\t\t\t\tamount: item.amount,\n\t\t\t\t\tnumber: item.number,\n\t\t\t\t\tprice: item.price\n\t\t\t\t}\n\t\t\t\treturn obj\n\t\t\t})\n\t\t\tthis.params.detailList = list\n\t\t\tmethod(this.params, res => {\n\t\t\t\tif (res.state) {\n\t\t\t\t\tthis.$notify({\n\t\t\t\t\t\ttype: 'success',\n\t\t\t\t\t\tmessage: this.title + '成功',\n\t\t\t\t\t\tduration: 2000\n\t\t\t\t\t})\n\t\t\t\t\tthis.$parent.loadData()\n\t\t\t\t\tthis.handleClose()\n\t\t\t\t} else {\n\t\t\t\t\tthis.$message.warning(res.message)\n\t\t\t\t}\n\t\t\t})\n\t\t},\n\t\tnumInputChange(row, e) {\n\t\t\trow.amount = parseFloat((row.quantity * row.price).toFixed(2))\n\t\t},\n\t\tgetSummaries(param) {\n\t\t\tconst {\n\t\t\t\tcolumns,\n\t\t\t\tdata\n\t\t\t} = param\n\t\t\tconst sums = []\n\t\t\tcolumns.forEach((column, index) => {\n\t\t\t\tif (index === 0) {\n\t\t\t\t\tsums[index] = '合计'\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (column.property == 'amount') {\n\t\t\t\t\tconst values = data.map(item => Number(item[column.property]))\n\t\t\t\t\tif (!values.every(value => isNaN(value))) {\n\t\t\t\t\t\tsums[index] = values.reduce((prev, curr) => {\n\t\t\t\t\t\t\tconst value = Number(curr)\n\t\t\t\t\t\t\tif (!isNaN(value)) {\n\t\t\t\t\t\t\t\treturn prev + curr\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\treturn prev\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 0)\n\t\t\t\t\t\tsums[index] = sums[index].toFixed(2)\n\t\t\t\t\t\tsums[index] += ' 元'\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsums[index] = '--'\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsums[index] = ''\n\t\t\t\t}\n\t\t\t})\n\n\t\t\t// console.log(sums)\n\t\t\treturn sums\n\t\t}\n\t}\n}\n",null]}