| | |
| | | :dataSource="dataSource" |
| | | :pagination="ipagination" |
| | | @change="handleTableChange" |
| | | :loading="loading" |
| | | > |
| | | |
| | | <template |
| | | v-for="col in columns" |
| | | :slot="col.dataIndex" |
| | | slot-scope='text, record, index' |
| | | > |
| | | <div :key="col.dataIndex"> |
| | | <a-input-search |
| | | v-if="col.dataIndex == 'materialName'" |
| | | enter-button |
| | | @search="onSearchMaterial(index)" |
| | | <a-input |
| | | :value="text" |
| | | :read-only="true" |
| | | @change="(e) => handleChange(e, record.key, col, index)" |
| | | v-if="col.dataIndex == 'sparePartId'" |
| | | auto-size |
| | | placeholder="请输入物料名称" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | /> |
| | | <a-input |
| | | :value="text" |
| | | v-if="col.dataIndex == 'smoamUda2'" |
| | | auto-size |
| | | placeholder="请输入单位" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | /> |
| | | <j-dict-select-tag |
| | | :value='text' |
| | | v-if="col.dataIndex == 'smoamUda1'" |
| | | dictCode="material_type" |
| | | style="width: 100%;" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | /> |
| | | <a-input-number |
| | | :value="text" |
| | |
| | | :min="1" |
| | | :max="99999" |
| | | @change="(e)=>handleChange(e, record.key, col, index)" |
| | | :disabled="record.isLock == 'yes'||dailyMaintenanceOrderStatus!='4'" |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | /> |
| | | |
| | | </div> |
| | | </template> |
| | | <span |
| | | slot='action' |
| | | slot-scope='text, record' |
| | | slot-scope='text, record,index' |
| | | > |
| | | <a-popconfirm |
| | | title="确认锁料吗?" |
| | | @confirm="() => handleLock(record)" |
| | | > |
| | | <a v-if="record.isLock=='no'&&dailyMaintenanceOrderStatus=='4'">锁料</a> |
| | | </a-popconfirm> |
| | | <a-divider |
| | | v-if="record.isLock=='no'" |
| | | type="vertical" |
| | | /> |
| | | <a-popconfirm |
| | | title="解锁后会自动释放库存,确认解锁吗?" |
| | | @confirm="() => handleUnLock(record)" |
| | | > |
| | | <a v-if="record.isLock=='yes'&&dailyMaintenanceOrderStatus=='4'">解锁</a> |
| | | </a-popconfirm> |
| | | <a-popconfirm |
| | | title="确定删除吗?" |
| | | @confirm="() => handleDelete(record.id)" |
| | | > |
| | | <a v-if="record.isLock=='no'&&dailyMaintenanceOrderStatus=='4'">删除</a> |
| | | </a-popconfirm> |
| | | <a |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | @click='handleDeleteFake(index)' |
| | | >删除</a> |
| | | <!-- :disabled="mainId.status=='4'" --> |
| | | </span> |
| | | </a-table> |
| | | <a-button |
| | |
| | | icon="plus" |
| | | @click="addMaterial" |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | v-has="'dailyMaintenanceOrder:actualMaterialAdd'" |
| | | >添加实际用料</a-button> |
| | | <div :style="{width: '100%',border: '1px solid #e9e9e9',padding: '10px 16px',background: '#fff',}"> |
| | | <a-row :style="{textAlign:'right'}"> |
| | |
| | | type="primary" |
| | | :style="{marginRight: '8px'}" |
| | | :disabled="specialyMaintenanceOrderStatus!='4'" |
| | | >暂存</a-button> |
| | | >暂存</a-button> --> |
| | | <a-button |
| | | @click="handleOk(0)" |
| | | type="primary" |
| | | :disabled="specialyMaintenanceOrderStatus!='4'" |
| | | >保存</a-button> --> |
| | | :disabled="dailyMaintenanceOrderStatus!='4'" |
| | | >保存</a-button> |
| | | </a-row> |
| | | <!-- :disabled="false" --> |
| | | </div> |
| | | <actual-material-select |
| | | ref="actualMaterialSelect" |
| | | @sendMaterialRecord="sendMaterialRecord" |
| | | > |
| | | <actual-material-select ref="actualMaterialSelect"> |
| | | <!-- @sendMaterialRecord="sendMaterialRecord" --> |
| | | </actual-material-select> |
| | | <j-select-spare-part-modal ref='JSelectSparePartModal'></j-select-spare-part-modal> |
| | | <j-select-spare-part-modal |
| | | ref='JSelectSparePartModal' |
| | | @selection2Rows="getSelectRows" |
| | | ></j-select-spare-part-modal> |
| | | </a-card> |
| | | </template> |
| | | <script> |
| | |
| | | equipmentId: { |
| | | type: String, |
| | | required: false, |
| | | default: '' |
| | | default: '-1' |
| | | }, |
| | | }, |
| | | data() { |
| | |
| | | dataSource: [], |
| | | columns: [ |
| | | { |
| | | title: '领料出库单', |
| | | dataIndex: 'num', |
| | | title: '#', |
| | | dataIndex: '', |
| | | key: 'rowIndex', |
| | | width: 60, |
| | | align: "center", |
| | | width: 150, |
| | | customRender: function (t, r, index) { |
| | | return parseInt(index) + 1; |
| | | } |
| | | }, |
| | | { |
| | | title: '备件编码', |
| | | dataIndex: 'sparePartNum', |
| | | title: '物料名称', |
| | | dataIndex: 'sparePartId', |
| | | scopedSlots: { customRender: 'sparePartId' }, |
| | | align: "center", |
| | | |
| | | // className: 'red', |
| | | // width: 250, |
| | | }, |
| | | { |
| | | title: '备件名称', |
| | | dataIndex: 'sparePartName', |
| | | title: '物料种类', |
| | | dataIndex: 'smoamUda1', |
| | | scopedSlots: { customRender: 'smoamUda1' }, |
| | | align: "center", |
| | | |
| | | }, |
| | | { |
| | | title: '规格', |
| | | dataIndex: 'specification', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: '型号', |
| | | dataIndex: 'model', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: '制造商', |
| | | dataIndex: 'constructorName', |
| | | align: "center", |
| | | }, |
| | | { |
| | | title: '主单位', |
| | | dataIndex: 'mainUnitName', |
| | | align: "center", |
| | | |
| | | }, |
| | | { |
| | | title: '主数量', |
| | | align: 'center', |
| | | dataIndex: 'mainQuantity' |
| | | }, |
| | | { |
| | | title: '可用数量', |
| | | align: 'center', |
| | | dataIndex: 'availableQuantity' |
| | | // width: 250, |
| | | }, |
| | | { |
| | | title: '使用数量', |
| | | dataIndex: 'quantity', |
| | | align: "center", |
| | | scopedSlots: { customRender: 'quantity' }, |
| | | className: 'red', |
| | | |
| | | // className: 'red', |
| | | }, |
| | | { |
| | | title: '单位', |
| | | dataIndex: 'smoamUda2', |
| | | |
| | | align: "center", |
| | | scopedSlots: { customRender: 'smoamUda2' }, |
| | | // className: 'red', |
| | | }, |
| | | |
| | | { |
| | | title: '操作', |
| | | dataIndex: 'action', |
| | | align: 'center', |
| | | width: 250, |
| | | scopedSlots: { customRender: 'action' } |
| | | } |
| | | ], |
| | |
| | | lock: "/eam/maintenanceOrderActualMaterial/lock", |
| | | unLock: "/eam/maintenanceOrderActualMaterial/unLock" |
| | | }, |
| | | changeIndex: 0 |
| | | changeIndex: 0, |
| | | loading: false, |
| | | } |
| | | }, |
| | | watch: { |
| | |
| | | immediate: true, |
| | | handler(val) { |
| | | this.clearList(); |
| | | this.queryParam['maintenanceOrderId'] = val |
| | | this.queryParam['equipmentId'] = this.equipmentId |
| | | // this.queryParam['maintenanceOrderId'] = val |
| | | // this.queryParam['equipmentId'] = this.equipmentId |
| | | this.loadData(1); |
| | | } |
| | | }, |
| | | equipmentId: { |
| | | immediate: true, |
| | | handler(val) { |
| | | this.clearList(); |
| | | this.queryParam['maintenanceOrderId'] = this.dailyMaintenanceOrderId |
| | | this.queryParam['equipmentId'] = val |
| | | this.loadData(1); |
| | | } |
| | | } |
| | | // equipmentId: { |
| | | // immediate: true, |
| | | // handler(val) { |
| | | // this.clearList(); |
| | | // this.queryParam['maintenanceOrderId'] = this.dailyMaintenanceOrderId |
| | | // this.queryParam['equipmentId'] = val |
| | | // this.loadData(1); |
| | | // } |
| | | // } |
| | | }, |
| | | created() { |
| | | this.queryParam['maintenanceOrderId'] = this.dailyMaintenanceOrderId; |
| | |
| | | this.loadData(1); |
| | | }, |
| | | 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 |
| | | // }, |
| | | 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 |
| | | this.dataSource.push({ sparePartId: '', smoamUda1: '', smoamUda2: '', quantity: '', repairOrderId: this.equipmentId }) |
| | | }, |
| | | handleCancel() { |
| | | this.$bus.$emit('closeDrawer'); |
| | |
| | | if (saveStatus == 0) { |
| | | let materialDataSource = that.dataSource; |
| | | let indexIdList = []; |
| | | for (let i = 0; i < materialDataSource.length; i++) { |
| | | if (materialDataSource[i].materialId == undefined || materialDataSource[i].materialId == null || materialDataSource[i].materialId == '') { |
| | | that.$message.warning("请选择第" + (i + 1) + "行物料!"); |
| | | return false; |
| | | } |
| | | if (materialDataSource[i].quantity == undefined || materialDataSource[i].quantity == null || materialDataSource[i].quantity == '') { |
| | | that.$message.warning("请填写第" + (i + 1) + "行用料数!"); |
| | | return false; |
| | | } |
| | | } |
| | | // for (let i = 0; i < materialDataSource.length; i++) { |
| | | // if (materialDataSource[i].materialId == undefined || materialDataSource[i].materialId == null || materialDataSource[i].materialId == '') { |
| | | // that.$message.warning("请选择第" + (i + 1) + "行物料!"); |
| | | // return false; |
| | | // } |
| | | // 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("请添加物料!") |
| | |
| | | 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 ('smoamUda2' == column.dataIndex) { |
| | | target['smoamUda2'] = value.target.value |
| | | } |
| | | if ('quantity' == column.dataIndex) { |
| | | target['quantity'] = value |
| | | } |
| | | if ('smoamUda1' == column.dataIndex) { |
| | | target['smoamUda1'] = value |
| | | } |
| | | }, |
| | | 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) { |
| | | 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 |
| | | } |
| | | }, |
| | | |
| | | // sendMaterialRecord(data, val) { |
| | | // let record = data.record |
| | | // const temp = [...this.dataSource] |
| | | // const target = temp[this.recordIndex] |
| | | // if (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) |
| | | }, |
| | | // 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; |
| | | } |
| | | this.confirmLoading = true; |
| | | this.loading = true; |
| | | postAction(this.url.lock, record).then(res => { |
| | | if (res.success) { |
| | | this.$message.success("库存锁定成功!") |
| | |
| | | this.$message.error(res.message) |
| | | } |
| | | }).finally(res => { |
| | | that.confirmLoading = false |
| | | that.loading = false |
| | | that.loadData(); |
| | | }) |
| | | |
| | | }, |
| | | handleUnLock(record) { |
| | | let that = this; |
| | | this.confirmLoading = true; |
| | | this.loading = true; |
| | | postAction(this.url.unLock, record).then(res => { |
| | | if (res.success) { |
| | | this.$message.success("库存解锁成功!") |
| | |
| | | this.$message.error(res.message) |
| | | } |
| | | }).finally(res => { |
| | | that.confirmLoading = false |
| | | that.loading = false |
| | | that.loadData(); |
| | | }) |
| | | }, |
| | |
| | | this.loading = false |
| | | }) |
| | | }, |
| | | }, |
| | | mounted() { |
| | | let newActualMaterials = []; |
| | | this.$bus.$on('selectionRows', (data) => { |
| | | getSelectRows(data) { |
| | | let newActualMaterials = []; |
| | | for (let i = 0; i < data.length; i++) { |
| | | var actualMaterial |
| | | = |
| | | { |
| | | id: this.getUuiD(16), |
| | | num: data[i].num, |
| | | 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, |
| | | // 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.dailyMaintenanceOrderId, |
| | | equipmentId: this.equipmentId, |
| | | isLock: 'no' |
| | | } |
| | | newActualMaterials.push(actualMaterial); |
| | | }) |
| | | } |
| | | let that = this |
| | | let obj = obj = postAction(this.url.addInit, newActualMaterials) |
| | | obj.then((res) => { |
| | | 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 => { |
| | | that.loadData(); |
| | | newActualMaterials = [] |
| | | that.loadData(); |
| | | |
| | | }) |
| | | }) |
| | | |
| | | } |
| | | }, |
| | | |
| | | mounted() { |
| | | }, |
| | | |
| | | } |