695593266@qq.com 7 месяцев назад
Родитель
Сommit
2db5c3c57c

+ 13 - 11
src/api/byProduct/index.js

@@ -10,7 +10,6 @@ export async function getPage(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 获取列表
 export async function getMaterialList(data) {
   const res = await request.get(`/main/category/getList`, {
@@ -22,30 +21,33 @@ export async function getMaterialList(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-
 // 新建副产品处置
 
 export async function listDisposeBy(data) {
-  const res = await request.post(`/mes/disposeorder/listDisposeByWorkOrderIds`,data);
+  const res = await request.post(
+    `/mes/disposeorder/listDisposeByWorkOrderIds`,
+    data
+  );
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
 // 新建副产品回收
 export async function disposeSave(data) {
-  const res = await request.post(`/mes/disposeorder/save`,data);
+  const res = await request.post(`/mes/disposeorder/save`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
 }
 
-
-
-
-
-
+// 副产品处置
+export async function byProductDisposal(data) {
+  const res = await request.post(`/mes/disposeorder/dispose`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 42 - 9
src/api/entrust/index.js

@@ -1,6 +1,5 @@
 import request from '@/utils/request';
 
-
 /**
  * 列表
  */
@@ -12,9 +11,18 @@ export async function getList(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
-//新建/修改
+//新建
 export async function save(data) {
-  const res = await request.post('/mes/please_entrust_management/' + (data.id ? 'update' : 'add'), data);
+  const res = await request.post(`/mes/please_entrust_management/add`, data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//修改
+export async function update(data) {
+  const res = await request.post(`/mes/please_entrust_management/update`, data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -23,7 +31,9 @@ export async function save(data) {
 
 // 删除
 export async function remove(data) {
-  const res = await request.delete('/mes/please_entrust_management/remove' ,{data});
+  const res = await request.delete('/mes/please_entrust_management/remove', {
+    data
+  });
   if (res.data.code == 0) {
     return res.data.message;
   }
@@ -37,12 +47,35 @@ export async function submit(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-// please_entrust_management/warehouseEntry/?id=132133123&warehouseId=123131
-// 申请入库
-export async function warehouseEntry (params) {
-  const res = await request.get(`/mes/please_entrust_management/warehouseEntry`, { params });
+
+export async function warehouseEntry(params) {
+  const res = await request.get(
+    `/mes/please_entrust_management/warehouseEntry`,
+    { params }
+  );
   if (res.data.code == 0) {
     return res.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}
+
+//直接提交
+export async function addSubmit(data) {
+  const res = await request.post(
+    '/mes/please_entrust_management/addAndSubmit',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
+//获取详情
+export async function pleaseEntrustDetail(id) {
+  const res = await request.get(`/mes/please_entrust_management/getById/${id}`);
+  if (res.data.code == 0) {
+    return res.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}

+ 25 - 3
src/views/byProduct/index.vue

@@ -82,7 +82,7 @@
 </template>
 
 <script>
-  import { getPage } from '@/api/byProduct/index';
+  import { getPage, byProductDisposal } from '@/api/byProduct/index';
   import byProductSearch from './components/byProduct-search.vue';
   import addByProduct from './components/addByProduct.vue';
   import { getWarehouseList } from '@/api/mes';
@@ -105,7 +105,8 @@
         form: {
           warehouseId: ''
         },
-        tableHeight: 'calc(100vh - 300px)'
+        tableHeight: 'calc(100vh - 300px)',
+        disposeData: null
       };
     },
     computed: {
@@ -243,10 +244,31 @@
       },
 
       warehouseSave() {
-        this.visible = false;
+        if (!this.form.warehouseId) {
+          return this.$message.warning('请选择仓库');
+        }
+
+        const data = this.warehouseList.filter(
+          (it) => this.form.warehouseId == it.id
+        );
+
+        let parm = {
+          id: this.disposeData.id,
+          warehouseCode: data[0].code,
+          warehouseName: data[0].name,
+          warehouseId: data[0].id
+        };
+
+        byProductDisposal(parm).then((res) => {
+          this.$message.success('处置成功');
+          this.reload();
+          this.visible = false;
+        });
       },
 
       disopseProduct(item) {
+        this.disposeData = item;
+        this.form.warehouseId = '';
         this.visible = true;
       },
 

+ 454 - 192
src/views/entrust/components/create.vue

@@ -1,6 +1,7 @@
 <template>
   <ele-modal
     :visible.sync="visible"
+    v-if="visible"
     :title="title"
     width="75vw"
     append-to-body
@@ -60,56 +61,14 @@
             </el-select>
           </el-form-item>
         </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
-          <el-form-item label="编码:" prop="code">
-            <el-input v-model="form.code" disabled />
-          </el-form-item>
-        </el-col>
+
         <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
           <el-form-item label="名称:" prop="name">
             <el-input v-model="form.name" :disabled="type == 'detail'" />
           </el-form-item>
         </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
-          <el-form-item label="生产工单:" prop="workOrderCode">
-            <el-input
-              v-model="form.workOrderCode"
-              placeholder="请选择"
-              style="width: 100%"
-              clearable
-              :disabled="type == 'detail'"
-              @click.native="addProduct"
-            >
-            </el-input>
-          </el-form-item>
-        </el-col>
-        <el-col v-bind="styleResponsive ? { lg: 6, md: 24 } : { span: 6 }">
-          <el-form-item label="工序:" prop="procedureList">
-            <el-select
-              style="width: 100%"
-              v-model="form.procedureList"
-              multiple
-              placeholder="请选择"
-              clearable
-              :disabled="type == '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="请托部门:" prop="pleaseEntrustDeptName">
-            <!-- <deptSelect
-              :disabled="type == 'detail'"
-              v-model="form.pleaseEntrustDeptId"
-              @changeGroup="searchDeptNodeClick"
-            /> -->
             <el-input v-model="form.pleaseEntrustDeptName" clearable disabled>
             </el-input>
           </el-form-item>
@@ -117,22 +76,6 @@
         <el-col :span="6">
           <el-form-item label="请托人:" prop="pleaseEntrustUserId">
             <el-input v-model="form.pleaseEntrustUserName" clearable disabled />
-
-            <!-- <el-select
-              :disabled="type == 'detail'"
-              v-model="form.pleaseEntrustUserId"
-              size="small"
-              style="width: 100%"
-              filterable
-            >
-              <el-option
-                v-for="item in executorList"
-                :key="item.id"
-                :value="item.id"
-                @click.native="changeExecutor(item)"
-                :label="item.name"
-              ></el-option>
-            </el-select> -->
           </el-form-item>
         </el-col>
         <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 6 }">
@@ -170,7 +113,7 @@
             />
           </el-form-item>
         </el-col>
-        <el-col :span="6">
+        <!-- <el-col :span="6">
           <el-form-item label="完成时间:" prop="finishTime">
             <el-date-picker
               style="width: 100%"
@@ -191,97 +134,87 @@
               :disabled="type == 'detail'"
             />
           </el-form-item>
-        </el-col>
-        <!-- <el-col :span="8">
-          s
         </el-col> -->
       </el-row>
       <headerTitle title="产品信息" style="margin-top: 15px"></headerTitle>
 
-      <el-table :data="form.pleaseEntrustObjList" border height="40vh">
-        <el-table-column label="序号" align="center" width="60">
-          <template slot-scope="scope">
-            <span>{{ scope.$index + 1 }}</span>
-          </template>
-        </el-table-column>
-
-        <el-table-column label="产品名称" align="center" prop="productName">
-        </el-table-column>
-        <el-table-column label="产品编码" align="center" prop="productCode">
-        </el-table-column>
-        <el-table-column label="牌号" align="center" prop="brandNo">
-        </el-table-column>
-        <el-table-column label="批次号" align="center" prop="batchNo">
-        </el-table-column>
-        <!-- <el-table-column label="型号" align="center" prop="model">
-        </el-table-column> -->
-        <el-table-column label="规格" align="center" prop="specification">
-        </el-table-column>
-        <el-table-column label="数量" align="center" prop="productNumber">
-          <template slot-scope="scope">
-            <el-form-item
-              label-width="0px"
-              :prop="'pleaseEntrustObjList.' + scope.$index + '.productNumber'"
-              :rules="[
-                {
-                  required: true,
-                  message: '请输入数量',
-                  trigger: 'blur'
-                }
-              ]"
-            >
-              <el-input
-                :disabled="type == 'detail'"
-                v-model.number="scope.row.productNumber"
-                size="small"
-                oninput="value=value.replace(/[^\d]/g,'')"
-                style="width: 100%"
-                placeholder="输入数量"
-              ></el-input>
-            </el-form-item>
-          </template>
-        </el-table-column>
-        <el-table-column
-          label="完成时间"
-          align="center"
-          prop="finishTime"
-          width="180"
-        >
-          <template slot-scope="scope">
-            <el-form-item
-              label-width="0px"
-              :prop="'pleaseEntrustObjList.' + scope.$index + '.finishTime'"
-              :rules="[
-                {
-                  required: true,
-                  message: '请选择',
-                  trigger: 'blur'
-                }
-              ]"
+      <el-button
+        size="small"
+        type="primary"
+        icon="el-icon-plus"
+        class="ele-btn-icon"
+        @click="addOder"
+        style="margin-bottom: 10px"
+      >
+        新建
+      </el-button>
+
+      <el-button
+        size="small"
+        type="danger"
+        icon="el-icon-delete"
+        class="ele-btn-icon"
+        @click="removeOder"
+        plain
+        style="margin-bottom: 10px"
+      >
+        删除
+      </el-button>
+
+      <ele-pro-table
+        ref="entrustCreateTable"
+        :columns="columns"
+        :datasource="orderList"
+        :selection.sync="selection"
+        :current.sync="current"
+        highlight-current-row
+        row-key="id"
+        height="40vh"
+      >
+        <template v-slot:totalCount="{ row }">
+          <el-input v-model="row.totalCount"> </el-input>
+        </template>
+
+        <template v-slot:describes="{ row }">
+          <el-input v-model="row.describes"> </el-input>
+        </template>
+
+        <template v-slot:taskId="{ row, $index }">
+          <el-select
+            clearable
+            filterable
+            style="width: 100%"
+            v-model="row.taskId"
+            placeholder="请选择"
+            @change="taskListChange(row, $index)"
+          >
+            <el-option
+              v-for="item in row.taskList"
+              :label="item.name"
+              :value="item.id"
+              :key="item.id"
             >
-              <el-date-picker
-                :disabled="type == 'detail'"
-                style="width: 100%"
-                v-model="scope.row.finishTime"
-                type="date"
-                value-format="yyyy-MM-dd"
-              ></el-date-picker>
-            </el-form-item>
-          </template>
-        </el-table-column>
-      </el-table>
+            </el-option>
+          </el-select>
+        </template>
+
+        <template v-slot:planDeliveryTime="{ row }">
+          <el-date-picker
+            v-model="row.planDeliveryTime"
+            type="datetime"
+            placeholder="选择日期时间"
+            format="yyyy-MM-dd HH:mm:ss"
+            value-format="yyyy-MM-dd HH:mm:ss"
+          >
+          </el-date-picker>
+        </template>
+      </ele-pro-table>
     </el-form>
 
     <template v-slot:footer>
       <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="save(1)"> 保存 </el-button>
+      <el-button type="primary" @click="save(2)"> 提交 </el-button>
     </template>
     <detail
       v-if="activeComp === 'bpm' && form.processInstanceId"
@@ -293,7 +226,7 @@
 </template>
 
 <script>
-  import { save } from '@/api/entrust/index';
+  import { save, addSubmit, pleaseEntrustDetail } from '@/api/entrust/index';
   import produceOrder from './produceOrder';
   import detail from '@/views/bpm/processInstance/detail.vue';
   import deptSelect from '@/components/CommomSelect/dept-select.vue';
@@ -333,8 +266,14 @@
     data() {
       return {
         visible: false,
-        loading: false,
+        loading: null,
         activeComp: 'main',
+        planType: [
+          { label: '所有计划类型', value: null },
+          { label: '内销计划', value: '1' },
+          { label: '外销计划', value: '2' },
+          { label: '预制计划', value: '3' }
+        ],
         options: [
           {
             name: '一般',
@@ -361,12 +300,225 @@
           beEntrustedDeptId: [
             { required: true, message: '请选择', trigger: 'change' }
           ],
-          finishTime: [{ required: true, message: '请选择', trigger: 'change' }]
+          finishTime: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          beEntrustedFactoriesId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ]
         },
         type: '',
         title: '创建',
         produceTaskList: [],
-        factoryList: []
+        factoryList: [],
+        orderList: [],
+        selection: [],
+        current: null,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'categoryName',
+            label: '产品名称',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'apsWorkOrderCode',
+            label: '生产订单号',
+            slot: 'apsWorkOrderCode',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productionPlanCode',
+            label: '计划编号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNum',
+            label: '牌号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'describes',
+            slot: 'describes',
+            label: '需求描述',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'totalCount',
+            slot: 'totalCount',
+            label: '请托数量',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planType',
+            label: '计划类型',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              const obj = this.planType.find((i) => i.value == row.planType);
+              return obj && obj.label;
+            }
+          },
+          {
+            prop: 'code',
+            label: '生产工单号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'name',
+            label: '名称',
+            width: 130,
+            showOverflowTooltip: true,
+            align: 'center'
+          },
+          {
+            prop: 'modelType',
+            label: '型号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'bomType',
+            label: 'BOM分类',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomType == 1) {
+                return '产品(PBOM)';
+              }
+              if (row.bomType == 2) {
+                return '加工(MBOM)';
+              }
+              if (row.bomType == 3) {
+                return '装配(ABOM)';
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'bomCategoryVersions',
+            label: 'BOM版本',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomCategoryName) {
+                return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'taskId',
+            slot: 'taskId',
+            label: '工序',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planDeliveryTime',
+            slot: 'planDeliveryTime',
+            label: '完成日期',
+            align: 'center',
+            minWidth: 260
+          },
+          {
+            prop: 'planStartTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            sortable: true
+          },
+          {
+            prop: 'planCompleteTime',
+            label: '计划结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            sortable: true
+          },
+          {
+            prop: 'startTime',
+            label: '工单开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            sortable: true
+          },
+          {
+            prop: 'completeTime',
+            label: '工单结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            sortable: true
+          }
+          // {
+          //   prop: 'priority',
+          //   label: '优先级',
+          //   align: 'center',
+          //   minWidth: 120
+          // }
+        ]
       };
     },
 
@@ -382,21 +534,72 @@
     methods: {
       open(type, row) {
         this.visible = true;
+        this.orderList = [];
+        if (type == 'add') {
+          this.form.pleaseEntrustDeptName =
+            this.$store.state.user.info.groupName;
+          this.form.pleaseEntrustDeptId = this.$store.state.user.info.groupId;
+          this.form.pleaseEntrustUserName = this.$store.state.user.info.name;
+          this.form.pleaseEntrustUserId = this.$store.state.user.info.userId;
 
-        (this.activeComp = 'main'), (this.type = type);
-        if (type != 'add') {
-          this.form = JSON.parse(JSON.stringify(row));
-          this.getProduceTaskList();
-          this.form.procedureList = this.form.procedureList.map(
-            (item) => item.produceTaskId
+          const data = this.factoryList.filter(
+            (it) => it.factoryId == this.$store.state.user.info.factoryId
           );
-          this.form.type = this.form.type + '';
+
+          if (data.length != 0) {
+            this.form.factoriesId = data[0].factoryId;
+            this.form.factoriesName = data[0].factoryName;
+          }
+        } else if (type == 'edit') {
+          this.getDetail(row.id);
         }
+
         this.title = type == 'add' ? '新增' : type == 'edit' ? '修改' : '详情';
       },
 
-      addProduct() {
-        this.$refs.produceOrderRef.open();
+      addOder() {
+        this.$refs.produceOrderRef.open(this.orderList);
+      },
+
+      async getDetail(id) {
+        await pleaseEntrustDetail(id).then((res) => {
+          this.form.pleaseEntrustDeptName = res.data.applyDeptName;
+          this.form.pleaseEntrustDeptId = res.data.applyDeptId;
+          this.form.pleaseEntrustUserName = res.data.createUserName;
+          this.form.pleaseEntrustUserId = res.data.createUserId;
+          this.form.factoriesId = res.data.applyFactoriesId;
+          this.form.factoriesName = res.data.applyFactoriesName;
+          this.form.beEntrustedDeptId = res.data.beEntrustedDeptId;
+          this.form.beEntrustedDeptName = res.data.beEntrustedDeptName;
+          this.form.beEntrustedFactoriesName =
+            res.data.beEntrustedFactoriesName;
+          this.form.beEntrustedFactoriesId = res.data.beEntrustedFactoriesId;
+          this.form.name = res.data.name;
+          this.form.type = res.data.type;
+          this.form.priority = res.data.priority;
+
+          res.data.taskList = [];
+
+          this.orderList.push(this.deepCopy(res.data));
+
+          // console.log(this.orderList, 'this.orderListthis.orderList');
+          this.getOrderTaskList();
+        });
+      },
+
+      removeOder() {
+        this.$confirm('此操作将删除这些工单, 是否继续?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            for (let item of this.selection) {
+              const index = this.orderList.findIndex((it) => it.id == item.id);
+              this.orderList.splice(index, 1);
+            }
+          })
+          .catch(() => {});
       },
 
       beEntrustedDeptIdChange(val, row) {
@@ -405,6 +608,7 @@
       factoryListChange(row) {
         this.form.beEntrustedFactoriesName = row.name;
       },
+
       async getFactoryList() {
         const { list } = await warehouseDefinition.getFactoryarea({
           pageNum: 1,
@@ -418,57 +622,115 @@
         this.produceTaskList = [];
         this.visible = false;
       },
-      choose(data) {
-        this.form.workOrderCode = data.code;
-        this.form.produceRoutingId = data.produceRoutingId;
-        this.form.produceRoutingName = data.produceRoutingName;
-        this.form.pleaseEntrustObjList = [data];
-        this.form.procedureList = [];
-        this.getProduceTaskList();
-      },
-      async getProduceTaskList() {
-        const res = await getProduceTaskList({
-          isDetail: true,
-          pageNum: 1,
-          routingId: this.form.produceRoutingId,
-          size: -1
+      choose(list) {
+        if (list.length == 0) {
+          this.orderList = [];
+          return;
+        }
+
+        const existingKeys = new Set(
+          this.orderList.map((i) => i.id || i.apsWorkOrderCode)
+        );
+        const data = list.filter(
+          (item) => !existingKeys.has(item.id || item.apsWorkOrderCode)
+        );
+
+        data.forEach((item) => {
+          item.describes = '';
+          item.totalCount = '';
+          item.taskList = [];
+          item.taskId = '';
+          item.taskName = '';
+          item.beEntrustedFactoriesId = '';
+          item.beEntrustedFactoriesName = '';
+          item.status = '';
+          item.beEntrustedDeptName = '';
+          item.beEntrustedDeptId = '';
+          item.categoryName = item.productName;
+          item.categoryCode = item.productCode;
+          item.brandNum = item.brandNo;
+          item.modelType = item.model;
+          item.name = this.form.name;
+          item.type = this.form.type;
+          item.planDeliveryTime = item.startTime;
+          item.applyDeptId = this.form.pleaseEntrustDeptId;
+          item.applyDeptName = this.form.pleaseEntrustDeptName;
+          item.applyFactoriesId = this.form.factoriesId;
+          item.applyFactoriesName = this.form.factoriesName;
+          this.orderList.push(this.deepCopy(item));
         });
-        console.log(res, 'res');
-        this.produceTaskList = res.list;
+
+        this.getOrderTaskList();
       },
-      /* 保存编辑 */
-      save() {
+
+      async getOrderTaskList() {
+        for (const item of this.orderList) {
+          const res = await getProduceTaskList({
+            isDetail: true,
+            pageNum: 1,
+            routingId: item.produceRoutingId,
+            size: -1
+          });
+
+          item.taskList = res.list;
+        }
+      },
+
+      deepCopy(obj, hash = new WeakMap()) {
+        if (obj === null) return null;
+        if (obj instanceof Date) return new Date(obj);
+        if (obj instanceof RegExp) return new RegExp(obj);
+        if (typeof obj !== 'object' && typeof obj !== 'function') return obj;
+        if (hash.has(obj)) return hash.get(obj);
+
+        const result = Array.isArray(obj) ? [] : {};
+        hash.set(obj, result);
+
+        return Object.keys(obj).reduce((acc, key) => {
+          acc[key] = this.deepCopy(obj[key], hash);
+          return acc;
+        }, result);
+      },
+
+      taskListChange(item, index) {
+        const data = item.taskList.filter((it) => it.id == item.taskId);
+
+        this.orderList[index].taskName = data[0].name;
+      },
+
+      save(type) {
         this.$refs.form.validate((valid) => {
           if (!valid) {
             return false;
           }
 
-          // for (let key in this.form) {
-          //   if (key.includes('create')) {
-          //     this.form[key] = '';
-          //   }
-          // }
-          this.loading = true;
-          let data = JSON.parse(JSON.stringify(this.form));
-          data.procedureList = data.procedureList.map((item) => {
-            return {
-              produceTaskId: item,
-              produceTaskName: this.produceTaskList.find(
-                (val) => val.id == item
-              ).name
-            };
+          this.orderList.forEach((item) => {
+            item.beEntrustedFactoriesId = this.form.beEntrustedFactoriesId;
+            item.beEntrustedFactoriesName = this.form.beEntrustedFactoriesName;
+            item.beEntrustedDeptName = this.form.beEntrustedDeptName;
+            item.beEntrustedDeptId = this.form.beEntrustedDeptId;
+            item.name = this.form.name;
+            item.status = type == 1 ? 0 : 1;
+            item.approvalStatus = type == 1 ? 0 : 1;
           });
-          // console.log(data);
-          // return;
-          save(data)
+
+          const URL = type == 1 ? save : addSubmit;
+
+          this.loading = this.$loading({
+            lock: true,
+            text: '加载中',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+
+          URL(this.orderList)
             .then((res) => {
-              this.loading = false;
+              this.loading.close();
               this.$message.success('成功');
               this.cancel();
               this.$emit('refresh');
             })
             .catch((e) => {
-              this.loading = false;
+              this.loading.close();
             });
         });
       }

+ 0 - 5
src/views/entrust/components/order-search.vue

@@ -15,11 +15,6 @@
           ></DictSelection>
         </el-form-item>
       </el-col>
-      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { 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: 12 } : { span: 6 }">
         <el-form-item label="名称:">
           <el-input clearable v-model="where.name" placeholder="请输入" />

+ 712 - 216
src/views/entrust/components/produceOrder.vue

@@ -10,6 +10,7 @@
     title="生产工单"
   >
     <div>
+      <seek-page :seekList="seekList" @search="search"></seek-page>
       <el-row>
         <el-col :span="24" class="table_col" v-if="equipmentdialog">
           <ele-pro-table
@@ -21,7 +22,8 @@
             highlight-current-row
             row-key="id"
             height="50vh"
-            @done="onDone"
+            :pageSize="20"
+            @update:selection="handleSelectionChange"
           >
           </ele-pro-table>
         </el-col>
@@ -35,237 +37,731 @@
 </template>
 
 <script>
-import { produceOrder } from '@/api/aps/index.js';
+  import { produceOrder } from '@/api/aps/index.js';
+  import produceOrderSearch from './produceOrderSearch.vue';
 
-export default {
-  components: {},
-  props: {
-    selectList: Array,
-    type: {
-      default: 2 //1多选 2单选
-    }
-  },
-  data() {
-    return {
-      planType: [
-        { label: '所有计划类型', value: null },
-        { label: '内销计划', value: '1' },
-        { label: '外销计划', value: '2' },
-        { label: '预制计划', value: '3' }
-      ],
-      equipmentdialog: false,
-      current: null,
-      columns: [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center',
-          reserveSelection: true,
-          show: this.type == 1
+  export default {
+    components: { produceOrderSearch },
+    props: {
+      selectList: Array,
+      type: {
+        default: 2 //1多选 2单选
+      }
+    },
+    data() {
+      return {
+        planType: [
+          { label: '所有计划类型', value: null },
+          { label: '内销计划', value: '1' },
+          { label: '外销计划', value: '2' },
+          { label: '预制计划', value: '3' }
+        ],
+        statusOpt: {
+          first: [
+            { label: '所有状态', value: '5,4' },
+            { label: '待生产', value: '4' },
+            { label: '生产中', value: '5' }
+            // { label: '已延期', value: '7' }
+          ],
+          second: [{ label: '已完成', value: '6' }]
         },
-        {
-          label: '生产工单号',
-          align: 'center',
-          prop: 'code',
+        equipmentdialog: false,
+        current: null,
+        columns: [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            reserveSelection: true
+          },
+          {
+            label: '生产工单号',
+            align: 'center',
+            prop: 'code',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
 
-          minWidth: 110
-        },
+          {
+            prop: 'productionPlanCode',
+            label: '计划编号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planType',
+            label: '计划类型',
+            align: 'center',
+            formatter: (row) => {
+              const obj = this.planType.find((i) => i.value == row.planType);
+              return obj && obj.label;
+            },
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productName',
+            label: '产品名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
 
-        {
-          prop: 'productionPlanCode',
-          label: '计划编号',
-          align: 'center',
-          minWidth: 110
-        },
-        {
-          prop: 'planType',
-          label: '计划类型',
-          align: 'center',
-          formatter: (row) => {
-            const obj = this.planType.find((i) => i.value == row.planType);
-            return obj && obj.label;
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            sortable: 'custom',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'formingNum',
+            label: '要求生产数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formingWeight',
+            label: '要求生产重量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formedNum',
+            label: '已生产数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formedWeight',
+            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
+          },
+
+          {
+            prop: 'teamName',
+            label: '班组',
+            align: 'center',
+            showOverflowTooltip: true
           }
-        },
-        {
-          prop: 'produceRoutingName',
-          label: '工艺路线',
-          align: 'center'
-        },
-        {
-          prop: 'productCode',
-          label: '产品编码',
-          align: 'center'
-        },
-        {
-          prop: 'productName',
-          label: '产品名称',
-          align: 'center'
-        },
-        {
-          prop: 'brandNo',
-          label: '牌号',
-          align: 'center'
-        },
-        {
-          prop: 'specification',
-          label: '规格',
-          align: 'center'
-        },
-        {
-          prop: 'model',
-          label: '型号',
-          align: 'center'
-        },
-        {
-          prop: 'batchNo',
-          label: '批次号',
-          align: 'center',
-          minWidth: 100,
-          showOverflowTooltip: true
-        },
+        ],
+        categoryLevelId: null,
+        code: null,
+        selection: [],
+        ids: [],
+        allSelection: []
+      };
+    },
 
-        {
-          prop: 'priority',
-          label: '优先级',
-          align: 'center',
-          minWidth: 120,
-          sortable: 'custom'
-        },
+    computed: {
+      // 表格列配置
+      seekList() {
+        return [
+          {
+            label: '关键字:',
+            value: 'keyWord',
+            type: 'input',
+            placeholder: ''
+          },
+          {
+            label: '生产工单号:',
+            value: 'code',
+            type: 'input',
+            placeholder: '',
+            labelWidth: 100
+          },
+          {
+            label: '生产订单号:',
+            value: 'apsWorkOrderCode',
+            type: 'input',
+            labelWidth: 100
+          },
+          {
+            label: '计划编号:',
+            value: 'productionPlanCode',
+            type: 'input',
+            width: 240
+          },
+          {
+            label: '计划类型:',
+            value: 'planType',
+            type: 'select',
 
-        {
-          prop: 'formingNum',
-          label: '要求生产数量',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'formingWeight',
-          label: '要求生产重量',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'formedNum',
-          label: '已生产数量',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'formedWeight',
-          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
-        },
+            placeholder: '',
+            width: 240,
+            // 加载状态
+            planList: this.planType
+          },
+          {
+            label: '工艺路线',
+            value: 'produceRoutingName',
+            type: 'input',
 
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
+            placeholder: '',
+            width: 240
+          },
+          {
+            label: '产品编码',
+            value: 'productCode',
+            type: 'input',
 
-        {
-          prop: 'teamName',
-          label: '班组',
-          align: 'center',
-          showOverflowTooltip: true
-        }
-      ],
-      categoryLevelId: null,
-      code: null,
-      selection: [],
-      ids: []
-    };
-  },
+            placeholder: '',
+            width: 240
+          },
 
-  watch: {},
-  methods: {
-    datasource({ page, where, limit }) {
-      return produceOrder({
-        ...where,
-        pageNum: page,
-        size: limit
-      });
-    },
-    open(ids) {
-      this.equipmentdialog = true;
-    },
-    onDone() {
-      this.$nextTick(() => {
-        this.$refs.equiTable.setSelectedRowKeys(this.ids);
-      });
-    },
-    handleClose() {
-      this.equipmentdialog = false;
-      this.$refs.equiTable.clearSelection();
+          {
+            label: '产品名称:',
+            value: 'productName',
+            type: 'input',
+
+            placeholder: '',
+            width: 240
+          },
+          {
+            label: '牌号',
+            value: 'brandNo',
+            type: 'input',
+
+            placeholder: '',
+            width: 240
+          },
+          {
+            label: '型号',
+            value: 'model',
+            type: 'input',
+
+            placeholder: '',
+            width: 240
+          },
+          // {
+          //   label: "状态:",
+          //   value: 'status',
+          //   type: "select",
+
+          //   placeholder: '',
+          //   width: 240,
+          //   // 加载状态
+          //   planList: this.statusOpt.first
+          // },
+          {
+            label: '班组:',
+            value: 'teamId',
+            type: 'select',
+            multiple: false, // 是否多选
+            filterable: true, // 是否可搜索
+            placeholder: '',
+            width: 240,
+            // 加载状态
+            planList: this.statusOpt.first
+          },
+          {
+            label: '创建时间:',
+            value: 'createTime',
+            type: 'date',
+            dateType: 'daterange',
+            placeholder: '',
+            width: 240,
+            // 加载状态
+            planList: this.statusOpt.first
+          }
+        ];
+      },
+      basicColumns() {
+        const num = this.columnsVersion;
+        const opt = {
+          first: [
+            // {
+            //   prop: 'deliveryTime',
+            //   label: '预测交货日期',
+            //   align: 'center',
+            //   showOverflowTooltip: true,
+            //   minWidth: 110
+            // }
+          ],
+          second: [
+            {
+              prop: 'completeTime',
+              label: '完成时间',
+              align: 'center'
+            },
+            {
+              prop: 'cycle',
+              label: '生产周期',
+              align: 'center'
+            }
+          ]
+        };
+
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center',
+            fixed: 'left'
+          },
+
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 130,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'lineNumber',
+            label: '行号',
+            align: 'center',
+            minWidth: 130,
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'code',
+            slot: 'code',
+            label: '生产工单号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          // {
+          //   prop: 'originalCode',
+          //   label: '原始工单号',
+          //   align: 'center',
+          //   minWidth: 110
+          // },
+
+          {
+            prop: 'QRcode',
+            slot: 'QRcode',
+            label: '二维码',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'apsWorkOrderCode',
+            label: '生产订单号',
+            slot: 'apsWorkOrderCode',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productionPlanCode',
+            label: '计划编号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planType',
+            label: '计划类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              const obj = this.planType.find((i) => i.value == row.planType);
+              return obj && obj.label;
+            }
+          },
+          {
+            prop: 'bomType',
+            label: '生产类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            width: 120,
+            formatter: (row) => {
+              if (row.bomType == 1) {
+                return '产品(PBOM)';
+              }
+              if (row.bomType == 2) {
+                return '加工(MBOM)';
+              }
+              if (row.bomType == 3) {
+                return '装配(ABOM)';
+              }
+              // if (row.bomType == 4) {
+              //   return '装配(EBOM)';
+              // }
+              return '';
+            }
+          },
+          {
+            prop: 'bomCategoryName',
+            label: 'BOM版本',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomCategoryName) {
+                return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            label: '编码',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'colorKey',
+            label: '颜色',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          {
+            prop: 'modelKey',
+            label: '机型',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'productName',
+            label: '名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productionCodes',
+            label: '生产编号',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'taskName',
+            label: '工序进度',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'singleReport',
+            slot: 'singleReport',
+            label: '报工类型',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'outsourceStatus',
+            label: '委外状态',
+            align: 'center',
+            slot: 'outsourceStatus',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: 'custom'
+          },
+
+          {
+            prop: 'formingNum',
+            label: '要求生产数量',
+            align: 'center',
+            slot: 'formingNum',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'unit',
+            label: '单位',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'factoriesName',
+            label: '所属工厂',
+            align: 'center',
+            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
+          },
+          {
+            prop: 'planStartTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            sortable: 'custom'
+          },
+          {
+            prop: 'planCompleteTime',
+            label: '计划结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            sortable: 'custom'
+          },
+          {
+            prop: 'startTime',
+            label: '实际开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            sortable: 'custom'
+          },
+          {
+            prop: 'completeTime',
+            label: '实际完成时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            sortable: 'custom'
+          },
+          ...opt[this.activeName],
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            sortable: 'custom'
+          },
+          // {
+          //   prop: 'status',
+          //   slot: 'status',
+          //   label: '状态',
+          //   align: 'center',
+          //   formatter: (row) => {
+          //     const obj = this.statusOpt[this.activeName].find(
+          //       (i) => i.value == row.status
+          //     );
+          //     return obj && obj.label;
+          //   }
+          // },
+          {
+            prop: 'deviceName',
+            slot: 'deviceName',
+            label: '设备名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'crewNames',
+            slot: 'crewNames',
+            label: '报工人员',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'teamName',
+            label: '班组',
+            align: 'center',
+            showOverflowTooltip: true
+          }
+        ];
+      },
+
+      clientEnvironmentId() {
+        return this.$store.state.user.info.clientEnvironmentId;
+      }
     },
-    // 选择
-    selected() {
-      let data =
-        this.type == 1
-          ? JSON.parse(JSON.stringify(this.selection))
-          : JSON.parse(JSON.stringify(this.current));
-      data['productNumber'] = data.formingNum;
+    methods: {
+      datasource({ page, where, limit }) {
+        return produceOrder({
+          ...where,
+          pageNum: page,
+          size: limit
+        });
+      },
+      open(list) {
+        this.equipmentdialog = true;
+        this.allSelection = list;
+        this.$nextTick(() => {
+          this.allSelection.forEach((item) => {
+            this.$refs.equiTable.toggleRowSelection(item, true);
+          });
+        });
+      },
+
+      search(e) {
+        if (Array.isArray(e.createTime) && e.createTime.length) {
+          e.createTimeStart = e.createTime[0];
+          e.createTimeEnd = e.createTime[1];
+        }
+        this.reload(e);
+      },
+
+      /* 刷新表格 */
+      reload(where = {}) {
+        this.$nextTick(() => {
+          where.statusList = (
+            where.status || this.statusOpt[this.activeName][0].value
+          ).split(',');
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+
+      handleClose() {
+        this.equipmentdialog = false;
+        this.$refs.equiTable.clearSelection();
+      },
 
-      console.log(data);
+      handleSelectionChange(data) {
+        this.allSelection = data;
+      },
 
-      this.$emit('choose', data);
-      this.handleClose();
+      // 选择
+      selected() {
+        this.$emit('choose', this.selection);
+        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;
+  .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;
   }
-}
-.pagination {
-  text-align: right;
-  padding: 10px 0;
-}
-.btns {
-  text-align: center;
-  padding: 10px 0;
-}
-.topsearch {
-  margin-bottom: 15px;
-}
 </style>

+ 155 - 0
src/views/entrust/components/produceOrderSearch.vue

@@ -0,0 +1,155 @@
+<!-- 搜索表单 -->
+<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: 5, md: 10 } : { span: 5 }">
+        <el-form-item label="工序名称:" prop="warehouseId">
+          <template>
+            <el-select
+              clearable
+              filterable
+              style="width: 100%"
+              v-model="where.warehouseId"
+              placeholder="请选择"
+            >
+              <el-option
+                v-for="item in warehouseList"
+                :label="item.name"
+                :value="item.id"
+                :key="item.id"
+              >
+              </el-option>
+            </el-select>
+          </template>
+        </el-form-item>
+      </el-col> -->
+
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+        <el-form-item label="关键字:" prop="keyWord">
+          <el-input
+            clearable
+            placeholder="请输入"
+            v-model.trim="where.keyWord"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+        <el-form-item label="工厂名称:" prop="factoriesName">
+          <el-input
+            clearable
+            placeholder="请输入"
+            v-model.trim="where.factoriesName"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+        <el-form-item label="生产工单号:" prop="code">
+          <el-input
+            clearable
+            v-model="where.code"
+            placeholder="请输入"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 5, md: 10 } : { span: 5 }">
+        <el-form-item label="编号:" prop="batchNo">
+          <el-input
+            clearable
+            v-model="where.batchNo"
+            placeholder="请输入"
+          ></el-input>
+        </el-form-item>
+      </el-col>
+
+      <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+            size="small"
+          >
+            查询
+          </el-button>
+          <el-button
+            @click="reset"
+            icon="el-icon-refresh-left"
+            size="small"
+            type="primary"
+            >重置</el-button
+          >
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  import { getWarehouseList } from '@/api/produce/index.js';
+  export default {
+    data() {
+      // 默认表单数据
+      const defaultWhere = {
+        batchNo: '',
+        keyWord: '',
+        factoriesName: '',
+        warehouseId: '',
+        manualBatchNo: '',
+        code: '',
+        modelType: '',
+        specification: '',
+        categoryCode: '',
+
+        categoryName: ''
+      };
+      return {
+        defaultWhere,
+        // 表单数据
+        where: { ...defaultWhere },
+        warehouseList: [],
+        dimension: '2',
+        type: 'products'
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    created() {
+      this.getArguInfo();
+    },
+    methods: {
+      /* 搜索 */
+      search() {
+        this.$emit('search', this.where);
+      },
+      /*  重置 */
+      reset() {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      },
+      //搜索数据源
+      async getArguInfo() {
+        const { data } = await getWarehouseList();
+        this.warehouseList = data;
+      }
+    }
+  };
+</script>
+
+<style>
+  .ele-form-actions {
+    display: inline-block;
+    transform: translate(0);
+    transition: all;
+  }
+</style>

+ 173 - 72
src/views/entrust/index.vue

@@ -16,6 +16,23 @@
           <span> {{ getDictValue('请托类型', row.type + '') }}</span>
         </template>
 
+        <template v-slot:status="{ row }">
+          <el-tag>{{
+            row.status == 0 ? '未提交' : row.status == 1 ? '已提交' : '已发布'
+          }}</el-tag>
+        </template>
+
+        <template v-slot:approvalStatus="{ row }">
+          <el-tag v-if="row.approvalStatus == 0">未提交</el-tag>
+          <el-tag v-if="row.approvalStatus == 1" type="warning">审核中</el-tag>
+          <el-tag v-if="row.approvalStatus == 2" type="success"
+            >审核通过</el-tag
+          >
+          <el-tag v-if="row.approvalStatus == 3" type="danger"
+            >审核不通过</el-tag
+          >
+        </template>
+
         <template v-slot:code="{ row }">
           <el-link
             type="primary"
@@ -37,7 +54,7 @@
           >
             新建
           </el-button>
-          <el-button
+          <!-- <el-button
             size="small"
             type="danger"
             icon="el-icon-delete"
@@ -47,17 +64,6 @@
             :disabled="selection.length == 0"
           >
             删除
-          </el-button>
-
-          <!-- <el-button
-            size="small"
-            type="primary"
-            icon="el-icon-circle-plus-outline"
-            class="ele-btn-icon"
-            plain
-            :disabled="selection.length == 0"
-          >
-            处置
           </el-button> -->
         </template>
 
@@ -71,15 +77,6 @@
           >
             编辑
           </el-link>
-          <el-link
-            type="primary"
-            v-if="row.status == 2"
-            :underline="false"
-            icon="el-icon-truck"
-            @click="openWarehouseEntry(row.id)"
-          >
-            申请入库
-          </el-link>
           <el-popconfirm
             class="ele-action"
             v-if="row.status == 0"
@@ -141,7 +138,12 @@
 
     // queryKilnXCH
   } from '@/api/mes';
-  import { getList, remove, submit, warehouseEntry } from '@/api/entrust/index';
+  import {
+    getList,
+    remove,
+    submit,
+    warehouseEntry
+  } from '@/api/entrust/index.js';
 
   export default {
     components: {
@@ -198,14 +200,6 @@
               return cellValue == 1 ? '一般' : cellValue == 2 ? '紧急' : '';
             }
           },
-          {
-            prop: 'code',
-            label: '编码',
-            align: 'center',
-            width: 160,
-            showOverflowTooltip: true,
-            slot: 'code'
-          },
           {
             prop: 'name',
             label: '名称',
@@ -214,50 +208,41 @@
             align: 'center'
           },
           {
-            prop: 'workOrderCode',
-            label: '工单编码',
+            prop: 'code',
+            slot: 'code',
+            label: '编码',
             width: 160,
             showOverflowTooltip: true,
             align: 'center'
           },
           {
-            prop: 'procedureList',
-            width: 130,
-            showOverflowTooltip: true,
-
-            label: '工序',
-            align: 'center',
-            formatter: (row, column, cellValue) => {
-              return cellValue.map((item) => item.produceTaskName).toString();
-            }
-          },
-
-          // {
-          //   prop: 'a',
-          //   label: '关联名称',
-          //   align: 'center'
-          // },
-          {
-            prop: 'factoriesName',
+            prop: 'applyFactoriesName',
             label: '所属工厂',
             align: 'center',
             width: 130,
             showOverflowTooltip: true
           },
           {
-            prop: 'pleaseEntrustDeptName',
+            prop: 'applyDeptName',
             label: '请托部门',
             align: 'center',
             width: 120,
             showOverflowTooltip: true
           },
           {
-            prop: 'pleaseEntrustUserName',
+            prop: 'createUserName',
             label: '请托人',
             align: 'center',
             width: 80,
             showOverflowTooltip: true
           },
+          {
+            prop: 'totalCount',
+            label: '请托数量',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true
+          },
           {
             prop: 'beEntrustedFactoriesName',
             label: '受托工厂',
@@ -273,12 +258,122 @@
             showOverflowTooltip: true
           },
           {
-            prop: 'finishTime',
+            prop: 'productionPlanCode',
+            label: '计划编号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'bomType',
+            label: 'BOM分类',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomType == 1) {
+                return '产品(PBOM)';
+              }
+              if (row.bomType == 2) {
+                return '加工(MBOM)';
+              }
+              if (row.bomType == 3) {
+                return '装配(ABOM)';
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'bomCategoryVersions',
+            label: 'BOM版本',
+            align: 'center',
+            width: 100,
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              if (row.bomCategoryName) {
+                return `${row.bomCategoryName} (V${row.bomCategoryVersions}.0)`;
+              }
+              return '';
+            }
+          },
+          {
+            prop: 'productionCodes',
+            label: '生产编号',
+            align: 'center',
+            minWidth: 150,
+            showOverflowTooltip: true
+          },
+          // {
+          //   prop: 'priority',
+          //   label: '优先级',
+          //   align: 'center',
+          //   minWidth: 120
+          // },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批次号',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planStartTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            sortable: true
+          },
+          {
+            prop: 'planCompleteTime',
+            label: '计划结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 130,
+            sortable: true
+          },
+          {
+            prop: 'specification',
+            label: '规格',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'apsWorkOrderCode',
+            label: '生产订单号',
+            slot: 'apsWorkOrderCode',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'planDeliveryTime',
             label: '完成时间',
             align: 'center',
             width: 150,
             showOverflowTooltip: true
           },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            width: 150,
+            showOverflowTooltip: true
+          },
           {
             prop: 'describes',
             label: '需求描述',
@@ -290,17 +385,15 @@
             label: '状态',
             align: 'center',
             slot: 'status',
-            width: 80,
-            showOverflowTooltip: true,
-            formatter: (row, column, cellValue) => {
-              return cellValue == 0
-                ? '草稿'
-                : cellValue == 1
-                ? '审核中'
-                : cellValue == 2
-                ? '审核通过'
-                : '';
-            }
+            width: 100
+          },
+
+          {
+            prop: 'approvalStatus',
+            label: '审批状态',
+            align: 'center',
+            slot: 'approvalStatus',
+            width: 100
           },
 
           {
@@ -361,14 +454,22 @@
       },
 
       submit(item) {
-        submit({
-          businessId: item.id,
-          beEntrustedDeptId: item.beEntrustedDeptId
-        }).then((res) => {
-          this.$message.success('提交' + res.message);
-          this.reload();
-          this.visible = false;
-        });
+        this.$confirm('是否提交该请托单的审核流程?', '提示', {
+          confirmButtonText: '确定',
+          cancelButtonText: '取消',
+          type: 'warning'
+        })
+          .then(() => {
+            submit({
+              businessId: item.id,
+              beEntrustedDeptId: item.beEntrustedDeptId
+            }).then((res) => {
+              this.$message.success('提交' + res.message);
+              this.reload();
+              this.visible = false;
+            });
+          })
+          .catch(() => {});
       },
       /* 刷新表格 */
       reload(where) {

+ 0 - 8
src/views/pick/pickApply/components/selfBuildPick.vue

@@ -165,12 +165,6 @@
       <el-button size="mini" type="primary" @click="save()">确 定</el-button>
     </template>
 
-    <!-- <pickingList
-      isType="pick"
-      ref="pickingListRef"
-      @allSelection="allSelection"
-    ></pickingList> -->
-
     <newPickingList
       isType="pick"
       ref="pickingListRef"
@@ -181,14 +175,12 @@
 
 <script>
   import { getCode } from '@/api/produce/workOrder';
-  import pickingList from '@/views/produce/components/picking/pickingList.vue';
   import newPickingList from './newPickingList.vue';
   import { typeName } from '@/views/produce/components/common.js';
 
   import { unproductive } from '@/api/produce/picking';
   export default {
     components: {
-      pickingList,
       newPickingList
     },
     data() {

+ 4 - 0
src/views/pick/pickApply/index.vue

@@ -313,3 +313,7 @@
     }
   };
 </script>
+
+
+
+

+ 1 - 1
src/views/produce/components/jobBooking/index.vue

@@ -564,7 +564,7 @@
     </div>
 
     <pickingList
-      isType="job"
+      isType="feed"
       ref="pickingListRef"
       @allSelection="allSelection"
     ></pickingList>

+ 10 - 0
src/views/taskList/components/Ddtails.vue

@@ -313,6 +313,16 @@
       // 时间选择
       handleTimeChange() {
         // 如果结束时间早于开始时间,清空结束时间
+
+        if (this.form.realStartTime && this.current.startTime) {
+          const realStartTime = new Date(this.form.realStartTime).getTime();
+          const realEndTime = new Date(this.current.startTime).getTime();
+          if (realStartTime < realEndTime) {
+            this.form.realStartTime = '';
+            this.$message.warning('实际开始时间不能早于任务开始时间');
+          }
+        }
+
         if (this.form.realStartTime && this.form.realEndTime) {
           const realStartTime = new Date(this.form.realStartTime).getTime();
           const realEndTime = new Date(this.form.realEndTime).getTime();

+ 2 - 2
vue.config.js

@@ -36,8 +36,8 @@ module.exports = {
         // target: 'http://192.168.1.125:18086',
         // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.251:18086',
-        // target: 'http://192.168.1.125:18086',
-        target: 'http://192.168.1.116:18086', // 赵沙金
+        target: 'http://192.168.1.125:18086',
+        // target: 'http://192.168.1.116:18086', // 赵沙金
         // target: 'http://192.168.1.251:18086', // 开发环境
         // target: 'http://192.168.1.103:18086',192.168.1.116
         // target: 'http://192.168.1.144:18086',