Browse Source

新增合格证和质检报告功能模块

yusheng 3 months ago
parent
commit
a9cdb91a13

+ 21 - 4
src/api/qms/index.js

@@ -1,8 +1,6 @@
 import request from '@/utils/request';
 
-
-
-export async function queryFactory () {
+export async function queryFactory() {
   const res = await request.get(`/qms/quality_work_order/queryFactory`);
   if (res.data.code == 0) {
     return res.data.data;
@@ -10,5 +8,24 @@ export async function queryFactory () {
   return Promise.reject(new Error(res.data.message));
 }
 
+//合格证
+export async function getCertificatetList(params) {
+  const res = await request.get(`/qms/qmscertificatemanagement/page`, {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 
-
+// 质检报告
+export async function getQualityReportApproval(params) {
+  const res = await request.get('/qms/quality_work_order/pageByReport', {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 392 - 0
src/views/batchRecord/components/tables/certificate.vue

@@ -0,0 +1,392 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <!-- 搜索表单 -->
+      <seekPage
+        :seekList="seekList"
+        :formLength="3"
+        @search="reload"
+      ></seekPage>
+
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        row-key="code"
+        :page-size="20"
+        @columns-change="handleColumnChange"
+        :cache-key="cacheKeyUrl"
+      >
+        <template v-slot:code="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="open(row, 'print')"
+            >{{ row.code }}</el-link
+          >
+        </template>
+        <template v-slot:type="{ row }">{{
+          getDictValue('质检计划类型', row.type)
+        }}</template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="open(row, 'print')"
+          >
+            打印
+          </el-link>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <ele-modal
+      title="合格证"
+      :visible.sync="QRvisible"
+      v-if="QRvisible"
+      width="90%"
+      append-to-body
+    >
+      <div id="printSection">
+        <component
+          :is="form.reportTemplateCode"
+          ref="template"
+          :key="form.reportTemplateCode"
+          v-if="!form.reportTemplateJson?.template"
+        ></component>
+        <div v-else v-html="form.reportTemplateJson?.template"> </div>
+      </div>
+
+      <div slot="footer">
+        <el-button @click="print">打印预览</el-button>
+
+        <el-button @click="QRvisible = false">关闭</el-button></div
+      >
+    </ele-modal>
+  </div>
+</template>
+
+<script>
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import dictMixins from '@/mixins/dictMixins';
+  import { getCertificatetList } from '@/api/qms/index.js';
+  import certificate_conformity_jangnan_template from './certificateTemplate/certificate_conformity_jangnan_template.vue';
+
+  export default {
+    mixins: [dictMixins, tabMixins],
+    components: {
+      certificate_conformity_jangnan_template
+    },
+    props: {
+      tableQuery: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      }
+    },
+    data() {
+      return {
+        cacheKeyUrl: 'qsm-c2e9664a-certificateManagement',
+
+        orderTypeList: [
+          {
+            id: 0,
+            label: '库存性订单'
+          },
+          {
+            id: 1,
+            label: '生产性订单'
+          },
+          {
+            id: 2,
+            label: '无客户生产性订单'
+          },
+          {
+            id: 4,
+            label: '不定向订单'
+          }
+        ],
+        form: {},
+        QRvisible: false,
+        // 表格列配置
+        columns: []
+      };
+    },
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '订单号:',
+            value: 'orderNo',
+            type: 'input',
+            placeholder: '请输入'
+          }
+        ];
+      }
+    },
+    created() {
+      this.requestDict('质检计划类型');
+      this.requestDict('取样类型');
+      this.setColumns();
+    },
+
+    methods: {
+      setColumns() {
+        this.columns = [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            slot: 'code',
+            label: '合格证号',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 130
+          },
+          {
+            prop: 'quantity',
+            label: '交验数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 100
+          },
+          {
+            prop: 'qualifiedQuantity',
+            label: '合格数量',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'type',
+            label: '类型',
+            slot: 'type',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'produceTaskName',
+            minWidth: 110,
+            label: '工序名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'produceTaskCode',
+            minWidth: 110,
+            label: '工序编号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            minWidth: 110,
+            label: '批次号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'orderNo',
+            label: '订单号',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 140
+          },
+          {
+            prop: 'luxuryProductCode',
+            minWidth: 110,
+            label: '顶级产品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'luxuryProductName',
+            minWidth: 110,
+            label: '顶级产品名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            minWidth: 110,
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productName',
+            minWidth: 110,
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          // {
+          //   prop: 'executeDeptName',
+          //   label: '下发数量',
+          //   showOverflowTooltip: true,
+          //   align: 'center',
+          //   minWidth: 110
+          // },
+
+          {
+            prop: 'executeUserName',
+            minWidth: 110,
+            label: '计量单位',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'processingType',
+            minWidth: 110,
+            label: '加工类型',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'workAme',
+            minWidth: 110,
+            label: '作业名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'contractor',
+            minWidth: 110,
+            label: '承制单位',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'orderType',
+            minWidth: 110,
+            label: '订单类型',
+            align: 'center',
+            formatter: (_row, _column, cellValue) => {
+              let obj = this.orderTypeList.find(
+                (el) => el.id == _row.orderType
+              );
+              return obj ? obj.label : '';
+            },
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'status',
+            minWidth: 110,
+            label: '状态',
+            align: 'center',
+            isNone: this.pageName == 'list',
+            formatter: (row) => {
+              return row.status == 0
+                ? '待提交'
+                : row.status == 1
+                ? '审核中'
+                : row.status == 2
+                ? '已审核'
+                : row.status == 3
+                ? '已作废'
+                : row.status == 4
+                ? '驳回'
+                : '撤回';
+            },
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createUserName',
+            minWidth: 110,
+            label: '创建人',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            minWidth: 110,
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'approvalUserName',
+            minWidth: 110,
+            label: '审批人',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'approvalTime',
+            minWidth: 110,
+            label: '审批时间',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 120,
+            align: 'center',
+            resizable: false,
+            isNone: this.type == 'add',
+            slot: 'action',
+            fixed: 'right',
+            showOverflowTooltip: true
+          }
+        ].filter((el) => !el.isNone);
+      },
+      /*回显类型 */
+
+      /* 表格数据源 */
+      datasource({ page, where, limit }) {
+        return getCertificatetList({
+          ...where,
+          pageNum: page,
+          size: limit,
+          ...this.tableQuery
+        });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$refs.table.reload({ page: 1, where: where });
+      },
+      print() {
+        const printSection = document.getElementById('printSection');
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<style>table { border-collapse: collapse; width: 100%; } td { border: 1px solid black; padding: 5px; text-align: center; }</style>'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      },
+      /* 打印 */
+      open(row) {
+        this.form = row;
+        this.QRvisible = true;
+        if (!row.reportTemplateJson.template) {
+          this.$nextTick(() => {
+            console.log(this.$refs,'this.$refs')
+            this.$refs.template.init(row);
+          });
+        }
+      }
+    }
+  };
+</script>

+ 147 - 0
src/views/batchRecord/components/tables/certificateTemplate/certificate_conformity_jangnan_template.vue

@@ -0,0 +1,147 @@
+<template>
+  <div
+    id="print"
+    style="
+      display: flex;
+      align-items: center;
+      justify-content: center;
+      flex-direction: column;
+    "
+  >
+    <div
+      style="
+        position: relative;
+        width: 100%;
+        display: flex;
+        flex-direction: column;
+        align-items: center;
+      "
+    >
+      <div
+        style="
+          font-size: 24px;
+          font-weight: 800;
+          text-align: center;
+          width: 100%;
+          margin-bottom: 10px;
+        "
+      >
+        半成品验收合格证
+      </div>
+
+      <div style="width: 100%; font-size: 14px; margin-bottom: 10px">
+        <span
+          style="
+            min-width: 65px;
+            border-bottom: 1px solid #000;
+            display: inline-block;
+            text-align: center;
+          "
+          >{{ form.contractor || ' ' }}</span
+        >
+        厂生产的下述半成品,经我们按产品图及技术条件要求验收合格,准予按序流转。
+      </div>
+
+      <div
+        style="
+          width: 100%;
+          font-size: 14px;
+          text-align: right;
+          margin-bottom: 10px;
+        "
+      >
+        {{ form.createTime }}
+      </div>
+    </div>
+
+    <table
+      cellspacing="0"
+      border
+      style="
+        width: 100%;
+        table-layout: fixed;
+        word-break: break-all;
+        word-wrap: break-word;
+        font-size: 12px;
+        border-collapse: collapse;
+      "
+    >
+      <thead>
+        <tr align="center">
+          <td style="padding: 5px">产品名称(代号)</td>
+          <td style="padding: 5px">半成品名称(代号)</td>
+          <td style="padding: 5px">批号</td>
+          <td style="padding: 5px">交验数</td>
+          <td style="padding: 5px">合格数</td>
+        </tr>
+      </thead>
+      <tbody>
+        <tr align="center" v-if="form?.productName">
+          <td style="padding: 5px">{{ form.luxuryProductName }}</td>
+          <td style="padding: 5px">{{ form.productName }}</td>
+          <td style="padding: 5px">{{ form.batchNo }}</td>
+          <td style="padding: 5px">{{ form.quantity }}</td>
+          <td style="padding: 5px">{{ form.qualifiedQuantity }}</td>
+        </tr>
+        <tr align="center">
+          <td style="padding: 5px"></td>
+          <td style="padding: 5px"></td>
+          <td style="padding: 5px"></td>
+          <td style="padding: 5px"></td>
+          <td style="padding: 5px">&nbsp;</td>
+        </tr>
+        <tr>
+          <td colspan="5" style="padding: 5px; text-align: left">
+            <div style="width: 100%; height: 100px">
+              重要记事:
+
+              <span v-if="type == 'print'"> {{ form.remark }}</span>
+            </div>
+          </td>
+        </tr>
+      </tbody>
+    </table>
+
+    <div
+      style="
+        width: 100%;
+        font-size: 14px;
+        margin-top: 10px;
+        display: flex;
+        justify-content: space-around;
+      "
+    >
+      <div>主管:{{ form.createUserName }}</div>
+      <div>验收者:{{ form.approvalUserName }}</div>
+    </div>
+  </div>
+</template>
+
+<script>
+  import { mapGetters } from 'vuex';
+  export default {
+    name: 'print',
+    computed: {
+      ...mapGetters(['user'])
+    },
+    props: {
+      type: String
+    },
+    data() {
+      return {
+        form: {}
+      };
+    },
+
+    methods: {
+      async init(row) {
+        this.form = row || {};
+      },
+      getValue() {
+        return this.form;
+      }
+    }
+  };
+</script>
+
+<style lang="scss"></style>

+ 271 - 0
src/views/batchRecord/components/tables/qualityReportApproval.vue

@@ -0,0 +1,271 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never">
+      <seek-page
+        :seekList="seekList"
+        @search="search"
+        ref="search"
+        :keyValue="'qms-inspectionReport-index-search'"
+      ></seek-page>
+
+      <ele-pro-table
+        ref="table"
+        :columns="columns"
+        :datasource="datasource"
+        :pageSize="20"
+        :pageSizes="[20, 30, 40, 50, 100]"
+        @columns-change="handleColumnChange"
+        :cache-key="cacheKeyUrl"
+        row-key="id"
+      >
+        <template v-slot:reportNumber="{ row }">
+          <el-link type="primary" :underline="false" @click="open(row)">{{
+            row.reportNumber
+          }}</el-link>
+        </template>
+
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="open(row, 'print')"
+          >
+            打印
+          </el-link></template
+        >
+      </ele-pro-table>
+    </el-card>
+    <ele-modal
+      title="质检报告"
+      :visible.sync="detailVisible"
+      v-if="detailVisible"
+      width="90%"
+      append-to-body
+    >
+      <div id="printSection">
+        <div v-html="template"> </div>
+      </div>
+
+      <div slot="footer">
+        <el-button @click="print">打印预览</el-button>
+
+        <el-button @click="detailVisible = false">关闭</el-button></div
+      >
+    </ele-modal>
+  </div>
+</template>
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import tabMixins from '@/mixins/tableColumnsMixin';
+  import { getQualityReportApproval } from '@/api/qms/index.js';
+
+  export default {
+    mixins: [dictMixins, tabMixins],
+    components: {},
+    props: {
+      tableQuery: {
+        type: Object,
+        default: () => {
+          return {};
+        }
+      }
+    },
+    data() {
+      return {
+        cacheKeyUrl: 'qsm-c2e9664a-inspectionReport-index',
+
+        detailVisible: false,
+        template: '',
+        columns: [
+          {
+            type: 'index',
+            columnKey: 'index',
+            align: 'center',
+            label: '序号',
+            width: 55,
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'reportNumber',
+            label: '报告编码',
+            slot: 'reportNumber',
+            align: 'center',
+            width: 180,
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '质检工单编码',
+            // slot: 'code',
+            align: 'center',
+            width: 180,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'productCode',
+            width: 120,
+            label: '产品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productName',
+            width: 120,
+            label: '产品名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            label: '创建时间',
+            prop: 'reportDate',
+            align: 'center',
+            width: 160
+          },
+          {
+            label: '创建人',
+            prop: 'reportTemplateCreateUserName',
+            align: 'center',
+            width: 160
+          },
+          {
+            label: '审批时间',
+            prop: 'reportApprovalTime',
+            align: 'center',
+            width: 160
+          },
+          {
+            label: '审批人',
+            prop: 'reportApprovalUserName',
+            align: 'center',
+            width: 160
+          },
+          {
+            prop: 'reportApprovalStatus',
+            label: '审批状态',
+            align: 'center',
+            width: 80,
+            formatter: (row, column, cellValue) => {
+              switch (cellValue) {
+                case 0:
+                  return '未提交';
+                case 1:
+                  return '审核中';
+                case 2:
+                  return '已审核';
+                case 3:
+                  return '审核不通过';
+                case 7:
+                  return '作废';
+                default:
+                  return '';
+              }
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            align: 'center',
+            width: 120,
+            resizable: false,
+            slot: 'action',
+            fixed: 'right'
+          }
+        ],
+        statusList: [
+          { value: 0, label: '未提交' },
+          { value: 1, label: '审核中' },
+          { value: 2, label: '已审核' },
+          { value: 3, label: '审核不通过' },
+          { value: 7, label: '作废' }
+        ]
+      };
+    },
+    created() {},
+    computed: {
+      seekList() {
+        return [
+          {
+            label: '报告编码:',
+            value: 'reportNumber',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '工单编码:',
+            value: 'code',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '工单名称:',
+            value: 'name',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '审批状态:',
+            value: 'reportApprovalStatus',
+            type: 'select',
+            placeholder: '',
+            planList: this.statusList
+          }
+        ];
+      }
+    },
+    methods: {
+      async datasource({ page, where, limit }) {
+        return getQualityReportApproval({
+          ...where,
+          pageNum: page,
+          ...this.tableQuery,
+          size: limit
+        });
+      },
+      search(where) {
+        this.$refs.table.reload({
+          where: where
+          // page: 1
+        });
+      },
+      print() {
+        const printSection = document.getElementById('printSection');
+        const printWindow = window.open('', '_blank');
+        printWindow.document.open();
+        printWindow.document.write('<html><head><title>打印预览</title>');
+        printWindow.document.write(
+          '<style>table { border-collapse: collapse; width: 100%; } td { border: 1px solid black; padding: 5px; text-align: center; }</style>'
+        );
+        printWindow.document.write('</head><body>');
+        printWindow.document.write(printSection.innerHTML);
+        printWindow.document.write('</body></html>');
+        printWindow.document.close();
+        printWindow.onload = function () {
+          printWindow.print();
+        };
+      },
+      /* 打印 */
+      open(row) {
+        this.template = row.reportTemplateJson.template;
+        this.detailVisible = true;
+      }
+    }
+  };
+</script>

+ 11 - 1
src/views/batchRecord/index.vue

@@ -204,6 +204,8 @@
   import deviceBatchRecordTable from './components/tables/deviceBatchRecordTable.vue';
   import craftFilesTable from './components/tables/craftFilesTable.vue';
   import qualityInspection from './components/tables/qualityInspection.vue';
+  import certificate from './components/tables/certificate.vue';
+  import qualityReportApproval from './components/tables/qualityReportApproval.vue';
 
   export default {
     components: {
@@ -217,7 +219,7 @@
       batchRecordTable,
       deviceBatchRecordTable,
       craftFilesTable,
-      qualityInspection
+      qualityInspection,certificate,qualityReportApproval
     },
     name: 'batchRecord',
     mixins: [dictMixins, tableColumnsMixin],
@@ -263,6 +265,14 @@
           {
             name: '首件两检',
             componentName: 'qualityInspection'
+          },
+          {
+            name: '质检报告',
+            componentName: 'qualityReportApproval'
+          },
+          {
+            name: '合格证',
+            componentName: 'certificate'
           }
         ],
         activeType: '生产工单',