ysy пре 1 година
родитељ
комит
c35347b20a
1 измењених фајлова са 556 додато и 579 уклоњено
  1. 556 579
      src/views/productionPlan/index.vue

+ 556 - 579
src/views/productionPlan/index.vue

@@ -1,13 +1,8 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-      <productionPlan-search
-        @search="reload"
-        ref="searchRef"
-        :statusOpt="statusOpt"
-        :planType="planType"
-        :activeName="activeName"
-      >
+      <productionPlan-search @search="reload" ref="searchRef" :statusOpt="statusOpt" :planType="planType"
+        :activeName="activeName">
       </productionPlan-search>
       <div class="btn_box">
         <el-button type="success" size="mini">齐套性检查</el-button>
@@ -15,15 +10,11 @@
         <el-button type="primary" size="mini">补单计划</el-button>
         <el-button type="info" size="mini">计划行事历</el-button>
         <el-button type="warning" size="mini">预警设置</el-button>
-        <el-button type="primary" size="mini" @click="handleMerge"
-          >合批</el-button
-        >
+        <el-button type="primary" size="mini" @click="handleMerge">合批</el-button>
         <el-button type="danger" size="mini">延期申请</el-button>
         <el-button type="danger" size="mini">变更申请</el-button>
 
-        <el-button type="success" size="mini" v-if="timeDimensionPlanType == 3"
-          >新增</el-button
-        >
+        <el-button type="success" size="mini" v-if="timeDimensionPlanType == 3">新增</el-button>
       </div>
 
       <el-tabs v-model="activeName" type="card" size="mini">
@@ -32,43 +23,29 @@
         <el-tab-pane label="已变更" name="change"></el-tab-pane>
       </el-tabs>
       <!-- 数据表格 -->
-      <ele-pro-table
-        ref="table"
-        :key="activeName"
-        :initLoad="false"
-        :columns="newColumns"
-        :datasource="datasource"
-        row-key="id"
-        :selection.sync="selection"
-        :cache-key="`${activeName}ProductionPlanTable`"
-        @sort-change="onSortChange"
-        autoAmendPage
-        :parse-data="parseData"
-        @done="handleDone"
-      >
+      <ele-pro-table ref="table" :key="activeName" :initLoad="false" :columns="newColumns" :datasource="datasource"
+        row-key="code" :selection.sync="selection" :cache-key="`${activeName}ProductionPlanTable`"
+        @sort-change="onSortChange" autoAmendPage :parse-data="parseData" @update:selection="handleSelectionChange">
         <template v-slot:batchNo="{ row }">
           <el-link type="primary" :underline="false">
-            <el-tag
-              type="success"
-              size="mini"
-              v-if="row.joinPlanCode"
-              @click.stop="splitDetails(1, row)"
-            >
-              拆</el-tag
-            >
-
-            <el-tag
-              type="danger"
-              size="mini"
-              v-if="row.splitBatch == 2"
-              @click.stop="splitDetails(2, row)"
-            >
-              合</el-tag
-            >
+            <el-tag type="success" size="mini" v-if="row.joinPlanCode" @click.stop="splitDetails(1, row)">
+              拆</el-tag>
+
+            <el-tag type="danger" size="mini" v-if="row.splitBatch == 2" @click.stop="splitDetails(2, row)">
+              合</el-tag>
             {{ row.batchNo }}
           </el-link>
         </template>
 
+        <template v-slot:selection="{ row }">
+          <div class="check_box" @click="handOneSelection(row)">
+            <div class="check act_check" v-if="selectionFilter(row)">
+              <i class="el-icon-check"></i>
+            </div>
+            <div class="check" v-else></div>
+          </div>
+        </template>
+
         <template v-slot:code="{ row }">
           <el-link type="primary" :underline="false" @click="goDetail(row)">
             {{ row.code }}
@@ -81,23 +58,11 @@
 
         <template v-slot:priority="{ row }">
           <div style="display: flex">
