From 92ff846fb659c62037a32b1d8c15eae9df9d9b54 Mon Sep 17 00:00:00 2001 From: zenglf <18502938215@163.com> Date: 星期一, 18 九月 2023 13:24:30 +0800 Subject: [PATCH] Merge branch 'develop' of http://117.34.109.166:18448/r/vue_mdc_430 --- src/views/eam/modules/repairorder/moudles/RepairOrderActualMaterialReport.vue | 433 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 433 insertions(+), 0 deletions(-) diff --git a/src/views/eam/modules/repairorder/moudles/RepairOrderActualMaterialReport.vue b/src/views/eam/modules/repairorder/moudles/RepairOrderActualMaterialReport.vue new file mode 100644 index 0000000..406d5a4 --- /dev/null +++ b/src/views/eam/modules/repairorder/moudles/RepairOrderActualMaterialReport.vue @@ -0,0 +1,433 @@ +<template> + <a-card + :bordered="false" + :class="'cust-erp-sub-tab'" + > + <a-table + ref="table" + bordered + rowKey="id" + :columns="columns" + :dataSource="dataSource" + :pagination="ipagination" + @change="handleTableChange" + > + + <template + v-for="col in columns" + :slot="col.dataIndex" + slot-scope='text, record, index' + > + <div :key="col.dataIndex"> + <a-input-number + :value="text" + v-if="col.dataIndex == 'actualQuantity'" + :min="1" + :max="99999" + @change="(e)=>handleChange(e, record.key, col, index)" + :disabled="record.isLock == 'yes'||mainId.status=='4'" + /> + + </div> + </template> + <span + slot='action' + slot-scope='text, record' + > + <a-popconfirm + title="纭閿佹枡鍚�?" + @confirm="() => handleLock(record)" + > + <a v-if="record.isLock=='no'&&mainId.status=='3'">閿佹枡</a> + </a-popconfirm> + <a-divider + v-if="record.isLock=='no'" + type="vertical" + /> + <a-popconfirm + title="瑙i攣鍚庝細鑷姩閲婃斁搴撳瓨锛岀‘璁よВ閿佸悧?" + @confirm="() => handleUnLock(record)" + > + <a v-if="record.isLock=='yes'&&mainId.status=='3'">瑙i攣</a> + </a-popconfirm> + <a-popconfirm + title="纭畾鍒犻櫎鍚�?" + @confirm="() => handleDelete(record.id)" + > + <a v-if="record.isLock=='no'&&mainId.status=='3'">鍒犻櫎</a> + </a-popconfirm> + </span> + </a-table> + <a-button + style="width: 100%; margin-top: 16px; margin-bottom: 8px" + type="dashed" + icon="plus" + @click="addMaterial" + :disabled="mainId.status=='4' || mainId.status=='2'" + >娣诲姞瀹為檯鐢ㄦ枡</a-button> + <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}"> + <a-row :style="{textAlign:'right'}"> + <!-- <a-button + :style="{marginRight: '8px'}" + @click="handleCancel" + > + 鍙栨秷 + </a-button> --> + <!-- <a-button + @click="handleOk(1)" + type="primary" + :style="{marginRight: '8px'}" + :disabled="specialyMaintenanceOrderStatus!='4'" + >鏆傚瓨</a-button> + <a-button + @click="handleOk(0)" + type="primary" + :disabled="specialyMaintenanceOrderStatus!='4'" + >淇濆瓨</a-button> --> + </a-row> + <!-- :disabled="false" --> + </div> + <j-select-spare-part-modal ref='JSelectSparePartModal'></j-select-spare-part-modal> + </a-card> +</template> +<script> +import { postAction, getAction } from '@/api/manage' +import { JeecgListMixin } from '@/mixins/JeecgListMixin' +import pick from 'lodash.pick' +import JEllipsis from '@/components/jeecg/JEllipsis' +import JSelectSparePartModal from './select/JSelectSparePartModal' +import RepairOrderActualMaterialReportModel from './RepairOrderActualMaterialReportModel.vue' +export default { + name: 'RepairOrderActualMaterialReport', + mixins: [JeecgListMixin], + components: { + JEllipsis, + JSelectSparePartModal, + RepairOrderActualMaterialReportModel + }, + props: { + mainId: { + type: Object, + } + }, + data() { + return { + title: "瀹為檯鐢ㄦ枡", + visible: false, + model: {}, + maskClosable: true, + confirmLoading: false, + // specialyMaintenanceOrderStatus: '', + form: this.$form.createForm(this), + /* 鍒嗛〉鍙傛暟 */ + ipagination: { + current: 1, + pageSize: 99, + pageSizeOptions: ['99', '199'], + showTotal: (total, range) => { + return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�" + }, + showQuickJumper: true, + showSizeChanger: true, + total: 0 + }, + validatorRules: { + materialId: { + rules: [ + { required: true, message: '璇烽�夋嫨鐗╂枡!' }, + ] + }, + actualQuantity: { + rules: [ + { required: false, message: '璇峰~鍐欐暟閲�!' }, + ] + }, + }, + labelCol: { + xs: { span: 24 }, + sm: { span: 7 }, + }, + wrapperCol: { + xs: { span: 24 }, + sm: { span: 16 }, + }, + drawerWidth: "100%", + visible: false, + disableSubmit: false, + disableSelect: false, + loading: false, + dataSource: [], + columns: [ + { + title: '#', + dataIndex: '', + key: 'rowIndex', + width: 60, + align: "center", + customRender: function (t, r, index) { + return parseInt(index) + 1; + } + }, + { + title: '棰嗘枡鍑哄簱鍗�', + dataIndex: 'num', + align: "center", + width: 150, + }, + { + title: '澶囦欢缂栫爜', + dataIndex: 'sparePartNum', + align: "center", + + }, + { + title: '澶囦欢鍚嶇О', + dataIndex: 'sparePartName', + align: "center", + + }, + { + title: '瑙勬牸', + dataIndex: 'sparePartSpecification', + align: "center", + }, + { + title: '鍨嬪彿', + dataIndex: 'sparePartModel', + align: "center", + }, + { + title: '鍒堕�犲晢', + dataIndex: 'constructorName', + align: "center", + }, + { + title: '涓诲崟浣�', + dataIndex: 'mainUnitName', + align: "center", + + }, + { + title: '涓绘暟閲�', + align: 'center', + dataIndex: 'mainQuantity' + }, + { + title: '鍙敤鏁伴噺', + align: 'center', + dataIndex: 'availableQuantity' + }, + { + title: '浣跨敤鏁伴噺', + dataIndex: 'actualQuantity', + align: "center", + scopedSlots: { customRender: 'actualQuantity' }, + className: 'red', + + }, + { + title: '鎿嶄綔', + dataIndex: 'action', + align: 'center', + width: 250, + scopedSlots: { customRender: 'action' } + } + ], + url: { + list: '/eam/repairOrder/listRepairOrderActualMaterialByMainId', + confirmMaterial: "/eam/repairOrderActualMaterial/add", + delete: "/eam/repairOrderActualMaterial/delete", + addInit: "/eam/repairOrderActualMaterial/addInit", + lock: "/eam/repairOrderActualMaterial/lock", + unLock: "/eam/repairOrderActualMaterial/unLock" + }, + changeIndex: 0 + } + }, + watch: { + mainId: { + immediate: true, + handler(val) { + console.log(val) + if (!this.mainId.id) { + + this.clearList() + } else { + this.queryParam['repairOrderId'] = val.id + this.loadData(1) + } + } + } + }, + // created() { + // this.queryParam['maintenanceOrderId'] = this.dailyMaintenanceOrderId; + // this.queryParam['equipmentId'] = this.equipmentId + // this.loadData(1); + // console.log("77777777", this.mainId) + // }, + methods: { + addMaterial() { + let ids = []; + for (let i = 0; i < this.dataSource.length; i++) { + ids.push(this.dataSource[i].outboundOrderDetailId); + } + this.$refs.JSelectSparePartModal.showModals(ids); + this.$refs.JSelectSparePartModal.title = '閫夋嫨澶囦欢淇℃伅' + this.$refs.JSelectSparePartModal.disableSubmit = false + }, + handleCancel() { + this.$bus.$emit('close'); + }, + close() { + this.$emit('close'); + this.dataSource = []; + this.disableSubmit = false; + this.visible = false; + }, + handleDeleteFake(index) { + this.dataSource.pop(index); + }, + handleChange(value, key, column, index) { + console.log(column) + const temp = [...this.dataSource] + const target = temp[index] + let availableQuantity = target['availableQuantity'] + if (target) { + if (value != undefined && value != null && value != '' && availableQuantity < value) { + this.$message.error('浣跨敤鏁伴噺涓嶈兘澶т簬鍙敤鏁伴噺!') + } else { + } + target[column.dataIndex] = value + this.dataSource = temp + } + }, + clearList() { + this.dataSource = []; + this.ipagination.current = 1 + }, + // getUuiD(randomLength) { + // return Number( + // Math.random() + // .toString() + // .substr(2, randomLength) + Date.now() + // ).toString(36) + // }, + handleLock(record) { + let that = this; + if (record.actualQuantity == null || record.actualQuantity == undefined || record.actualQuantity == '') { + this.$message.error('璇峰厛濉啓鏁伴噺!'); + return false + } + if (record.availableQuantity < record.actualQuantity) { + this.$message.error('浣跨敤鏁伴噺涓嶈兘澶т簬鍙敤鏁伴噺!'); + return false; + } + this.confirmLoading = true; + postAction(this.url.lock, record).then(res => { + if (res.success) { + this.$message.success("搴撳瓨閿佸畾鎴愬姛锛�") + } else { + this.$message.error(res.message) + } + }).finally(res => { + that.confirmLoading = false + that.loadData(); + }) + + }, + handleUnLock(record) { + let that = this; + this.confirmLoading = true; + postAction(this.url.unLock, record).then(res => { + if (res.success) { + this.$message.success("搴撳瓨瑙i攣鎴愬姛锛�") + } else { + this.$message.error(res.message) + } + }).finally(res => { + that.confirmLoading = false + that.loadData(); + }) + }, + loadData(arg) { + if (!this.url.list) { + this.$message.error('璇疯缃畊rl.list灞炴��!') + return + } + //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭 + if (arg === 1) { + this.ipagination.current = 1 + } + // this.queryParam['maintenanceOrderId'] = this.dailyMaintenanceOrderId + // this.queryParam['equipmentId'] = this.equipmentId + var params = this.getQueryParams() //鏌ヨ鏉′欢 + this.loading = true + getAction(this.url.list, params) + .then(res => { + if (res.success) { + //update-begin---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + this.dataSource = res.result.records || res.result + if (res.result.total) { + this.ipagination.total = res.result.total + } else { + this.ipagination.total = 0 + } + //update-end---author:zhangyafei Date:20201118 for锛氶�傞厤涓嶅垎椤电殑鏁版嵁鍒楄〃------------ + } else { + this.$message.warning(res.message) + } + }) + .finally(() => { + this.loading = false + }) + }, + }, + mounted() { + let newActualMaterials = []; + this.$bus.$on('selection3Rows', (data) => { + for (let i = 0; i < data.length; i++) { + newActualMaterials.push({ + // id: this.getUuiD(16), + num: data[i].num, + outboundOrderDetailId: data[i].id, + sparePartId: data[i].sparePartId, + // sparePartNum: data[i].spareNum, + // sparePartName: data[i].spareName, + // sparePartSpecification: data[i].specification, + // sparePartModel: data[i].model, + // constructorName: data[i].constructorName, + // constructorId: data[i].constructorId, + // mainUnitName: data[i].mainUnitName, + // mainUnitId: data[i].mainUnitId, + mainQuantity: data[i].mainQuantity, + useQuantity: data[i].useQuantity, + availableQuantity: data[i].availableQuantity, + repairOrderId: this.mainId.id, + equipmentId: this.equipmentId, + isLock: 'no' + }) + } + let that = this + postAction(this.url.addInit, newActualMaterials).then((res) => { + if (res.success) { + that.$message.success(res.message) + newActualMaterials = [] + that.$emit('ok') + } else { + that.$message.warning(res.message) + } + }).finally(res => { + that.loadData(); + + }) + }) + }, + +} +</script> + +<style scoped> +/deep/ .red { + color: red; +} +</style> \ No newline at end of file -- Gitblit v1.9.3