| | |
| | | :dataSource="dataSource" |
| | | :pagination="ipagination" |
| | | @change="handleTableChange" |
| | | :loading="loading" |
| | | > |
| | | |
| | | <template |
| | |
| | | /> |
| | | <a-input-number |
| | | :value="text" |
| | | v-if="col.dataIndex == 'actualQuantity'" |
| | | v-if="col.dataIndex == 'quantity'" |
| | | :min="1" |
| | | :max="99999" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="record.disabled" |
| | | :disabled="record.isLock == 'yes'||orderStatus!='4'" |
| | | /> |
| | | |
| | | </div> |
| | | </template> |
| | | <span |
| | | slot='action' |
| | | slot-scope='text, record,index' |
| | | slot-scope='text, record' |
| | | > |
| | | <a @click="handleDeleteFake(index)">删除</a> |
| | | <a-popconfirm |
| | | title="确认锁料吗?" |
| | | @confirm="() => handleLock(record)" |
| | | > |
| | | <a |
| | | v-has="'specialtyMaintenanceOrder:actualMaterialLock'" |
| | | v-if="record.isLock=='no'&&orderStatus=='4'" |
| | | >锁料</a> |
| | | </a-popconfirm> |
| | | <a-divider |
| | | v-if="record.isLock=='no'" |
| | | type="vertical" |
| | | /> |
| | | <a-popconfirm |
| | | title="解锁后会自动释放库存,确认解锁吗?" |
| | | @confirm="() => handleUnLock(record)" |
| | | > |
| | | <a |
| | | v-has="'specialtyMaintenanceOrder:actualMaterialLock'" |
| | | v-if="record.isLock=='yes'&&orderStatus=='4'" |
| | | >解锁</a> |
| | | </a-popconfirm> |
| | | <a-popconfirm |
| | | title="确定删除吗?" |
| | | @confirm="() => handleDelete(record.id)" |
| | | > |
| | | <a |
| | | v-has="'specialtyMaintenanceOrder:actualMaterialDelete'" |
| | | v-if="record.isLock=='no'&&orderStatus=='4'" |
| | | >删除</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | </a-table> |
| | | <a-button |
| | |
| | | type="dashed" |
| | | icon="plus" |
| | | @click="addMaterial" |
| | | :disabled="repairOrderStatus!='3'" |
| | | >添加实际用料 |
| | | |
| | | </a-button> |
| | | :disabled="orderStatus!='4'" |
| | | v-has="'specialtyMaintenanceOrder:actualMaterialAdd'" |
| | | >添加实际用料</a-button> |
| | | <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}"> |
| | | <a-row :style="{textAlign:'right'}"> |
| | | <a-button |
| | | <!-- <a-button |
| | | :style="{marginRight: '8px'}" |
| | | @click="handleCancel" |
| | | :disabled="repairOrderStatus!='3'" |
| | | > |
| | | 清空 |
| | | </a-button> |
| | | <a-button |
| | | 取消 |
| | | </a-button> --> |
| | | <!-- <a-button |
| | | @click="handleOk(1)" |
| | | type="primary" |
| | | :style="{marginRight: '8px'}" |
| | | :disabled="repairOrderStatus!='3'" |
| | | :disabled="orderStatus!='4'" |
| | | >暂存</a-button> |
| | | <a-button |
| | | @click="handleOk(0)" |
| | | type="primary" |
| | | :disabled="repairOrderStatus!='3'" |
| | | >保存</a-button> |
| | | :disabled="orderStatus!='4'" |
| | | >保存</a-button> --> |
| | | </a-row> |
| | | <!-- :disabled="false" --> |
| | | </div> |
| | | <actual-material-select |
| | | ref="actualMaterialSelect" |
| | | @sendMaterialRecord="sendMaterialRecord" |
| | | > |
| | | <actual-material-select |
| | | @getSelectRows="getSelectRows" |
| | | ref='JSelectSparePartModal'> |
| | | <!-- @sendMaterialRecord="sendMaterialRecord" --> |
| | | </actual-material-select> |
| | | </a-card> |
| | | </template> |
| | |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | JEllipsis, |
| | | ActualMaterialSelect |
| | | ActualMaterialSelect, |
| | | }, |
| | | props: { |
| | | repairOrderId: { |
| | | type: String, |
| | | required: false, |
| | | default: '-1' |
| | | }, |
| | | repairOrderStatus: { |
| | | orderId: { |
| | | type: String, |
| | | required: false, |
| | | default: '' |
| | | } |
| | | }, |
| | | orderStatus: { |
| | | type: String, |
| | | required: false, |
| | | default: '' |
| | | }, |
| | | equipmentId: { |
| | | type: String, |
| | | required: false, |
| | | default: '' |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | title: "工艺确认", |
| | | flag: false,//主页面的标记位 用于区分是否确认过工单工艺 来区分table页展示 工单工序 还是产品工序 |
| | | disableMixiCreated:true, |
| | | title: "实际用料", |
| | | visible: false, |
| | | model: {}, |
| | | obj: {}, |
| | | maskClosable: true, |
| | | confirmLoading: false, |
| | | // specialyMaintenanceOrderStatus: '', |
| | | form: this.$form.createForm(this), |
| | | /* 分页参数 */ |
| | | ipagination: { |
| | |
| | | { required: true, message: '请选择物料!' }, |
| | | ] |
| | | }, |
| | | actualQuantity: { |
| | | quantity: { |
| | | rules: [ |
| | | { required: false, message: '请填写数量!' }, |
| | | ] |
| | |
| | | loading: false, |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: '领料出库单号', |
| | | { |
| | | title: '领料出库单', |
| | | dataIndex: 'num', |
| | | align: "center", |
| | | width: 150, |
| | |
| | | } |
| | | ], |
| | | url: { |
| | | list: "/eam/repairOrder/listRepairOrderActualMaterialByMainId", |
| | | confirmMaterial: "/eam/repairOrder/addRepairOrderActualMaterial" |
| | | list: "/eam/maintenanceOrderActualMaterial/getMaintenanceOrderActualMaterialList", |
| | | confirmMaterial: "/eam/maintenanceOrderActualMaterial/add", |
| | | delete: "/eam/maintenanceOrderActualMaterial/delete", |
| | | addInit: "/eam/maintenanceOrderActualMaterial/addInit", |
| | | lock: "/eam/maintenanceOrderActualMaterial/lock", |
| | | unLock: "/eam/maintenanceOrderActualMaterial/unLock" |
| | | }, |
| | | changeIndex: 0 |
| | | changeIndex: 0, |
| | | loading:false |
| | | } |
| | | }, |
| | | |
| | | created() { |
| | | this.queryParam['repairOrderId'] = this.repairOrderId; |
| | | this.loadData(1); |
| | | watch: { |
| | | orderId: { |
| | | immediate: true, |
| | | handler(val) { |
| | | if(this.orderId){ |
| | | alert |
| | | this.queryParam['maintenanceOrderId'] = val |
| | | this.queryParam['equipmentId'] = this.equipmentId |
| | | this.queryParam['delFlag'] = 0 |
| | | this.loadData(1); |
| | | }else{ |
| | | this.clearList(); |
| | | } |
| | | } |
| | | }, |
| | | }, |
| | | methods: { |
| | | addMaterial() { |
| | | this.dataSource.push({ materialId: '', repairOrderId: this.repairOrderId, actualQuantity: 1, materialNum: '', materialName: '', materialModel: '', materialSpecification: '', unitId_dictText: '' }) |
| | | 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.close() |
| | | this.$bus.$emit('closeDrawer'); |
| | | }, |
| | | close() { |
| | | this.$emit('close'); |
| | |
| | | that.$message.warning("请选择第" + (i + 1) + "行物料!"); |
| | | return false; |
| | | } |
| | | if (materialDataSource[i].actualQuantity == undefined || materialDataSource[i].actualQuantity == null || materialDataSource[i].actualQuantity == '') { |
| | | if (materialDataSource[i].quantity == undefined || materialDataSource[i].quantity == null || materialDataSource[i].quantity == '') { |
| | | that.$message.warning("请填写第" + (i + 1) + "行用料数!"); |
| | | return false; |
| | | } |
| | | } |
| | | } |
| | | if (that.dataSource.length === 0) { |
| | | that.$message.warning("请添加物料!") |
| | | return |
| | | } |
| | | this.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | that.confirmLoading = true |
| | | let formData = {} |
| | | formData.repairOrderId = that.repairOrderId; |
| | | formData.actualMaterialList = that.dataSource; |
| | | formData.maintenanceOrderId = that.specialyMaintenanceOrderId; |
| | | formData.maintenanceOrderActualMaterials = that.dataSource; |
| | | formData.equipmentId = that.equipmentId; |
| | | let obj = obj = postAction(this.url.confirmMaterial, formData) |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | |
| | | }) |
| | | }, |
| | | handleChange(value, key, column, index) { |
| | | let that = this; |
| | | const temp = [...that.dataSource]; |
| | | const target = temp[index]; |
| | | console.log(column) |
| | | const temp = [...this.dataSource] |
| | | const target = temp[index] |
| | | let availableQuantity = target['availableQuantity'] |
| | | if (target) { |
| | | target[column.dataIndex] = value; |
| | | if ('materialId' == column.dataIndex) { |
| | | target['materialId'] = value; |
| | | if (value != undefined && value != null && value != '' && availableQuantity < value) { |
| | | this.$message.error('使用数量不能大于可用数量!') |
| | | } else { |
| | | } |
| | | if ('actualQuantity' == column.dataIndex) { |
| | | target['actualQuantity'] = value; |
| | | } |
| | | that.dataSource = temp; |
| | | target[column.dataIndex] = value |
| | | this.dataSource = temp |
| | | } |
| | | }, |
| | | onSearchMaterial(index) { |
| | |
| | | this.$refs.actualMaterialSelect.list() |
| | | this.$refs.actualMaterialSelect.title = '物料选择' |
| | | }, |
| | | sendMaterialRecord(data, val) { |
| | | let record = data.record |
| | | const temp = [...this.dataSource] |
| | | const target = temp[this.recordIndex] |
| | | if (target) { |
| | | console.log(target) |
| | | target.materialId = record.id; |
| | | target.materialName = record.name; |
| | | target.materialNum = record.num; |
| | | target.materialModel = record.model; |
| | | target.materialSpecification = record.specification; |
| | | target.unitId_dictText = record.unitId_dictText; |
| | | 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.quantity == null || record.quantity == undefined || record.quantity == '') { |
| | | this.$message.error('请先填写数量!'); |
| | | return false |
| | | } |
| | | if (record.availableQuantity < record.quantity) { |
| | | this.$message.error('使用数量不能大于可用数量!'); |
| | | return false; |
| | | } |
| | | this.loading = true; |
| | | postAction(this.url.lock, record).then(res => { |
| | | if (res.success) { |
| | | this.$message.success("库存锁定成功!") |
| | | } else { |
| | | this.$message.error(res.message) |
| | | } |
| | | }).finally(res => { |
| | | that.loading = false |
| | | that.loadData(); |
| | | }) |
| | | |
| | | }, |
| | | handleUnLock(record) { |
| | | let that = this; |
| | | this.loading = true; |
| | | postAction(this.url.unLock, record).then(res => { |
| | | if (res.success) { |
| | | this.$message.success("库存解锁成功!") |
| | | } else { |
| | | this.$message.error(res.message) |
| | | } |
| | | }).finally(res => { |
| | | that.loading = false |
| | | that.loadData(); |
| | | }) |
| | | }, |
| | | getSelectRows(data){ |
| | | let newActualMaterials = []; |
| | | 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, |
| | | // specification: data[i].specification, |
| | | // model: 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, |
| | | maintenanceOrderId: this.orderId, |
| | | equipmentId: this.equipmentId, |
| | | isLock: 'no' |
| | | }) |
| | | } |
| | | let that = this |
| | | postAction(this.url.addInit, newActualMaterials).then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(res => { |
| | | newActualMaterials = [] |
| | | that.loadData(); |
| | | |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | |
| | | watch: { |
| | | repairOrderId: { |
| | | immediate: true, |
| | | handler(val) { |
| | | this.clearList(); |
| | | this.queryParam['repairOrderId'] = val |
| | | this.loadData(1); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | </script> |
| | | |