-            <el-input
-              v-model="row.priority"
-              type="number"
-              size="mini"
-              :min="0"
-              :max="10"
-              @change="priorityChange(row)"
-              style="width: 80px"
-            >
+            <el-input v-model="row.priority" type="number" size="mini" :min="0" :max="10" @change="priorityChange(row)"
+              style="width: 80px">
             </el-input>
 
-            <el-popover
-              placement="right"
-              width="200"
-              trigger="hover"
-              content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
-            >
+            <el-popover placement="right" width="200" trigger="hover" content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)">
               <div class="sort-wrap" slot="reference">
                 <i class="el-icon-caret-top" @click="sortTop(row)"></i>
                 <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
@@ -129,43 +94,24 @@
         </template>
         <!-- 操作列 -->
         <template v-slot:action="{ row }">
-          <el-link
-            type="primary"
-            :underline="false"
-            v-if="row.status == 2"
-            @click="handleOrderPublish(1, row)"
-          >
+          <el-link type="primary" :underline="false" v-if="row.status == 2" @click="handleOrderPublish(1, row)">
             发布
           </el-link>
-          <el-link
-            type="primary"
-            v-if="row.status == 3"
-            :underline="false"
-            @click="handleOrderPublish(2, row)"
-          >
+          <el-link type="primary" v-if="row.status == 3" :underline="false" @click="handleOrderPublish(2, row)">
             重新发布
           </el-link>
-          <el-link
-            v-if="
-              row.splitBatch != 2 && !row.joinPlanCode && activeName == 'first'
-            "
-            type="primary"
-            :underline="false"
-            @click="planEdit(row)"
-          >
+          <el-link v-if="
+            row.splitBatch != 2 && !row.joinPlanCode && activeName == 'first'
+          " type="primary" :underline="false" @click="planEdit(row)">
             修改
           </el-link>
 
-          <el-link
-            v-if="
-              clientEnvironmentId != 4 &&
-              activeName == 'first' &&
-              row.splitBatch != 2
-            "
-            type="primary"
-            :underline="false"
-            @click="toUnpack(row)"
-          >
+          <el-link v-if="
+            clientEnvironmentId != 4 &&
+            activeName == 'first' &&
+            row.splitBatch != 2 &&
+            !row.joinPlanCode
+          " type="primary" :underline="false" @click="toUnpack(row)">
             拆批
           </el-link>
         </template>
@@ -181,575 +127,606 @@
 </template>
 
 <script>
