|
|
@@ -195,11 +195,53 @@
|
|
|
ref="table"
|
|
|
row-key="id"
|
|
|
:columns="materialColumns"
|
|
|
- :datasource="[]"
|
|
|
+ :datasource="addForm.pickDetails"
|
|
|
cache-key="prenatal-examination-material-list-table-2510231107"
|
|
|
autoAmendPage
|
|
|
:needPage="false"
|
|
|
+ @refresh="getListByWorkOrderId"
|
|
|
>
|
|
|
+ <template v-slot:toolbar>
|
|
|
+ <el-button type="primary" @click="openMaterialModal"
|
|
|
+ >添加物料</el-button
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:reportQuantity="{ row }">
|
|
|
+ <el-input-number
|
|
|
+ size="small"
|
|
|
+ v-model.number="row.reportQuantity"
|
|
|
+ controls-position="right"
|
|
|
+ :min="0"
|
|
|
+ :max="row.feedQuantity"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-slot:qualifiedQuantity="{ row }">
|
|
|
+ <el-input-number
|
|
|
+ size="small"
|
|
|
+ v-model.number="row.qualifiedQuantity"
|
|
|
+ controls-position="right"
|
|
|
+ :min="0"
|
|
|
+ :max="qualifiedQuantityMax(row)"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-slot:noQualifiedQuantity="{ row }">
|
|
|
+ <el-input-number
|
|
|
+ size="small"
|
|
|
+ v-model.number="row.noQualifiedQuantity"
|
|
|
+ controls-position="right"
|
|
|
+ :min="0"
|
|
|
+ :max="noQualifiedQuantityMax(row)"
|
|
|
+ ></el-input-number>
|
|
|
+ </template>
|
|
|
+ <template v-slot:msg="{ row }">
|
|
|
+ <el-input
|
|
|
+ v-model="row.msg"
|
|
|
+ type="textarea"
|
|
|
+ rows="1"
|
|
|
+ autosize
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
|
|
|
|
<header-title title="检查项目"></header-title>
|
|
|
@@ -355,6 +397,8 @@
|
|
|
</template>
|
|
|
|
|
|
<toolModal ref="toolModalRef" @chooseModal="chooseModal" />
|
|
|
+
|
|
|
+ <materialModal ref="materialModalRef" @confirm="materialConfirm" />
|
|
|
</ele-modal>
|
|
|
</template>
|
|
|
|
|
|
@@ -369,14 +413,15 @@
|
|
|
saveOrUpdateAndSubmit,
|
|
|
saveOrUpdate,
|
|
|
logicDelete,
|
|
|
- getById
|
|
|
+ getById,
|
|
|
+ queryListByWorkOrderId
|
|
|
} from '@/api/producetaskrecordrulesrecord/index';
|
|
|
import toolModal from '@/views/batchRecord/components/toolModal.vue';
|
|
|
import { getTeam } from '@/api/produce/job.js';
|
|
|
- import { det, row } from 'mathjs';
|
|
|
+ import materialModal from './materialModal.vue';
|
|
|
|
|
|
export default {
|
|
|
- components: { SelectUser, toolModal },
|
|
|
+ components: { SelectUser, toolModal, materialModal },
|
|
|
emits: ['reload'],
|
|
|
props: {
|
|
|
isTempRecord: {
|
|
|
@@ -430,7 +475,9 @@
|
|
|
// }
|
|
|
],
|
|
|
// 班组id
|
|
|
- teamId: ''
|
|
|
+ teamId: '',
|
|
|
+ // 物料字段name
|
|
|
+ pickDetails: []
|
|
|
};
|
|
|
|
|
|
return {
|
|
|
@@ -450,11 +497,10 @@
|
|
|
if (!value) return callback();
|
|
|
const now = new Date();
|
|
|
const start = new Date(value);
|
|
|
- if (start < now) {
|
|
|
- callback(new Error('开始时间不能小于当前时间'));
|
|
|
- } else {
|
|
|
- callback();
|
|
|
- }
|
|
|
+ // if (start < now) {
|
|
|
+ // return callback(new Error('开始时间不能小于当前时间'));
|
|
|
+ // }
|
|
|
+ callback();
|
|
|
},
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
@@ -534,7 +580,127 @@
|
|
|
checked: false,
|
|
|
teamUserList: [],
|
|
|
teamList: [],
|
|
|
- teamAllList: []
|
|
|
+ teamAllList: [],
|
|
|
+ // 物料清单表头
|
|
|
+ materialColumns: [
|
|
|
+ {
|
|
|
+ width: 45,
|
|
|
+ type: 'index',
|
|
|
+ columnKey: 'index',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '批次号',
|
|
|
+ prop: 'batchNo',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+
|
|
|
+ {
|
|
|
+ label: '领料类型',
|
|
|
+ prop: 'categoryLevelNamePath',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '物料编码',
|
|
|
+ prop: 'categoryCode',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '物料名称',
|
|
|
+ prop: 'categoryName',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '工序名称',
|
|
|
+ prop: 'produceTaskName',
|
|
|
+ minWidth: 120
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '领料数量',
|
|
|
+ prop: 'pickQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter: (row) => {
|
|
|
+ return (row.pickQuantity || '') + (row.pickUnit || '');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '出库数量',
|
|
|
+ prop: 'outStorageQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter: (row) => {
|
|
|
+ return (
|
|
|
+ (row.outStorageQuantity || '') + (row.outStorageUnit || '')
|
|
|
+ );
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '投料数量',
|
|
|
+ prop: 'feedQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter: (row) => {
|
|
|
+ return (row.feedQuantity || '') + (row.feedUnit || '');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '当次报工数量',
|
|
|
+ prop: 'reportQuantity',
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'reportQuantity'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '当次合格数量',
|
|
|
+ prop: 'qualifiedQuantity',
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'qualifiedQuantity'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '当次不合格数量',
|
|
|
+ prop: 'noQualifiedQuantity',
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'noQualifiedQuantity'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '不合格原因',
|
|
|
+ prop: 'msg',
|
|
|
+ minWidth: 160,
|
|
|
+ slot: 'msg'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '已报工数量',
|
|
|
+ prop: 'sumReportQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter(row) {
|
|
|
+ return (row.sumReportQuantity || 0) + row.feedUnit;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '未报工数量',
|
|
|
+ prop: 'noReportQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter(row) {
|
|
|
+ if (row.sumReportQuantity != null) {
|
|
|
+ return row.feedQuantity - row.sumReportQuantity + row.feedUnit;
|
|
|
+ }
|
|
|
+ return `${row.feedQuantity}${row.feedUnit || ''}`;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '合格总数',
|
|
|
+ prop: 'sumQualifiedQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter(row) {
|
|
|
+ return (row.sumQualifiedQuantity || 0) + (row.feedUnit || '');
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '不合格总数',
|
|
|
+ prop: 'sumNoQualifiedQuantity',
|
|
|
+ minWidth: 120,
|
|
|
+ formatter(row) {
|
|
|
+ return (row.sumNoQualifiedQuantity || 0) + (row.feedUnit || '');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
};
|
|
|
},
|
|
|
computed: {
|
|
|
@@ -556,16 +722,7 @@
|
|
|
return this.teamUserList.filter((user) =>
|
|
|
this.addForm.executeUsersIds.includes(user.id)
|
|
|
);
|
|
|
- },
|
|
|
- // 物料清单表头
|
|
|
- materialColumns: [
|
|
|
- {
|
|
|
- width: 45,
|
|
|
- type: 'index',
|
|
|
- columnKey: 'index',
|
|
|
- align: 'center'
|
|
|
- }
|
|
|
- ]
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
if (localStorage.getItem('singleUserInfo') == '1') {
|
|
|
@@ -667,11 +824,26 @@
|
|
|
this.teamUserList = this.teamAllList[index];
|
|
|
}
|
|
|
|
|
|
+ this.getListByWorkOrderId();
|
|
|
+
|
|
|
this.loading = false;
|
|
|
} catch (error) {
|
|
|
this.loading = false;
|
|
|
}
|
|
|
},
|
|
|
+ // 物料信息查询
|
|
|
+ async getListByWorkOrderId() {
|
|
|
+ // 查询物料信息
|
|
|
+ const materialList = await queryListByWorkOrderId({
|
|
|
+ workOrderId: this.addForm.workOrderId,
|
|
|
+ recordId: this.productionInfo.recordId,
|
|
|
+ produceTaskInstanceId: this.workOrderInfo.taskId,
|
|
|
+ ruleId: this.addForm.ruleId
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log('materialList 物料信息', materialList);
|
|
|
+ this.addForm.pickDetails = materialList;
|
|
|
+ },
|
|
|
// 规则信息
|
|
|
async getRuleInfo() {
|
|
|
const data = await getRecordRulesDetail(this.productionInfo.ruleId);
|
|
|
@@ -715,8 +887,8 @@
|
|
|
handleBeforeClose() {
|
|
|
this.addForm = JSON.parse(JSON.stringify(this.formDate));
|
|
|
console.log('this.$refs.ruleFormRef', this.addForm);
|
|
|
- this.$refs.ruleFormRef?.clearValidate();
|
|
|
this.$nextTick(() => {
|
|
|
+ this.$refs.ruleFormRef.clearValidate();
|
|
|
this.visible = false;
|
|
|
});
|
|
|
},
|
|
|
@@ -799,12 +971,20 @@
|
|
|
this.addForm.checkValidityUnit = null;
|
|
|
this.addForm.conclution = null;
|
|
|
this.addForm.id = null;
|
|
|
+ this.addForm.pickDetails = [];
|
|
|
+ this.addForm.duration = 0;
|
|
|
+ this.addForm.executeUsers = [];
|
|
|
+ thia.addForm.executeUsersIds = [];
|
|
|
|
|
|
this.getRuleList();
|
|
|
this.$message.success('缓存清空成功!');
|
|
|
this.productionInfo.executeStatus = 0;
|
|
|
if (this.addForm.isTempRecord) {
|
|
|
this.handleBeforeClose();
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.ruleFormRef.clearValidate();
|
|
|
+ });
|
|
|
}
|
|
|
this.$emit('reload');
|
|
|
} catch (error) {
|
|
|
@@ -942,6 +1122,62 @@
|
|
|
});
|
|
|
|
|
|
console.log('row', row);
|
|
|
+ },
|
|
|
+ // 选择物料
|
|
|
+ openMaterialModal() {
|
|
|
+ this.$refs.materialModalRef.open(
|
|
|
+ this.addForm.workOrderId,
|
|
|
+ this.addForm.ruleId,
|
|
|
+ []
|
|
|
+ );
|
|
|
+ },
|
|
|
+ materialConfirm(data) {
|
|
|
+ // 选择物料后添加
|
|
|
+ console.log('data', data);
|
|
|
+
|
|
|
+ // 去重
|
|
|
+ const list = data
|
|
|
+ .filter((i) => {
|
|
|
+ const any = this.addForm.pickDetails.find(
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode === i.categoryCode &&
|
|
|
+ item.produceTaskInstanceId === i.produceTaskInstanceId
|
|
|
+ );
|
|
|
+ return !any;
|
|
|
+ })
|
|
|
+ .map((i) => {
|
|
|
+ i.ruleId = this.addForm.ruleId;
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+
|
|
|
+ // 覆盖部分数据
|
|
|
+ this.addForm.pickDetails = this.addForm.pickDetails.map((i) => {
|
|
|
+ const item = data.find(
|
|
|
+ (item) =>
|
|
|
+ item.categoryCode === i.categoryCode &&
|
|
|
+ item.produceTaskInstanceId === i.produceTaskInstanceId
|
|
|
+ );
|
|
|
+ if (item) {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ reportQuantity: i.reportQuantity,
|
|
|
+ qualifiedQuantity: i.qualifiedQuantity,
|
|
|
+ noQualifiedQuantity: i.noQualifiedQuantity,
|
|
|
+ msg: i.msg
|
|
|
+ };
|
|
|
+ }
|
|
|
+ return i;
|
|
|
+ });
|
|
|
+ this.addForm.pickDetails = [...this.addForm.pickDetails, ...list];
|
|
|
+ console.log('list', list);
|
|
|
+ console.log('this.addForm.pickDetails', this.addForm.pickDetails);
|
|
|
+ },
|
|
|
+ // qualifiedQuantityMax 最大合格数量
|
|
|
+ qualifiedQuantityMax(row) {
|
|
|
+ return row.reportQuantity - row.noQualifiedQuantity;
|
|
|
+ },
|
|
|
+ noQualifiedQuantityMax(row) {
|
|
|
+ return row.reportQuantity - row.qualifiedQuantity;
|
|
|
}
|
|
|
}
|
|
|
};
|