Pārlūkot izejas kodu

Merge branch 'dev' of http://110.41.163.243:9980/kd-aiot/kd-aiot-frontend-mes into dev

lucw 7 mēneši atpakaļ
vecāks
revīzija
033e8f3aa8

+ 6 - 0
src/styles/transition/common.scss

@@ -111,6 +111,12 @@
   color: #1890ff !important;
 }
 
+table th .is-required::before{
+  content: "*";
+  color: red;
+  margin-right: 4px;
+}
+
 
 
 /* 布局-横向 */

+ 1 - 1
src/views/beEntrusted/components/create-order.vue

@@ -155,7 +155,7 @@
           </el-col>
 
           <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
-            <el-form-item label="工艺路线:">
+            <el-form-item label="工艺路线:" prop="produceRoutingName">
               <el-input
                 v-model="form.produceRoutingName"
                 placeholder="请选择工艺路线"

+ 1 - 1
src/views/beEntrusted/index.vue

@@ -147,7 +147,7 @@
 <script>
   import OrderSearch from '@/views/entrust/components/order-search.vue';
   import dictMixins from '@/mixins/dictMixins';
-  import Create from './components/create';
+  import Create from '@/views/entrust/components/create';
   import SalesToProduction from './components/salesToProduction.vue';
   import createOrder from './components/create-order.vue';
   import { getList, warehouseEntry, update } from '@/api/beEntrusted/index';

+ 119 - 38
src/views/entrust/components/create.vue

@@ -28,7 +28,6 @@
       :rules="rules"
       label-width="100px"
       class="create-form"
-      v-if="activeComp == 'main'"
     >
       <headerTitle title="基本信息" style="margin-top: 15px"></headerTitle>
 
@@ -154,7 +153,7 @@
         icon="el-icon-plus"
         class="ele-btn-icon"
         @click="addOder"
-        v-if="type == 'add'"
+        v-if="type != 'detail'"
         style="margin-bottom: 10px"
       >
         新建
@@ -166,7 +165,7 @@
         icon="el-icon-delete"
         class="ele-btn-icon"
         @click="removeOder"
-        v-if="type == 'add'"
+        v-if="type != 'detail'"
         plain
         style="margin-bottom: 10px"
       >
@@ -183,6 +182,24 @@
         row-key="id"
         height="40vh"
       >
+        <template v-slot:totalCountHead="{ column }">
+          <div>
+            <span class="is-required">{{ column.label }}</span>
+          </div>
+        </template>
+
+        <template v-slot:taskIdHead="{ column }">
+          <div>
+            <span class="is-required">{{ column.label }}</span>
+          </div>
+        </template>
+
+        <template v-slot:planDeliveryTimeHead="{ column }">
+          <div>
+            <span class="is-required">{{ column.label }}</span>
+          </div>
+        </template>
+
         <template v-slot:totalCount="{ row }">
           <el-input v-model="row.totalCount" :disabled="type == 'detail'">
             <template slot="append">{{ row.measuringUnit }}</template>
@@ -406,7 +423,8 @@
             label: '请托数量',
             align: 'center',
             minWidth: 140,
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            headerSlot: 'totalCountHead'
           },
           {
             prop: 'planType',
@@ -433,13 +451,13 @@
             minWidth: 110,
             showOverflowTooltip: true
           },
-          {
-            prop: 'name',
-            label: '名称',
-            width: 130,
-            showOverflowTooltip: true,
-            align: 'center'
-          },
+          // {
+          //   prop: 'name',
+          //   label: '名称',
+          //   width: 130,
+          //   showOverflowTooltip: true,
+          //   align: 'center'
+          // },
           {
             prop: 'modelType',
             label: '型号',
@@ -490,7 +508,8 @@
             label: '工序',
             align: 'center',
             minWidth: 150,
-            showOverflowTooltip: true
+            showOverflowTooltip: true,
+            headerSlot: 'taskIdHead'
           },
           {
             prop: 'categoryCode',
@@ -503,7 +522,8 @@
             slot: 'planDeliveryTime',
             label: '完成日期',
             align: 'center',
-            minWidth: 260
+            minWidth: 260,
+            headerSlot: 'planDeliveryTimeHead'
           },
           {
             prop: 'planStartTime',
@@ -684,25 +704,28 @@
           return;
         }
 