-  import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
-  import productionPlanSearch from './components/productionPlan-search.vue';
-  import unpackDialog from './components/unpackDialog.vue';
-  import mergeDialog from './components/mergeDialog.vue';
-  import unpackDetails from './components/unpackDetails.vue';
-  import { release } from '@/api/productionPlan/order.js';
-
-  import { getCode } from '@/api/codeManagement';
-
-  import { fieldModel } from '@/api/saleOrder';
-
-  import { debounce } from 'lodash';
-  export default {
-    components: {
-      productionPlanSearch,
-      unpackDialog,
-      mergeDialog,
-      unpackDetails
-    },
-    props: {
-      timeDimensionPlanType: { type: Number, default: 1 }
-    },
-    data() {
-      return {
-        activeName: 'first',
-
-        // 加载状态
-        loading: false,
-        pageType: 'add',
-        dialogTitle: '',
-        isBindPlan: false,
-        statusOpt: {
-          first: [
-            { label: '所有状态', value: '3,2' },
-            { label: '待发布', value: '2' },
-            { label: '发布失败', value: '3' }
-          ],
-          second: [
-            { label: '所有状态', value: '7,4,5,6' },
-            { label: '待生产', value: '4' },
-            { label: '生产中', value: '5' },
-            { label: '已完成', value: '6' },
-            { label: '已延期', value: '7' }
-          ],
-          change: [{ label: '已变更', value: '9' }]
-        },
-        planType: [
-          { label: '所有计划类型', value: null },
-          { label: '内销计划', value: '1' },
-          { label: '外销计划', value: '2' },
-          { label: '预制计划', value: '3' }
+import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
+import productionPlanSearch from './components/productionPlan-search.vue';
+import unpackDialog from './components/unpackDialog.vue';
+import mergeDialog from './components/mergeDialog.vue';
+import unpackDetails from './components/unpackDetails.vue';
+import { release } from '@/api/productionPlan/order.js';
+
+import { getCode } from '@/api/codeManagement';
+
+import { fieldModel } from '@/api/saleOrder';
+
+import { debounce } from 'lodash';
+export default {
+  components: {
+    productionPlanSearch,
+    unpackDialog,
+    mergeDialog,
+    unpackDetails
+  },
+  props: {
+    timeDimensionPlanType: { type: Number, default: 1 }
+  },
+  data() {
+    return {
+      activeName: 'first',
+
+      // 加载状态
+      loading: false,
+      pageType: 'add',
+      dialogTitle: '',
+      isBindPlan: false,
+      statusOpt: {
+        first: [
+          { label: '所有状态', value: '3,2' },
+          { label: '待发布', value: '2' },
+          { label: '发布失败', value: '3' }
         ],
-        newColumns: [],
-
-        selection: []
-      };
-    },
-    computed: {
-      clientEnvironmentId() {
-        return this.$store.state.user.info.clientEnvironmentId;
+        second: [
+          { label: '所有状态', value: '7,4,5,6' },
+          { label: '待生产', value: '4' },
+          { label: '生产中', value: '5' },
+          { label: '已完成', value: '6' },
+          { label: '已延期', value: '7' }
+        ],
+        change: [{ label: '已变更', value: '9' }]
       },
-      // 表格列配置
-      columns() {
-        const opt = {
-          first: [
-            // {
-            //   prop: 'deliveryTime',
-            //   label: '预测交货日期',
-            //   align: 'center',
-            //
-            //   minWidth: 110
-            // }
-          ],
-          second: [
-            // {
-            //   prop: 'formingTime',
-            //   label: '实际生产日期',
-            //   align: 'center',
-            //
-            //   minWidth: 110
-            // },
-            {
-              prop: 'releaseTime',
-              label: '工单发布日期',
-              align: 'center',
-
-              minWidth: 110
-            },
-            {
-              prop: 'planFormingTime',
-              label: '预测生产日期',
-              align: 'center',
-
-              minWidth: 110
-            },
-            {
-              prop: 'deliveryTime',
-              label: '预测交货日期',
-              align: 'center',
-
-              minWidth: 110
-            },
-            {
-              prop: 'formingTime',
-              label: '实际交货日期',
-              align: 'center',
-
-              minWidth: 110
-            }
-          ],
-          change: []
-        };
+      planType: [
+        { label: '所有计划类型', value: null },
+        { label: '内销计划', value: '1' },
+        { label: '外销计划', value: '2' },
+        { label: '预制计划', value: '3' }
+      ],
+      newColumns: [],
+
+      selection: [],
+
+    };
+  },
+  computed: {
+    clientEnvironmentId() {
+      return this.$store.state.user.info.clientEnvironmentId;
+    },
+    // 表格列配置
+    columns() {
+      const opt = {
+        first: [
+
+        ],
+        second: [
 
-        return [
           {
-            width: 45,
-            type: 'selection',
-            columnKey: 'selection',
+            prop: 'releaseTime',
+            label: '工单发布日期',
             align: 'center',
-            reserveSelection: true
+
+            minWidth: 110
           },
           {
-            columnKey: 'index',
-            label: '序号',
-            type: 'index',
-            width: 55,
+            prop: 'planFormingTime',
+            label: '预测生产日期',
             align: 'center',
-            showOverflowTooltip: true
-          },
 
-          {
-            slot: 'batchNo',
-            prop: 'batchNo',
-            label: '批次号',
-            align: 'center',
-            minWidth: 140
+            minWidth: 110
           },
-
           {
-            slot: 'code',
-            prop: 'code',
-            action: 'code',
-            label: '计划编号',
+            prop: 'deliveryTime',
+            label: '预测交货日期',
             align: 'center',
 
-            minWidth: 160,
-            sortable: true
+            minWidth: 110
           },
-
           {
-            prop: 'salesCode',
-            action: 'salesCode',
-            label: '销售订单号',
+            prop: 'formingTime',
+            label: '实际交货日期',
             align: 'center',
 
-            minWidth: 160
-          },
+            minWidth: 110
+          }
+        ],
+        change: []
+      };
 
-          {
-            prop: 'productCode',
-            label: '产品编码',
-            align: 'center',
+      return [
+        {
+          width: 45,
+          type: 'selection',
+          columnKey: 'selection',
+          align: 'center',
+          slot: 'selection'
+        },
 
-            minWidth: 140
-          },
-          {
-            prop: 'productName',
-            label: '产品名称',
-            align: 'center',
 
-            minWidth: 140
-          },
+        {
+          slot: 'batchNo',
+          prop: 'batchNo',
+          label: '批次号',
+          align: 'center',
+          minWidth: 140
+        },
 
-          {
-            prop: 'brandNo',
-            label: '牌号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          slot: 'code',
+          prop: 'code',
+          action: 'code',
+          label: '计划编号',
+          align: 'center',
 
-          {
-            prop: 'specification',
-            label: '规格',
-            align: 'center',
-            minWidth: 150,
+          minWidth: 160,
+          sortable: true
+        },
 
-            showOverflowTooltip: true
-          },
-          {
-            prop: 'model',
-            label: '型号',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'salesCode',
+          action: 'salesCode',
+          label: '销售订单号',
+          align: 'center',
 
-          {
-            prop: 'priority',
-            label: '优先级',
-            align: 'center',
-            minWidth: 120,
-            slot: 'priority',
-            sortable: 'custom'
-          },
+          minWidth: 160
+        },
 
-          {
-            prop: 'produceRoutingName',
-            label: '工艺路线',
-            align: 'center',
-            minWidth: 120
-          },
+        {
+          prop: 'productCode',
+          label: '产品编码',
+          align: 'center',
 
-          {
-            prop: 'productNum',
-            label: '计划数量',
-            align: 'center',
+          minWidth: 140
+        },
+        {
+          prop: 'productName',
+          label: '产品名称',
+          align: 'center',
 
-            slot: 'productNum'
-          },
-          {
-            prop: 'productWeight',
-            label: '计划重量',
-            align: 'center',
+          minWidth: 140
+        },
 
-            slot: 'productWeight'
-          },
-          {
-            prop: 'requiredFormingNum',
-            label: '要求生产数量',
-            align: 'center',
+        {
+          prop: 'brandNo',
+          label: '牌号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-            slot: 'requiredFormingNum'
-          },
+        {
+          prop: 'specification',
+          label: '规格',
+          align: 'center',
+          minWidth: 150,
 
-          {
-            prop: 'newSumOrderWeight',
-            label: '要求生产重量',
-            align: 'center',
+          showOverflowTooltip: true
+        },
+        {
+          prop: 'model',
+          label: '型号',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-            slot: 'newSumOrderWeight'
-          },
+        {
+          prop: 'priority',
+          label: '优先级',
+          align: 'center',
+          minWidth: 120,
+          slot: 'priority',
+          sortable: 'custom'
+        },
 
-          {
-            prop: 'scheduleStatusName',
-            label: '进度状态',
-            align: 'center',
+        {
+          prop: 'produceRoutingName',
+          label: '工艺路线',
+          align: 'center',
+          minWidth: 120
+        },
 
-            minWidth: 100
-          },
+        {
+          prop: 'productNum',
+          label: '计划数量',
+          align: 'center',
 
-          {
-            prop: '',
-            label: '已排产数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+          slot: 'productNum'
+        },
+        {
+          prop: 'productWeight',
+          label: '计划重量',
+          align: 'center',
 
-          {
-            prop: '',
-            label: '未排产数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+          slot: 'productWeight'
+        },
+        {
+          prop: 'requiredFormingNum',
+          label: '要求生产数量',
+          align: 'center',
 
-          {
-            prop: '',
-            label: '已生产数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+          slot: 'requiredFormingNum'
+        },
 
-          {
-            prop: '',
-            label: '未生产数量',
-            align: 'center',
-            showOverflowTooltip: true
-          },
+        {
+          prop: 'newSumOrderWeight',
+          label: '要求生产重量',
+          align: 'center',
 
-          {
-            prop: 'moCount',
-            label: '模数',
-            align: 'center',
-            show: this.clientEnvironmentId == '4'
-          },
+          slot: 'newSumOrderWeight'
+        },
 
-          {
-            prop: 'blockCount',
-            label: '块数',
-            align: 'center',
-            show: this.clientEnvironmentId == '4'
-          },
-          {
-            prop: 'noWordCount',
-            label: '未排程块数',
-            align: 'center',
+        {
+          prop: 'scheduleStatusName',
+          label: '进度状态',
+          align: 'center',
 
-            show: this.clientEnvironmentId == '4',
-            minWidth: 110
-          },
-          {
-            prop: 'reqMoldTime',
-            label: '计划完成日期',
-            align: 'center',
+          minWidth: 100
+        },
 
-            minWidth: 110
-          },
+        {
+          prop: '',
+          label: '已排产数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          ...opt[this.activeName],
+        {
+          prop: '',
+          label: '未排产数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-          {
-            prop: 'orderType',
-            label: '计划类型',
-            align: 'center',
+        {
+          prop: '',
+          label: '已生产数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-            formatter: (row) => {
-              const obj = this.planType.find((i) => i.value == row.planType);
-              return obj && obj.label;
-            }
-          },
-          {
-            prop: 'version',
-            label: '版本',
-            align: 'center',
+        {
+          prop: '',
+          label: '未生产数量',
+          align: 'center',
+          showOverflowTooltip: true
+        },
 
-            minWidth: 80
-          },
-          {
-            prop: 'createTime',
-            label: '创建时间',
-            align: 'center',
+        {
+          prop: 'moCount',
+          label: '模数',
+          align: 'center',
+          show: this.clientEnvironmentId == '4'
+        },
 
-            minWidth: 110
-          },
-          {
-            columnKey: '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: 'blockCount',
+          label: '块数',
+          align: 'center',
+          show: this.clientEnvironmentId == '4'
+        },
+        {
+          prop: 'noWordCount',
+          label: '未排程块数',
+          align: 'center',
+
+          show: this.clientEnvironmentId == '4',
+          minWidth: 110
+        },
+        {
+          prop: 'reqMoldTime',
+          label: '计划完成日期',
+          align: 'center',
+
+          minWidth: 110
+        },
+
+        ...opt[this.activeName],
+
+        {
+          prop: 'orderType',
+          label: '计划类型',
+          align: 'center',
+
+          formatter: (row) => {
+            const obj = this.planType.find((i) => i.value == row.planType);
+            return obj && obj.label;
           }
-        ];
-      }
+        },
+        {
+          prop: 'version',
+          label: '版本',
+          align: 'center',
+
+          minWidth: 80
+        },
+        {
+          prop: 'createTime',
+          label: '创建时间',
+          align: 'center',
+
+          minWidth: 110
+        },
+        {
+          columnKey: 'status',
+          slot: 'status',
+          label: '状态',
+          align: 'center',
+          formatter: (row) => {
+            const obj = this.statusOpt[this.activeName].find(
+              (i) => i.value == row.status
+            );
+            return obj && obj.label;
+          }
+        }
+      ];
+    }
+  },
+  created() {
+    this.getFieldModel();
+  },
+  methods: {
+    statusFormatter(status) {
+      const obj = this.statusOpt[this.activeName].find(
+        (i) => i.value == status
+      );
+
+      return obj && obj.label;
     },
-    created() {
-      this.getFieldModel();
+    /* 表格数据源 */
+    datasource({ page, limit, where }) {
+      return getList({
+        pageNum: page,
+        timeDimensionPlanType: this.timeDimensionPlanType,
+        size: limit,
+        ...where,
+        ...this.sort
+      });
     },
-    methods: {
-      statusFormatter(status) {
-        const obj = this.statusOpt[this.activeName].find(
-          (i) => i.value == status
-        );
+    // 发布工单
+    handleOrderPublish(type, row) {
+      if (!row.produceRoutingName) {
+        return this.$message.error('请先选择工艺路线!');
+      }
 
-        return obj && obj.label;
-      },
-      /* 表格数据源 */
-      datasource({ page, limit, where }) {
-        return getList({
-          pageNum: page,
-          timeDimensionPlanType: this.timeDimensionPlanType,
-          size: limit,
-          ...where,
-          ...this.sort
+      this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
+        .then(async () => {
+          const loading = this.$loading({
+            lock: true,
+            fullscreen: true,
+            text: '工单发布中...'
+          });
+          try {
+            let code = row.workOrderCode;
+            if (!code) {
+              code = await getCode('product_order_code');
+            }
+            // 反显对象会报错 status
+            const data = await release([row.id]);
+            if (data || data === 0) {
+              this.$message.success('发布成功!');
+            } else {
+              this.$message.error('发布失败,请重新发布!');
+            }
+            this.reload();
+          } catch (error) {
+            console.error(error);
+          }
+          loading.close();
+        })
+        .catch((err) => {
+          console.error(err);
         });
-      },
-      // 发布工单
-      handleOrderPublish(type, row) {
-        if (!row.produceRoutingName) {
-          return this.$message.error('请先选择工艺路线!');
+
+      // this.$router.push({
+      //   path: '/productionPlan/workOrderPublish',
+      //   query: {
+      //     type,
+      //     id: row.id
+      //   }
+      // });
+    },
+    // 修改计划
+    planEdit({ id }) {
+      this.$router.push({
+        path: '/saleOrder/salesToProduction',
+        query: {
+          type: 'edit',
+          id
         }
+      });
+    },
 
-        this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
-          .then(async () => {
-            const loading = this.$loading({
-              lock: true,
-              fullscreen: true,
-              text: '工单发布中...'
-            });
-            try {
-              let code = row.workOrderCode;
-              if (!code) {
-                code = await getCode('product_order_code');
-              }
-              // 反显对象会报错 status
-              const data = await release([row.id]);
-              if (data || data === 0) {
-                this.$message.success('发布成功!');
-              } else {
-                this.$message.error('发布失败,请重新发布!');
-              }
-              this.reload();
-            } catch (error) {
-              console.error(error);
-            }
-            loading.close();
-          })
-          .catch((err) => {
-            console.error(err);
+    getFieldModel() {
+      fieldModel({ fieldModel: 't_main_category' }).then((res) => {
+        const privateColumn = [];
+        if (this.activeName == 'first') {
+          privateColumn.push({
+            columnKey: 'action',
+            label: '操作',
+            width: 148,
+            align: 'center',
+            resizable: false,
+            fixed: 'right',
+            slot: 'action'
           });
+        } else {
+          privateColumn = [];
+        }
 
-        // this.$router.push({
-        //   path: '/productionPlan/workOrderPublish',
-        //   query: {
-        //     type,
-        //     id: row.id
-        //   }
-        // });
-      },
-      // 修改计划
-      planEdit({ id }) {
-        this.$router.push({
-          path: '/saleOrder/salesToProduction',
-          query: {
-            type: 'edit',
-            id
-          }
+        let newRes = res.map((m) => {
+          return {
+            prop: 'extField.' + m.prop,
+            label: m.label,
+            align: 'center',
+            showOverflowTooltip: true
+          };
         });
-      },
 
-      handleDone() {
-        this.$nextTick(() => {
-          this.$refs.table.setSelectedRowKeys(['1867146702592253954']);
-        });
-      },
-      getFieldModel() {
-        fieldModel({ fieldModel: 't_main_category' }).then((res) => {
-          const privateColumn = [];
-          if (this.activeName == 'first') {
-            privateColumn.push({
-              columnKey: 'action',
-              label: '操作',
-              width: 148,
-              align: 'center',
-              resizable: false,
-              fixed: 'right',
-              slot: 'action'
-            });
-          } else {
-            privateColumn = [];
-          }
+        this.newColumns = [...this.columns, ...newRes, ...privateColumn];
 
-          let newRes = res.map((m) => {
-            return {
-              prop: 'extField.' + m.prop,
-              label: m.label,
-              align: 'center',
-              showOverflowTooltip: true
-            };
-          });
+        this.$forceUpdate();
+      });
+    },
 
-          this.newColumns = [...this.columns, ...newRes, ...privateColumn];
+    handleTabChange() {
+      this.$refs.searchRef.reset();
+    },
 
-          this.$forceUpdate();
-        });
-      },
+    /* 刷新表格 */
+    reload(where) {
+      this.$nextTick(() => {
+        this.$refs.table.reload({ page: 1, where });
+      });
+    },
 
-      handleTabChange() {
-        this.$refs.searchRef.reset();
-      },
+    /* 数据转为树形结构 */
+    parseData(data) {
+      return {
+        ...data,
+        list: this.$util.toTreeData({
+          data: data.list,
+          count: data.total,
+
+          idField: 'code',
+          parentIdField: 'joinPlanCode'
+        })
+      };
+    },
+    handleSelectionChange(list) {
+      console.log(list);
 
-      /* 刷新表格 */
-      reload(where) {
-        this.$nextTick(() => {
-          this.$refs.table.reload({ page: 1, where });
-        });
-      },
 
-      /* 数据转为树形结构 */
-      parseData(data) {
-        return {
-          ...data,
-          list: this.$util.toTreeData({
-            data: data.list,
-            count: data.total,
-
-            idField: 'code',
-            parentIdField: 'joinPlanCode'
-          })
-        };
-      },
+      if (list.length > 1) {
+        this.selection = list;
+      } else {
+        this.selection = [];
+      }
 
-      goDetail({ id }) {
-        this.$router.push({
-          path: '/productionPlan/detail/' + id
-        });
-      },
 
-      // 拆批
-      toUnpack(row) {
-        if (!row.batchNo) {
-          return this.$message.error('请先填写批次号!');
-        }
-        this.$refs.unpackRef.open(row);
-      },
-      // 合并
-      handleMerge() {
-        this.$forceUpdate();
+    },
 
-        if (this.selection.length <= 1) {
-          return this.$message.warning('请先勾选二个或多个计划!');
-        }
-        const productCode = this.selection[0].productCode;
-        const produceRoutingId = this.selection[0].produceRoutingId;
+    handOneSelection(row) {
+      const index = this.selection.findIndex((item) => item.id == row.id);
+      if (index >= 0) {
+        this.selection.splice(index, 1);
+      } else {
+        this.selection.push(row)
+      }
 
-        for (var i = 0; i < this.selection.length; i++) {
-          if (productCode != this.selection[i].productCode) {
-            return this.$message.warning('产品编码不一致!');
-          }
 
-          if (produceRoutingId != this.selection[i].produceRoutingId) {
-            return this.$message.warning('工艺路线不一致!');
-          }
-        }
+    },
 
-        this.$refs.mergeRef.open(this.selection);
+    selectionFilter(row) {
+      return this.selection.findIndex((item) => item.id == row.id) >= 0;
+    },
 
-        console.log(this.selection);
-      },
+    goDetail({ id }) {
+      this.$router.push({
+        path: '/productionPlan/detail/' + id
+      });
+    },
 
-      splitDetails(type, row) {
-        this.$refs.DetailsRef.open(type, row);
-      },
+    // 拆批
+    toUnpack(row) {
+      if (!row.batchNo) {
+        return this.$message.error('请先填写批次号!');
+      }
+      this.$refs.unpackRef.open(row);
+    },
 
-      onSortChange(e) {
-        let sort = {
-          orderBy: e.order,
-          sortName: e.prop
-        };
-        this.sort = sort;
-        this.reload();
-      },
+    // 合并
+    handleMerge() {
+      if (this.selection.length <= 1) {
+        return this.$message.warning('请先勾选二个或多个计划!');
+      }
+      const productCode = this.selection[0].productCode;
+      const produceRoutingId = this.selection[0].produceRoutingId;
 
-      sortTop(row) {
-        row.priority = Number(row.priority) + 1;
-        this.priorityChange(row);
-      },
-      sortBottom(row) {
-        if (row.priority <= 1) {
-          return;
+      for (var i = 0; i < this.selection.length; i++) {
+        if (productCode != this.selection[i].productCode) {
+          return this.$message.warning('产品编码不一致!');
         }
-        row.priority = Number(row.priority) - 1;
-        this.priorityChange(row);
-      },
 
-      priorityChange(row) {
-        if (row.priority > 10) {
-          row.priority = 10; // 如果大于 10,则设置为 10
-        } else if (row.priority < 0) {
-          row.priority = 0; // 如果小于 0,则设置为 0
+        if (produceRoutingId != this.selection[i].produceRoutingId) {
+          return this.$message.warning('工艺路线不一致!');
         }
+      }
 
-        this.priorityFn(row);
-      },
-      priorityFn: debounce(function (row) {
-        let params = {
-          id: row.id,
-          priority: row.priority
-        };
-        updatePriority(params).then((res) => {});
-      }, 800)
-    }
-  };
+      this.$refs.mergeRef.open(this.selection);
+
+      console.log(this.selection);
+    },
+
+    splitDetails(type, row) {
+      this.$refs.DetailsRef.open(type, row);
+    },
+
+    onSortChange(e) {
+      let sort = {
+        orderBy: e.order,
+        sortName: e.prop
+      };
+      this.sort = sort;
+      this.reload();
+    },
+
+    sortTop(row) {
+      row.priority = Number(row.priority) + 1;
+      this.priorityChange(row);
+    },
+    sortBottom(row) {
+      if (row.priority <= 1) {
+        return;
+      }
+      row.priority = Number(row.priority) - 1;
+      this.priorityChange(row);
+    },
+
+    priorityChange(row) {
+      if (row.priority > 10) {
+        row.priority = 10; // 如果大于 10,则设置为 10
+      } else if (row.priority < 0) {
+        row.priority = 0; // 如果小于 0,则设置为 0
+      }
+
+      this.priorityFn(row);
+    },
+    priorityFn: debounce(function (row) {
+      let params = {
+        id: row.id,
+        priority: row.priority
+      };
+      updatePriority(params).then((res) => { });
+    }, 800)
+  }
+};
 </script>
 
 <style lang="scss" scoped>
-  .btn_box {
-    margin-bottom: 6px;
+.btn_box {
+  margin-bottom: 6px;
+}
+
+.check_box {
+  width: 100%;
+  display: flex;
+  align-items: center;
+  justify-content: center;
+  cursor: pointer;
+}
+
+.check {
+  width: 14px;
+  height: 14px;
+  border: 1px solid #dddddd;
+
+  display: flex;
+  align-items: center;
+  justify-content: center;
+}
+
+.act_check {
+  border: 1px solid #409eff;
+  background: #409eff;
+
+  .el-icon-check {
+    color: #fff;
+    font-size: 10px;
   }
+}
 </style>