|
|
@@ -0,0 +1,520 @@
|
|
|
+<template>
|
|
|
+ <ele-modal
|
|
|
+ :title="title"
|
|
|
+ :visible.sync="visible"
|
|
|
+ :close-on-click-modal="false"
|
|
|
+ @close="handleClose"
|
|
|
+ resizable
|
|
|
+ maxable
|
|
|
+ width="80%"
|
|
|
+ >
|
|
|
+ <el-form ref="formRef" :model="form" :rules="rules" label-width="100px">
|
|
|
+ <header-title title="基本信息"></header-title>
|
|
|
+
|
|
|
+ <el-row :gutter="10">
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="放行单编码">
|
|
|
+ <el-input
|
|
|
+ v-model="form.code"
|
|
|
+ placeholder="系统自动生成"
|
|
|
+ disabled
|
|
|
+ ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="8">
|
|
|
+ <el-form-item label="放行单名称" prop="name">
|
|
|
+ <el-input v-model="form.name" placeholder="请输入"></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+
|
|
|
+ <header-title title="物品清单">
|
|
|
+ <el-button type="primary" icon="el-icon-plus" @click="openAddModel">
|
|
|
+ 添加
|
|
|
+ </el-button>
|
|
|
+ </header-title>
|
|
|
+
|
|
|
+ <ele-pro-table
|
|
|
+ ref="table"
|
|
|
+ row-key="userId"
|
|
|
+ :columns="ordersColumns"
|
|
|
+ :datasource="form.orders"
|
|
|
+ >
|
|
|
+ <template v-slot:action="{ row }">
|
|
|
+ <el-link icon="el-icon-edit" type="primary" :underline="false"
|
|
|
+ >详情</el-link
|
|
|
+ >
|
|
|
+ <el-link
|
|
|
+ icon="el-icon-delete"
|
|
|
+ type="danger"
|
|
|
+ :underline="false"
|
|
|
+ @click="deleteRow(row)"
|
|
|
+ >删除</el-link
|
|
|
+ >
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <el-button type="primary" style="margin-bottom: 15px">
|
|
|
+ 规则齐套检查
|
|
|
+ </el-button>
|
|
|
+
|
|
|
+ <header-title title="生产放行规则"> </header-title>
|
|
|
+
|
|
|
+ <ele-pro-table
|
|
|
+ ref="scTable"
|
|
|
+ row-key="id"
|
|
|
+ :columns="detailsColumns"
|
|
|
+ :datasource="scDetails"
|
|
|
+ >
|
|
|
+ <template v-slot:isPass="{ row }">
|
|
|
+ <el-radio-group v-model="row.isPass">
|
|
|
+ <el-radio :label="1">是</el-radio>
|
|
|
+ <el-radio :label="2">否</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </template>
|
|
|
+ <template v-slot:remark="{ row }">
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ v-model="row.remark"
|
|
|
+ placeholder="请输入备注"
|
|
|
+ :rows="1"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <table class="detail-table" style="width: 500px; margin: 15px 0">
|
|
|
+ <tr>
|
|
|
+ <td>结论</td>
|
|
|
+ <td>
|
|
|
+ <el-radio-group v-model="form.workConclution">
|
|
|
+ <el-radio :label="0">不符合规定</el-radio>
|
|
|
+ <el-radio :label="1">符合规定</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>验收人</td>
|
|
|
+ <td>
|
|
|
+ <el-input
|
|
|
+ v-model="form.workCheckUserName"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>验收时间</td>
|
|
|
+ <td>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.workCheckTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-date-picker>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ <header-title title="质检放行规则"></header-title>
|
|
|
+
|
|
|
+ <ele-pro-table
|
|
|
+ ref="zjTable"
|
|
|
+ row-key="id"
|
|
|
+ :columns="detailsColumns"
|
|
|
+ :datasource="zjDetails"
|
|
|
+ >
|
|
|
+ <template v-slot:isPass="{ row }">
|
|
|
+ <el-radio-group v-model="row.isPass">
|
|
|
+ <el-radio :label="1">是</el-radio>
|
|
|
+ <el-radio :label="2">否</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </template>
|
|
|
+ <template v-slot:remark="{ row }">
|
|
|
+ <el-input
|
|
|
+ type="textarea"
|
|
|
+ v-model="row.remark"
|
|
|
+ placeholder="请输入备注"
|
|
|
+ :rows="1"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ </ele-pro-table>
|
|
|
+
|
|
|
+ <table class="detail-table" style="width: 500px; margin: 15px 0">
|
|
|
+ <tr>
|
|
|
+ <td>结论</td>
|
|
|
+ <td>
|
|
|
+ <el-radio-group v-model="form.qualityConclution">
|
|
|
+ <el-radio :label="0">不符合规定</el-radio>
|
|
|
+ <el-radio :label="1">符合规定</el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>验收人</td>
|
|
|
+ <td>
|
|
|
+ <el-input
|
|
|
+ v-model="form.qualityCheckUserName"
|
|
|
+ placeholder="请输入"
|
|
|
+ ></el-input>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ <tr>
|
|
|
+ <td>验收时间</td>
|
|
|
+ <td>
|
|
|
+ <el-date-picker
|
|
|
+ v-model="form.qualityCheckTime"
|
|
|
+ type="datetime"
|
|
|
+ placeholder="选择日期时间"
|
|
|
+ style="width: 100%"
|
|
|
+ ></el-date-picker>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </table>
|
|
|
+
|
|
|
+ <selectWorkOrder
|
|
|
+ ref="selectWorkOrderRef"
|
|
|
+ :where="workOrderWhere"
|
|
|
+ :autoClose="false"
|
|
|
+ @confirm="selectWorkOrderConfirm"
|
|
|
+ ></selectWorkOrder>
|
|
|
+ </el-form>
|
|
|
+
|
|
|
+ <template v-slot:footer>
|
|
|
+ <el-button type="primary" @click="submit" :loading="butLoading"
|
|
|
+ >提 交</el-button
|
|
|
+ >
|
|
|
+ <el-button type="primary" @click="submit('save')" :loading="butLoading"
|
|
|
+ >保存</el-button
|
|
|
+ >
|
|
|
+ <el-button @click="handleClose">取 消</el-button>
|
|
|
+ </template>
|
|
|
+ </ele-modal>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+ import dictMixins from '@/mixins/dictMixins';
|
|
|
+ import selectWorkOrder from '@/components/selectWorkOrder/selectWorkOrder.vue';
|
|
|
+ import { checklisttemplateGetById } from '@/api/checklisttemplate/index';
|
|
|
+ import { checklistrecordSave } from '@/api/checklistrecord/index';
|
|
|
+
|
|
|
+ export default {
|
|
|
+ mixins: [dictMixins],
|
|
|
+ components: { selectWorkOrder },
|
|
|
+ data() {
|
|
|
+ const formBaseData = {
|
|
|
+ approvalStatus: 0,
|
|
|
+ checklistType: 0,
|
|
|
+ code: '',
|
|
|
+ createUserName: '',
|
|
|
+ details: [],
|
|
|
+ name: '',
|
|
|
+ orders: [],
|
|
|
+ processInstanceId: '',
|
|
|
+ qualityCheckTime: '',
|
|
|
+ qualityCheckUserId: 0,
|
|
|
+ qualityCheckUserName: '',
|
|
|
+ qualityConclution: 0,
|
|
|
+ templateId: 0,
|
|
|
+ templateName: '',
|
|
|
+ workCheckTime: '',
|
|
|
+ workCheckUserId: 0,
|
|
|
+ workCheckUserName: '',
|
|
|
+ workConclution: 0
|
|
|
+ };
|
|
|
+
|
|
|
+ return {
|
|
|
+ visible: false,
|
|
|
+ title: '放行申请单',
|
|
|
+ formBaseData,
|
|
|
+ form: JSON.parse(JSON.stringify(formBaseData)),
|
|
|
+ rules: {
|
|
|
+ name: [
|
|
|
+ { required: true, message: '请输入放行单名称', trigger: 'blur' },
|
|
|
+ { required: true, message: '请输入放行单名称', trigger: 'change' }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ // 类型 add / edit / detail
|
|
|
+ type: '',
|
|
|
+ // 生产工单查询条件
|
|
|
+ workOrderWhere: {
|
|
|
+ statusList: ['6']
|
|
|
+ },
|
|
|
+ loading: false,
|
|
|
+ butLoading: false
|
|
|
+ };
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ ordersColumns() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ width: 55,
|
|
|
+ type: 'index',
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'batchNo',
|
|
|
+ label: '批次号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productCode',
|
|
|
+ label: '产品编码',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productName',
|
|
|
+ label: '产品名称',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'workOrderId',
|
|
|
+ label: '生产工单号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'formingNum',
|
|
|
+ label: '数量',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'specification',
|
|
|
+ label: '规格',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'productModel',
|
|
|
+ label: '型号',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '操作',
|
|
|
+ columnKey: 'action',
|
|
|
+ slot: 'action',
|
|
|
+ minWidth: 120
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ // 生产放行规则
|
|
|
+ scDetails() {
|
|
|
+ return this.form.details.filter((item) => item.checkType == 1);
|
|
|
+ },
|
|
|
+ // 质检放行规则
|
|
|
+ zjDetails() {
|
|
|
+ return this.form.details.filter((item) => item.checkType == 2);
|
|
|
+ },
|
|
|
+ detailsColumns() {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ width: 55,
|
|
|
+ type: 'index',
|
|
|
+ columnKey: 'index',
|
|
|
+ label: '序号',
|
|
|
+ align: 'center'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'targetDefinitionName',
|
|
|
+ label: '指标名称',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'isPass',
|
|
|
+ label: '审核结果',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'isPass',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'remark',
|
|
|
+ label: '备注',
|
|
|
+ align: 'center',
|
|
|
+ slot: 'remark',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true
|
|
|
+ }
|
|
|
+ ];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ // 外部调用,打开弹窗
|
|
|
+ open(type, data) {
|
|
|
+ console.log('data , type', data, type);
|
|
|
+ if (type == 'add') {
|
|
|
+ this.title = '放行申请单';
|
|
|
+ // 生产放心单名称 = 模版名称+年月日+3位数
|
|
|
+ this.form.name = `${data.templateName}${new Date()
|
|
|
+ .toLocaleDateString()
|
|
|
+ .replace(/\//g, '')}${String(
|
|
|
+ Math.floor(Math.random() * 1000)
|
|
|
+ ).padStart(3, '0')}`;
|
|
|
+
|
|
|
+ this.form.templateId = data.templateId;
|
|
|
+ this.form.templateName = data.templateName;
|
|
|
+
|
|
|
+ // 根据模版id 查询模版详情
|
|
|
+ this.getTemplateDetails(data.templateId);
|
|
|
+ } else if (type == 'edit') {
|
|
|
+ this.title = '放行申请单';
|
|
|
+ } else if (type == 'detail') {
|
|
|
+ this.title = '放行单详情';
|
|
|
+ } else {
|
|
|
+ this.title = '审批';
|
|
|
+ }
|
|
|
+ this.visible = true;
|
|
|
+ },
|
|
|
+ // 关闭时清理表单
|
|
|
+ handleClose() {
|
|
|
+ this.visible = false;
|
|
|
+ this.form = JSON.parse(JSON.stringify(this.formBaseData));
|
|
|
+ this.$refs.formRef && this.$refs.formRef.resetFields();
|
|
|
+ },
|
|
|
+ // 提交
|
|
|
+ submit(type) {
|
|
|
+ console.log('this.form', this.form);
|
|
|
+ this.$refs.formRef.validate(async (valid, invalidFields) => {
|
|
|
+ if (valid) {
|
|
|
+ // 必须要有物品清单
|
|
|
+ if (this.form.orders.length == 0) {
|
|
|
+ this.$message.warning('请添加物品清单');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ this.butLoading = true;
|
|
|
+ try {
|
|
|
+ if (type == 'save') {
|
|
|
+ await checklistrecordSave(this.form);
|
|
|
+ } else {
|
|
|
+ }
|
|
|
+ this.$message.success('操作成功');
|
|
|
+ this.butLoading = false;
|
|
|
+ this.$emit('reload');
|
|
|
+ } catch (error) {
|
|
|
+ this.butLoading = false;
|
|
|
+ }
|
|
|
+ this.handleClose();
|
|
|
+ } else {
|
|
|
+ // 转换为数组
|
|
|
+ const firstErrorField = Object.values(invalidFields);
|
|
|
+ if (firstErrorField.length > 0) {
|
|
|
+ this.$message.warning(firstErrorField[0][0].message);
|
|
|
+ }
|
|
|
+
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 选择生产工单
|
|
|
+ openAddModel() {
|
|
|
+ this.$refs.selectWorkOrderRef?.open();
|
|
|
+ },
|
|
|
+ // 选择生产工单确认
|
|
|
+ selectWorkOrderConfirm(selection) {
|
|
|
+ const selectList = selection.map((i) => {
|
|
|
+ return {
|
|
|
+ batchNo: i.batchNo,
|
|
|
+ createUserName: i.createUserName,
|
|
|
+ formingNum: i.formingNum,
|
|
|
+ produceRoutingId: i.produceRoutingId,
|
|
|
+ produceRoutingName: i.produceRoutingName,
|
|
|
+ productCode: i.productCode,
|
|
|
+ productModel: i.productModel,
|
|
|
+ productName: i.productName,
|
|
|
+ recordId: i.recordId,
|
|
|
+ specification: i.specification,
|
|
|
+ workOrderCode: i.code,
|
|
|
+ workOrderId: i.id
|
|
|
+ };
|
|
|
+ });
|
|
|
+
|
|
|
+ console.log('selectList', selectList);
|
|
|
+ // 判断是否同一产品 同一批次
|
|
|
+ if (selectList.length != 0) {
|
|
|
+ const productCode = selectList[0].productCode;
|
|
|
+ const batchNo = selectList[0].batchNo;
|
|
|
+ const isSame = selectList.every(
|
|
|
+ (item) =>
|
|
|
+ item.productCode === productCode && item.batchNo === batchNo
|
|
|
+ );
|
|
|
+
|
|
|
+ const isSameOrders = this.form.orders.every(
|
|
|
+ (item) =>
|
|
|
+ item.productCode === productCode && item.batchNo === batchNo
|
|
|
+ );
|
|
|
+
|
|
|
+ if (!isSame || !isSameOrders) {
|
|
|
+ this.$message.warning('请选择同产品同批次号工单发起批量放行');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 去重
|
|
|
+ const existingWorkOrderIds = this.form.orders.map(
|
|
|
+ (order) => order.workOrderId
|
|
|
+ );
|
|
|
+ const newOrders = selectList.filter(
|
|
|
+ (item) => !existingWorkOrderIds.includes(item.workOrderId)
|
|
|
+ );
|
|
|
+ this.form.orders = [...this.form.orders, ...newOrders];
|
|
|
+ }
|
|
|
+ // 关闭弹窗
|
|
|
+ this.$refs.selectWorkOrderRef?.handleClose();
|
|
|
+ },
|
|
|
+ // 删除行
|
|
|
+ deleteRow(row) {
|
|
|
+ this.form.orders = this.form.orders.filter(
|
|
|
+ (item) => item.workOrderId !== row.workOrderId
|
|
|
+ );
|
|
|
+ },
|
|
|
+ async getTemplateDetails(id) {
|
|
|
+ this.loading = true;
|
|
|
+ try {
|
|
|
+ const data = await checklisttemplateGetById(id);
|
|
|
+ console.log('模板详情', data);
|
|
|
+ // 详情
|
|
|
+ this.form.details = data.details;
|
|
|
+
|
|
|
+ this.loading = false;
|
|
|
+ } catch (error) {
|
|
|
+ this.loading = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+</script>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+ .detail-table {
|
|
|
+ border: 1px solid #ebeef5;
|
|
|
+ // 实线边框
|
|
|
+ border-collapse: collapse;
|
|
|
+
|
|
|
+ td {
|
|
|
+ border: none;
|
|
|
+ padding: 10px 15px;
|
|
|
+ border: 1px solid #ebeef5;
|
|
|
+
|
|
|
+ &:first-child {
|
|
|
+ font-weight: 600;
|
|
|
+ background: #f5f7fa;
|
|
|
+ width: 130px;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+</style>
|