695593266@qq.com 1 год назад
Родитель
Сommit
11ac427ca8

+ 137 - 0
src/api/inspectionWork/index.js

@@ -0,0 +1,137 @@
+import request from '@/utils/request';
+
+// 列表
+export async function getList(data) {
+  const res = data.parentId
+    ? await request.post(`/qms/line_point/page`)
+    : await request.post('/qms/quality_work_order/page', data);
+  console.log(res);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 新增
+export async function save(data) {
+  const res = await request.post(`/qms/quality_work_order/save`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 编辑
+export async function update(data) {
+  const res = await request.post(`/qms/quality_work_order/update`, data);
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+export async function getById(id) {
+  const res = await request.get(`/qms/quality_work_order/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 新增合格证
+export async function qualificationSave(data) {
+  const res = await request.post(`/qms/qualityWorkOrderCertificate/save`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 删除
+export async function removeItem(data) {
+  const res = await request.delete('/qms/quality_work_order/delete', {
+    data
+  });
+  if (res.data.code == 0) {
+    return res.data.message;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+//列表
+export async function parameterList(params) {
+  const res = await request.get('/main/produceparam/page', {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
+
+// 报工
+export async function exeReportWork(data) {
+  const res = await request.post(`/qms/quality_work_order/exeReportWork`, data);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+// 根据质检工单id获取清单列表
+export async function queryQualityInventory(data) {
+  const res = await request.post(
+    '/qms/quality_work_order/query_quality_inventory',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
+
+// 根据质检工单id获取质检样品列表
+export async function queryQualitySamplContent(data) {
+  const res = await request.post(
+    '/qms/quality_work_order/query_quality_sampl_content',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
+// 根据质检工单id获取方案内容
+export async function queryQualityTempleContent(data) {
+  const res = await request.post(
+    '/qms/quality_work_order/query_quality_temple_content',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
+// 仓库定义列表
+export async function warehouseList(data) {
+  const res = await request.post('/wms/warehouse/select/warehouseList', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
+
+//更新合格证号
+export async function updateCertificateNumber(data) {
+  const res = await request.post(
+    '/qms/quality_work_order/updateCertificateNumber',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}
+
+// 查询合格证
+export async function qualityWorkOrderCertificate(params) {
+  const res = await request.get('/qms/qualityWorkOrderCertificate/page', {
+    params
+  });
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+}

+ 13 - 4
src/api/login/index.js

@@ -4,7 +4,7 @@ import { setToken } from '@/utils/token-util';
 /**
  * 登录
  */
-export async function login (data) {
+export async function login(data) {
   const res = await request.post('/main/user/login', data);
   if (res.data.code == 0) {
     setToken(res.data.data.token, data.remember);
@@ -15,7 +15,7 @@ export async function login (data) {
 /**
  * 获取用户信息
  */
-export async function getLoginUser (data) {
+export async function getLoginUser(data) {
   const res = await request.get('/system/account/getLoginUser', data);
   if (res.data.code == 0) {
     return res.data.data;
@@ -23,10 +23,19 @@ export async function getLoginUser (data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+//生成编码
+export async function getCode(code) {
+  const res = await request.get(`/main/codemanage/getCode/` + code, {});
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 获取验证码
  */
-export async function getCaptcha () {
+export async function getCaptcha() {
   const res = await request.get('/captcha');
   if (res.data.code === 0) {
     return res.data.data;
@@ -37,7 +46,7 @@ export async function getCaptcha () {
  * 获取当前登陆用户数据权限部门数据
  * @param
  */
-export async function getCurrentUserAuthorityDeptAPI () {
+export async function getCurrentUserAuthorityDeptAPI() {
   const res = await request.post('/main/user/getCurrentUserAuthorityDepts');
   if (res.data.code == 0) {
     return res.data.data;

+ 54 - 38
src/views/produce/components/inspection/components/packingTgBom.vue

@@ -38,6 +38,7 @@
         </template>
       </el-table-column>
 
+
       <el-table-column label="型号" prop="modelType">
         <template slot-scope="{ row, $index }">
           {{ row.modelType }}
@@ -56,7 +57,11 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="刻码" prop="engrave"   v-if="item.singleReport == 1">
+      <el-table-column
+        label="刻码"
+        prop="engrave"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           <span v-if="isDetails"> {{ row.extInfo.engrave }}</span>
           <el-input
@@ -66,11 +71,14 @@
             v-model="row.extInfo.engrave"
             placeholder="请输入物料代号"
           />
-
         </template>
       </el-table-column>
 
-      <el-table-column label="物料代号" prop="materielCode"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="物料代号"
+        prop="materielCode"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           <span v-if="isDetails"> {{ row.extInfo.materielCode }}</span>
           <el-input
@@ -83,7 +91,11 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="客户代号" prop="clientCode"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="客户代号"
+        prop="clientCode"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           <span v-if="isDetails"> {{ row.extInfo.clientCode }}</span>
           <el-input
@@ -96,58 +108,67 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="位置" width="110" prop="feedQuantity"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="位置"
+        width="110"
+        prop="feedQuantity"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           {{ row.extInfo.position }}
         </template>
       </el-table-column>
 
-
-
       <el-table-column label="工序重量" prop="newWeight">
         <template slot-scope="{ row, $index }">
-          <span> {{ row.extInfo.newWeight }}  {{ row.extInfo.weightUnit }} </span>
+          <span>
+            {{ row.extInfo.newWeight }} {{ row.extInfo.weightUnit }}
+          </span>
         </template>
       </el-table-column>
 
-      
       <el-table-column label="打包类型" prop="" v-if="item.singleReport == 0">
         <template slot-scope="{ row, $index }">
-          <span style="color:#157A2C;"> 批量打包 </span>
+          <span style="color: #157a2c"> 批量打包 </span>
         </template>
       </el-table-column>
 
-      <el-table-column label="打包数量" prop="feedQuantity" width="200"  v-if="item.singleReport == 0">
+      <el-table-column
+        label="打包数量"
+        prop="feedQuantity"
+        width="200"
+        v-if="item.singleReport == 0"
+      >
         <template slot-scope="{ row, $index }">
-       <div v-if="!isWarehousing">
-        <el-input
-            size="mini"
-            class="content_num"
-            v-model="row.feedQuantity"
-            :disabled="isDetails"
-          />
-       </div>
-
-       <div v-if="isWarehousing">
-        <div style="color:#157A2C;"	>{{row.feedQuantity }}</div>
-        </div>
+          <div v-if="!isWarehousing">
+            <el-input
+              size="mini"
+              class="content_num"
+              v-model="row.feedQuantity"
+              :disabled="isDetails"
+            />
+          </div>
+
+          <div v-if="isWarehousing">
+            <div style="color: #157a2c">{{ row.feedQuantity }}</div>
+          </div>
         </template>
       </el-table-column>
 
-
-
-      
-
-      <el-table-column label="处置" prop=""  v-if="item.singleReport == 1">
+      <el-table-column label="处置" prop="" v-if="item.singleReport == 1">
         <template slot-scope="{ row, $index }">
           <span>入库 </span>
         </template>
       </el-table-column>
 
-
-      <el-table-column label="发货(包装)码" prop="" width="200"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="发货(包装)码"
+        prop=""
+        width="200"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
-            <el-input
+          <el-input
             size="mini"
             class="content_num"
             v-model="row.sendCode"
@@ -156,8 +177,6 @@
           />
         </template>
       </el-table-column>
-
-
     </el-table>
   </div>
 </template>
@@ -182,9 +201,7 @@
       isWarehousing: {
         type: Boolean,
         default: false
-      },
-
-   
+      }
     },
 
     data() {
@@ -197,8 +214,7 @@
 </script>
 
 <style lang="scss" scoped>
-
-.content_num {
+  .content_num {
     display: flex;
     align-items: center;
     padding: 2px;

+ 98 - 39
src/views/produce/components/jobBooking/components/packingTgBom.vue

@@ -37,9 +37,47 @@
           {{ row.name }}
         </template>
       </el-table-column>
+      <el-table-column
+        label="颜色"
+        prop="colour"
+        minWidth="110"
+        v-if="clientEnvironmentId == '21'"
+      >
+        <template slot-scope="{ row, $index }">
+          <el-input
+            v-model="row.colour"
+            size="mini"
+            class="content_num"
+            style="width: 100%"
+          ></el-input>
+        </template>
+      </el-table-column>
+
+      <el-table-column
+        label="车辆编码"
+        prop="carCode"
+        minWidth="130"
+        v-if="clientEnvironmentId == '21'"
+      >
+        <template slot-scope="{ row, $index }">
+          <el-input
+            v-model="row.carCode"
+            size="mini"
+            class="content_num"
+            style="width: 100%"
+          ></el-input>
+        </template>
+      </el-table-column>
+
       <el-table-column label="批次号" prop="batchNo" minWidth="90">
         <template slot-scope="{ row, $index }">
-          <el-input v-model="row.batchNo" size="mini" class="content_num" :disabled="isDetails" style="width: 100%"></el-input>
+          <el-input
+            v-model="row.batchNo"
+            size="mini"
+            class="content_num"
+            :disabled="isDetails"
+            style="width: 100%"
+          ></el-input>
         </template>
       </el-table-column>
 
@@ -61,7 +99,11 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="刻码" prop="engrave"   v-if="item.singleReport == 1">
+      <el-table-column
+        label="刻码"
+        prop="engrave"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           <span v-if="isDetails"> {{ row.extInfo.engrave }}</span>
           <el-input
@@ -71,11 +113,14 @@
             v-model="row.extInfo.engrave"
             placeholder="请输入物料代号"
           />
-
         </template>
       </el-table-column>
 
-      <el-table-column label="物料代号" prop="materielCode"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="物料代号"
+        prop="materielCode"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           <span v-if="isDetails"> {{ row.extInfo.materielCode }}</span>
           <el-input
@@ -88,7 +133,11 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="客户代号" prop="clientCode"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="客户代号"
+        prop="clientCode"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           <span v-if="isDetails"> {{ row.extInfo.clientCode }}</span>
           <el-input
@@ -101,58 +150,67 @@
         </template>
       </el-table-column>
 
-      <el-table-column label="位置" width="110" prop="feedQuantity"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="位置"
+        width="110"
+        prop="feedQuantity"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
           {{ row.extInfo.position }}
         </template>
       </el-table-column>
 
-
-
       <el-table-column label="工序重量" prop="newWeight">
         <template slot-scope="{ row, $index }">
-          <span> {{ row.extInfo.newWeight }}  {{ row.extInfo.weightUnit }} </span>
+          <span>
+            {{ row.extInfo.newWeight }} {{ row.extInfo.weightUnit }}
+          </span>
         </template>
       </el-table-column>
 
-      
       <el-table-column label="打包类型" prop="" v-if="item.singleReport == 0">
         <template slot-scope="{ row, $index }">
-          <span style="color:#157A2C;"> 批量打包 </span>
+          <span style="color: #157a2c"> 批量打包 </span>
         </template>
       </el-table-column>
 
-      <el-table-column label="打包数量" prop="feedQuantity" width="200"  v-if="item.singleReport == 0">
+      <el-table-column
+        label="打包数量"
+        prop="feedQuantity"
+        width="200"
+        v-if="item.singleReport == 0"
+      >
         <template slot-scope="{ row, $index }">
-       <div v-if="!isWarehousing">
-        <el-input
-            size="mini"
-            class="content_num"
-            v-model="row.feedQuantity"
-            :disabled="isDetails"
-          />
-       </div>
-
-       <div v-if="isWarehousing">
-        <div style="color:#157A2C;"	>{{row.feedQuantity }}</div>
-        </div>
+          <div v-if="!isWarehousing">
+            <el-input
+              size="mini"
+              class="content_num"
+              v-model="row.feedQuantity"
+              :disabled="isDetails"
+            />
+          </div>
+
+          <div v-if="isWarehousing">
+            <div style="color: #157a2c">{{ row.feedQuantity }}</div>
+          </div>
         </template>
       </el-table-column>
 
-
-
-      
-
-      <el-table-column label="处置" prop=""  v-if="item.singleReport == 1">
+      <el-table-column label="处置" prop="" v-if="item.singleReport == 1">
         <template slot-scope="{ row, $index }">
           <span>入库 </span>
         </template>
       </el-table-column>
 
-
-      <el-table-column label="发货(包装)码" prop="" width="200"  v-if="item.singleReport == 1">
+      <el-table-column
+        label="发货(包装)码"
+        prop=""
+        width="200"
+        v-if="item.singleReport == 1"
+      >
         <template slot-scope="{ row, $index }">
-            <el-input
+          <el-input
             size="mini"
             class="content_num"
             v-model="row.sendCode"
@@ -161,8 +219,6 @@
           />
         </template>
       </el-table-column>
-
-
     </el-table>
   </div>
 </template>
@@ -187,23 +243,26 @@
       isWarehousing: {
         type: Boolean,
         default: false
-      },
-
-   
+      }
     },
 
     data() {
       return {};
     },
 
+    computed: {
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
+    },
+
     components: {},
     methods: {}
   };
 </script>
 
 <style lang="scss" scoped>
-
-.content_num {
+  .content_num {
     display: flex;
     align-items: center;
     padding: 2px;

+ 418 - 0
src/views/produce/components/new_produceOrder.vue

@@ -0,0 +1,418 @@
+<template>
+  <div>
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      height="calc(100vh - 280px)"
+      width="100%"
+      :datasource="datasource"
+      :selection.sync="selection"
+      @selection-change="handleSelectionChange"
+      @cell-click="cellClick"
+      highlight-current-row
+      @select="cellClick"
+      :need-page="false"
+      @sort-change="onSortChange"
+      @columns-change="handleColumnChange"
+      :cache-key="cacheKeyUrl"
+    >
+      <!-- <template v-slot:toolbar>
+        <div class="rx-bc">
+          <div class="c_title">工单列表 </div>
+
+          <div>
+            <el-input
+              style="width: 180px"
+              clearable
+              v-model="code"
+              placeholder="请输入工单号"
+            />
+            <el-button  size="mini" type="primary" style="margin: 0 5px" @click="handleSearch">查询</el-button>
+          </div>
+        </div>
+      </template> -->
+
+      <template v-slot:code="{ row }">
+        <el-link type="primary" @click="handRoute(row)" :underline="false">{{
+          row.code
+        }}</el-link>
+      </template>
+
+      <template v-slot:singleReport="{ row }">
+        <el-tag size="mini">
+          {{ row.singleReport == 1 ? '单个报工' : '批量报工' }}</el-tag
+        >
+      </template>
+
+      <template v-slot:taskName="{ row }">
+        <span> {{ row.taskName }}</span>
+      </template>
+
+      <template v-slot:status="{ row }">
+        <span> {{ sumStatus(row) }}</span>
+      </template>
+
+      <template v-slot:formingNum="{ row }">
+        <span> {{ row.formingNum }} {{ row.unit }} </span>
+      </template>
+
+      <template v-slot:formingWeight="{ row }">
+        <span> {{ row.formingWeight }} {{ row.weightUnit }} </span>
+      </template>
+    </ele-pro-table>
+
+    <!-- //工单列表 -->
+    <routings
+      v-if="routingShow"
+      :routeObj="routeObj"
+      @closeRoute="closeRoute"
+    ></routings>
+  </div>
+</template>
+
+<script>
+  import { workorderPage2 } from '@/api/produce/workOrder.js';
+  import routings from './routings.vue';
+  import { isFullscreen } from 'ele-admin';
+  import tableColumnsMixin from '@/mixins/tableColumnsMixin';
+  import {
+    getList,
+    removeItem,
+    updateCertificateNumber
+  } from '@/api/inspectionWork';
+  export default {
+    components: { routings },
+    mixins: [tableColumnsMixin],
+    data() {
+      return {
+        loading: false,
+        selection: [],
+
+        routeObj: {},
+        routingShow: false,
+
+        code: '',
+
+        internalIsFullscreen: isFullscreen(), // 初始值
+        cacheKeyUrl: 'mes-145878-mes-produce',
+        columnsVersion: 0
+      };
+    },
+    computed: {
+      // 表格列配置
+      columns() {
+        this.columnsVersion++;
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: true
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center'
+          },
+
+          {
+            prop: 'code',
+            slot: 'code',
+            label: '生产工单号',
+            align: 'center',
+            minWidth: '160'
+          },
+
+          {
+            prop: 'productCode',
+            label: '编码',
+            align: 'center',
+            minWidth: '160',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productName',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'singleReport',
+            slot: 'singleReport',
+            label: '报工类型',
+            align: 'center',
+            filters: [
+              { text: '单个报工', value: 1 },
+              { text: '批量报工', value: 0 }
+            ],
+            filterMethod: this.filterMethod,
+            width: 100
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productionCodes',
+            label: '生产编号',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120
+          },
+
+          {
+            prop: 'formingNum',
+            label: '要求生产数量',
+            align: 'center',
+            slot: 'formingNum',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formingWeight',
+            label: '要求生产重量',
+            slot: 'formingWeight',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formedNum',
+            label: '已生产数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formedWeight',
+            label: '已生产重量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          {
+            slot: 'taskName',
+            prop: 'taskName',
+            label: '工序进度',
+            align: 'center',
+            showOverflowTooltip: true,
+            sortable: 'custom',
+            minWidth: 110
+          },
+          {
+            slot: 'status',
+            prop: 'status',
+            label: '最新工单状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          {
+            prop: 'planStartTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'planCompleteTime',
+            label: '计划结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'startTime',
+            label: '实际开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          }
+        ];
+      },
+
+      taskObj() {
+        return this.$store.state.user.taskObj;
+      },
+      current() {
+        console.log(this.$store.state.user, 'this.$store.state.user');
+
+        return this.$store.state.user.currentObj.id;
+      }
+    },
+
+    watch: {
+      taskObj: {
+        handler(val) {
+          this.reload();
+        },
+        // immediate: true,
+        deep: true
+      },
+      current: {
+        handler(val) {
+          this.reload();
+        },
+        // immediate: true,
+        deep: true
+      }
+    },
+    created() {},
+
+    mounted() {
+      // 添加窗口resize事件监听器
+      window.addEventListener('resize', this.handleResize);
+    },
+
+    beforeDestroy() {
+      // 组件销毁前移除事件监听器,防止内存泄漏
+      window.removeEventListener('resize', this.handleResize);
+    },
+    methods: {
+      filterMethod(value, row, column) {
+        if (value == row.singleReport) {
+          return row;
+        }
+      },
+      sumStatus(row) {
+        if (row.reportStatus === 1) {
+          return '已报工';
+        }
+        if (row.feedStatus === 1) {
+          return '已投料';
+        }
+        // {{  row.reportStatus }}  {{  row.feedStatus }}
+      },
+
+      /* 表格数据源 */
+      datasource({ page, where }) {
+        if (!this.taskObj?.id) {
+          return [];
+        }
+
+        console.log(this.taskObj?.id);
+        if (this.taskObj?.id == '1916800744740663298') {
+          return getList({
+            pageNum: page,
+            size: 1000
+          });
+        } else {
+          return workorderPage2({
+            pageNum: page,
+            size: 1000,
+            workOrderId: this.$route.query.workOrderId
+              ? this.$route.query.workOrderId
+              : null,
+            taskId: this.taskObj && this.taskObj.id,
+            deviceId: this.current && this.current.deviceId,
+            keyWord: this.keyWord,
+            taskName: this.taskName,
+            ...where
+          });
+        }
+      },
+
+      onSortChange(e) {
+        console.log(e);
+        let sort = {
+          orderBy: e.order,
+          sortName: e.prop
+        };
+        this.where = sort;
+        this.reload();
+      },
+      handleSearch(obj) {
+        this.keyWord = obj.keyWord;
+        this.taskName = obj.taskName;
+        this.reload();
+      },
+
+      /* 刷新表格 */
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+
+      handleSelectionChange(val) {
+        let initReportValue = val[0] && val[0].singleReport;
+        let allSame = true;
+
+        val.forEach((item) => {
+          if (item.singleReport !== initReportValue) {
+            allSame = false;
+          }
+        });
+
+        if (!allSame) {
+          return this.$message.warning('请选择报工类型相同的工单');
+        }
+
+        let ids = [];
+        ids = val.map((item) => {
+          return item.id;
+        });
+        this.$emit('workSelect', { ids: ids, list: val });
+      },
+
+      rowClick(e) {
+        this.$emit('rowClick', e, this.taskObj.id);
+      },
+      cellClick() {
+        this.$nextTick(() => {
+          this.$emit('getTaskName', this.selection);
+        });
+      },
+
+      handRoute(row) {
+        this.routeObj = row;
+        this.routingShow = true;
+      },
+
+      closeRoute() {
+        this.routingShow = false;
+      },
+
+      handleResize() {
+        this.internalIsFullscreen = isFullscreen();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 216 - 0
src/views/produce/components/workPlan/components/Certificate.vue

@@ -0,0 +1,216 @@
+<template>
+  <ele-modal
+    custom-class="ele-dialog-form long-dialog-form"
+    :centered="true"
+    :visible.sync="addOpen"
+    title="合格证"
+    :close-on-click-modal="false"
+    width="85%"
+    :maxable="true"
+    append-to-body
+    @close="handleClose"
+  >
+    <el-form ref="certificateForm" :model="form" class="certificate_form">
+      <ele-pro-table
+        :columns="columns"
+        :datasource="form.tableList"
+        ref="table"
+        :need-page="false"
+        class="el-form-box"
+        :toolkit="[]"
+      >
+        <template v-slot:toolbar>
+          <el-button :loading="loading" type="primary" @click="addBank"
+            >添加</el-button
+          >
+        </template>
+        <template v-slot:headerNumber="{ column }">
+          <span class="is-required">{{ column.label }}</span>
+        </template>
+        <template v-slot:certificateNumber="{ row, $index }">
+          <el-form-item
+            :prop="`tableList.${$index}.certificateNumber`"
+            :rules="{
+              required: true,
+              message: '请输入合格证号',
+              trigger: 'change'
+            }"
+          >
+            <el-input
+              v-model="row.certificateNumber"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:remark="{ row }">
+          <el-form-item>
+            <el-input v-model="row.remark" placeholder="请输入"></el-input>
+          </el-form-item>
+        </template>
+        <template v-slot:certificateAttachments="{ row }">
+          <fileMain v-model="row.certificateAttachments"></fileMain>
+        </template>
+        <template v-slot:action="{ $index }">
+          <el-popconfirm
+            class="ele-action"
+            title="确定要删除当前数据吗?"
+            @confirm="delSon($index)"
+          >
+            <template v-slot:reference>
+              <el-link type="danger" :underline="false" icon="el-icon-delete"
+                >删除</el-link
+              >
+            </template>
+          </el-popconfirm>
+        </template>
+      </ele-pro-table>
+    </el-form>
+    <div slot="footer" class="footer">
+      <el-button type="primary" @click="submitAdd">保存</el-button>
+      <el-button @click="handleClose">返回</el-button>
+    </div>
+  </ele-modal>
+</template>
+
+<script>
+  // import {
+  //   updateCertificateNumber,
+  //   qualityWorkOrderCertificate
+  // } from '@/api/inspectionWork';
+  // import fileMain from '@/components/addDoc/index.vue';
+  export default {
+    data() {
+      return {
+        form: {
+          tableList: [],
+          loading: false
+        }
+      };
+    },
+    components: { fileMain },
+    props: {
+      addOpen: {
+        type: Boolean,
+        default: false
+      },
+      rowData: {
+        type: Object,
+        default: () => {}
+      }
+    },
+    computed: {
+      columns() {
+        return [
+          {
+            type: 'index',
+            label: '序号',
+            align: 'center',
+            width: 60
+          },
+          {
+            label: '合格证号',
+            prop: 'certificateNumber',
+            slot: 'certificateNumber',
+            headerSlot: 'headerNumber',
+            align: 'center',
+            width: 250
+          },
+          {
+            prop: 'remark',
+            slot: 'remark',
+            label: '备注',
+            align: 'center'
+          },
+          {
+            prop: 'certificateAttachments',
+            slot: 'certificateAttachments',
+            label: '合格证附件',
+            align: 'center',
+            width: 120
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action'
+          }
+        ];
+      }
+    },
+    mounted() {
+      this.getList();
+    },
+    methods: {
+      handleClose() {
+        this.$emit('closeModel');
+      },
+      getList() {
+        let params = {
+          pageNum: 1,
+          qualityWorkOrderId: this.rowData.id,
+          size: 1000
+        };
+        this.loading = true;
+        qualityWorkOrderCertificate(params)
+          .then((res) => {
+            this.loading = false;
+            if (res.list.length > 0) {
+              this.form.tableList = res.list;
+            }
+          })
+          .catch((err) => {
+            this.loading = true;
+          });
+      },
+      addBank() {
+        this.form.tableList.push({
+          certificateNumber: '',
+          remark: ''
+        });
+      },
+      delSon(index) {
+        this.form.tableList.splice(index, 1);
+      },
+      submitAdd() {
+        if (this.form.tableList.length == 0) {
+          return this.$message.warning('至少需要保留一条数据');
+        }
+        this.$refs.certificateForm.validate((valid) => {
+          if (valid) {
+            let certificates = this.form.tableList.map((el) => {
+              return {
+                ...el,
+                qualityWorkOrderCode: this.rowData.code,
+                qualityWorkOrderId: this.rowData.id,
+                qualityWorkOrderName: this.rowData.name
+              };
+            });
+            let data = {
+              certificates,
+              id: this.rowData.id
+            };
+            updateCertificateNumber(data).then((res) => {
+              if (res) {
+                this.$message.success('操作成功');
+                this.handleClose();
+                this.$emit('search');
+              }
+            });
+          }
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .certificate_form {
+    min-height: 500px;
+
+    :deep(.el-form-item) {
+      margin: 16px 0;
+    }
+  }</style
+>>

+ 227 - 0
src/views/produce/components/workPlan/components/EquipmentDialog.vue

@@ -0,0 +1,227 @@
+<template>
+  <el-dialog
+    title="选择"
+    :visible.sync="equipmentdialog"
+    :before-close="handleClose"
+    :close-on-click-modal="true"
+    :close-on-press-escape="false"
+    append-to-body
+    width="60%"
+    @onDone="onDone"
+  >
+    <div>
+      <el-row>
+        <el-col :span="24" class="topsearch">
+          <el-form>
+            <el-row>
+              <el-col :span="6">
+                <el-input
+                  v-model="code"
+                  placeholder="请输入编码"
+                  size="small"
+                ></el-input>
+              </el-col>
+              <el-col :span="6" style="margin-left: 10px">
+                <el-button type="primary" size="small" @click="reload"
+                  >搜索</el-button
+                >
+                <el-button size="small" @click="reset">重置</el-button>
+              </el-col>
+            </el-row>
+          </el-form>
+        </el-col>
+        <el-col :span="6" class="tree_col">
+          <AssetTree
+            @handleNodeClick="handleNodeClick"
+            :treeIds="treeIds"
+            :paramsType="'type'"
+            ref="treeList"
+          />
+        </el-col>
+        <el-col :span="18" class="table_col" v-if="equipmentdialog">
+          <ele-pro-table
+            ref="equiTable"
+            :columns="columns"
+            :datasource="datasource"
+            :selection.sync="selection"
+            :current.sync="current"
+            highlight-current-row
+            cache-key="systemRoleTable3"
+            row-key="id"
+            height="50vh"
+          >
+          </ele-pro-table>
+        </el-col>
+      </el-row>
+    </div>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import AssetTree from '@/components/AssetTree/index.vue';
+  import { getList } from '@/api/classifyManage';
+  export default {
+    components: {
+      AssetTree
+    },
+    props: {
+      selectList: Array,
+      type: {
+        default: 2 //1多选 2单选
+      },
+      isAll: {
+        default: false
+      },
+      treeIds: {
+        default: () => {
+          return ['9'];
+        }
+      }
+    },
+    data() {
+      return {
+        equipmentdialog: false,
+        current: null,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true,
+            show: this.type == 1
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'code',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'code'
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          }
+        ],
+        tableList: [],
+        categoryLevelId: null,
+        code: null,
+        selection: [],
+        ids: []
+      };
+    },
+
+    watch: {},
+    methods: {
+      async datasource({ page, limit }) {
+        const params = {
+          code: this.code,
+          pageNum: page,
+          size: limit,
+          categoryLevelId: this.categoryLevelId,
+          isProduct: true
+        };
+        const data = await getList(params);
+        this.tableList = data.list;
+        return data;
+      },
+      open(ids) {
+        this.equipmentdialog = true;
+        if (ids) {
+          this.ids = ids;
+        }
+      },
+      handleNodeClick(data) {
+        this.categoryLevelId = data.id;
+        this.reload();
+      },
+      reload() {
+        this.$refs.equiTable.reload();
+      },
+      handleClose() {
+        this.equipmentdialog = false;
+        this.code = '';
+        this.$refs.equiTable.clearSelection();
+      },
+      reset() {
+        this.code = null;
+        this.reload();
+      },
+      onDone() {
+        this.$nextTick(() => {
+          this.$refs.equiTable.setSelectedRowKeys(this.ids);
+        });
+      },
+      // 选择
+      selected() {
+        let list = this.type == 1 ? this.selection : [this.current];
+        this.$emit('choose', JSON.parse(JSON.stringify(list)));
+        this.handleClose();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .tree_col {
+    border: 1px solid #eee;
+    padding: 10px 0;
+    box-sizing: border-box;
+    max-height: 530px;
+    overflow: auto;
+  }
+  .table_col {
+    padding-left: 10px;
+    ::v-deep .el-table th.el-table__cell {
+      background: #f2f2f2;
+    }
+  }
+  .pagination {
+    text-align: right;
+    padding: 10px 0;
+  }
+  .btns {
+    text-align: center;
+    padding: 10px 0;
+  }
+  .topsearch {
+    margin-bottom: 15px;
+  }
+</style>

+ 186 - 0
src/views/produce/components/workPlan/components/ProductionVersion.vue

@@ -0,0 +1,186 @@
+<template>
+  <el-dialog title="选择工艺路线" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="true"
+    :close-on-press-escape="false" append-to-body width="80%">
+    <el-card shadow="never">
+
+      <ele-pro-table ref="table" :columns="columns" :datasource="datasource" height="calc(100vh - 350px)"
+        class="dict-table" @cell-click="cellClick">
+        <!-- 表头工具栏 -->
+
+        
+
+        <template v-slot:status="{ row }">
+          {{ checkStatus(row) }}
+        </template>
+
+        <template v-slot:action="{ row }">
+          <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
+        </template>
+      </ele-pro-table>
+
+    </el-card>
+    <div class="btns">
+      <el-button type="primary" size="small" @click="selected">选择</el-button>
+      <el-button size="small" @click="handleClose">关闭</el-button>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+
+
+import { routeList } from '@/api/aps';
+// import productionSearch from './production-search.vue'
+export default {
+  components: { 
+    // productionSearch
+    },
+  data() {
+    return {
+      visible: false,
+      // 表格列配置
+      columns: [
+        {
+          prop: 'code',
+          label: '工艺路线组编码',
+          // sortable: 'custom',
+          showOverflowTooltip: true,
+          align: 'center',
+
+          minWidth: 110
+        },
+        {
+          prop: 'name',
+          label: '工艺路线名称',
+          showOverflowTooltip: true,
+          align: 'center',
+          minWidth: 110
+        },
+
+
+        {
+          prop: 'version',
+          label: '工艺路线版本',
+          align: 'center',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          prop: 'produceVersionName',
+          label: '生产版本',
+          align: 'center',
+          showOverflowTooltip: true
+        },
+
+        {
+          prop: 'status',
+          label: '状态',
+          align: 'center',
+          slot: 'status',
+          showOverflowTooltip: true,
+          minWidth: 110
+        },
+
+        {
+          action: 'action',
+          slot: 'action',
+          align: 'center',
+          label: '选择'
+        }
+      ],
+      statusList: [
+        { label: '草稿', value: -1 },
+        { label: '失效', value: 0 },
+        { label: '生效', value: 1 }
+      ],
+      categoryLevelId: '9',
+      radio: null
+    }
+  },
+
+  watch: {
+
+  },
+  methods: {
+
+    checkStatus(row) {
+      let obj = this.statusList.find((it) => it.value == row.status);
+      return obj.label;
+    },
+    /* 表格数据源 */
+    datasource({ page, where, limit }) {
+      return routeList({
+        ...where,
+        pageNum: page,
+        size: limit,
+  
+      });
+    },
+
+    /* 刷新表格 */
+    reload(where) {
+      this.$refs.table.reload({ page: 1, where: where });
+    },
+    open(item) {
+      if (item) {
+        this.current = {
+          id: item.id,
+          name: item.name,
+        }
+        this.radio = item.id
+      }
+      this.visible = true
+    },
+    // 单击获取id
+    cellClick (row) {
+        this.current = row
+        this.radio = row.id
+    },
+
+    handleClose() {
+      this.visible = false
+ 
+    },
+    selected() {
+      if (!this.current) {
+        return this.$message.warning('请选择工艺路线')
+      }
+      this.$emit('changeProduct', this.current)
+      this.handleClose()
+    },
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.tree_col {
+  border: 1px solid #eee;
+  padding: 10px 0;
+  box-sizing: border-box;
+  height: 500px;
+  overflow: auto;
+}
+
+.table_col {
+  padding-left: 10px;
+
+  ::v-deep .el-table th.el-table__cell {
+    background: #f2f2f2;
+  }
+}
+
+.pagination {
+  text-align: right;
+  padding: 10px 0;
+}
+
+.btns {
+  text-align: center;
+  padding: 10px 0;
+}
+
+.topsearch {
+  margin-bottom: 15px;
+}
+</style>

+ 887 - 0
src/views/produce/components/workPlan/components/QualityContentTabs.vue

@@ -0,0 +1,887 @@
+<template>
+  <el-row>
+    <header-title title="质检内容">
+      <el-button
+        type="primary"
+        :loading="loading"
+        v-if="type != 'detail'"
+        @click="$emit('batch-quality')"
+        >批量质检</el-button
+      >
+      <el-button
+        type="primary"
+        :loading="loading"
+        v-if="type != 'detail'"
+        @click="$emit('batch-dispose')"
+        >批量处置</el-button
+      >
+    </header-title>
+
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+      <!--  -->
+      <el-tab-pane label="来源清单" name="1">
+        <ele-pro-table
+          ref="sourceTable"
+          :columns="tableColumns1"
+          :datasource="datasource"
+          @selection-change="handleSelectionChange"
+          :initLoad="false"
+          :pagination="true"
+        >
+          <template
+            v-slot:toolbar
+            v-if="
+              form.qualityMode == 2 && form.qualityType == 2 && type != 'detail'
+            "
+          >
+            <el-dropdown trigger="click" @command="handleSampleNumber">
+              <el-link type="primary" icon="el-icon-plus">取样</el-link>
+              <el-dropdown-menu slot="dropdown">
+                <el-dropdown-item command="1">取整样</el-dropdown-item>
+                <el-dropdown-item command="2">取小样</el-dropdown-item>
+              </el-dropdown-menu>
+            </el-dropdown>
+          </template>
+          <template
+            v-slot:toolkit
+            v-if="form.qualityMode == 2 && form.qualityType == 2"
+          >
+            <el-row>
+              <el-form
+                ref="ruleForm"
+                :model="formData"
+                label-width="60px"
+                size="mini"
+                :rules="rules"
+                class="flex"
+                :show-message="false"
+              >
+                <el-col :span="6" v-if="conditionType == 2">
+                  <el-form-item
+                    prop="number"
+                    label-width="0"
+                    style="margin-bottom: 0"
+                  >
+                    <el-input
+                      v-model="formData.number"
+                      placeholder="请输入"
+                      size="mini"
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="6" v-if="conditionType == 2">
+                  <el-form-item
+                    prop="sampleUnit"
+                    label-width="0"
+                    style="margin: 0"
+                  >
+                    <DictSelection
+                      dictName="计量单位"
+                      clearable
+                      v-model="formData.sampleUnit"
+                      size="mini"
+                      @change="changeSamUnit"
+                    >
+                    </DictSelection>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="8" v-if="conditionType == 2">
+                  <el-form-item prop="portion" label="数量" style="margin: 0">
+                    <el-input
+                      v-model="formData.portion"
+                      placeholder="请输入"
+                      size="mini"
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col :span="20" v-if="conditionType == 1">
+                  <el-form-item prop="portion" label="数量" style="margin: 0">
+                    <el-input
+                      v-model="formData.portion"
+                      placeholder="请输入"
+                      size="mini"
+                    ></el-input>
+                  </el-form-item>
+                </el-col>
+                <el-col
+                  :span="4"
+                  style="text-align: right"
+                  v-if="conditionType == 2"
+                >
+                  <el-button
+                    type="primary"
+                    size="mini"
+                    @click="handleSampleSubmit"
+                    style="margin-right: 12px"
+                    >确认</el-button
+                  >
+                </el-col>
+                <el-col
+                  :span="4"
+                  style="text-align: right"
+                  v-if="conditionType == 1"
+                >
+                  <el-button
+                    type="primary"
+                    size="mini"
+                    @click="handleSampleSubmit"
+                    style="margin-right: 12px"
+                    >确认</el-button
+                  >
+                </el-col>
+              </el-form>
+            </el-row>
+          </template>
+
+          <template v-slot:materielDesignation="{ row }">
+            <el-input
+              v-model="row.materielDesignation"
+              placeholder="请输入"
+            ></el-input>
+          </template>
+          <template v-slot:clientCode="{ row }">
+            <el-input v-model="row.clientCode" placeholder="请输入"></el-input>
+          </template>
+          <template v-slot:engrave="{ row }">
+            <el-input v-model="row.engrave" placeholder="请输入"></el-input>
+          </template>
+          <template v-slot:weight="{ row }">
+            <el-input v-model="row.weight" placeholder="请输入"></el-input>
+          </template>
+        </ele-pro-table>
+      </el-tab-pane>
+      <!--  -->
+      <el-tab-pane label="样品清单" name="2">
+        <el-table
+          v-if="sampleList.length > 0"
+          ref="showSampleListTable"
+          :data="paginatedSampleList"
+          tooltip-effect="dark"
+          :max-height="300"
+          border
+          row-key="id"
+        >
+          <el-table-column
+            label="序号"
+            type="index"
+            width="50"
+            align="center"
+            fixed="left"
+          ></el-table-column>
+          <template v-for="column in tableColumns">
+            <el-table-column
+              :key="column.prop"
+              :label="column.label"
+              :prop="column.prop"
+              :fixed="column.fixed"
+              :show-overflow-tooltip="true"
+              :width="column.width"
+              :align="column.align"
+            >
+              <template slot-scope="scope">
+                <template v-if="column.prop === 'categoryCode'">
+                  <el-link
+                    type="primary"
+                    :underline="false"
+                    @click="handleDetail(scope.$index, scope.row, 'detail')"
+                  >
+                    {{ scope.row.categoryCode }}
+                  </el-link>
+                </template>
+                <template v-else-if="column.prop === 'materielDesignation'">
+                  <el-input
+                    :disabled="scope.row.isMaterielDesignationEmpty"
+                    v-model="scope.row.materielDesignation"
+                    size="mini"
+                  ></el-input>
+                </template>
+                <template v-else-if="column.prop === 'clientCode'">
+                  <el-input
+                    :disabled="scope.row.isClientCodeEmpty"
+                    v-model="scope.row.clientCode"
+                    size="mini"
+                  ></el-input>
+                </template>
+                <template v-else-if="column.prop === 'engrave'">
+                  <el-input
+                    :disabled="scope.row.isEngraveEmpty"
+                    v-model="scope.row.engrave"
+                    size="mini"
+                  ></el-input>
+                </template>
+                <template v-else-if="column.prop === 'weight'">
+                  <el-input
+                    type="number"
+                    v-model="scope.row.weight"
+                    :min="0"
+                    @input="inputWeight(scope.row, scope.$index)"
+                    size="mini"
+                  ></el-input>
+                </template>
+                <template v-else>
+                  {{ scope.row[column.prop] }}
+                </template>
+              </template>
+            </el-table-column>
+          </template>
+          <!-- *** fixed="right"  -->
+          <el-table-column
+            label="处置状态"
+            prop="disposalStatus"
+            align="center"
+            :show-overflow-tooltip="true"
+          >
+            <template slot-scope="scope">
+              <span
+                v-if="scope.row.disposalStatus == 1 && form.qualityType == 2"
+                >返工</span
+              >
+              <span
+                v-if="scope.row.disposalStatus == 2 && form.qualityType == 2"
+                >返修</span
+              >
+              <span v-if="scope.row.disposalStatus == 3">报废</span>
+              <span
+                v-if="scope.row.disposalStatus == 4 && form.qualityType == 2"
+                >降级使用</span
+              >
+              <span
+                v-if="scope.row.disposalStatus == 5 && form.qualityType == 2"
+                >让步接收</span
+              >
+              <span v-if="scope.row.disposalStatus == 6">留样</span>
+              <span v-if="scope.row.disposalStatus == 7">消耗</span>
+              <span v-if="scope.row.disposalStatus == 8">回用</span>
+            </template>
+          </el-table-column>
+          <!-- ***  fixed="right" -->
+          <el-table-column
+            label="处置时间"
+            prop="disposeTime"
+            align="center"
+            :show-overflow-tooltip="true"
+          >
+          </el-table-column>
+          <!-- *** fixed="right" -->
+          <el-table-column
+            label="质检状态"
+            prop="qualityStatus"
+            align="center"
+            :show-overflow-tooltip="true"
+          >
+            <template slot-scope="scope">
+              <span v-if="scope.row.qualityStatus == 0">未检</span>
+              <span v-if="scope.row.qualityStatus == 1">已检</span>
+              <span v-if="scope.row.qualityStatus == 2">待检</span>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="质检结果"
+            prop="qualityResults"
+            align="center"
+            fixed="right"
+            :show-overflow-tooltip="true"
+          >
+            <template slot-scope="scope">
+              <el-select
+                @change="selectQualityResultsChange"
+                v-model="scope.row.qualityResults"
+                placeholder="请选择"
+                style="width: 100%"
+                :disabled="type == 'detail'"
+                size="mini"
+              >
+                <el-option
+                  v-for="item in qualityResultsList"
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value"
+                >
+                </el-option>
+              </el-select>
+            </template>
+          </el-table-column>
+          <el-table-column
+            label="操作"
+            align="center"
+            width="120"
+            fixed="right"
+            v-if="type != 'detail'"
+          >
+            <template slot-scope="scope">
+              <el-link
+                :type="scope.row.isValid ? 'primary' : 'danger'"
+                :underline="false"
+                @click="handleDetail(scope.$index, scope.row, 'report')"
+              >
+                质检
+              </el-link>
+              <el-link
+                type="primary"
+                :underline="false"
+                @click="handleDispose(scope.$index, scope.row, 'dispose')"
+                >处置
+              </el-link>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-pagination
+          @size-change="handleSampleSizeChange"
+          @current-change="handleSampleCurrentChange"
+          :current-page="samplePagination.currentPage"
+          :page-sizes="[10, 20, 50, 100]"
+          :page-size="samplePagination.pageSize"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="sampleList.length"
+        />
+      </el-tab-pane>
+      <!--  -->
+      <el-tab-pane label="质检方案" name="3">
+        <el-table
+          :data="paginatedSchemeList"
+          tooltip-effect="dark"
+          :max-height="300"
+          border
+          row-key="id"
+        >
+          <el-table-column
+            label="序号"
+            type="index"
+            width="50"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            label="质检方案编码"
+            prop="qualitySchemeTemplateCode"
+            align="center"
+          >
+          </el-table-column>
+          <el-table-column
+            label="质检方案名称"
+            prop="qualitySchemeTemplateName"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            label="质检类型"
+            prop="categoryLevelClassName"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            label="质检项编码"
+            prop="inspectionCode"
+            align="center"
+          ></el-table-column>
+          <el-table-column
+            label="质检项名称"
+            prop="inspectionName"
+            align="center"
+          ></el-table-column>
+          <el-table-column label="工艺参数" prop="defaultValue" align="center">
+            <template slot-scope="scope">
+              <div style="display: flex; justify-content: center">
+                <span>{{ scope.row.symbol }}</span>
+                <span v-if="scope.row.textType == 3">
+                  {{ scope.row.minValue }}-{{ scope.row.maxValue }}
+                </span>
+
+                <span v-else>
+                  <span>{{ scope.row.defaultValue }}</span>
+                </span>
+
+                {{ scope.row.unitName }}
+              </div>
+            </template>
+          </el-table-column>
+        </el-table>
+        <el-pagination
+          @size-change="handleSchemeSizeChange"
+          @current-change="handleSchemeCurrentChange"
+          :current-page="schemePagination.currentPage"
+          :page-sizes="[10, 20, 50, 100]"
+          :page-size="schemePagination.pageSize"
+          layout="total, sizes, prev, pager, next, jumper"
+          :total="schemeList.length"
+        />
+      </el-tab-pane>
+    </el-tabs>
+  </el-row>
+</template>
+
+<script>
+  import {
+    save,
+    update,
+    getById,
+    exeReportWork,
+    queryQualitySamplContent,
+    queryQualityTempleContent,
+    queryQualityInventory
+  } from '@/api/inspectionWork';
+  export default {
+    props: {
+      type: String,
+      packingList: Array,
+      sampleList: Array,
+      schemeList: Array,
+      loading: Boolean,
+      form: Object,
+      ids: String,
+      activeName: String
+    },
+    data() {
+      return {
+        activeName: this.activeName,
+        samplePagination: { currentPage: 1, pageSize: 10 },
+        schemePagination: { currentPage: 1, pageSize: 10 },
+
+        qualityResultsList: [
+          {
+            value: 1,
+            label: '合格'
+          },
+          {
+            value: 2,
+            label: '不合格'
+          },
+          {
+            value: 3,
+            label: '让步接收'
+          }
+        ],
+        tableColumns: [
+          {
+            label: '样品编码',
+            prop: 'sampleCode',
+            width: '200',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            label: '编码',
+            prop: 'categoryCode',
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            label: '名称',
+            prop: 'categoryName',
+            align: 'center'
+          },
+          { label: '批次号', prop: 'batchNo', align: 'center' },
+          { label: '发货条码', prop: 'barcodes', align: 'center' },
+          { label: '包装编码', prop: 'packageNo', align: 'center' },
+          // { label: '包装数量', prop: 'packingQuantity', align: 'center' },
+          { label: '包装单位', prop: 'packingUnit', align: 'center' },
+          { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+          { label: '计量单位', prop: 'measureUnit', align: 'center' },
+          {
+            label: '供应商名称',
+            prop: 'supplierName',
+            align: 'center',
+            width: '120'
+          },
+          {
+            label: '供应商代号',
+            prop: 'supplierCode',
+            align: 'center',
+            width: '120'
+          },
+          {
+            label: '物料代号',
+            prop: 'materielDesignation',
+            align: 'center',
+            slot: 'materielDesignation',
+            width: '120'
+          },
+          {
+            label: '客户代号',
+            prop: 'clientCode',
+            align: 'center',
+            slot: 'clientCode',
+            width: '120'
+          },
+          {
+            label: '刻码',
+            prop: 'engrave',
+            align: 'center',
+            slot: 'engrave',
+            width: '120'
+          },
+          {
+            label: '重量',
+            prop: 'weight',
+            align: 'center',
+            slot: 'weight',
+            width: '120'
+          },
+          {
+            label: '重量单位',
+            prop: 'weightUnit',
+            align: 'center',
+            width: 100
+          },
+          { label: '仓库', prop: 'warehouseName', align: 'center', width: 100 },
+          { label: '货区', prop: 'areaName', align: 'center' },
+          { label: '货架', prop: 'goodsShelfName', align: 'center' },
+          { label: '货位', prop: 'goodsAllocationName', align: 'center' },
+          { label: '生产日期', prop: 'productionDate', align: 'center' },
+          { label: '采购日期', prop: 'purchaseDate', align: 'center' }
+        ],
+
+        conditionType: null,
+        formData: {
+          number: 1,
+          sampleUnit: '',
+          portion: null
+        },
+        rules: {
+          number: [
+            {
+              required: true,
+              message: '请输入',
+              trigger: 'blur'
+            }
+          ],
+          sampleUnit: [
+            {
+              required: true,
+              message: '请选择样品单位',
+              trigger: 'change'
+            }
+          ],
+          portion: [
+            {
+              required: true,
+              message: '请输入',
+              trigger: 'blur'
+            }
+          ]
+        }
+      };
+    },
+
+    computed: {
+      tableColumns1() {
+        let arr = [
+          // (this.btnType !== 'issued' || this.baseForm.qualityMode === 2)
+          //   ? {
+          //     columnKey: 'selection',
+          //     type: 'selection',
+          //     width: 45,
+          //     align: 'center'
+          //   }
+          //   : null,
+          {
+            columnKey: 'selection',
+            type: 'selection',
+            width: 45,
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            label: '编码',
+            prop: 'categoryCode',
+            width: 150,
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            label: '名称',
+            prop: 'categoryName',
+            width: '150',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          { label: '批次号', prop: 'batchNo', align: 'center', width: 120 },
+          { label: '发货条码', prop: 'barcodes', align: 'center' },
+          {
+            label: '包装编码',
+            prop: 'packageNo',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          { label: '包装数量', prop: 'packingQuantity', align: 'center' },
+          { label: '包装单位', prop: 'packingUnit', align: 'center' },
+          { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+          { label: '计量单位', prop: 'measureUnit', align: 'center' },
+          { label: '物料代号', prop: 'materielDesignation', align: 'center' },
+          { label: '客户代号', prop: 'clientCode', align: 'center' },
+          {
+            label: '供应商名称',
+            prop: 'supplierName',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            label: '供应商代号',
+            prop: 'supplierCode',
+            align: 'center',
+            width: '120'
+          },
+          { label: '刻码', prop: 'engrave', align: 'center' },
+          { label: '重量', prop: 'weight', align: 'center' },
+          { label: '重量单位', prop: 'weightUnit', align: 'center' },
+          {
+            label: '仓库',
+            prop: 'warehouseName',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          { label: '货区', prop: 'areaName', align: 'center' },
+          { label: '货架', prop: 'goodsShelfName', align: 'center' },
+          { label: '货位', prop: 'goodsAllocationName', align: 'center' },
+          {
+            label: '生产日期',
+            prop: 'productionDate',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            label: '采购日期',
+            prop: 'purchaseDate',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          }
+        ];
+        return arr;
+      },
+      // 分页后的样品列表
+      paginatedSampleList() {
+        const { currentPage, pageSize } = this.samplePagination;
+        const start = (currentPage - 1) * pageSize;
+        const end = start + pageSize;
+        return this.sampleList?.slice(start, end);
+      },
+      // 分页后的质检方案列表
+      paginatedSchemeList() {
+        const { currentPage, pageSize } = this.schemePagination;
+        const start = (currentPage - 1) * pageSize;
+        const end = start + pageSize;
+        return this.schemeList?.slice(start, end);
+      }
+    },
+    created() {
+      this.reload({ qualityWorkerId: this.ids });
+    },
+    methods: {
+      async datasource({ page, limit, where }) {
+        console.log('请求来源清单数据');
+        const res = await queryQualityInventory({ ...where, page, limit });
+        return res;
+      },
+
+      reload(where) {
+        this.$nextTick(() => {
+          if (this.$refs.sourceTable && this.$refs.sourceTable.reload)
+            this.$refs.sourceTable.reload({ page: 1, where: where });
+        });
+      },
+
+      tableSelClear() {
+        console.log('清空勾选');
+        this.$refs.sourceTable.clearSelection();
+      },
+      handleSelectionChange(selection) {
+        if (this.form.conditionType == 2) {
+          if (this.form.isUnpack == 2) {
+            this.$set(this.form, 'sampleNumber', this.formData.portion);
+          } else {
+            this.formData.portion = selection.length;
+            this.$set(this.form, 'sampleNumber', selection.length);
+          }
+          this.formData.sampleUnit = selection[0]?.measureUnit;
+          this.$set(this.form, 'sampleMeasureUnit', selection[0]?.measureUnit);
+        } else if (this.form.conditionType == 1) {
+          this.$set(this.form, 'sampleNumber', this.formData.portion);
+        }
+        // this.formData.portion = selection.length;
+        // this.formData.sampleUnit = selection[0]?.measureUnit;
+        //
+        // this.$set(this.form, 'sampleNumber', selection.length);
+        // this.$set(this.form, 'sampleMeasureUnit', selection[0]?.measureUnit);
+
+        this.$emit('handleSelectionChange', selection);
+      },
+
+      handleSampleNumber(val) {
+        console.log('取样方式选择', this.form.isUnpack);
+        console.log(val, 'val');
+        this.conditionType = val;
+        this.form.sampleUnit = '';
+        this.$emit('getConditionType', val);
+
+        //取整样
+        // let data = this.$refs.sourceTable.getData()
+        // this.$emit('getSelectedList')
+        // if (this.selectedList.length == 0) {
+        //   this.$message.warning('请先选择样品!');
+        // }
+        // if (val == 1) {
+        //   // this.activeName = '2'
+        //   this.$emit('handleSample1', val, data)
+        // } else if (val == 2) {
+        //   this.tableSelClear();
+        //   this.$emit('handleSample1', val, data)
+        // }
+      },
+      handleInputNumber(val) {
+        let packingList = this.$refs.sourceTable.getData();
+
+        const maxValue =
+          packingList.length > 1
+            ? packingList.length
+            : packingList[0].measureQuantity;
+
+        if (val > maxValue) {
+          this.$message.warning('数量不能大于计量数量!');
+          this.formData.number = maxValue;
+          return;
+        }
+      },
+      handleInput(val) {
+        debugger;
+        if (val == 0 || val == '' || val == null) {
+          this.$refs.sourceTable.clearSelection();
+          return;
+        }
+
+        let packingList = this.$refs.sourceTable.getData();
+        if (!packingList || packingList.length === 0) {
+          return;
+        }
+        // 计算 packingList 中 measureQuantity 字段的总和
+        const measureQuantitySum = packingList.reduce((sum, item) => {
+          const quantity = Number(item.measureQuantity) || 0;
+          return sum + quantity;
+        }, 0);
+        const portion = Number(this.formData.portion);
+        // 清空当前选中
+        this.$refs.sourceTable.clearSelection();
+        debugger;
+        if (this.form.conditionType == 2) {
+          // 确保 portion 不超过数据列表长度
+          const safePortion = Math.min(portion, packingList.length);
+          if (this.form.isUnpack == 2) {
+            const maxQuantity = Number(packingList[0].measureQuantity);
+            if (portion > maxQuantity) {
+              this.$message.warning('取样数量不能大于计量数量!');
+              this.formData.portion = maxQuantity;
+            }
+          } else if (this.form.isUnpack == 1) {
+            if (portion > packingList.length) {
+              this.$message.warning('取样数量不能大于来源清单数量!');
+              this.formData.portion = packingList.length;
+            }
+          }
+          packingList.slice(0, safePortion).forEach((row) => {
+            this.$refs.sourceTable.toggleRowSelection(row);
+          });
+        } else if (this.form.conditionType == 1) {
+          // 确保 portion 不超过数据列表长度
+          const safePortion = Math.min(portion, measureQuantitySum);
+          if (portion > measureQuantitySum) {
+            this.$message.warning('取样数量不能大于计量数量!');
+            this.formData.portion = measureQuantitySum;
+          }
+          // 选中前 safePortion 行
+          packingList.slice(0, safePortion).forEach((row) => {
+            this.$refs.sourceTable.toggleRowSelection(row, true);
+          });
+        }
+
+        // if (packingList.length > 1) {
+        //   if (portion > packingList.length) {
+        //     this.$message.warning('取样数量不能大于来源清单数量!');
+        //     this.formData.portion = packingList.length;
+        //     return;
+        //   }
+        //   packingList.slice(0, this.formData.portion).forEach(row => {
+        //     this.$refs.table12.toggleRowSelection(row);
+        //   });
+        // } else {
+        //   const maxQuantity = Number(packingList[0].measureQuantity);
+        //   if (portion > maxQuantity) {
+        //     this.$message.warning('取样数量不能大于计量数量!');
+        //     this.formData.portion = maxQuantity;
+        //     return;
+        //   }
+        // }
+      },
+      changeSamUnit(val) {
+        console.log(val, 'dddd');
+        this.$emit('changeSamUnit', val);
+      },
+      handleSampleSubmit() {
+        this.$refs.ruleForm.validate((valid) => {
+          if (valid) {
+            //取小样 赋值右上角单位
+            this.changeSamUnit(this.formData.sampleUnit);
+
+            let params = {
+              conditionType: this.conditionType,
+              measureQ: this.formData.number,
+              sampleUnit: this.formData.sampleUnit,
+              portion: this.formData.portion
+            };
+            this.$emit('handleSampleSubmit', params);
+          }
+        });
+      },
+
+      handleClick(tab) {
+        console.log(tab, 'tab');
+        this.activeName = tab.name;
+      },
+      tabsChange(val) {
+        this.activeName = val;
+      },
+      tabsConditionType(val) {
+        this.conditionType = val;
+      },
+      checkSelectable(row, index) {
+        // 只有当质检方式为抽检(qualityMode=2)时   类型不是生产检验  才可选
+        return this.form.qualityType != 2 && this.form.qualityMode === 2;
+      },
+      handleDetail(index, row, type) {
+        this.$emit('handleDetail', index, row, type);
+      },
+      inputWeight(row, index) {
+        this.$emit('inputWeight', row, index);
+      },
+      handleDispose(index, row, type) {
+        this.$emit('handleDispose', index, row, type);
+      },
+      handleSampleSizeChange(val) {
+        this.samplePagination.pageSize = val;
+        this.samplePagination.currentPage = 1;
+      },
+      handleSampleCurrentChange(val) {
+        this.samplePagination.currentPage = val;
+      },
+      handleSchemeSizeChange(val) {
+        this.schemePagination.pageSize = val;
+        this.schemePagination.currentPage = 1;
+      },
+      handleSchemeCurrentChange(val) {
+        this.schemePagination.currentPage = val;
+      },
+
+      selectQualityResultsChange() {
+        this.$emit('countQualityResults');
+      }
+    }
+  };
+</script>

+ 627 - 0
src/views/produce/components/workPlan/components/baseInfo.vue

@@ -0,0 +1,627 @@
+<template>
+  <el-form ref="form1" :model="form" :rules="rules" label-width="120px">
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="编码:">
+          <el-input
+            :maxlength="20"
+            v-model="form.code"
+            disabled
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <!-- <el-col :span="6">
+        <el-form-item label="质检类型:" prop="qualityType">
+          <DictSelection
+            dictName="质检计划类型"
+            v-model="form.qualityType"
+            :disabled="btnType == 'detail'"
+          ></DictSelection>
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="质检方式:" prop="qualityMode">
+          <DictSelection
+            dictName="取样类型"
+            v-model="form.qualityMode"
+            clearable
+            :disabled="btnType == 'detail'"
+          ></DictSelection>
+        </el-form-item>
+      </el-col>-->
+      <el-col :span="6">
+        <el-form-item label="产品名称:" prop="productName">
+          <el-input
+            :disabled="btnType == 'detail'"
+            v-model="form.productName"
+            @click.native="addProduct"
+            readonly
+            placeholder="请选择"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="产品编码:" prop="productCode">
+          <el-input v-model="form.productCode" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="批次号:" prop="batchNo">
+          <el-input v-model="form.batchNo" disabled />
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <el-row>
+      <el-col :span="6">
+        <el-form-item label="规格:" prop="specification">
+          <el-input v-model="form.specification" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="型号:" prop="modelType">
+          <el-input v-model="form.modelType" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="牌号:" prop="brandNo">
+          <el-input v-model="form.brandNo" disabled />
+        </el-form-item>
+      </el-col>
+      <el-col :span="6">
+        <el-form-item label="总数量:" prop="total">
+          <el-input
+            type="number"
+            v-model="form.total"
+            @input="inputTotal"
+            disabled
+          />
+        </el-form-item>
+      </el-col>
+    </el-row>
+    <div style="text-align: right; margin-bottom: 22px">
+      <div @click="toggleExpand">
+        <div v-if="isExpanded"> <i class="el-icon-arrow-up"></i>收起 </div>
+        <div v-if="!isExpanded">
+          <i class="el-icon-arrow-down"></i>展开更多
+        </div>
+      </div>
+    </div>
+    <div v-if="isExpanded">
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="质检部门" prop="groupId">
+            <deptSelect
+              :disabled="btnType == 'detail'"
+              v-model="form.groupId"
+              @changeGroup="searchDeptNodeClick"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="质检人" prop="qualityId">
+            <el-select
+              :disabled="btnType == 'detail'"
+              v-model="form.qualityId"
+              @change="changeExecutor"
+              size="small"
+              style="width: 100%"
+              filterable
+            >
+              <el-option
+                v-for="item in executorList"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="质检时间:" prop="qualityTime">
+            <el-date-picker
+              class="w100"
+              v-model="form.qualityTime"
+              type="date"
+              value-format="yyyy-MM-dd"
+              :disabled="btnType == 'detail'"
+              placeholder="请选择"
+            ></el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="工时(h):" prop="hours">
+            <el-input
+              v-model="form.hours"
+              :disabled="btnType == 'detail'"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="合格数:" prop="qualifiedNumber">
+            <el-input
+              type="number"
+              :min="0"
+              :disabled="btnType == 'detail'"
+              @input="limitation('qualifiedNumber')"
+              @blur="quantityCalculation"
+              v-model="form.qualifiedNumber"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="不合格数:" prop="noQualifiedNumber">
+            <el-input
+              type="number"
+              :min="0"
+              :disabled="btnType == 'detail'"
+              @input="limitation('noQualifiedNumber')"
+              @blur="quantityCalculation"
+              v-model="form.noQualifiedNumber"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="合格率:" prop="qualificationRate">
+            <el-input v-model="form.qualificationRate" disabled />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="不合格率:" prop="noQualificationRate">
+            <el-input v-model="form.noQualificationRate" disabled />
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="总重量:" prop="totalWeight">
+            <el-input
+              type="number"
+              :disabled="btnType == 'detail'"
+              v-model="form.totalWeight"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="检验标准" prop="inspectionStandards">
+            <!-- 计量 计重 -->
+            <el-select
+              style="width: 100%"
+              v-model="form.inspectionStandards"
+              placeholder="请选择"
+              :disabled="
+                parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3
+              "
+            >
+              <el-option
+                v-for="item in inspectionStandardsList"
+                :label="item.label"
+                :value="item.value"
+                :key="item.value"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="检验方式:" prop="qualityMode">
+            <!-- <DictSelection dictName="取样类型" v-model="form.qualityMode" :disabled="qualityType == 1"></DictSelection> -->
+            <el-select
+              style="width: 100%"
+              v-model="form.qualityMode"
+              placeholder="请选择"
+              :disabled="
+                parseInt(qualityType1) == 1 || parseInt(qualityType1) == 3
+              "
+            >
+              <el-option
+                v-for="item in qualityModeList"
+                :label="item.label"
+                :value="item.value"
+                :key="item.value"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="6" v-if="btnType != 'detail'">
+          <el-form-item label="取样数量:" prop="sampleNumber" :rules="{
+            required: form.qualityMode == 2 ? true : false,
+            message: '请输入取样数量',
+            trigger: 'blur'
+          }" v-if="form.qualityMode == 2">
+            <div style="display: flex;align-items: center;justify-content: space-between;">
+              <el-input type="number"
+                :disabled="form.qualityMode == null || form.qualityMode == 1 || (form.qualityMode == 2 && form.sampleNumber) ? true : false"
+                v-model="form.sampleNumber" @change="handleChangeNumber" style="width: calc(100% - 90px)" />
+              <DictSelection dictName="计量单位" clearable v-model="form.sampleMeasureUnit" disabled size="mini"
+                style="width: 90px;margin-left: 12px;">
+              </DictSelection>
+            </div>
+          </el-form-item>
+        </el-col>-->
+        <!-- <el-col :span="6" v-if="btnType != 'detail'">
+          <el-form-item label="取样数量:" prop="sampleNumber" :rules="{
+            required: form.qualityMode == 2 ? true : false,
+            message: '请输入取样数量',
+            trigger: 'blur'
+          }" v-if="form.qualityMode == 2">
+            <div style="display: flex;align-items: center;justify-content: space-between;">
+              <el-input type="number"
+                :disabled="form.qualityMode == null || form.qualityMode == 1 || (form.qualityMode == 2 && form.sampleNumber) ? true : false"
+                v-model="form.sampleNumber" @change="handleChangeNumber" style="width: calc(100% - 90px)" />
+              <DictSelection dictName="计量单位" clearable v-model="form.sampleMeasureUnit" disabled size="mini"
+                style="width: 90px;margin-left: 12px;">
+              </DictSelection>
+            </div>
+          </el-form-item>
+        </el-col>-->
+        <el-col :span="6">
+          <el-form-item label="合格证号:" prop="certificateNumber">
+            <el-input
+              v-model="form.certificateNumber"
+              :disabled="btnType == 'detail'"
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row>
+        <el-col :span="6" v-if="parseInt(qualityType1) == 2">
+          <el-form-item label="工艺路线:">
+            <el-input
+              @click.native="openVersion"
+              clearable
+              v-model="form.produceRoutingName"
+              :disabled="btnType == 'detail'"
+              placeholder="请选择"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="6" v-if="parseInt(qualityType1) == 2">
+          <el-form-item label="工序:">
+            <el-select
+              style="width: 100%"
+              v-model="form.produceTaskId"
+              placeholder="请选择"
+              clearable
+              @change="produceTaskChange"
+              :disabled="btnType == 'detail'"
+            >
+              <el-option
+                v-for="item in produceTaskList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+              ></el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <!-- <el-col :span="6">
+          <el-form-item label="质检类型:">
+            <el-input
+              v-model="form.certificateNumber"
+              disabled
+              placeholder="请输入"
+            ></el-input>
+          </el-form-item>
+        </el-col> -->
+        <el-col :span="6">
+          <el-form-item label="质检类型:" prop="qualityType">
+            <DictSelection
+              dictName="质检计划类型"
+              v-model="form.qualityType"
+              disabled
+            ></DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <!-- <el-form-item label="质检结果:" prop="qualityResults" v-if="form.qualityMode == 2"> -->
+          <el-form-item label="质检结果:" prop="qualityResults">
+            <el-select
+              v-model="form.qualityResults"
+              placeholder="请选择"
+              style="width: 100%"
+              :disabled="btnType == 'detail'"
+            >
+              <el-option label="合格" :value="1" />
+              <el-option label="不合格" :value="2" />
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="备注:" prop="remark">
+            <el-input
+              type="textarea"
+              v-model="form.remark"
+              placeholder="请输入"
+              :disabled="btnType == 'detail'"
+            />
+          </el-form-item>
+        </el-col>
+        <el-col :span="8">
+          <el-form-item label="附件:" prop="accessory">
+            <fileUpload
+              v-model="form.accessory"
+              :type="btnType == 'detail' ? 'view' : ''"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </div>
+    <ProductionVersion ref="versionRefs" @changeProduct="changeProduct" />
+    <EquipmentDialog ref="equipmentRefs" @choose="choose" />
+  </el-form>
+</template>
+<script>
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import fileUpload from '@/components/upload/fileUpload';
+
+  import ProductionVersion from './ProductionVersion.vue';
+  import EquipmentDialog from './EquipmentDialog.vue';
+  //接口
+  import { getUserPage } from '@/api/system/organization';
+
+  import { getProduceTaskList } from '@/api/aps';
+  import { getByCode } from '@/api/system/dictionary-data';
+
+  export default {
+    components: {
+      EquipmentDialog,
+      ProductionVersion,
+      deptSelect,
+      fileUpload
+    },
+    props: {
+      form: {
+        type: Object,
+        default: () => {}
+      },
+      btnType: {
+        type: String,
+        default: ''
+      },
+      qualityType1: {
+        type: String,
+        default: ''
+      },
+      sampleList: {
+        type: Array,
+        default: () => []
+      }
+    },
+    watch: {
+      'form.qualityMode': {
+        handler(newVal) {
+          if (newVal) {
+            this.$emit('changeModel', newVal);
+          } else {
+            console.log('清空样品清单');
+            // this.$emit('table2');
+          }
+        },
+        immediate: false
+      },
+      'form.inspectionStandards': {
+        handler(newVal) {
+          if (newVal && this.qualityType1 == 2) {
+            this.$emit('changeInspectionStandardsModel', newVal);
+          } else {
+            console.log('清空样品清单');
+            // this.$emit('table2');
+          }
+        },
+        immediate: false
+      },
+      // 新增 *** 监听合格率更改 质检结果
+      'form.qualificationRate': {
+        handler(newVal) {
+          // if (newVal == '100.00%' || newVal == '100%' || newVal == '100.0%') {
+          //   this.$set(this.form, 'qualityResults', 1);
+          // } else {
+          //   this.$set(this.form, 'qualityResults', 2);
+          //   // this.$emit('table2');
+          // }
+        },
+        immediate: false,
+        deep: true
+      }
+    },
+    data() {
+      return {
+        executorList: [],
+        sourceList: [],
+        rules: {
+          productName: [
+            { required: true, message: '请选择产品', trigger: 'change' }
+          ],
+          qualifiedNumber: [
+            { required: true, message: '请输入合格数', trigger: 'blur' }
+          ],
+          noQualifiedNumber: [
+            { required: true, message: '请输入不合格数', trigger: 'blur' }
+          ],
+          qualityTime: [
+            { required: true, message: '请选择质检时间', trigger: 'blur' }
+          ],
+          groupId: [
+            { required: true, message: '请选择质检部门', trigger: 'change' }
+          ],
+          qualityId: [
+            { required: true, message: '请选择质检人', trigger: 'change' }
+          ],
+          qualityResults: [
+            { required: true, message: '请选择质检结果', trigger: 'change' }
+          ],
+          inspectionStandards: [
+            { required: true, message: '请选择检验标准', trigger: 'change' }
+          ]
+        },
+        produceTaskList: [],
+        inspectionStandardsList: [],
+        qualityModeList: [],
+        isExpanded: false
+      };
+    },
+    created() {
+      this.getDictListIqoCode('iqo_code');
+      this.getQualityModeList('quality_method_code');
+    },
+    methods: {
+      // *** 只能输入大于0的数字
+      limitation(val) {
+        this.form[val] =
+          this.form[val].replace(/[^\d]/g, '').replace(/^0+/, '') || '0';
+      },
+      // *** 计算合格数 不合格数
+      quantityCalculation() {
+        let qualifiedNumber = this.form.qualifiedNumber - 0;
+        let noQualifiedNumber = this.form.noQualifiedNumber - 0;
+        let total = qualifiedNumber + noQualifiedNumber;
+        let passRate = ((qualifiedNumber / total) * 100).toFixed(2);
+        let failureRate = ((noQualifiedNumber / total) * 100).toFixed(2);
+        this.form.qualificationRate = passRate + '%';
+        this.form.noQualificationRate = failureRate + '%';
+        if (total != this.form.total) {
+          this.$message.warning('合格数加上不合格数需要等于总数量');
+          return false;
+        }
+        return true;
+      },
+
+      toggleExpand() {
+        this.isExpanded = !this.isExpanded;
+      },
+      toggleExpand2() {
+        this.isExpanded = true;
+        this.$nextTick(() => {
+          this.$refs.form1.validateField('qualityResults');
+        });
+      },
+      async getDictListIqoCode(code) {
+        let { data: res } = await getByCode(code);
+        this.inspectionStandardsList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+      async getQualityModeList(code) {
+        let { data: res } = await getByCode(code);
+        this.qualityModeList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+      // 打开工艺路线弹窗
+      openVersion() {
+        this.$refs.versionRefs.open();
+      },
+      //工艺路线回调
+      changeProduct(data) {
+        this.form.produceRoutingId = data.id;
+        this.form.produceRoutingName = data.name;
+        this.form.produceTaskId = '';
+        this.form.produceTaskName = '';
+        this.getTaskList();
+      },
+      // 获取工序数据
+      async getTaskList() {
+        if (!this.form.produceRoutingId) {
+          return;
+        }
+        const res = await getProduceTaskList({
+          isDetail: true,
+          pageNum: 1,
+          routingId: this.form.produceRoutingId,
+          size: -1
+        });
+        this.produceTaskList = res?.list;
+      },
+      // 选择工序
+      produceTaskChange() {
+        if (!this.form.produceTaskId) {
+          return;
+        }
+        this.form.produceTaskName = this.produceTaskList.find(
+          (item) => item.id == this.form.produceTaskId
+        ).name;
+      },
+      // 产品名称
+      addProduct() {
+        this.$refs.equipmentRefs.open();
+      },
+      choose(data) {
+        this.form.productCode = data[0].code;
+        this.form.productName = data[0].name;
+        this.form.specification = data[0].specification;
+        this.form.modelType = data[0].modelType;
+        this.form.brandNo = data[0].brandNum;
+      },
+
+      //选择部门(搜索)
+      searchDeptNodeClick(info, row) {
+        if (info) {
+          const params = { groupId: info };
+          this.getUserList(params);
+          this.form.groupName = row.name;
+        } else {
+          this.form.executeGroupId = null;
+        }
+      },
+      // 获取人员
+      async getUserList(params) {
+        try {
+          let data = { pageNum: 1, size: -1 };
+          // 如果传了参数就是获取巡点检人员数据
+          if (params) {
+            data = Object.assign(data, params);
+          }
+          const res = await getUserPage(data);
+          this.executorList = res.list;
+        } catch (error) {}
+      },
+      // 人员选择
+      changeExecutor(val) {
+        if (val) {
+          this.form.executeId = val;
+          this.form.executeName = this.executorList.filter(
+            (item) => item.id === val
+          )[0].name;
+        }
+      },
+      inputTotal(val) {
+        if (val) {
+          this.form.total = val;
+          this.form.qualifiedNumber = val;
+        }
+      },
+      handleChangeNumber(val) {
+        this.form.sampleNumber = val;
+        console.log(val);
+        this.$emit('changeNumber', val);
+      },
+
+      //更新合格率
+      updateQualificationRate(
+        qualifiedNumber,
+        noQualifiedNumber,
+        qualificationRate,
+        noQualificationRate
+      ) {
+        this.form.qualifiedNumber = qualifiedNumber;
+        this.form.noQualifiedNumber = noQualifiedNumber;
+        this.form.qualificationRate = qualificationRate + '%';
+        this.form.noQualificationRate = noQualificationRate + '%';
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped></style>

+ 287 - 0
src/views/produce/components/workPlan/components/sampleDisposeDialog.vue

@@ -0,0 +1,287 @@
+<template>
+  <ele-modal
+    :title="title"
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="false"
+    :close-on-press-escape="false"
+    append-to-body
+    width="80%"
+    :maxable="true"
+  >
+    <el-form ref="form1" :model="formData" :rules="rules" label-width="120px">
+      <el-row>
+        <el-col :span="6">
+          <el-form-item label="处置方式" prop="disposalStatus" align="center">
+            <el-select
+              v-model="formData.disposalStatus"
+              placeholder="请选择"
+              style="width: 100%"
+              v-if="qualityType == 1"
+              clearable
+            >
+              <el-option
+                v-for="item in disposalStatusListType"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+            <el-select
+              v-model="formData.disposalStatus"
+              placeholder="请选择"
+              style="width: 100%"
+              v-else
+              clearable
+            >
+              <el-option
+                v-for="item in disposalStatusList"
+                :key="item.value"
+                :label="item.label"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6" v-if="formData.disposalStatus == 3">
+          <el-form-item
+            label="处置仓库"
+            prop="disposeWarehouseId"
+            align="center"
+          >
+            <el-select
+              v-model="formData.disposeWarehouseId"
+              placeholder="请选择"
+              style="width: 100%"
+              clearable
+              @change="handleWarehouseChange"
+              filterable
+            >
+              <el-option
+                v-for="item in warehouseList"
+                :key="item.disposeWarehouseId"
+                :label="item.disposeWarehouseName"
+                :value="item.disposeWarehouseId"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="留样日期" prop="sampleDate" align="center">
+            <el-date-picker
+              class="w100"
+              v-model="formData.sampleDate"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="请输入"
+            ></el-date-picker>
+          </el-form-item>
+        </el-col>
+        <el-col :span="6">
+          <el-form-item label="处置时间:" prop="disposeTime">
+            <el-date-picker
+              class="w100"
+              v-model="formData.disposeTime"
+              type="date"
+              value-format="yyyy-MM-dd"
+              placeholder="请输入"
+            ></el-date-picker>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row style="margin-top: 12px">
+        <el-col :span="24">
+          <el-form-item label="留样条件" prop="sampleCondition" align="center">
+            <el-input
+              v-model="formData.sampleCondition"
+              placeholder="请输入"
+              style="width: 100%"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row style="margin-top: 12px">
+        <el-col :span="24">
+          <el-form-item
+            label="生产商/受托生产"
+            prop="producerManufacturer"
+            align="center"
+          >
+            <el-input
+              v-model="formData.producerManufacturer"
+              placeholder="请输入"
+              style="width: 100%"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row style="margin-top: 12px">
+        <el-col :span="24">
+          <el-form-item label="留样地点" prop="samplePlace" align="center">
+            <el-input
+              type="textarea"
+              v-model="formData.samplePlace"
+              placeholder="请输入"
+              style="width: 100%"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+      <el-row style="margin-top: 12px">
+        <el-col :span="24">
+          <el-form-item label="留样备注" prop="sampleRemark" align="center">
+            <el-input
+              type="textarea"
+              v-model="formData.sampleRemark"
+              placeholder="请输入"
+              style="width: 100%"
+            ></el-input>
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+    <template v-slot:footer>
+      <el-button @click="handleClose">取消</el-button>
+      <el-button type="primary" @click="handleConfirm"> 确认 </el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import { warehouseList } from '@/api/inspectionWork';
+
+  export default {
+    components: {},
+    data() {
+      return {
+        title: '',
+        visible: false,
+        rowIndex: 0,
+        type: '',
+        formData: {
+          disposalStatus: '',
+          sampleDate: '',
+          disposeTime: '',
+          sampleCondition: '',
+          producerManufacturer: '',
+          samplePlace: '',
+          sampleRemark: ''
+        },
+        qualityType: '',
+        warehouseList: [],
+        // 表单验证规则
+        rules: {
+          disposeTime: [
+            {
+              required: true,
+              message: '请选择处置时间',
+              trigger: 'blur'
+            }
+          ],
+          disposalStatus: [
+            {
+              required: true,
+              message: '请选择处置方式',
+              trigger: 'blur'
+            }
+          ]
+        },
+        disposalStatusList: [
+          {
+            value: 1,
+            label: '返工'
+          },
+          {
+            value: 2,
+            label: '返修'
+          },
+          {
+            value: 3,
+            label: '报废'
+          },
+          {
+            value: 4,
+            label: '降级使用'
+          },
+          {
+            value: 5,
+            label: '让步接收'
+          },
+          {
+            value: 6,
+            label: '留样'
+          },
+          {
+            value: 7,
+            label: '消耗'
+          },
+          {
+            value: 8,
+            label: '回用'
+          }
+        ],
+        disposalStatusListType: [
+          {
+            value: 5,
+            label: '让步接收'
+          },
+          {
+            value: 9,
+            label: '退货'
+          }
+        ]
+      };
+    },
+    computed: {},
+
+    created() {
+      this.getWarehouseList();
+    },
+    methods: {
+      handleWarehouseChange(val) {
+        this.warehouseList.findIndex((item) => {
+          if (item.disposeWarehouseId == val) {
+            this.formData.disposeWarehouseName = item.disposeWarehouseName;
+          }
+        });
+      },
+      async getWarehouseList() {
+        let res = await warehouseList({});
+        this.warehouseList = res.map((item) => {
+          item.disposeWarehouseName = item.name;
+          item.disposeWarehouseId = item.id;
+          return {
+            ...item
+          };
+        });
+      },
+      async openDispose(index, row, type, qualityType) {
+        this.visible = true;
+        if (index != null) {
+          this.formData = JSON.parse(JSON.stringify(row));
+        } else {
+          this.formData = {};
+        }
+
+        this.rowIndex = index;
+        this.type = type;
+        this.qualityType = qualityType;
+      },
+      handleClose() {
+        this.visible = false;
+      },
+      handleConfirm() {
+        this.$refs.form1.validate((valid) => {
+          if (valid) {
+            this.$emit('handleDisposeConfirm', this.formData, this.rowIndex);
+
+            this.visible = false;
+          }
+        });
+      }
+    }
+  };
+</script>

+ 182 - 0
src/views/produce/components/workPlan/components/sampleListDialog.vue

@@ -0,0 +1,182 @@
+<!-- 用户编辑弹窗 -->
+<template>
+    <ele-modal :title="title" :visible.sync="visible" :before-close="handleClose" :close-on-click-modal="false"
+        :close-on-press-escape="false" append-to-body width="80%" :maxable="true">
+
+        <el-table :data="tableData" :default-expand-all="true">
+            <el-table-column type="expand">
+                <template slot-scope="props">
+                    <div style="padding: 10px;">
+                        <el-table :data="props.row.qualitySampleTemplateList" border>
+                            <el-table-column label="质检方案编码" prop="qualitySchemeTemplateCode" align="center">
+                            </el-table-column>
+                            <el-table-column label="质检方案名称" prop="qualitySchemeTemplateName"
+                                align="center"></el-table-column>
+                            <el-table-column label="质检类型" prop="categoryLevelClassName"
+                                align="center"></el-table-column>
+                            <el-table-column label="质检项编码" prop="inspectionCode" align="center"></el-table-column>
+                            <el-table-column label="质检项名称" prop="inspectionName" align="center"></el-table-column>
+                            <el-table-column label="工艺参数" prop="defaultValue" align="center">
+                            </el-table-column>
+                            <el-table-column label="质检工具" prop="" align="center">
+                                <template slot-scope="scope">
+                                    <toolButtom
+                                    v-model="scope.row.useTools"
+                                    :type="type"
+                                    :sList="scope.row.toolList"
+                                    />
+                                </template>
+                            </el-table-column>
+                            <el-table-column label="质检内容" prop="qualityResultContent" align="center" fixed="right"
+                                width="360">
+                                <template slot-scope="scope">
+                                    <el-input v-model="scope.row.qualityResultContent" placeholder="请输入内容"
+                                        :disabled="type == 'detail'"></el-input>
+                                </template>
+                            </el-table-column>
+                            <el-table-column label="质检结果" prop="qualityResults" align="center" fixed="right">
+                                <template slot-scope="scope">
+                                    <el-select v-model="scope.row.qualityResults" placeholder="请选择" style="width: 100%;"
+                                        :disabled="type == 'detail'">
+                                        <el-option v-for="item in qualityResultsList" :key="item.value"
+                                            :label="item.label" :value="item.value">
+                                        </el-option>
+                                    </el-select>
+                                </template>
+                            </el-table-column>
+                        </el-table>
+                    </div>
+                </template>
+            </el-table-column>
+            <template v-for="column in tableColumns">
+                <el-table-column :label="column.label" :prop="column.prop" :fixed="column.fixed"
+                    :show-overflow-tooltip="true" :width="column.width" :align="column.align"
+                    :formatter="column.formatter">
+                </el-table-column>
+            </template>
+            <el-table-column label="操作" align="center" width="80">
+                <template slot-scope="scope">
+                    <el-link :underline="false" type="primary"
+                        @click="handleDispose(scope.$index, scope.row, 'dispose')">
+                        处置
+                    </el-link>
+                </template>
+            </el-table-column>
+        </el-table>
+        <template v-slot:footer v-if="type == 'report'">
+            <el-button @click="handleClose">取消</el-button>
+            <el-button type="primary" @click="handleConfirm">
+                确认
+            </el-button>
+        </template>
+    </ele-modal>
+</template>
+
+<script>
+import toolButtom from './toolButtom.vue';
+export default {
+    components: {
+        toolButtom
+    },
+    data() {
+
+        return {
+            title: '',
+            visible: false,
+            rowIndex: 0,
+            type: '',
+            tableData: [],
+            tableColumns: [
+                {
+                    label: '编码',
+                    prop: 'categoryCode',
+                    width: '150',
+                    align: 'center'
+                },
+                {
+                    label: '名称',
+                    prop: 'categoryName',
+                    width: '150',
+                    align: 'center'
+                },
+                { label: '批次号', prop: 'batchNo', align: 'center' },
+                // { label: '发货条码', prop: 'barcodes', align: 'center' },
+                { label: '包装编码', prop: 'packageNo', align: 'center' },
+                { label: '包装数量', prop: 'packingQuantity', align: 'center' },
+                // { label: '包装单位', prop: 'packingUnit', align: 'center' },
+                { label: '计量数量', prop: 'measureQuantity', align: 'center' },
+                // { label: '计量单位', prop: 'measureUnit', align: 'center' },
+                { label: '物料代号', prop: 'materielDesignation', align: 'center' },
+                { label: '客户代号', prop: 'clientCode', align: 'center' },
+                { label: '刻码', prop: 'engrave', align: 'center' },
+                { label: '重量', prop: 'weight', align: 'center' },
+                { label: '重量单位', prop: 'weightUnit', align: 'center' },
+                { label: '仓库', prop: 'warehouseName', align: 'center', },
+                {
+                    label: '质检结果', prop: 'qualityResults', align: 'center', formatter: (row, column) => {
+                        if (row.qualityResults) {
+                            return row.qualityResults == 1 ? '合格' : row.qualityResults == 2 ? '不合格' : row.qualityResults == 3 ? '让步接收' : '';
+                        }
+                    }
+                },
+                // { label: '货区', prop: 'areaName', align: 'center', },
+                // { label: '货架', prop: 'goodsShelfName', align: 'center', },
+                // { label: '货位', prop: 'goodsAllocationName', align: 'center', },
+                // { label: '生产日期', prop: 'productionDate', align: 'center', },
+                // { label: '采购日期', prop: 'purchaseDate', align: 'center', }
+            ],
+            qualityResultsList: [
+                {
+                    value: 1,
+                    label: '合格'
+                },
+                {
+                    value: 2,
+                    label: '不合格'
+                },
+                {
+                    value: 3,
+                    label: '让步接收'
+                },
+            ],
+            sList:[],//质检工具筛选
+        };
+    },
+    computed: {
+    },
+
+    created() { },
+    methods: {
+        async openDia(index, row, type, list, isStatus, sList) {
+            this.tableData = [];
+            this.rowIndex = index
+            this.type = type;
+            // console.log(list, 'lklllllllllllllllllkkkkkkkkkkkkkkkkkkkkk', list[0].qualityResults);
+            //如果质检项qualitySampleTemplateList只有一条数据且质检结果是让步接收
+            if (list[0].qualitySampleTemplateList.length == 1) {
+                for (let i = 0; i < list[0].qualitySampleTemplateList.length; i++) {
+                    list[0].qualitySampleTemplateList[i].qualityResults = list[0].qualityResults
+
+                }
+            }
+            this.tableData = list;
+            this.visible = true
+        },
+        handleClose() {
+            this.visible = false;
+        },
+        handleConfirm() {
+            this.visible = false;
+            this.$emit('handleConfirm', this.tableData, this.rowIndex);
+        },
+        handleDispose(index, row, type) {
+            this.$emit('handleDispose', index, row, type);
+        },
+
+        //选择质检工具
+        openToolList(index, row) {
+            this.$emit('openToolList', index, row);
+        },
+    }
+};
+</script>

+ 93 - 0
src/views/produce/components/workPlan/components/search.vue

@@ -0,0 +1,93 @@
+<!-- 搜索表单 -->
+6
+<template>
+  <el-form
+    label-width="77px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6 }">
+        <el-form-item label="编码:">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6 }">
+        <el-form-item label="工序:">
+          <el-input
+            clearable
+            v-model="where.produceTaskName"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <!-- 
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 10 } : { span: 6}">
+        <el-form-item label="状态:" >
+          <el-select v-model="where.status" class="m-2" placeholder="请选择" size="large" style="width: 100%">
+            <el-option label="停用" :value="0" />
+            <el-option label="启用" :value="1" />
+          </el-select>
+        </el-form-item>
+      </el-col> -->
+      <!-- <el-col v-bind="styleResponsive ?{ lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="组织机构:">
+          <auth-selection data-type="Array" v-model="where.deptIds" style="width: 100%"></auth-selection>
+        </el-form-item>
+      </el-col> -->
+      <el-col
+        style="display: flex; justify-content: flex-end"
+        v-bind="styleResponsive ? { lg: 12, md: 6 } : { span: 12 }"
+      >
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+          <el-button @click="reset">重置</el-button>
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        code: '',
+        produceTaskName: '',
+        deptIds: ''
+      };
+      return {
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere }
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    methods: {
+      /* 搜索 */
+      search() {
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>

+ 247 - 0
src/views/produce/components/workPlan/components/term.vue

@@ -0,0 +1,247 @@
+<template>
+  <div>
+    <ele-pro-table
+      ref="table"
+      :columns="columns"
+      :datasource="list"
+      max-height="calc(100vh - 605px)"
+      tool-class="ele-toolbar-form"
+      cache-key="inspectionClassify"
+      row-key="qualityLevelId"
+    >
+      <template v-slot:textType="{ row }">
+        {{
+          row.textType == 1
+            ? '数值'
+            : row.textType == 2
+            ? '选择'
+            : row.textType == 3
+            ? '上下限'
+            : row.textType == 4
+            ? '规格'
+            : row.textType == 5
+            ? '时间'
+            : row.textType == 6
+            ? '范围'
+            : ''
+        }}
+      </template>
+
+      <template v-slot:type="{ row }">
+        {{ getDictValue('质检标准类型', row.qualityStandardType) }}
+      </template>
+
+      <template v-slot:defaultValue="{ row }">
+        <div style="display: flex">
+          <div
+            v-if="row.textType == 3"
+            style="display: flex; align-items: center"
+          >
+           {{ row.minValue }} {{row.unit}}
+            <span>&nbsp;&nbsp;-</span>
+          {{ row.maxValue }}{{row.unit}}
+          </div>
+
+          <div v-else >
+          {{ row.defaultValue }} {{row.unit}}
+          </div>
+
+        </div>
+      </template>
+
+
+      <template v-slot:qualityResultValue="{ row }">
+        <el-input
+              v-model="row.qualityResultValue"
+            ></el-input>
+      </template>
+
+      <template v-slot:qualityResult="{ row }">
+        <el-select
+              v-model="row.qualityResult"
+              placeholder="请选择"
+              style="width: 100%"
+              clearable
+              :disabled="isDetails"
+            >
+              <el-option
+                v-for="item in qualityList"
+                :label="item.name"
+                :key="item.value"
+                :value="item.value"
+              />
+            </el-select>
+
+      </template>
+
+      
+    </ele-pro-table>
+  </div>
+</template>
+
+<script>
+  import dictMixins from '@/mixins/dictMixins';
+  import { getByCode } from '@/api/system/dictionary-data';
+
+  export default {
+    components: {},
+    mixins: [dictMixins],
+    props: {
+      qualityParam: {
+        type: Array
+      },
+
+      isDetails: {
+        type: Boolean,
+        default: false
+      }
+    },
+
+    watch: {
+      qualityParam: {
+        handler(val) {
+          this.list = val;
+          this.$forceUpdate();
+        },
+        deep: true,
+        immediate: true
+      }
+    },
+
+    data() {
+      return {
+        list: [],
+        dictList: [],
+
+        
+				qualityList: [{
+						name: '合格',
+						value: 1
+					},
+					{
+						name: '不合格',
+						value: 2
+					},
+					{
+						name: '让步接受',
+						value: 3
+					},
+
+				],
+
+        columns: [
+          {
+            prop: 'categoryLevelName',
+            label: '质检类型',
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'inspectionName',
+            label: '质检名称',
+            showOverflowTooltip: true,
+            align: 'center',
+            minWidth: 110
+          },
+
+          {
+            prop: 'defaultValue',
+            slot: 'defaultValue',
+            label: '工艺参数',
+            align: 'center',
+            minWidth: 180
+          },
+
+          {
+            label: '工艺要求',
+            prop: 'inspectionStandard',
+            formatter: (row, column, cellValue) => {
+              return row.symbol + ' ' + cellValue + ' ' + row.unit;
+            },
+            minWidth: 350
+          },
+
+          {
+            prop: 'qualityResultValue',
+            slot: 'qualityResultValue',
+            label: '质检结果参数',
+            align: 'center',
+            minWidth: 160
+          },
+
+          {
+            prop: 'qualityResult',
+            slot: 'qualityResult',
+            label: '质检结果',
+            align: 'center',
+            minWidth: 100
+          },
+
+        ]
+      };
+    },
+
+    created() {
+      this.requestDict('质检标准类型');
+      // this.getDictList('mathematical_symbol');
+    },
+
+    methods: {
+      async getDictList(code) {
+        let { data: res } = await getByCode(code);
+        this.dictList = res.map((item) => {
+          let values = Object.keys(item);
+          return {
+            value: Number(values[0]),
+            label: item[values[0]]
+          };
+        });
+      },
+
+      getDate() {
+        return this.list;
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped>
+  .content_box {
+    width: 100%;
+    margin-top: 12px;
+    max-height: 42vh;
+    overflow-y: scroll;
+  }
+
+  .content_ll_case {
+    display: flex;
+    flex-wrap: wrap;
+    background: #e6f7ff;
+    line-height: 30px;
+  }
+
+  .content_ll {
+    height: 30px;
+    width: 23%;
+    display: flex;
+    flex-direction: row;
+    align-items: center;
+
+    margin: auto;
+
+    .name {
+      color: #000;
+      font-weight: 500;
+      margin-right: 8px;
+    }
+  }
+
+  ::v-deep .el-table--medium .el-table__cell {
+    padding: 4px 0 !important;
+  }
+
+  ::v-deep .el-form-item__content {
+    line-height: 28px !important;
+  }
+</style>

+ 79 - 0
src/views/produce/components/workPlan/components/toolButtom.vue

@@ -0,0 +1,79 @@
+<template>
+  <div>
+    <el-badge :value="value.length" class="item">
+      <el-button
+        icon="el-icon-plus"
+        v-if="type != 'detail'"
+        type="primary"
+        @click="handleUpload"
+      >
+        选择</el-button
+      >
+      <el-button
+        icon="el-icon-view"
+        v-else
+        type="primary"
+        @click="handleUpload"
+      >
+        查看</el-button
+      >
+    </el-badge>
+
+    <ToolList @success="getFiles" ref="toolListRef"></ToolList>
+  </div>
+</template>
+
+<script>
+  import ToolList from './toolList.vue';
+
+  export default {
+    name: 'index',
+    components: { ToolList },
+    model: {
+      prop: 'value',
+      event: 'updateVal'
+    },
+    props: {
+      type: {
+        type: String,
+        default: ''
+      },
+      value: {
+        type: Array,
+        default: () => {
+          return [];
+        }
+      },
+      
+      sList:{
+        type: Array,
+      }
+    },
+    data() {
+      return {
+        selectVal: ''
+      };
+    },
+    watch: {
+      value: {
+        handler(newVal) {
+          console.log(newVal, '=======');
+          this.selectVal = newVal || [];
+        },
+        immediate: true
+      }
+    },
+    created() {},
+    methods: {
+      handleUpload() {
+        console.log(this.sList, '选择质检工具列表======');
+        this.$refs.toolListRef.open(this.selectVal,this.type,this.sList);
+      },
+      getFiles(val = []) {
+        this.$emit('updateVal', val);
+      }
+    }
+  };
+</script>
+
+<style scoped lang="scss"></style>

+ 195 - 0
src/views/produce/components/workPlan/components/toolList.vue

@@ -0,0 +1,195 @@
+<template>
+    <ele-modal width="60%" :visible.sync="visible" :close-on-click-modal="false" custom-class="ele-dialog-form"
+        append-to-body :maxable="true" :resizable="true">
+
+        <!-- <div class="ele-body" style="height:60vh;overflow: auto;"> -->
+        <!-- <el-card shadow="never" v-loading="loading"> -->
+        <!-- <ele-split-layout
+        width="210px"
+        allow-collapse
+        :right-style="{ overflow: 'hidden' }"
+      >
+          <div class="ele-border-lighter sys-organization-list">
+            <el-tree
+              ref="tree"
+              :data="data"
+              highlight-current
+              :draggable="true"
+              node-key="id"
+              :expand-on-click-node="false"
+              :default-expand-all="true"
+              @node-click="onNodeClick"
+            >
+            </el-tree>
+          </div> -->
+        <!-- <template v-slot:content> -->
+        <ele-pro-table ref="table" :columns="columns" :datasource="useList" tool-class="ele-toolbar-form"
+            :needPage="false" row-key="id" :selection.sync="selection" >
+            <template v-slot:toolbar v-if="type != 'detail'">
+                <el-button type="primary" @click="fileShow = true">选择质检工具</el-button>
+            </template>
+            <template v-slot:action="{ row }">
+            <el-popconfirm
+            class="ele-action"
+            title="确定要删除吗?"
+            @confirm="remove(row)"
+            >
+            <template v-slot:reference v-if="type != 'detail'">
+                <el-link type="danger" :underline="false" icon="el-icon-delete">
+                删除
+                </el-link>
+            </template>
+            </el-popconfirm>
+      </template>
+        </ele-pro-table>
+        <!-- </template> -->
+        <!-- </ele-split-layout> -->
+        <!-- </el-card> -->
+
+        <!-- </div> -->
+        <template v-slot:footer>
+            <el-button @click="visible = false">取消</el-button>
+            <el-button type="primary" @click="addUserToolList"> 确认 </el-button>
+        </template>
+
+
+        <ele-modal width="60%" :visible.sync="fileShow" :close-on-click-modal="false" custom-class="ele-dialog-form"
+            append-to-body :maxable="true" :resizable="true">
+            <ele-pro-table ref="table" :columns="columns" :datasource="datasource" tool-class="ele-toolbar-form"
+                :needPage="false" row-key="id" :selection.sync="selection" :toolbar="false">
+            </ele-pro-table>
+            <template v-slot:footer>
+                <el-button @click="fileShow = false">取消</el-button>
+                <el-button type="primary" @click="addTemplate"> 确认 </el-button>
+            </template>
+        </ele-modal>
+    </ele-modal>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            selection: [],
+            loading: false,
+            fileShow: false,
+            visible: false,
+            datasource: [],
+            useList: [],
+            columns: [
+                {
+                    width: 45,
+                    type: 'selection',
+                    columnKey: 'selection',
+                    align: 'center'
+                },
+                {
+                    columnKey: 'index',
+                    type: 'index',
+                    width: 50,
+                    align: 'center',
+                    label: '序号',
+                    showOverflowTooltip: true,
+                    fixed: 'left'
+                },
+                {
+                    prop: 'code',
+                    label: '物品编码',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    slot: 'name',
+                    prop: 'name',
+                    label: '物品名称',
+                    align: 'center',
+                    showOverflowTooltip: true,
+                    minWidth: 200
+                },
+                {
+                    prop: 'brandNum',
+                    label: '牌号',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'categoryModel',
+                    label: '型号',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    prop: 'specification',
+                    label: '规格',
+                    align: 'center',
+                    showOverflowTooltip: true
+                },
+                {
+                    columnKey: 'action',
+                    label: '操作',
+                    width: 200,
+                    align: 'center',
+                    resizable: false,
+                    slot: 'action',
+                    showOverflowTooltip: true
+                }
+                // {
+                //     prop: 'measureQuantity',
+                //     label: '计量数量',
+                //     sortable: 'custom',
+                //     showOverflowTooltip: true,
+                //     width: 130,
+                //     align: 'center'
+                // },
+                // {
+                //     prop: 'measureUnit',
+                //     label: '计量单位',
+                //     align: 'center'
+                // },
+                // {
+                //     prop: 'weight',
+                //     label: '重量',
+                //     showOverflowTooltip: true
+                // },
+                // {
+                //     prop: 'weightUnit',
+                //     label: '重量单位',
+                //     showOverflowTooltip: true
+                // },
+            ],
+            data: [],
+        }
+    },
+    methods: {
+        open(val, type, sList) {
+            this.visible = true;
+            this.type = type;
+            this.useList = val;
+            this.datasource = sList;
+        },
+        addUserToolList() {
+            if (this.selection.some((item) => 
+                this.useList.some((i) => i.code == item.code))) {
+                return this.$message.error('选择的物品已经存在列表了');
+            }
+            
+            this.$emit(
+                'success',
+                this.useList
+            );
+            this.visible = false;
+            this.init();
+        },
+        addTemplate() {
+            this.useList = this.selection;
+            this.fileShow = false;
+        },
+        remove(row) {
+            this.useList = this.useList.filter((item) => item.code != row.code);
+        },
+        init() {
+            this.selection = [];
+        }
+    },
+}
+</script>

+ 140 - 0
src/views/produce/components/workPlan/components/work.vue

@@ -0,0 +1,140 @@
+<template>
+  <el-dialog
+    :visible.sync="equipmentdialog"
+    :before-close="handleClose"
+    :close-on-click-modal="true"
+    :close-on-press-escape="false"
+    append-to-body
+    width="90%"
+  >
+  </el-dialog>
+</template>
+
+<script>
+  export default {
+    props: {
+      // workListIds: {
+      //   type: Array,
+      //   default() {
+      //     return [];
+      //   }
+      // },
+      // activeName: {
+      //   type: String
+      // },
+      // reportNeedFeed: {}
+      workListIds: {
+        type: Array,
+        default() {
+          return [];
+        }
+      },
+      taskId: {
+        type: String,
+        default() {
+          return null;
+        }
+      }
+    },
+
+    data() {
+      const defaultForm = function () {
+        return {
+          code: '',
+          qualityType: null,
+          qualityModeproduceRoutingId: '',
+          produceRoutingName: '',
+          produceTaskId: '',
+          produceTaskName: '',
+          productName: '',
+          productCode: '',
+          batchNo: '',
+          specification: '',
+          modelType: '',
+          brandNo: '',
+          total: '',
+          qualifiedNumber: '',
+          noQualifiedNumber: '',
+          groupId: '',
+          groupName: '',
+          qualityId: '',
+          qualityName: '',
+          qualityTime: '',
+          hours: '',
+          qualificationRate: '',
+          noQualificationRate: '',
+          totalWeight: '',
+          sampleNumber: '',
+          imgUrl: [],
+          qualityTimeStart: '',
+          qualityTimeEnd: '',
+
+          sampleMeasureUnit: '',
+          conditionType: null
+        };
+      };
+      return {
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm() },
+        voList: [],
+
+        // 表单验证规则
+        categoryParamList: [],
+        type: '',
+        title: '',
+        loading: false,
+
+        tabTaskId: null,
+        equipmentdialog: false,
+        // activeName: '2',
+
+        packingList: [],
+        sampleList: [],
+        schemeList: [],
+        activeName: null,
+
+        isValid: true,
+        isStatus: true,
+        SampleListbyReportList: [],
+        qualityTimeStart: '',
+        isReportProcessProduce: false,
+        addStatus: []
+      };
+    },
+    // watch: {
+    //   workListIds: {
+    //     handler(id) {
+    //       if (id) {
+    //         this.getDetail();
+    //       } else {
+    //         this.form = { ...defaultForm() };
+    //       }
+    //     }
+    //   }
+    // },
+
+    created() {
+      // this.open();
+      // console.log(11111);
+      // console.log(this.workListIds[0]);
+      // if (this.workListIds[0]) {
+      //   this.getDetail();
+      // }
+    },
+    methods: {
+      open() {
+        console.log(11111);
+        this.equipmentdialog = true;
+      },
+
+      handleClose() {
+        this.equipmentdialog = false;
+        this.$emit('close', false);
+        // this.$refs.equiTable.clearSelection();
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 1363 - 0
src/views/produce/components/workPlan/index.vue

@@ -0,0 +1,1363 @@
+<template>
+  <el-dialog
+    :visible.sync="visible"
+    :before-close="handleClose"
+    :close-on-click-modal="true"
+    :close-on-press-escape="false"
+    append-to-body
+    width="90%"
+  >
+    <div class="ele-body" v-if="visible">
+      <el-card shadow="never">
+        <header-title title="基本信息">
+          <el-button @click="cancel">返回</el-button>
+          <el-button
+            type="primary"
+            @click="save"
+            :loading="loading"
+            v-if="type != 'detail'"
+            >保存</el-button
+          >
+          <el-button
+            type="primary"
+            @click="handleReporting"
+            :loading="loading"
+            v-if="type != 'detail'"
+            >报工完成</el-button
+          >
+        </header-title>
+        <base-info
+          ref="baseInfoRefs"
+          v-if="form"
+          :form="form"
+          :btnType="type"
+          :qualityType1="qualityType"
+          @changeModel="changeModel"
+          @changeNumber="changeNumber"
+          @changeInspectionStandardsModel="changeInspectionStandardsModel"
+        ></base-info>
+
+        <quality-content-tabs
+          ref="tabsRef"
+          :type="type"
+          :ids="dataWork.id"
+          :sample-list="sampleList"
+          :activeName="activeName"
+          :scheme-list="schemeList"
+          :loading="loading"
+          :form="form"
+          @handleSelectionChange="handleSelectionChange1"
+          @batch-quality="batchQuality"
+          @batch-dispose="batchDispose"
+          @handleDetail="handleDetail"
+          @inputWeight="inputWeight"
+          @handleDispose="handleDispose"
+          @changeSamUnit="changeSamUnit"
+          @handleSample1="handleSample1"
+          @handleSampleSubmit="handleSampleSubmit"
+          @getConditionType="getConditionType"
+          @countQualityResults="countQualityResults"
+        />
+      </el-card>
+
+      <sampleListDialog
+        ref="detailRef"
+        @handleConfirm="handleConfirm"
+        @handleDispose="handleDispose"
+      ></sampleListDialog>
+      <sampleDisposeDialog
+        ref="disposeRef"
+        @handleDisposeConfirm="handleDisposeConfirm"
+      ></sampleDisposeDialog>
+    </div>
+  </el-dialog>
+</template>
+
+<script>
+  import baseInfo from './components/baseInfo.vue';
+  import QualityContentTabs from './components/QualityContentTabs.vue';
+
+  import { getCode } from '@/api/login';
+  import {
+    save,
+    update,
+    getById,
+    exeReportWork,
+    queryQualitySamplContent,
+    queryQualityTempleContent,
+    queryQualityInventory
+  } from '@/api/inspectionWork';
+
+  import dictMixins from '@/mixins/dictMixins';
+
+  // import term from './term';
+  import sampleListDialog from './components/sampleListDialog.vue';
+  import sampleDisposeDialog from './components/sampleDisposeDialog.vue';
+
+  import { finishPageTab } from '@/utils/page-tab-util';
+  export default {
+    components: {
+      baseInfo,
+      QualityContentTabs,
+      sampleListDialog,
+      sampleDisposeDialog
+    },
+    mixins: [dictMixins],
+
+    props: {
+      // workListIds: {
+      //   type: Array,
+      //   default() {
+      //     return [];
+      //   }
+      // },
+      // activeName: {
+      //   type: String
+      // },
+      // reportNeedFeed: {}
+      workListIds: {
+        type: Array,
+        default() {
+          return [];
+        }
+      },
+      taskId: {
+        type: String,
+        default() {
+          return null;
+        }
+      }
+    },
+
+    data() {
+      const defaultForm = function () {
+        return {
+          code: '',
+          qualityType: null,
+          qualityModeproduceRoutingId: '',
+          produceRoutingName: '',
+          produceTaskId: '',
+          produceTaskName: '',
+          productName: '',
+          productCode: '',
+          batchNo: '',
+          specification: '',
+          modelType: '',
+          brandNo: '',
+          total: '',
+          qualifiedNumber: '',
+          noQualifiedNumber: '',
+          groupId: '',
+          groupName: '',
+          qualityId: '',
+          qualityName: '',
+          qualityTime: '',
+          hours: '',
+          qualificationRate: '',
+          noQualificationRate: '',
+          totalWeight: '',
+          sampleNumber: '',
+          imgUrl: [],
+          qualityTimeStart: '',
+          qualityTimeEnd: '',
+
+          sampleMeasureUnit: '',
+          conditionType: null
+        };
+      };
+      return {
+        defaultForm,
+        // 表单数据
+        form: { ...defaultForm() },
+        voList: [],
+
+        // 表单验证规则
+        categoryParamList: [],
+        type: '',
+        title: '',
+        loading: false,
+
+        tabTaskId: null,
+        visible: false,
+        // activeName: '2',
+
+        packingList: [],
+        sampleList: [],
+        schemeList: [],
+        activeName: null,
+
+        isValid: true,
+        isStatus: true,
+        SampleListbyReportList: [],
+        qualityTimeStart: '',
+        isReportProcessProduce: false,
+        addStatus: [],
+        dataWork: {}
+      };
+    },
+    // watch: {
+    //   workListIds: {
+    //     handler(id) {
+    //       if (id) {
+    //         this.getDetail();
+    //       } else {
+    //         this.form = { ...defaultForm() };
+    //       }
+    //     }
+    //   }
+    // },
+
+    created() {
+      // console.log(11111);
+      // console.log(this.workListIds);
+      // this.open();
+      // if (this.workListIds[0]) {
+      //   this.getDetail();
+      // }
+    },
+    methods: {
+      //切换检验方式
+      changeModel(val, flag) {
+        this.$refs.tabsRef.tableSelClear();
+        this.sampleList = [];
+        this.$refs.tabsRef.tabsChange('1');
+        this.$refs.tabsRef.tabsConditionType(null);
+
+        this.form.qualityMode = val;
+        //检验方式 全检
+        if (this.form.qualityMode == 1) {
+          this.activeName = '2';
+          this.form.sampleNumber = '';
+          const sData = this.$refs.tabsRef.$refs.sourceTable.getData();
+          if (sData.length == 0) {
+            for (let i = 0; i < sData.length; i++) {
+              this.$set(sData[i], 'qualityStatus', 2);
+            }
+          }
+          console.log(
+            this.$refs.tabsRef.$refs.sourceTable.getData(),
+            'packingList'
+          );
+          this.getProSamList(sData);
+        } else {
+          this.activeName = '1';
+          if (!flag) {
+            this.sampleList = [];
+          }
+        }
+      },
+
+      async open(req) {
+        this.visible = true;
+        this.dataWork = req.data;
+        this.getDetail(req.workOrderId);
+        this.type = req.data.type ? req.data.type : '';
+        this.qualityType = req.data.qualityType
+          ? '' + req.data.qualityType
+          : '';
+
+        this.title =
+          this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
+
+        if (this.type == 'add') {
+          const code = await getCode('quality_work_order_code');
+          this.form.code = code;
+        } else {
+          if (
+            req.data.qualityTimeStart != '' ||
+            req.data.qualityTimeStart != null ||
+            req.data.qualityTimeStart != undefined
+          ) {
+            this.qualityTimeStart = this.getNowTime();
+          }
+        }
+      },
+
+      handleClose() {
+        this.visible = false;
+        // this.$refs.equiTable.clearSelection();
+        this.$emit('close', false);
+      },
+
+      //根据类型判断样品清单现实列表数据
+      async getProSamList(list) {
+        //生产检验
+        if (this.qualityType == 2) {
+          if (this.form.qualityMode != null) {
+            const ProductSampleList = [];
+            console.log(list, 'list');
+            for (const oldItem of list) {
+              const count = oldItem.measureQuantity;
+              const newMeasureQuantity = oldItem.measureQuantity / count;
+              const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
+
+              console.log(typeof oldItem.qualitySampleTemplateList, 'ssssss');
+
+              // 遍历新数组设置 qualityResults 默认值
+              this.schemeList.forEach((item) => {
+                if (typeof item === 'object' && item !== null) {
+                  item.qualityResults = 1; // 设置默认值
+                }
+                delete item.id;
+              });
+
+              console.log(oldItem, 'oldItem');
+              console.log(count, newMeasureQuantity, newWeight);
+              delete oldItem.id;
+
+              if (
+                oldItem.qualitySampleTemplateList == undefined ||
+                oldItem.qualitySampleTemplateList == null ||
+                oldItem.qualitySampleTemplateList.length == 0
+              ) {
+                oldItem.qualitySampleTemplateList = JSON.parse(
+                  JSON.stringify(this.schemeList)
+                );
+                for (let i = 0; i < count; i++) {
+                  ProductSampleList.push({
+                    ...oldItem,
+                    measureQuantity: newMeasureQuantity,
+                    weight: newWeight,
+                    sampleCode: await this.getSampleCode(),
+                    qualitySampleTemplateList: JSON.parse(
+                      JSON.stringify(this.schemeList)
+                    )
+                  });
+                }
+                console.log(ProductSampleList, 'ProductSampleList');
+                this.sampleList = ProductSampleList;
+                const pNum = ProductSampleList.reduce((sum, item) => {
+                  return sum + Number(item.weight || 0);
+                }, 0);
+                this.form.totalWeight = parseFloat(pNum.toFixed(2));
+              } else {
+                for (let i = 0; i < count; i++) {
+                  ProductSampleList.push({
+                    ...oldItem,
+                    measureQuantity: newMeasureQuantity,
+                    weight: newWeight,
+                    sampleCode: await this.getSampleCode(),
+                    qualitySampleTemplateList: JSON.parse(
+                      JSON.stringify(oldItem.qualitySampleTemplateList)
+                    )
+                  });
+                }
+                console.log(ProductSampleList, 'ProductSampleList');
+                this.sampleList = ProductSampleList;
+                const pNum = ProductSampleList.reduce((sum, item) => {
+                  return sum + Number(item.weight || 0);
+                }, 0);
+                this.form.totalWeight = parseFloat(pNum.toFixed(2));
+              }
+            }
+          }
+        } else {
+          // this.sampleList = list;
+          this.sampleList = this.addStatus;
+        }
+      },
+      //输入取样数量
+      changeNumber(val) {
+        if (this.form.qualityMode !== 2) {
+          return;
+        }
+        if (val <= 0) {
+          this.$refs.showPackingListTable.clearSelection();
+          return;
+        }
+
+        if (this.qualityType == 2) {
+          //生产检验的抽检逻辑
+          if (val > this.packingList[0].measureQuantity) {
+            this.$message.warning('取样数量不能大于来源清单的计量数量!');
+            return;
+          }
+
+          const ProductSampleList = [];
+
+          this.packingList.forEach((oldItem) => {
+            const count = oldItem.measureQuantity;
+            const newMeasureQuantity = oldItem.measureQuantity / count;
+            const newWeight = parseFloat((oldItem.weight / count).toFixed(2));
+            console.log(count, newMeasureQuantity, newWeight);
+            delete oldItem.id;
+            // 遍历新数组设置 qualityResults 默认值
+            this.schemeList.forEach((item) => {
+              if (typeof item === 'object' && item !== null) {
+                item.qualityResults = 1; // 设置默认值
+              }
+              delete item.id;
+            });
+            for (let i = 0; i < val; i++) {
+              ProductSampleList.push({
+                ...oldItem,
+                measureQuantity: newMeasureQuantity,
+                weight: newWeight,
+                qualitySampleTemplateList: JSON.parse(
+                  JSON.stringify(this.schemeList)
+                )
+              });
+            }
+          });
+          this.sampleList = ProductSampleList;
+          const pNum = ProductSampleList.reduce((sum, item) => {
+            return sum + Number(item.weight || 0);
+          }, 0);
+          this.form.totalWeight = parseFloat(pNum.toFixed(2));
+        } else {
+          if (val > this.packingList.length) {
+            this.$message.warning('取样数量不能大于物料明细总数!');
+            return;
+          }
+          const rows = this.packingList.slice(0, val);
+          rows.forEach((row) => {
+            this.$refs.showPackingListTable.toggleRowSelection(row);
+          });
+        }
+      },
+      getNowDate() {
+        let date = new Date(),
+          obj = {
+            year: date.getFullYear(), //获取当前月份(0-11,0代表1月)
+            month: date.getMonth() + 1, //获取当前月份(0-11,0代表1月)
+            strDate: date.getDate(), // 获取当前日(1-31)
+            hour: date.getHours(), //获取当前小时(0 ~ 23)
+            minute: date.getMinutes(), //获取当前分钟(0 ~ 59)
+            second: date.getSeconds() //获取当前秒数(0 ~ 59)
+          };
+        Object.keys(obj).forEach((key) => {
+          if (obj[key] < 10) obj[key] = `0${obj[key]}`;
+        });
+        return obj;
+      },
+      //来源清单勾选事件
+      handleSelectionChange1(selection) {
+        if (this.form.qualityMode === 2) {
+          this.selectedList = selection;
+          this.activeName = '1';
+          if (this.schemeList.length == 0) {
+            for (let i = 0; i < selection.length; i++) {
+              this.$set(selection[i], 'qualityStatus', 2);
+              // 遍历新数组设置 qualityResults 默认值
+              this.schemeList.forEach((item) => {
+                if (typeof item === 'object' && item !== null) {
+                  item.qualityResults = 1; // 设置默认值
+                }
+                delete item.id;
+              });
+              this.$set(
+                selection[i],
+                'qualitySampleTemplateList',
+                JSON.parse(JSON.stringify(this.schemeList))
+              );
+            }
+          }
+
+          // this.sampleList = selection;
+          //赋值取样数量
+          this.form.sampleNumber = selection.length;
+        }
+      },
+
+      // async open(req) {
+      //   this.equipmentdialog = true;
+      //   console.log('弹窗打开了.....');
+      //   console.log(req);
+      //   console.log(req[workOrderId]);
+      //   console.log(req.workOrderId);
+      //   // this.getDetail(req.workOrderId);
+      //   this.type = this.$route.query.type;
+      //   this.qualityType = this.$route.query.qualityType;
+
+      //   this.title =
+      //     this.type == 'add' ? '新增' : this.type == 'edit' ? '报工' : '详情';
+
+      //   if (this.type == 'add') {
+      //     const code = await getCode('quality_work_order_code');
+      //     this.form.code = code;
+      //   } else {
+      //     if (
+      //       this.$route.query.qualityTimeStart != '' ||
+      //       this.$route.query.qualityTimeStart != null ||
+      //       this.$route.query.qualityTimeStart != undefined
+      //     ) {
+      //       this.qualityTimeStart = this.getNowTime();
+      //     }
+      //   }
+      // },
+      getNowTime() {
+        const nowDate = this.getNowDate();
+        return (
+          nowDate.year +
+          '-' +
+          nowDate.month +
+          '-' +
+          nowDate.strDate +
+          ' ' +
+          nowDate.hour +
+          ':' +
+          nowDate.minute +
+          ':' +
+          nowDate.second
+        );
+      },
+      getNowTimes() {
+        const nowDate = this.getNowDate();
+        return nowDate.year + '-' + nowDate.month + '-' + nowDate.strDate;
+      },
+      async getDetail(id) {
+        getById(id)
+          .then((res) => {
+            this.form = res.data;
+
+            this.isReportProcessProduce =
+              this.form.isReportProcessProduce == 1 ? true : false;
+
+            this.tabTaskId =
+              this.categoryParamList[0] && this.categoryParamList[0].id;
+
+            if (this.form.groupId) {
+              this.$nextTick(() => {
+                this.$refs.baseInfoRefs?.getUserList({
+                  groupId: this.form.groupId
+                });
+              });
+            }
+            if (this.form.produceRoutingId) {
+              this.$nextTick(() => {
+                this.$refs.baseInfoRefs?.getTaskList();
+              });
+            }
+          })
+          .catch((error) => console.error('Error fetching data:', error));
+
+        // await this.queryQualityInventory()
+        await this.queryQualityTempleContent();
+        await this.queryQualitySamplContent();
+      },
+      // getNewData(val) {
+      //   console.log(val, '清单列表')
+      //   this.packingList = val
+      // },
+
+      // async queryQualityInventory() {
+      //   let res = await queryQualityInventory({ qualityWorkerId: this.$route.query.id });
+      //   console.log(res, '清单列表');
+      //   this.packingList = res;
+      // },
+
+      changeSamUnit(val) {
+        this.$set(this.form, 'sampleMeasureUnit', val);
+      },
+      async handleSample1(val, data) {
+        this.sampleList = [];
+        if (this.selectedList == undefined || this.selectedList.length == 0) {
+          this.activeName = '1';
+          this.$message.warning('请先选择样品!');
+          return;
+        }
+        if (val == 1) {
+          this.activeName = '2';
+          if (this.form.isUnpack == 1) {
+            for (let i = 0; i < this.selectedList.length; i++) {
+              for (let j = 0; j < this.selectedList[i].measureQuantity; j++) {
+                // 不拆计算每个重量
+                let newWeight = parseFloat(
+                  (
+                    this.selectedList[i].weight /
+                    this.selectedList[i].measureQuantity
+                  ).toFixed(4)
+                );
+                if (
+                  this.selectedList[i].qualitySampleTemplateList == undefined ||
+                  this.selectedList[i].qualitySampleTemplateList == null ||
+                  this.selectedList[i].qualitySampleTemplateList.length == 0
+                ) {
+                  this.sampleList.push({
+                    ...this.selectedList[i],
+                    sampleCode: await this.getSampleCode(),
+                    measureQuantity: 1,
+                    qualitySampleTemplateList: JSON.parse(
+                      JSON.stringify(this.schemeList)
+                    ),
+                    weight: newWeight || 0
+                  });
+                } else {
+                  this.sampleList.push({
+                    ...this.selectedList[i],
+                    sampleCode: await this.getSampleCode(),
+                    measureQuantity: 1,
+                    qualitySampleTemplateList: JSON.parse(
+                      JSON.stringify(
+                        this.selectedList[i].qualitySampleTemplateList
+                      )
+                    ),
+                    weight: newWeight || 0
+                  });
+                }
+              }
+            }
+          } else if (this.form.isUnpack == 2) {
+            // 不拆计算每个重量
+            let newWeight = parseFloat(
+              (
+                this.selectedList[0].weight /
+                this.selectedList[0].measureQuantity
+              ).toFixed(4)
+            );
+
+            for (let i = 0; i < this.selectedList[0].measureQuantity; i++) {
+              if (
+                this.selectedList[0].qualitySampleTemplateList == undefined ||
+                this.selectedList[0].qualitySampleTemplateList == null ||
+                this.selectedList[0].qualitySampleTemplateList.length == 0
+              ) {
+                this.sampleList.push({
+                  ...this.selectedList[0],
+                  sampleCode: await this.getSampleCode(),
+                  measureQuantity: 1,
+                  qualitySampleTemplateList: JSON.parse(
+                    JSON.stringify(this.schemeList)
+                  ),
+                  weight: newWeight || 0
+                });
+              } else {
+                this.sampleList.push({
+                  ...this.selectedList[0],
+                  sampleCode: await this.getSampleCode(),
+                  measureQuantity: 1,
+                  qualitySampleTemplateList: JSON.parse(
+                    JSON.stringify(
+                      this.selectedList[0].qualitySampleTemplateList
+                    )
+                  ),
+                  weight: newWeight || 0
+                });
+              }
+            }
+          }
+          //取整样=勾选数据
+          // this.sampleList = this.selectedList;
+          this.$message.success('取样成功!');
+        } else if (val == 2) {
+          console.log(data, 'datadatadatadataxiaoyang');
+        }
+      },
+      async handleSampleSubmit(data) {
+        console.log(data, 'data123确认');
+        this.sampleList = [];
+        if (!this.selectedList || this.selectedList.length == 0) {
+          this.$message.warning('请先选择样品!');
+          return;
+        }
+        const measureQ = data.measureQ || 1;
+        const unit = data.sampleUnit;
+        const sampleCount = Number(data.portion);
+        console.log(measureQ, '计量数量');
+        console.log(unit, '所选单位');
+        console.log(sampleCount, '数量');
+        try {
+          if (this.isStandard1OrWeightSample()) {
+            //抽检计量整样小样或者抽检计重小样
+            if (!this.validateMeasureQuantity(measureQ, unit, sampleCount))
+              return; //取样数量验证
+            if (unit === 'KG' && !this.validateWeight(measureQ, sampleCount))
+              return; // 若计量单位为重量,还需验证总重量是否足够
+
+            await this.getNewFullSampleList(
+              Math.ceil(sampleCount),
+              measureQ,
+              unit
+            );
+          } else if (this.isWeightStandardFullSample()) {
+            //抽检取计重取整样
+            if (!this.validateSampleCount(sampleCount)) return;
+            await this.handleWeightFullSample(sampleCount);
+          }
+          this.activeName = '2';
+        } catch (error) {
+          console.error('取样处理失败:', error);
+          this.$message.error('取样处理失败');
+        }
+      },
+      //获取样品编码
+      async getSampleCode() {
+        return await getCode('sample_code');
+      },
+      async getNewSampleList(measureQ, unit, nums) {
+        this.sampleList = [];
+
+        console.log(this.selectedList, 'this.selectedList');
+        if (!this.selectedList || this.selectedList.length == 0) {
+          this.$message.warning('请先选择来源清单!');
+          return;
+        }
+        this.activeName = '2';
+        if (this.form.isUnpack == 1) {
+          // 1 拆包 2 不拆
+          let measureQuantity = 1;
+          if (this.form.conditionType == 2) {
+            measureQuantity = measureQ;
+          }
+          for (let i = 0; i < this.selectedList.length; i++) {
+            if (
+              this.selectedList[i].qualitySampleTemplateList == undefined ||
+              this.selectedList[i].qualitySampleTemplateList == null ||
+              this.selectedList[i].qualitySampleTemplateList.length == 0
+            ) {
+              this.sampleList.push({
+                ...this.selectedList[i],
+                sampleCode: await this.getSampleCode(),
+                measureQuantity: measureQuantity,
+                qualitySampleTemplateList: JSON.parse(
+                  JSON.stringify(this.schemeList)
+                ),
+                measureUnit: unit
+              });
+            } else {
+              this.sampleList.push({
+                ...this.selectedList[i],
+                sampleCode: await this.getSampleCode(),
+                measureQuantity: measureQuantity,
+                qualitySampleTemplateList: JSON.parse(
+                  JSON.stringify(this.selectedList[i].qualitySampleTemplateList)
+                ),
+                measureUnit: unit
+              });
+            }
+          }
+        } else if (this.form.isUnpack == 2) {
+          if (this.form.conditionType == 1) {
+            measureQ = 1;
+          }
+          // 不拆计算每个重量
+          let newWeight = parseFloat(
+            (
+              this.selectedList[0].weight / this.selectedList[0].measureQuantity
+            ).toFixed(4)
+          );
+
+          for (let i = 0; i < nums; i++) {
+            if (
+              this.selectedList[0].qualitySampleTemplateList == undefined ||
+              this.selectedList[0].qualitySampleTemplateList == null ||
+              this.selectedList[0].qualitySampleTemplateList.length == 0
+            ) {
+              this.sampleList.push({
+                ...this.selectedList[0],
+                sampleCode: await this.getSampleCode(),
+                measureQuantity: measureQ,
+                qualitySampleTemplateList: JSON.parse(
+                  JSON.stringify(this.schemeList)
+                ),
+                measureUnit: unit,
+                weight: newWeight || 0
+              });
+            } else {
+              this.sampleList.push({
+                ...this.selectedList[0],
+                sampleCode: await this.getSampleCode(),
+                measureQuantity: measureQ,
+                qualitySampleTemplateList: JSON.parse(
+                  JSON.stringify(this.selectedList[0].qualitySampleTemplateList)
+                ),
+                measureUnit: unit,
+                weight: newWeight || 0
+              });
+              // this.sampleList.push({
+              //   ...this.selectedList[0],
+              //   sampleCode: await this.getSampleCode(),
+              //   measureQuantity: measureQ,
+              //   measureUnit: unit,
+              //   weight: newWeight || 0,
+              // });
+            }
+          }
+        }
+        // this.sampleList = this.selectedList.map(oldItem => {
+        //   const newItem = JSON.parse(JSON.stringify(oldItem));
+        //   newItem.measureQuantity = measureQ;
+        //   newItem.measureUnit = unit;
+        //   return newItem;
+        // });
+
+        this.$refs.tabsRef.tabsChange('2');
+      },
+
+      async queryQualitySamplContent() {
+        const res = await queryQualitySamplContent({
+          qualityWorkerId: this.dataWork.id,
+          size: 1000
+        });
+        let addStatus = res.list.map((item) => {
+          item.isValid = true;
+          item.disposeTime = item.disposeTime
+            ? item.disposeTime.split(' ')[0]
+            : null;
+          item.sampleDate = item.sampleDate
+            ? item.sampleDate.split(' ')[0]
+            : null;
+          return {
+            ...item
+          };
+        });
+        console.log(addStatus, '样品清单12123123');
+        if (addStatus.length > 0) {
+          this.sampleList = addStatus;
+          this.addStatus = addStatus;
+        } else {
+          this.getProSamList(this.packingList);
+        }
+      },
+      async queryQualityTempleContent() {
+        const res = await queryQualityTempleContent({
+          qualityWorkerId: this.dataWork.id
+        });
+        console.log(res, '质检方案');
+        this.schemeList = res.list;
+      },
+      getConditionType(val) {
+        this.form.conditionType = val;
+      },
+
+      /* 保存编辑 */
+      save() {
+        // *** 新增判断
+        let flag = this.$refs.baseInfoRefs.quantityCalculation();
+        if (!flag) return;
+        // ***
+        this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+          // this.loading = true;
+          let URL =
+            this.type == 'add' ? save : this.type == 'edit' ? update : '';
+
+          this.form.qualityTimeStart = new Date(this.qualityTimeStart);
+
+          delete this.form['qualityTimeEnd'];
+
+          let params = {
+            ...this.form,
+            sampleList: this.sampleList,
+            planTemplateList: this.schemeList,
+            templateList: this.schemeList,
+            qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
+          };
+          console.log(params, 'params ----');
+          URL(params)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              this.cancel();
+              this.$emit('done');
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
+      update() {
+        this.loading = true;
+        this.form['status'] = 1;
+        update({ ...this.form })
+          .then((msg) => {
+            this.loading = false;
+            this.$message.success(msg);
+            this.$emit('done');
+          })
+          .catch((e) => {
+            this.loading = false;
+          });
+      },
+      restForm() {
+        this.form = { ...this.defaultForm() };
+        this.$nextTick(() => {
+          this.$refs.baseInfoRefs.$refs.form1.clearValidate();
+        });
+      },
+      cancel() {
+        finishPageTab();
+        this.$router.go(-1);
+      },
+      handleDetail(index, row, type) {
+        if (!this.sampleList[index] || !this.schemeList) {
+          return;
+        }
+        const selectedData = [];
+        selectedData.push(this.sampleList[index]);
+        this.$refs.detailRef.openDia(
+          index,
+          row,
+          type,
+          selectedData,
+          null,
+          this.schemeList.toolList
+        );
+      },
+      inputWeight(row, index) {
+        console.log(row, index, '输入重量');
+
+        // 计算所有样本的总重量
+        const pNum = this.sampleList.reduce((sum, item) => {
+          return sum + Number(item.weight || 0);
+        }, 0);
+        this.form.totalWeight = parseFloat(pNum.toFixed(2));
+      },
+      handleDispose(index, row, type) {
+        if (!this.sampleList[index]) {
+          return;
+        }
+
+        this.sampleList[index].sampleDate = this.getNowTimes();
+
+        this.sampleList[index].disposeTime = this.getNowTimes();
+
+        console.log(index, row, type, this.qualityType);
+
+        this.$refs.disposeRef.openDispose(index, row, type, this.qualityType);
+      },
+      // 报工
+      handleReporting(index, row) {
+        if (this.form.qualityMode == 2 && !this.form.qualityResults) {
+          this.$refs.baseInfoRefs.toggleExpand2();
+          this.$message.error('请选择质检结果');
+          return;
+        }
+
+        this.$refs.baseInfoRefs.$refs.form1.validate((valid) => {
+          if (!valid) return false;
+          this.loading = true;
+
+          if (this.qualityType == 2 && this.isReportProcessProduce) {
+            for (let i = 0; i < this.sampleList.length; i++) {
+              const disposalStatus = this.sampleList[i].disposalStatus;
+
+              if (disposalStatus == null) {
+                this.loading = false;
+                this.$refs.tabsRef.tabsChange('2');
+                this.$message.error('请完成以下样品处置!');
+                return;
+              }
+            }
+          }
+
+          for (let i = 0; i < this.sampleList.length; i++) {
+            const qualityStatus = this.sampleList[i].qualityStatus;
+
+            if (qualityStatus == '2') {
+              this.loading = false;
+              this.$refs.tabsRef.tabsChange('2');
+              this.$message.error('请完成以下样品质检!');
+              return;
+            }
+          }
+
+          this.form.qualityTimeEnd = new Date(this.getNowTime());
+          this.form.qualityTimeStart = new Date(this.qualityTimeStart);
+
+          // if (this.form.qualityMode == 1) {
+          //   this.form.qualityResults = '';
+          // }
+
+          let params = {
+            ...this.form,
+            sampleList: this.sampleList,
+            planTemplateList: this.schemeList,
+            qualityInventoryList: this.$refs.tabsRef.$refs.sourceTable.getData()
+          };
+          console.log(params, 'params');
+          exeReportWork(params)
+            .then((msg) => {
+              this.loading = false;
+              this.$message.success(msg);
+              this.cancel();
+              this.$emit('done');
+            })
+            .catch((e) => {
+              this.loading = false;
+            });
+        });
+      },
+      // 处理确认事件
+      handleDisposeConfirm(data, index) {
+        console.log(data, index, '确认处置事件');
+
+        if (index != null) {
+          this.$set(this.sampleList, index, data);
+        } else {
+          this.sampleList.forEach((obj) => {
+            obj.disposalStatus = data.disposalStatus;
+            obj.sampleDate = data.sampleDate;
+            obj.disposeTime = data.disposeTime;
+            obj.sampleCondition = data.sampleCondition;
+            obj.producerManufacturer = data.producerManufacturer;
+            obj.samplePlace = data.samplePlace;
+            obj.sampleRemark = data.sampleRemark;
+          });
+        }
+      },
+      //确认质检
+      handleConfirm(list, index) {
+        console.log(list);
+
+        // 检查有效性
+        // for (const item of list) {
+        //   for (const child of item.qualitySampleTemplateList) {
+        //
+        //     console.log(child, 'child')
+        //     if (!child.qualityResultContent || !child.qualityResults) {
+        //       this.$message.error('请完善报工内容!');
+        //       return;
+        //     }
+        //   }
+        // }
+        console.log(list, 'listlistlistlist');
+        list.forEach((item) => {
+          if (item.qualitySampleTemplateList.length == 1) {
+            if (
+              item.qualitySampleTemplateList.some(
+                (child) => child.qualityResults === 3
+              )
+            ) {
+              // 如果质检项只有一条而且结果为让步接收那么整个就是让步接收
+              item.isValid = false;
+              item.qualityResults = 3;
+            } else if (
+              item.qualitySampleTemplateList.some(
+                (child) => child.qualityResults === 2
+              )
+            ) {
+              item.isValid = false;
+              item.qualityResults = 2;
+            } else {
+              item.isValid = true;
+              item.qualityResults = 1;
+            }
+          } else {
+            if (
+              item.qualitySampleTemplateList.some(
+                (child) => child.qualityResults === 2
+              )
+            ) {
+              item.isValid = false;
+              item.qualityResults = 2;
+            } else {
+              item.isValid = true;
+              item.qualityResults = 1;
+            }
+          }
+          item.qualityStatus = 1;
+        });
+        if (index != null) {
+          this.$set(this.sampleList, index, list[0]);
+        } else {
+          this.$set(this.sampleList, null, list);
+        }
+        this.activeName = '2';
+        console.log(this.sampleList, '222表');
+        // *** 选完批量质检调用
+        this.countQualityResults();
+      },
+      // 批量质检
+      batchQuality(index, row, type) {
+        this.$refs.detailRef.openDia(
+          null,
+          null,
+          'report',
+          this.sampleList,
+          null,
+          this.schemeList.toolList
+        );
+      },
+      // 批量处置
+      batchDispose() {
+        this.$refs.disposeRef.openDispose(
+          null,
+          null,
+          'dispose',
+          this.qualityType
+        );
+      },
+
+      //全检,检验标准改变时,重新获取样品列表
+      async changeInspectionStandardsModel(val) {
+        const sData = this.$refs.tabsRef.$refs.sourceTable.getData();
+        if (sData.length > 0) {
+          for (let i = 0; i < sData.length; i++) {
+            this.$set(sData[i], 'qualityStatus', 2);
+          }
+        }
+        this.form.inspectionStandards = val;
+        this.form.sampleNumber = '';
+        this.$refs.tabsRef.tableSelClear();
+        this.sampleList = [];
+        this.$refs.tabsRef.tabsChange('1');
+        //检验标准 2计重 1计量
+        if (this.form.inspectionStandards == 2 && this.form.qualityMode == 1) {
+          for (let i = 0; i < sData.length; i++) {
+            let qualitySampleTemplateList = [];
+            if (
+              sData[i].qualitySampleTemplateList == undefined ||
+              sData[i].qualitySampleTemplateList == null ||
+              sData[i].qualitySampleTemplateList.length == 0
+            ) {
+              qualitySampleTemplateList = JSON.parse(
+                JSON.stringify(this.schemeList)
+              );
+            } else {
+              qualitySampleTemplateList = sData[i].qualitySampleTemplateList;
+            }
+            this.sampleList.push({
+              ...sData[i],
+              sampleCode: await this.getSampleCode(),
+              qualitySampleTemplateList
+            });
+          }
+        } else if (
+          this.form.inspectionStandards == 1 &&
+          this.form.qualityMode == 1
+        ) {
+          this.getProSamList(sData);
+        }
+      },
+
+      //从来源数组取样到目标数组
+      async getNewFullSampleList(sampleCount, sampleQuantity, sampleUnit) {
+        const sourceArray = this.selectedList;
+        // 检查单位是否匹配
+        const isUnitMismatch =
+          sourceArray.length > 0 && sourceArray[0].measureUnit !== sampleUnit;
+
+        // 创建副本并计算初始可取样数量
+        const items = sourceArray.map((item) => ({
+          ...item,
+          remainingQuantity: isUnitMismatch
+            ? Infinity
+            : item['measureQuantity'], // 剩余可取样数量
+          maxPossible: item['measureQuantity'] / sampleQuantity // 最大取样次数
+        }));
+
+        const result = [];
+        let remainingCount = sampleCount;
+
+        // 尽可能均匀地从各条目取样
+        while (remainingCount > 0) {
+          // 按剩余可取样比例排序
+          items.sort(
+            (a, b) =>
+              b.remainingQuantity / b['measureQuantity'] -
+              a.remainingQuantity / a['measureQuantity']
+          );
+
+          let distributed = false;
+
+          for (const item of items) {
+            if (
+              !isUnitMismatch ||
+              (item.remainingQuantity >= sampleQuantity && remainingCount > 0)
+            ) {
+              let qualitySampleTemplateList = [];
+              if (
+                item.qualitySampleTemplateList == undefined ||
+                item.qualitySampleTemplateList == null ||
+                item.qualitySampleTemplateList.length == 0
+              ) {
+                qualitySampleTemplateList = JSON.parse(
+                  JSON.stringify(this.schemeList)
+                );
+              } else {
+                qualitySampleTemplateList = item.qualitySampleTemplateList;
+              }
+              // 添加到结果数组
+              let sampleCode = await this.getSampleCode();
+              if (
+                this.form.conditionType == 1 &&
+                this.form.inspectionStandards == 1
+              ) {
+                result.push({
+                  ...item,
+                  measureQuantity: 1,
+                  sampleCode,
+                  qualitySampleTemplateList
+                });
+              } else if (
+                this.form.conditionType == 2 &&
+                (this.form.inspectionStandards == 1 ||
+                  this.form.inspectionStandards == 2)
+              ) {
+                let weight = (item.weight / item.maxPossible).toFixed(2);
+                result.push({
+                  ...item,
+                  measureQuantity: sampleQuantity,
+                  measureUnit: sampleUnit,
+                  sampleCode,
+                  weight,
+                  qualitySampleTemplateList
+                });
+              }
+              // 更新剩余数量
+              if (!isUnitMismatch) {
+                item.remainingQuantity -= sampleQuantity;
+              }
+              remainingCount--;
+              distributed = true;
+            }
+          }
+
+          // 如果没有分配任何取样
+          if (!distributed) {
+            break;
+          }
+        }
+        this.sampleList = result;
+        this.form.sampleNumber = this.sampleList.length;
+      },
+      validateWeight(measureQ, sampleCount) {
+        let totalMaxPossible = 0;
+        this.selectedList.forEach((item) => {
+          totalMaxPossible += item.measureQuantity / measureQ;
+        });
+
+        if (totalMaxPossible < sampleCount) {
+          // this.formData.portion = totalMaxPossible;
+          this.$message.info(`最大取样条数为${totalMaxPossible}`);
+          return false;
+        }
+
+        let totalWeight = this.selectedList.reduce(
+          (sum, item) => sum + item.weight,
+          0
+        );
+        const weightUnit = this.selectedList[0].weightUnit;
+        if (weightUnit === 'G') totalWeight /= 1000;
+
+        if (measureQ * sampleCount > totalWeight) {
+          this.$message.info('取样计量重量不能大于总计量重量');
+          return false;
+        }
+
+        const invalidItem = this.selectedList.find((item) => {
+          const weight =
+            item.weightUnit === 'G' ? item.weight / 1000 : item.weight;
+          return weight < measureQ;
+        });
+
+        if (invalidItem) {
+          this.$message.info('勾选条目重量小于取样重量');
+          return false;
+        }
+
+        return true;
+      },
+
+      isStandard1OrWeightSample() {
+        return (
+          this.form.inspectionStandards === 1 ||
+          (this.form.inspectionStandards === 2 && this.form.conditionType == 2)
+        );
+      },
+      validateMeasureQuantity(measureQ, unit, sampleCount) {
+        if (this.form.conditionType == 2 && measureQ <= 0) {
+          this.$message.info('取样计量数量必须大于0');
+          return false;
+        }
+
+        const totalQuantity = this.selectedList.reduce(
+          (sum, item) => sum + item.measureQuantity,
+          0
+        );
+        if (
+          (this.selectedList[0].measureUnit === unit ||
+            this.form.conditionType == 1) &&
+          measureQ * sampleCount > totalQuantity
+        ) {
+          this.$message.info('取样计量数量不能大于总计量数量');
+          return false;
+        }
+
+        const invalidItem = this.selectedList.find(
+          (item) => item.measureQuantity < measureQ
+        );
+        if (invalidItem) {
+          this.$message.info('条目计量数量小于取样计量数量');
+          return false;
+        }
+
+        return true;
+      },
+
+      isWeightStandardFullSample() {
+        return (
+          this.form.inspectionStandards === 2 && this.form.conditionType == 1
+        );
+      },
+
+      validateSampleCount(sampleCount) {
+        const invalidItem = this.selectedList.find(
+          (item) => item.measureQuantity < sampleCount
+        );
+        if (invalidItem) {
+          this.$message.info('所选的条目计量数量小于取样计量数量');
+          return false;
+        }
+        return true;
+      },
+
+      async handleWeightFullSample(sampleCount) {
+        for (const item of this.selectedList) {
+          const qualitySampleTemplateList = item.qualitySampleTemplateList
+            ?.length
+            ? JSON.parse(JSON.stringify(item.qualitySampleTemplateList))
+            : JSON.parse(JSON.stringify(this.schemeList));
+          this.sampleList.push({
+            ...item,
+            measureQuantity: sampleCount, //作为计量数量
+            sampleCode: await this.getSampleCode(),
+            qualitySampleTemplateList
+          });
+        }
+        this.sampleNumber = this.sampleList.length;
+      },
+
+      //计算合格率
+      countQualityResults() {
+        let sampleList = this.sampleList; //样品清单
+        let sampleNumber = this.form.total; //样品总数
+        console.log(sampleList, sampleNumber, '=====');
+        // let qualifiedNumber = sampleList.filter(item => item.qualityResults == 1 || item.qualityResults == 3).length;
+        // let noQualifiedNumber = sampleList.filter(
+        //   (item) => item.qualityResults == 2
+        // ).length;
+        let noQualifiedNumber = sampleList.reduce((acc, pro) => {
+          // console.log(acc, pro);
+          // if (pro.qualityResults == 2) {
+          //   return acc + Number(pro.measureQuantity);
+          // }
+          return pro.qualityResults == 2
+            ? acc + Number(pro.measureQuantity)
+            : acc;
+        }, 0);
+        console.log(noQualifiedNumber, 'noQualifiedNumber');
+        let qualifiedNumber = sampleNumber - noQualifiedNumber; //不合格数
+        let qualificationRate = (
+          (qualifiedNumber / sampleNumber) *
+          100
+        ).toFixed(2); //合格率
+        let noQualificationRate = (
+          (noQualifiedNumber / sampleNumber) *
+          100
+        ).toFixed(2); //不合格率
+        this.$refs.baseInfoRefs.updateQualificationRate(
+          qualifiedNumber,
+          noQualifiedNumber,
+          qualificationRate,
+          noQualificationRate
+        );
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 42 - 5
src/views/produce/index.vue

@@ -29,7 +29,7 @@
             >
             </el-tree>
 
-            <!-- 
+            <!--
               v-loading="treeLoading"
               :node-key="nodeKey"
               ref="tree"
@@ -158,6 +158,15 @@
                   ref="jobRef"
                   :reportNeedFeed="reportNeedFeed"
                 ></jobBooking>
+
+                <!-- <workPlan
+                  style="width: 100%"
+                  v-else
+                  :workListIds="workListIds"
+                  ref="jobRef"
+                  :reportNeedFeed="reportNeedFeed"
+                >
+                </workPlan> -->
               </div>
 
               <!-- 质检工序 -->
@@ -211,6 +220,10 @@
 
     <!-- 工艺文件 -->
     <wokePopup ref="wokePopupRef"></wokePopup>
+    <!-- 检验报工 -->
+    <workPlan ref="jobRefs"> </workPlan>
+    <!-- <workes ref="jobRefs"> </workes> -->
+
     <!-- :workListIds="workListIds" :taskId="taskObj.id" -->
   </div>
 </template>
@@ -218,7 +231,8 @@
 <script>
   import Search from './components/search.vue';
   import footBtn from './components/footBtn.vue';
-  import produceOrder from './components/produceOrder.vue';
+  // import produceOrder from './components/produceOrder.vue';
+  import produceOrder from './components/new_produceOrder.vue';
   import productionResource from './components/productionResource/index.vue';
   import outsourcing from './components/outsourcing/index.vue';
   import picking from './components/picking/index.vue';
@@ -230,6 +244,8 @@
   import feeding from './components/feeding/index.vue';
 
   import jobBooking from './components/jobBooking/index.vue';
+  import workPlan from './components/workPlan/index.vue';
+  import workes from './components/workPlan/components/work.vue';
   import warehousing from './components/warehousing/index.vue';
   import outsourceList from './components/outsourcing/outsourceList.vue';
 
@@ -258,7 +274,9 @@
       AssetTree,
       jobBooking,
       inspection,
-      warehousing
+      warehousing,
+      workPlan,
+      workes
     },
     data() {
       return {
@@ -296,7 +314,8 @@
         feedNeedEquipment: 0, //投料是否要添加生产设备1是0否
         reportNeedFeed: 0, //生产质检是否需要处置再报工1是0否
         singleReportInspection: null, //获取选中的工单是单个还是批量
-        workTaskId: null //选中的工单工序id
+        workTaskId: null, //选中的工单工序id
+        workData: {}
       };
     },
 
@@ -397,6 +416,10 @@
         this.$store.commit('user/setTaskObj', taskObj);
       },
 
+      handleChoose(val) {
+        console.log(val);
+      },
+
       // 获取工序列表
       getTaskList() {
         listTask().then((res) => {
@@ -460,6 +483,7 @@
         this.isStep = true;
         this.operationType = null;
         this.workListIds = data.ids;
+        this.workData = data.list[0];
       },
 
       pickingWokeClose() {
@@ -468,7 +492,6 @@
 
       footBtn(t) {
         this.operationType = t;
-
         if (
           Object.keys(this.$store.state.user.taskObj).length === 0 &&
           this.$store.state.user.taskObj.constructor === Object
@@ -483,6 +506,19 @@
           }
         }
 
+        // console.log('按钮被点击了.....', t);
+        if (t === 'job') {
+          let req = {
+            taskId: this.taskObj.id,
+            workOrderId: this.workListIds[0],
+            data: this.workData
+          };
+
+          if (this.taskObj.id == '1916800744740663298') {
+            this.$refs.jobRefs.open(req);
+          }
+        }
+
         if (t == 'pick') {
           this.$nextTick(() => {
             this.$refs.pickListRef.getList(this.workListIds);
@@ -572,6 +608,7 @@
       },
 
       rowClick(row, taskId) {
+        console.log(row, taskId, 'row');
         if (taskId) {
           let params = {
             categoryId: row.categoryId,

+ 2 - 1
vue.config.js

@@ -35,7 +35,8 @@ module.exports = {
         // target: 'http://192.168.1.116:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.103:18086',
-        target: 'http://192.168.1.251:18086',
+        // target: 'http://192.168.1.251:18086',
+        target: 'http://192.168.1.125:18086',
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {
           '^/api': ''