-        const getKey = (item) => item.id ?? item.apsWorkOrderCode ?? '';
-        const existingKeys = new Set(this.orderList.map(getKey));
+        // 只使用 id 作为唯一 key(你要求按 id 对比)
+        const getKey = (item) => item.id;
 
-        const commonList = list.filter((item) =>
-          existingKeys.has(getKey(item))
-        );
+        // 新旧数据的 key 集合
+        const newKeys = new Set(list.map(getKey));
+        const oldKeys = new Set(this.orderList.map(getKey));
 
-        const newList = list.filter((item) => !existingKeys.has(getKey(item)));
+        // 1️⃣ 保留原数据中在新数据里依然存在的项(不做任何修改)
+        const keptOldList = this.orderList.filter((oldItem) =>
+          newKeys.has(getKey(oldItem))
+        );
 
-        const mergedList = [];
+        // 2️⃣ 找出需要新增的项(id 不在旧数据中)
+        const addedItems = list.filter((item) => !oldKeys.has(getKey(item)));
 
-        commonList.forEach((it) => {
-          mergedList.push(this.deepCopy(it));
-        });
+        // 3️⃣ 处理新增项
+        const newList = addedItems.map((item) => {
+          const copy = this.deepCopy(item);
 
-        newList.forEach((item) => {
-          Object.assign(item, {
+          Object.assign(copy, {
             describes: '',
-            totalCount: item.formingNum,
+            totalCount: copy.formingNum,
             taskList: [],
             taskId: '',
             taskName: '',
@@ -711,25 +734,78 @@
             status: '',
             beEntrustedDeptName: '',
             beEntrustedDeptId: '',
-            measuringUnit: item.unit,
-            categoryName: item.productName,
-            categoryCode: item.productCode,
-            workOrderId: item.id,
-            workOrderCode: item.code,
-            brandNum: item.brandNo,
-            modelType: item.model,
-            name: this.form.name,
-            type: this.form.type,
-            planDeliveryTime: item.startTime,
+            measuringUnit: copy.unit,
+            categoryName: copy.productName,
+            categoryCode: copy.productCode,
+            workOrderId: copy.id,
+            workOrderCode: copy.code,
+            brandNum: copy.brandNo,
+            modelType: copy.model,
+            name: '',
+            type: '',
+            planDeliveryTime: copy.startTime,
             applyDeptId: this.form.pleaseEntrustDeptId,
             applyDeptName: this.form.pleaseEntrustDeptName,
             applyFactoriesId: this.form.factoriesId,
             applyFactoriesName: this.form.factoriesName
           });
-          mergedList.push(this.deepCopy(item));
+
+          return copy;
         });
 
-        this.orderList = mergedList;
+        // 4️⃣ 合并:保留原来的 + 新增
+        this.orderList = [...keptOldList, ...newList];
+        // if (!list || list.length === 0) {
+        //   this.orderList = [];
+        //   return;
+        // }
+
+        // const getKey = (item) => item.id ?? item.apsWorkOrderCode ?? '';
+        // const existingKeys = new Set(this.orderList.map(getKey));
+
+        // const commonList = list.filter((item) =>
+        //   existingKeys.has(getKey(item))
+        // );
+
+        // const newList = list.filter((item) => !existingKeys.has(getKey(item)));
+
+        // const mergedList = [];
+
+        // commonList.forEach((it) => {
+        //   mergedList.push(this.deepCopy(it));
+        // });
+
+        // newList.forEach((item) => {
+        //   Object.assign(item, {
+        //     describes: '',
+        //     totalCount: item.formingNum,
+        //     taskList: [],
+        //     taskId: '',
+        //     taskName: '',
+        //     beEntrustedFactoriesId: '',
+        //     beEntrustedFactoriesName: '',
+        //     status: '',
+        //     beEntrustedDeptName: '',
+        //     beEntrustedDeptId: '',
+        //     measuringUnit: item.unit,
+        //     categoryName: item.productName,
+        //     categoryCode: item.productCode,
+        //     workOrderId: item.id,
+        //     workOrderCode: item.code,
+        //     brandNum: item.brandNo,
+        //     modelType: item.model,
+        //     name: this.form.name,
+        //     type: this.form.type,
+        //     planDeliveryTime: item.startTime,
+        //     applyDeptId: this.form.pleaseEntrustDeptId,
+        //     applyDeptName: this.form.pleaseEntrustDeptName,
+        //     applyFactoriesId: this.form.factoriesId,
+        //     applyFactoriesName: this.form.factoriesName
+        //   });
+        //   mergedList.push(this.deepCopy(item));
+        // });
+
+        // this.orderList = mergedList;
 
         this.getOrderTaskList();
       },
@@ -775,6 +851,10 @@
             return false;
           }
 
+          if (this.orderList.length == 0) {
+            return this.$message.warning('请添加产品信息');
+          }
+
           for (let item of this.orderList) {
             if (!item.totalCount) {
               return this.$message.warning('请托数量不能为空');
@@ -796,6 +876,7 @@
             item.beEntrustedDeptId = this.form.beEntrustedDeptId;
             item.isLast = this.form.isLast;
             item.name = this.form.name;
+            item.type = this.form.type;
             item.status = type == 1 ? 0 : 1;
             item.approvalStatus = type == 1 ? 0 : 1;
           });

+ 14 - 1
src/views/produce/components/new_produceOrder.vue

@@ -53,6 +53,12 @@
         <span> {{ row.taskName }}</span>
       </template>
 
+      <template v-slot:sourceType="{ row }">
+        <span v-if="row.sourceType == 1">生产计划</span>
+        <span v-if="row.sourceType == 2">临时生产计划</span>
+        <span v-if="row.sourceType == 3">受托转订单</span>
+      </template>
+
       <template v-slot:outsourceStatus="{ row }">
         <div v-if="row.outsourceStatus">
           <span v-if="row.outsourceStatus == 1">未委外</span>
@@ -177,7 +183,14 @@
             align: 'center',
             showOverflowTooltip: true
           },
-
+          {
+            prop: 'sourceType',
+            label: '来源类型',
+            slot: 'sourceType',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
           {
             prop: 'singleReport',
             slot: 'singleReport',

+ 413 - 0
src/views/produce/components/outsourcing/addPlease.vue

@@ -0,0 +1,413 @@
+<template>
+  <ele-modal
+    :visible.sync="visible"
+    v-if="visible"
+    :title="title"
+    width="75vw"
+    append-to-body
+    @close="cancel"
+    :maxable="true"
+  >
+    <el-form
+      ref="form"
+      :model="form"
+      :rules="rules"
+      label-width="100px"
+      class="create-form"
+    >
+      <el-row :gutter="15">
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="类型:" prop="type">
+            <DictSelection
+              dictName="请托类型"
+              v-model="form.type"
+            ></DictSelection>
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="紧急程度:" prop="priority">
+            <el-select
+              style="width: 100%"
+              v-model="form.priority"
+              placeholder="请选择"
+              clearable
+            >
+              <el-option
+                v-for="item in options"
+                :key="item.value"
+                :label="item.name"
+                :value="item.value"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="名称:" prop="name">
+            <el-input v-model="form.name" />
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="请托数量:" prop="totalCount">
+            <el-input v-model="form.totalCount">
+              <template slot="append">{{ form.measuringUnit }}</template>
+            </el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="请托工序:" prop="taskId">
+            <el-select v-model="form.taskId" placeholder="请选择">
+              <el-option
+                v-for="item in newStepsList"
+                :key="item.taskId"
+                :label="item.taskTypeName"
+                :value="item.taskId"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="请托人:" prop="pleaseEntrustUserId">
+            <el-input v-model="form.pleaseEntrustUserName" clearable disabled />
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="请托部门:" prop="pleaseEntrustDeptName">
+            <el-input v-model="form.pleaseEntrustDeptName" clearable disabled>
+            </el-input>
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 8 } : { span: 6 }">
+          <el-form-item label="所属工厂:" prop="factoriesName">
+            <el-input v-model="form.factoriesName" style="width: 100%" disabled>
+            </el-input>
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="受托工厂:" prop="beEntrustedFactoriesId">
+            <el-select
+              style="width: 100%"
+              v-model="form.beEntrustedFactoriesId"
+              placeholder="请选择"
+              clearable
+            >
+              <el-option
+                v-for="item in factoryList"
+                :key="item.id"
+                :label="item.name"
+                :value="item.id"
+                @click.native="factoryListChange(item)"
+              >
+              </el-option>
+            </el-select>
+          </el-form-item>
+        </el-col>
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="受托部门:" prop="beEntrustedDeptId">
+            <deptSelect
+              v-model="form.beEntrustedDeptId"
+              @changeGroup="beEntrustedDeptIdChange"
+            />
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="完成日期:" prop="planDeliveryTime">
+            <el-date-picker
+              v-model="form.planDeliveryTime"
+              type="datetime"
+              placeholder="选择日期时间"
+              format="yyyy-MM-dd HH:mm:ss"
+              value-format="yyyy-MM-dd HH:mm:ss"
+            >
+            </el-date-picker>
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+          <el-form-item label="是否尾工序:" prop="isLast">
+            <el-radio-group v-model="form.isLast">
+              <el-radio :label="1">是</el-radio>
+              <el-radio :label="0">否</el-radio>
+            </el-radio-group>
+          </el-form-item>
+        </el-col>
+
+        <el-col v-bind="styleResponsive ? { lg: 24, md: 24 } : { span: 24 }">
+          <el-form-item label="需求描述:">
+            <el-input
+              clearable
+              v-model="form.describes"
+              type="textarea"
+              :rows="4"
+            />
+          </el-form-item>
+        </el-col>
+      </el-row>
+    </el-form>
+
+    <template v-slot:footer>
+      <el-button @click="cancel">取消</el-button>
+      <el-button type="primary" @click="save(1)"> 保存 </el-button>
+      <el-button type="primary" @click="save(2)"> 提交 </el-button>
+    </template>
+  </ele-modal>
+</template>
+
+<script>
+  import deptSelect from '@/components/CommomSelect/dept-select.vue';
+  import warehouseDefinition from '@/api/warehouseManagement/warehouseDefinition';
+  import { getTaskInstanceById } from '@/api/produce/index';
+  import { save, addSubmit, update } from '@/api/entrust/index';
+  export default {
+    components: { deptSelect },
+    data() {
+      return {
+        title: '新增请托单',
+        visible: false,
+        form: {
+          type: '',
+          priority: '',
+          name: '',
+          pleaseEntrustDeptName: '',
+          pleaseEntrustUserName: '',
+          factoriesName: '',
+          beEntrustedFactoriesId: '',
+          beEntrustedDeptId: '',
+          isLast: 0,
+          describes: '',
+          taskId: '',
+          planDeliveryTime: '',
+          beEntrustedDeptName: '',
+          beEntrustedFactoriesName: '',
+          pleaseEntrustDeptId: '',
+          pleaseEntrustUserId: '',
+          factoriesId: '',
+          factoriesName: ''
+        },
+        rules: {
+          type: [{ required: true, message: '请选择', trigger: 'change' }],
+          name: [{ required: true, message: '请输入', trigger: 'change' }],
+
+          workOrderCode: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          beEntrustedDeptId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          finishTime: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          beEntrustedFactoriesId: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          isLast: [{ required: true, message: '请选择', trigger: 'change' }],
+          planDeliveryTime: [
+            { required: true, message: '请选择', trigger: 'change' }
+          ],
+          totalCount: [
+            { required: true, message: '请输入', trigger: 'change' }
+          ],
+          taskId: [{ required: true, message: '请选择', trigger: 'change' }]
+        },
+        factoryList: [],
+        options: [
+          {
+            name: '一般',
+            value: 1
+          },
+          {
+            name: '紧急',
+            value: 2
+          }
+        ],
+        newStepsList: [],
+        taskObj: null
+      };
+    },
+
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive() {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+
+    methods: {
+      open(workOrderId, workData, taskObj) {
+        this.taskObj = taskObj;
+        console.log(taskObj, 'taskObj');
+        const newList = workData.list.map((item) => {
+          const copy = this.deepCopy(item);
+
+          Object.assign(copy, {
+            describes: '',
+            totalCount: copy.formingNum,
+            taskList: [],
+            taskId: '',
+            taskName: '',
+            beEntrustedFactoriesId: '',
+            beEntrustedFactoriesName: '',
+            status: '',
+            beEntrustedDeptName: '',
+            beEntrustedDeptId: '',
+            measuringUnit: copy.unit,
+            categoryName: copy.productName,
+            categoryCode: copy.productCode,
+            workOrderId: copy.id,
+            workOrderCode: copy.code,
+            brandNum: copy.brandNo,
+            modelType: copy.model,
+            name: '',
+            type: '',
+            planDeliveryTime: copy.startTime,
+            applyDeptId: this.form.pleaseEntrustDeptId,
+            applyDeptName: this.form.pleaseEntrustDeptName,
+            applyFactoriesId: this.form.factoriesId,
+            applyFactoriesName: this.form.factoriesName
+          });
+
+          return copy;
+        });
+
+        this.form = Object.assign(this.form, newList[0]);
+        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.form.name = this.taskObj.name
+          ? this.taskObj.name + '请托'
+          : this.taskObj.taskTypeName + '请托';
+        const taskId = this.taskObj.name
+          ? this.taskObj.id
+          : this.taskObj.taskId;
+        console.log(taskId, 'taskId');
+        this.getTaskInstanceByIdFn(workOrderId);
+        this.getFactoryList();
+
+        this.visible = true;
+      },
+
+      async getTaskInstanceByIdFn(workOrderId) {
+        await getTaskInstanceById(workOrderId).then((res) => {
+          let { data } = res;
+          if (data.length) {
+            data = data.filter((item) => item.taskId != -2);
+            let arr = data.findIndex(
+              (item) => item.sourceTaskId == this.taskObj.id
+            );
+
+            if (arr != -1) {
+              data.splice(0, arr);
+            }
+
+            this.newStepsList = data;
+          }
+        });
+      },
+
+      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);
+      },
+
+      async getFactoryList() {
+        const { list } = await warehouseDefinition.getFactoryarea({
+          pageNum: 1,
+          size: 999,
+          type: 1
+        });
+        this.factoryList = list || [];
+
+        const data = this.factoryList.filter(
+          (it) => it.factoryId == this.$store.state.user.info.factoryId
+        );
+
+        if (data.length != 0) {
+          this.form.factoriesId = data[0].factoryId;
+          this.form.factoriesName = data[0].factoryName;
+        }
+      },
+
+      beEntrustedDeptIdChange(val, row) {
+        this.form.beEntrustedDeptName = row.name;
+      },
+      factoryListChange(row) {
+        this.form.beEntrustedFactoriesName = row.name;
+      },
+
+      cancel() {
+        this.visible = false;
+      },
+
+      save(type) {
+        this.$refs.form.validate((valid) => {
+          if (!valid) {
+            return false;
+          }
+
+          let URL;
+
+          const clearOrderIds = () => {
+            this.orderList.forEach((it) => (it.id = ''));
+          };
+
+          if (type === 1 && this.form.id) {
+            // 编辑
+            URL = update;
+          } else if (type === 1) {
+            // 新增
+            URL = save;
+            clearOrderIds();
+          } else {
+            // 其他类型提交
+            URL = addSubmit;
+            clearOrderIds();
+          }
+
+          this.loading = this.$loading({
+            lock: true,
+            text: '加载中',
+            background: 'rgba(0, 0, 0, 0.7)'
+          });
+
+          console.log(this.form, 'this.form');
+
+          const list = [];
+          list.push(this.form);
+
+          URL(list)
+            .then((res) => {
+              this.loading.close();
+              this.$message.success('成功');
+              this.cancel();
+              this.$emit('refresh');
+            })
+            .catch((e) => {
+              this.loading.close();
+            });
+        });
+      }
+    }
+  };
+</script>
+
+<style></style>

+ 2 - 2
src/views/produce/components/outsourcing/details.vue

@@ -2,12 +2,12 @@
   <div>
     <!-- <el-card shadow="never" v-loading="loading"> -->
     <!-- <search @search="reload" ref="searchRef"> </search> -->
-    <!-- <div>
+    <div>
       <el-tabs type="card" v-model="activeName" @tab-click="handleClick">
         <el-tab-pane label="委外" name="1"></el-tab-pane>
         <el-tab-pane label="请托" name="2"></el-tab-pane>
       </el-tabs>
-    </div> -->
+    </div>
 
     <!-- 数据表格 -->
     <ele-pro-table

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

@@ -185,7 +185,7 @@
       </el-form>
     </div>
 
-    <div v-if="activeName == '2'">
+    <div v-if="activeName == '5'">
       <el-form
         label-width="100px"
         :rules="rules"

+ 25 - 6
src/views/produce/index.vue

@@ -349,6 +349,9 @@
       ref="prenatalExaminationRef"
       @close="closePrenatalExamination"
     />
+
+    <!-- 新增请托 -->
+    <addPlease ref="addPleaseRef" @refresh="refreshPlease"></addPlease>
   </div>
 </template>
 
@@ -382,6 +385,7 @@
   import outsourcingDetails from './components/outsourcing/details.vue';
   import BomDetailsPop from './components/bom/detailsPop.vue';
   import { parameterGetByCode } from '@/api/system/dictionary-data';
+  import addPlease from './components/outsourcing/addPlease.vue';
   import {
     getByTaskId,
     pcCheckOutsource,
@@ -424,7 +428,8 @@
       outsourcingDetails,
       BomDetailsPop,
       prenatalExamination,
-      pleaseEntrust
+      pleaseEntrust,
+      addPlease
     },
     data() {
       return {
@@ -1035,7 +1040,7 @@
         // 委外
         if (t == 'Outsourcing') {
           if (this.workListIds.length > 1) {
-            return this.$message.warning('委外工序只能选择一个工单!');
+            return this.$message.warning('委外请托工序只能选择一个工单!');
           } else if (this.workListIds.length < 1) {
             return this.$message.warning('请选择工单!');
           } else {
@@ -1095,7 +1100,23 @@
       outsourcingAdd(type, activeName) {
         this.getTaskInstanceByIdFn(this.workListIds[0]);
         this.chooseType = activeName;
-        this.isStep = true;
+        if (this.chooseType == 1) {
+          this.isStep = true;
+        } else {
+          this.$refs.addPleaseRef.open(
+            this.workListIds[0],
+            this.workData,
+            this.taskObj
+          );
+        }
+      },
+
+      refreshPlease() {
+        this.$nextTick(() => {
+          this.$refs.outsourcingListRef.getPleaseData(
+            this.workData.list[0].code
+          );
+        });
       },
 
       handOutsource(workOrderId) {
@@ -1116,7 +1137,6 @@
 
           if (res.data.outsource) {
             this.isType = '3';
-            console.log(this.workData, 'this.workData');
             if (!this.isStep && !this.isOutsource && !this.isPleaseEntrust) {
               this.$nextTick(() => {
                 this.$refs.outsourcingListRef.getDataList(
@@ -1142,12 +1162,11 @@
             let arr = data.findIndex(
               (item) => item.sourceTaskId == this.taskObj.id
             );
+
             if (arr != -1) {
               data.splice(0, arr);
             }
 
-            console.log(this.outsourceForm, 'this.outsourceForm');
-
             this.$set(this.outsourceForm, 'newStepsList', data);
           }
         });

+ 14 - 0
src/views/produceOrder/index.vue

@@ -117,6 +117,12 @@
           <span v-if="row.singleReport == 1">单个报工</span>
         </template>
 
+        <template v-slot:sourceType="{ row }">
+          <span v-if="row.sourceType == 1">生产计划</span>
+          <span v-if="row.sourceType == 2">临时生产计划</span>
+          <span v-if="row.sourceType == 3">受托转订单</span>
+        </template>
+
         <template v-slot:outsourceStatus="{ row }">
           <div v-if="row.outsourceStatus">
             <span v-if="row.outsourceStatus == 1">未委外</span>
@@ -518,6 +524,14 @@
             minWidth: 110,
             showOverflowTooltip: true
           },
+          {
+            prop: 'sourceType',
+            label: '来源类型',
+            slot: 'sourceType',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
           {
             prop: 'productionPlanCode',
             label: '计划编号',

+ 29 - 2
src/views/produceOrder/workReport.vue

@@ -289,6 +289,8 @@
 
       <!-- 异常 -->
       <createError ref="createErrorRef" />
+
+      <addPlease ref="addPleaseRef" @refresh="refreshPlease"></addPlease>
     </el-drawer>
   </div>
 </template>
@@ -322,6 +324,7 @@
   import createError from '@/views/produce/components/createError.vue';
   import productionDetails from '../workOrderList/components/productionDetails.vue';
   import { parameterGetByCode } from '@/api/system/dictionary-data';
+
   import {
     getByTaskId,
     pcCheckOutsource,
@@ -336,6 +339,7 @@
   import { workorderInfo } from '@/api/produceOrder/index.js';
   import feedDetails from '@/views/produce/components/feeding/details.vue';
   import jobDetails from '@/views/produce/components/jobBooking/details.vue';
+  import addPlease from '@/views/produce/components/outsourcing/addPlease.vue';
 
   export default {
     components: {
@@ -362,7 +366,8 @@
       jobDetails,
       productionDetails,
       outsourcingDetails,
-      pleaseEntrust
+      pleaseEntrust,
+      addPlease
     },
     data() {
       return {
@@ -906,9 +911,23 @@
       // },
 
       outsourcingAdd(type, activeName) {
+        // this.getTaskInstanceByIdFn(this.workListIds[0]);
+        // this.chooseType = activeName;
+        // this.isStep = true;
         this.getTaskInstanceByIdFn(this.workListIds[0]);
         this.chooseType = activeName;
-        this.isStep = true;
+        if (this.chooseType == 1) {
+          this.isStep = true;
+        } else {
+          const dataList = { list: [] };
+          dataList.list.push(this.workData);
+
+          this.$refs.addPleaseRef.open(
+            this.workListIds[0],
+            dataList,
+            this.taskObj
+          );
+        }
       },
 
       async handOutsource(workOrderId) {
@@ -952,6 +971,14 @@
         this.workPlanType = type;
       },
 
+      refreshPlease() {
+        this.$nextTick(() => {
+          this.$refs.outsourcingListRef.getPleaseData(
+            this.workData.list[0].code
+          );
+        });
+      },
+
       //获取工单列表
       getTaskInstanceByIdFn(workOrderId) {
         getTaskInstanceById(workOrderId).then((res) => {

+ 14 - 0
src/views/produceWord/index.vue

@@ -21,6 +21,12 @@ r++<template>
           <!-- </el-link> -->
         </template>
 
+        <template v-slot:sourceType="{ row }">
+          <span v-if="row.sourceType == 1">生产计划</span>
+          <span v-if="row.sourceType == 2">临时生产计划</span>
+          <span v-if="row.sourceType == 3">受托转订单</span>
+        </template>
+
         <template v-slot:priority="{ row }">
           <div style="display: flex">
             <el-input
@@ -189,6 +195,14 @@ r++<template>
             align: 'center',
             showOverflowTooltip: true
           },
+          {
+            prop: 'sourceType',
+            label: '来源类型',
+            slot: 'sourceType',
+            align: 'center',
+            minWidth: 110,
+            showOverflowTooltip: true
+          },
           {
             prop: 'model',
             label: '型号',

+ 1 - 1
vue.config.js

@@ -33,7 +33,7 @@ module.exports = {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
         // target: 'http://124.71.68.31:50001',
-        // target: 'http://192.168.1.125:18086',
+        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',