| | |
| | | slot-scope='text, record, index' |
| | | > |
| | | <div :key="col.dataIndex"> |
| | | <a-input |
| | | :value="text" |
| | | v-if="col.dataIndex == 'sparePartId'" |
| | | auto-size |
| | | placeholder="请输入物料名称" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="record.disabled" |
| | | /> |
| | | <a-input |
| | | :value="text" |
| | | v-if="col.dataIndex == 'repairOrderAmUda1'" |
| | | auto-size |
| | | placeholder="请输入单位" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="record.disabled" |
| | | /> |
| | | <j-dict-select-tag |
| | | :value='text' |
| | | v-if="col.dataIndex == 'outboundOrderId'" |
| | | dictCode="material_type" |
| | | :disabled="true" |
| | | style="width: 100%;" |
| | | @change='(e)=>handleChange(e, record.key, col, index)'/> |
| | | <a-input-number |
| | | :value="text" |
| | | v-if="col.dataIndex == 'actualQuantity'" |
| | |
| | | </div> |
| | | </template> |
| | | <span |
| | | slot='action' |
| | | slot-scope='text, record,index' |
| | | > |
| | | <a |
| | | :disabled="mainId.status=='4'" |
| | | @click='handleDelete(index)' |
| | | >删除</a> |
| | | </span> |
| | | <!-- <span |
| | | slot='action' |
| | | slot-scope='text, record' |
| | | > |
| | |
| | | > |
| | | <a v-if="record.isLock=='no'&&mainId.status=='3'">删除</a> |
| | | </a-popconfirm> |
| | | </span> |
| | | </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'" |
| | | :disabled="mainId.status!='3'||( mainId.repairOrderUda1!='needPart'&&mainId.repairOrderUda1!='needSpare')" |
| | | >添加实际用料</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" |
| | | @click='handleCancel' |
| | | > |
| | | 取消 |
| | | </a-button> --> |
| | | </a-button> |
| | | <!-- <a-button |
| | | @click="handleOk(1)" |
| | | type="primary" |
| | | @click='handleOk(1)' |
| | | type='primary' |
| | | :style="{marginRight: '8px'}" |
| | | :disabled="specialyMaintenanceOrderStatus!='4'" |
| | | >暂存</a-button> |
| | | :disabled="this.repairOrderStatus=='4' || this.repairOrderStatus=='2'" |
| | | >暂存 |
| | | </a-button> --> |
| | | <a-button |
| | | @click="handleOk(0)" |
| | | type="primary" |
| | | :disabled="specialyMaintenanceOrderStatus!='4'" |
| | | >保存</a-button> --> |
| | | @click='handleOk(0)' |
| | | type='primary' |
| | | :disabled="this.mainId.status=='4' || this.mainId.status=='2'" |
| | | >保存 |
| | | </a-button> |
| | | </a-row> |
| | | <!-- :disabled="false" --> |
| | | </div> |
| | |
| | | import pick from 'lodash.pick' |
| | | import JEllipsis from '@/components/jeecg/JEllipsis' |
| | | import JSelectSparePartModal from './select/JSelectSparePartModal' |
| | | import RepairOrderActualMaterialReportModel from './RepairOrderActualMaterialReportModel.vue' |
| | | // import RepairOrderActualMaterialReportModel from './RepairOrderActualMaterialReportModel.vue' |
| | | export default { |
| | | name: 'RepairOrderActualMaterialReport', |
| | | mixins: [JeecgListMixin], |
| | | components: { |
| | | JEllipsis, |
| | | JSelectSparePartModal, |
| | | RepairOrderActualMaterialReportModel |
| | | }, |
| | | props: { |
| | | mainId: { |
| | |
| | | return parseInt(index) + 1; |
| | | } |
| | | }, |
| | | { |
| | | title: '领料出库单', |
| | | dataIndex: 'num', |
| | | align: "center", |
| | | width: 150, |
| | | }, |
| | | { |
| | | title: '备件编码', |
| | | dataIndex: 'sparePartNum', |
| | | align: "center", |
| | | // { |
| | | // title: '领料出库单', |
| | | // dataIndex: 'num', |
| | | // align: "center", |
| | | // width: 150, |
| | | // }, |
| | | // { |
| | | // title: '备件编码', |
| | | // dataIndex: 'sparePartNum', |
| | | // align: "center", |
| | | |
| | | }, |
| | | // }, |
| | | { |
| | | title: '备件名称', |
| | | dataIndex: 'sparePartName', |
| | | title: '物料名称', |
| | | dataIndex: 'sparePartId', |
| | | scopedSlots: { customRender: 'sparePartId' }, |
| | | align: "center", |
| | | |
| | | className: 'red', |
| | | width: 250, |
| | | }, |
| | | { |
| | | title: '规格', |
| | | dataIndex: 'sparePartSpecification', |
| | | title: '物料种类', |
| | | dataIndex: 'outboundOrderId', |
| | | scopedSlots: { customRender: 'outboundOrderId' }, |
| | | align: "center", |
| | | width: 250, |
| | | }, |
| | | // { |
| | | // title: '型号', |
| | | // dataIndex: 'sparePartModel', |
| | | // align: "center", |
| | | // }, |
| | | // { |
| | | // title: '制造商', |
| | | // dataIndex: 'constructorName', |
| | | // align: "center", |
| | | // }, |
| | | { |
| | | title: '型号', |
| | | dataIndex: 'sparePartModel', |
| | | title: '单位', |
| | | dataIndex: 'repairOrderAmUda1', |
| | | scopedSlots: { customRender: 'repairOrderAmUda1' }, |
| | | align: "center", |
| | | className: 'red', |
| | | width: 250, |
| | | }, |
| | | { |
| | | title: '制造商', |
| | | dataIndex: 'constructorName', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: '主单位', |
| | | dataIndex: 'mainUnitName', |
| | | align: "center", |
| | | |
| | | }, |
| | | { |
| | | title: '主数量', |
| | | align: 'center', |
| | | dataIndex: 'mainQuantity' |
| | | }, |
| | | { |
| | | title: '可用数量', |
| | | align: 'center', |
| | | dataIndex: 'availableQuantity' |
| | | }, |
| | | // { |
| | | // title: '主数量', |
| | | // align: 'center', |
| | | // dataIndex: 'mainQuantity' |
| | | // }, |
| | | // { |
| | | // title: '可用数量', |
| | | // align: 'center', |
| | | // dataIndex: 'availableQuantity' |
| | | // }, |
| | | { |
| | | title: '使用数量', |
| | | dataIndex: 'actualQuantity', |
| | | align: "center", |
| | | scopedSlots: { customRender: 'actualQuantity' }, |
| | | className: 'red', |
| | | |
| | | width: 250, |
| | | }, |
| | | { |
| | | title: '操作', |
| | |
| | | } |
| | | ], |
| | | url: { |
| | | list: '/eam/repairOrder/listRepairOrderActualMaterialByMainId', |
| | | confirmMaterial: "/eam/repairOrderActualMaterial/add", |
| | | list: '/eam/repairOrderActualMaterial/list', |
| | | confirmMaterial: "/eam/repairOrderActualMaterial/addNew", |
| | | delete: "/eam/repairOrderActualMaterial/delete", |
| | | addInit: "/eam/repairOrderActualMaterial/addInit", |
| | | lock: "/eam/repairOrderActualMaterial/lock", |
| | |
| | | watch: { |
| | | mainId: { |
| | | immediate: true, |
| | | deep:true, |
| | | handler(val) { |
| | | console.log(val) |
| | | if (!this.mainId.id) { |
| | |
| | | // }, |
| | | 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 |
| | | // 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 |
| | | this.dataSource.push({ sparePartId: '', outboundOrderId: this.mainId.repairOrderUda1,repairOrderAmUda1: '', actualQuantity:'',repairOrderId:this.mainId.id }) |
| | | }, |
| | | handleCancel() { |
| | | this.$bus.$emit('close'); |
| | | this.$bus.$emit('closeDrawer') |
| | | }, |
| | | close() { |
| | | this.$emit('close'); |
| | |
| | | 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 |
| | | // 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 |
| | | // } |
| | | if ('sparePartId' == column.dataIndex) { |
| | | target['sparePartId'] = value.target.value |
| | | } |
| | | if ('repairOrderAmUda1' == column.dataIndex) { |
| | | target['repairOrderAmUda1'] = value.target.value |
| | | } |
| | | if ('actualQuantity' == column.dataIndex) { |
| | | target['actualQuantity'] = value |
| | | } |
| | | }, |
| | | clearList() { |
| | | this.dataSource = []; |
| | |
| | | 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) |
| | | handleOk(saveStatus) { |
| | | const that = this |
| | | if (saveStatus == 0) { |
| | | let workHoursDataSource = that.dataSource |
| | | for (let i = 0; i < workHoursDataSource.length; i++) { |
| | | if (workHoursDataSource[i].sparePartId == undefined || workHoursDataSource[i].sparePartId == null || workHoursDataSource[i].sparePartId == '') { |
| | | that.$message.warning('请选择第' + (i + 1) + '行物料名称!') |
| | | return false |
| | | } |
| | | if (workHoursDataSource[i].repairOrderAmUda1 == undefined || workHoursDataSource[i].repairOrderAmUda1 == null || workHoursDataSource[i].repairOrderAmUda1 == '') { |
| | | that.$message.warning('请填写第' + (i + 1) + '行单位!') |
| | | return false |
| | | } |
| | | if (workHoursDataSource[i].actualQuantity == undefined || workHoursDataSource[i].actualQuantity == null || workHoursDataSource[i].actualQuantity == '') { |
| | | that.$message.warning('请填写第' + (i + 1) + '行使用数量!') |
| | | return false |
| | | } |
| | | } |
| | | }).finally(res => { |
| | | that.loadData(); |
| | | |
| | | } |
| | | if (that.dataSource.length === 0) { |
| | | that.$message.warning('请添加用料!') |
| | | return |
| | | } |
| | | this.form.validateFields((err, values) => { |
| | | if (!err) { |
| | | that.confirmLoading = true |
| | | let formData = that.dataSource; |
| | | let obj = obj = postAction(this.url.confirmMaterial, formData) |
| | | obj.then((res) => { |
| | | if (res.success) { |
| | | that.$message.success(res.message) |
| | | that.$emit('ok') |
| | | } else { |
| | | that.$message.warning(res.message) |
| | | } |
| | | }).finally(() => { |
| | | that.confirmLoading = false |
| | | that.close() |
| | | that.loadData(1) |
| | | }) |
| | | } |
| | | }) |
| | | }) |
| | | }, |
| | | handleDelete(index) { |
| | | console.log(index) |
| | | this.dataSource.splice(index, 1) |
| | | }, |
| | | }, |
| | | // 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> |