2213980799@qq.com 1 год назад
Родитель
Сommit
21b8acd33f

+ 14 - 12
src/api/materialPlan/index.js

@@ -3,7 +3,7 @@ import request from '@/utils/request';
 /**
  * 列表
  */
-export async function getList(data) {
+export async function getList (data) {
   const res = await request.post('/aps/batchingplan/page', data);
   if (res.data.code == 0) {
     return res.data.data;
@@ -13,7 +13,7 @@ export async function getList(data) {
 /**
  * 保存
  */
-export async function save(data) {
+export async function save (data) {
   const res = await request.post('/aps/batchingplan/save', data);
   if (res.data.code == 0) {
     return res.data.data;
@@ -24,7 +24,7 @@ export async function save(data) {
 /**
  * 修改
  */
-export async function del(data) {
+export async function del (data) {
   const res = await request.delete('/aps/batchingplan/delete', { data });
   if (res.data.code == 0) {
     return res.data.data;
@@ -35,7 +35,7 @@ export async function del(data) {
 /**
  * 发布信息返显
  */
-export async function getById(id) {
+export async function getById (id) {
   const res = await request.get(`/aps/batchingplan/getById/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
@@ -45,7 +45,7 @@ export async function getById(id) {
 /**
  * 详情
  */
-export async function getPlanInfoById(id) {
+export async function getPlanInfoById (id) {
   const res = await request.get(`/aps/batchingplan/getPlanInfoById/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
@@ -55,7 +55,7 @@ export async function getPlanInfoById(id) {
 /**
  * 发布信息返显
  */
-export async function getReleaseInfoById(id) {
+export async function getReleaseInfoById (id) {
   const res = await request.get(`/aps/batchingplan/getReleaseInfoById/${id}`);
   if (res.data.code == 0) {
     return res.data.data;
@@ -81,7 +81,7 @@ export async function getMaterialList(data) {
 
 // 批量根据生产计划计算bom列表信息
 export async function listBomBySalesOrderIds(data) {
-  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderIds`, data);
+  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderIds`,data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -91,7 +91,7 @@ export async function listBomBySalesOrderIds(data) {
 
 // 根据销售订单计算bom列表信息
 export async function listBomBySalesOrderId(data) {
-  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderId`, data);
+  const res = await request.post(`/aps/batchingplandetail/listBomBySalesOrderId`,data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -100,7 +100,7 @@ export async function listBomBySalesOrderId(data) {
 
 // 提交
 export async function submit(data) {
-  const res = await request.post(`/bpm/apspurchaseplan/submit`, data);
+  const res = await request.post(`/bpm/apspurchaseplan/submit`,data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -111,7 +111,7 @@ export async function submit(data) {
 
 
 export async function listBomByWorkOrderIds(data) {
-  const res = await request.post(`/aps/batchingplandetail/listBomByMesWorkOrderIds`, data);
+  const res = await request.post(`/aps/batchingplandetail/listBomByMesWorkOrderIds`,data);
   if (res.data.code == 0) {
     return res.data.data;
   }
@@ -128,11 +128,13 @@ export async function getTaskListById(id) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+
 // 配料计划选择生产工单分页
 export async function dosingPage(data) {
-  const res = await request.post(`/mes/workorder/dosingPage`, data);
+  const res = await request.post(`/mes/workorder/dosingPage`,data);
   if (res.data.code == 0) {
     return res.data.data;
   }
   return Promise.reject(new Error(res.data.message));
-}
+}

+ 8 - 0
src/api/productionPlan/index.js

@@ -73,6 +73,14 @@ export async function del (id) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 修改优先级
+export async function updatePriority(data) {
+  const res = await request.post(`/aps/productionplan/updatePriority`,  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 /**
  * 生产详情列表
  */

+ 9 - 6
src/api/saleOrder/index.js

@@ -192,10 +192,13 @@ export async function getInventory(materialCode, planType) {
   }
   return Promise.reject(new Error(res.data.message));
 }
+
+// 修改优先级
 export async function updatePriority(data) {
-    const res = await request.post(`/aps/salesorder/updatePriority`,  data);
-    if (res.data.code == 0) {
-      return res.data.data;
-    }
-   return Promise.reject(new Error(res.data.message));
-  }
+  const res = await request.post(`/aps/salesorder/updatePriority`,  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

+ 8 - 6
src/api/workOrder/index.js

@@ -25,10 +25,12 @@ export async function releaseWorkOrder({ id, teamId }) {
 }
 
 
+// 修改优先级
 export async function updatePriority(data) {
-    const res = await request.post(`/aps/workorder/updatePriority`,  data);
-    if (res.data.code == 0) {
-      return res.data.data;
-    }
-    return Promise.reject(new Error(res.data.message));
-  }
+  const res = await request.post(`/aps/workorder/updatePriority`,  data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+

BIN
src/assets/file/AiMiLL.png


+ 1 - 1
src/config/setting.js

@@ -2,7 +2,7 @@
 export const API_BASE_URL = process.env.VUE_APP_API_BASE_URL;
 
 // 项目名称
-export const PROJECT_NAME = '';
+export const PROJECT_NAME = ''; //  process.env.VUE_APP_NAME;
 
 // 不显示侧栏的路由
 export const HIDE_SIDEBARS = [];

+ 3 - 2
src/views/materialPlan/components/ProductModal.vue

@@ -227,7 +227,7 @@ export default {
         this.$message.error('请至少选择一条数据');
         return;
       }
-      // if (this.type == 'add') {
+   
        _arr = this.selection.map(m => {
           m.categoryId = m.id
           m.unit = m.measuringUnit
@@ -236,7 +236,8 @@ export default {
             ...m
           }
         })
-      // }
+
+
 
       this.$emit('chooseModal', _arr, this.current)
       this.handleClose()

+ 3 - 1
src/views/materialPlan/components/plan-edit-dialog.vue

@@ -600,8 +600,10 @@ export default {
         }
       })
 
-      this.$refs.table.setData([...tableList]);
 
+      console.log(tableList);
+      this.$refs.table.setData([...tableList]);
+      this.$forceUpdate()
     },
 
     remove2(row) {

+ 0 - 1
src/views/materialPlan/components/workOrderPop.vue

@@ -21,7 +21,6 @@
   
 <script>
 import workOrderSearch from './workOrder-search'
-// import { getList } from '@/api/workOrder/index.js';
 import { dosingPage } from '@/api/materialPlan/index.js';
 import dictMixins from '@/mixins/dictMixins';
 export default {

+ 349 - 351
src/views/productionPlan/index.vue

@@ -21,25 +21,24 @@
         :columns="columns"
         :datasource="datasource"
         :cache-key="`${activeName}ProductionPlanTable`"
+        @sort-change="onSortChange"
       >
         <template v-slot:code="{ row }">
           <el-link type="primary" :underline="false" @click="goDetail(row)">
             {{ row.code }}
           </el-link>
         </template>
-        <!-- 
-        <template v-slot:productWeight="{ row }">
-          {{ row.productWeight }} {{ row.weightUnit }}
-        </template> -->
+
         <template v-slot:priority="{ row }">
           <el-input
             v-model="row.priority"
-           type="number"
+            type="number"
             size="mini"
             :min="0"
             :max="10"
             @change="priorityChange(row)"
           ></el-input>
+
           <el-popover
             placement="right"
             width="200"
@@ -52,9 +51,7 @@
             </div>
           </el-popover>
         </template>
-        <!-- <template v-slot:newSumOrderWeight="{ row }">
-          {{ row.newSumOrderWeight }} {{ row.newWeightUnit }}
-        </template> -->
+
         <template v-slot:productWeight="{ row }">
           {{ row.productWeight }} {{ row.weightUnit }}
         </template>
@@ -62,6 +59,7 @@
         <template v-slot:newSumOrderWeight="{ row }">
           {{ row.newSumOrderWeight }} {{ row.newWeightUnit }}
         </template>
+
         <template v-slot:status="{ row }">
           <span :class="{ 'ele-text-danger': row.status == 3 }">
             {{ statusFormatter(row.status) }}
@@ -110,195 +108,193 @@
 </template>
 
 <script>
-import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
-import productionPlanSearch from './components/productionPlan-search.vue';
-import { release } from '@/api/productionPlan/order.js';
-import { multiply } from '@/utils/math';
-import { getCode } from '@/api/codeManagement';
-import { debounce } from 'lodash';
-export default {
-  components: {
-    productionPlanSearch
-  },
-  data() {
-    return {
-      activeName: 'first',
+  import { getList, del, updatePriority } from '@/api/productionPlan/index.js';
+  import productionPlanSearch from './components/productionPlan-search.vue';
+  import { release } from '@/api/productionPlan/order.js';
+  import { multiply } from '@/utils/math';
+  import { getCode } from '@/api/codeManagement';
+  import { debounce } from 'lodash';
+  export default {
+    components: {
+      productionPlanSearch
+    },
+    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' }
+        // 加载状态
+        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' }
+          ]
+        },
+        planType: [
+          { label: '所有计划类型', value: null },
+          { label: '内销计划', value: '1' },
+          { label: '外销计划', value: '2' },
+          { label: '预制计划', value: '3' }
         ]
-      },
-      planType: [
-        { label: '所有计划类型', value: null },
-        { label: '内销计划', value: '1' },
-        { label: '外销计划', value: '2' },
-        { label: '预制计划', value: '3' }
-      ]
-    };
-  },
-  computed: {
-    // 表格列配置
-    columns() {
-      const opt = {
-        first: [
-          // {
-          //   prop: 'deliveryTime',
-          //   label: '预测交货日期',
-          //   align: 'center',
-          //   showOverflowTooltip: true,
-          //   minWidth: 110
-          // }
-        ],
-        second: [
-          // {
-          //   prop: 'formingTime',
-          //   label: '实际生产日期',
-          //   align: 'center',
-          //   showOverflowTooltip: true,
-          //   minWidth: 110
-          // },
+      };
+    },
+    computed: {
+      // 表格列配置
+      columns() {
+        const opt = {
+          first: [
+            // {
+            //   prop: 'deliveryTime',
+            //   label: '预测交货日期',
+            //   align: 'center',
+            //   showOverflowTooltip: true,
+            //   minWidth: 110
+            // }
+          ],
+          second: [
+            // {
+            //   prop: 'formingTime',
+            //   label: '实际生产日期',
+            //   align: 'center',
+            //   showOverflowTooltip: true,
+            //   minWidth: 110
+            // },
+            {
+              prop: 'releaseTime',
+              label: '工单发布日期',
+              align: 'center',
+              showOverflowTooltip: true,
+              minWidth: 110
+            },
+            {
+              prop: 'planFormingTime',
+              label: '预测生产日期',
+              align: 'center',
+              showOverflowTooltip: true,
+              minWidth: 110
+            },
+            {
+              prop: 'deliveryTime',
+              label: '预测交货日期',
+              align: 'center',
+              showOverflowTooltip: true,
+              minWidth: 110
+            },
+            {
+              prop: 'formingTime',
+              label: '实际交货日期',
+              align: 'center',
+              showOverflowTooltip: true,
+              minWidth: 110
+            }
+          ]
+        };
+
+        return [
           {
-            prop: 'releaseTime',
-            label: '工单发布日期',
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            fixed: 'left'
           },
           {
-            prop: 'planFormingTime',
-            label: '预测生产日期',
+            slot: 'code',
+            prop: 'code',
+            action: 'code',
+            label: '计划编号',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 180
           },
           {
-            prop: 'deliveryTime',
-            label: '预测交货日期',
+            prop: 'productCode',
+            label: '产品编码',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
+            minWidth: 140
           },
           {
-            prop: 'formingTime',
-            label: '实际交货日期',
+            prop: 'productName',
+            label: '产品名称',
             align: 'center',
             showOverflowTooltip: true,
-            minWidth: 110
-          }
-        ]
-      };
+            minWidth: 140
+          },
 
-      return [
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          slot: 'code',
-          prop: 'code',
-          action: 'code',
-          label: '计划编号',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 180
-        },
-        {
-          prop: 'productCode',
-          label: '产品编号',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 140
-        },
-        {
-           prop: 'productName',
-            label: '产品名称',
+
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'batchNo',
+            label: '批号',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+   
+
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: 'custom'
+          },
+
+          {
+            prop: 'productNum',
+            label: '计划数量(方)',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productWeight',
+            label: '计划重量',
             align: 'center',
             showOverflowTooltip: true,
-           minWidth: 140
+            slot: 'productWeight'
+          },
+          {
+            prop: 'requiredFormingNum',
+            label: '要求生产数量(方)',
+            align: 'center',
+            showOverflowTooltip: true
           },
-        {
-          prop: 'brandNo',
-          label: '牌号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'batchNo',
-          label: '批号',
-          align: 'center',
-          minWidth: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'model',
-          label: '型号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-    
-        {
-          prop: 'specification',
-          label: '规格',
-          align: 'center'
-        },
-        {
-          prop: 'priority',
-          label: '优先级',
-          align: 'center',
-          minWidth: 120,
-          slot: 'priority',
-          sortable: 'custom'
-        },
-        {
-          prop: 'productNum',
-          label: '计划数量(方)',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 100
-        },
-        {
-          prop: 'productWeight',
-          label: '计划重量',
-          align: 'center',
-          showOverflowTooltip: true,
-          slot: 'productWeight'
-        },
-        {
-          prop: 'requiredFormingNum',
-          label: '要求生产数量(方)',
-          align: 'center',
-          minWidth: 120,
-          showOverflowTooltip: true
-        },
 
-        {
-          prop: 'newSumOrderWeight',
-          label: '要求生产重量',
-          align: 'center',
-          showOverflowTooltip: true,
-          slot: 'newSumOrderWeight'
-        },
-        {
+          {
+            prop: 'newSumOrderWeight',
+            label: '要求生产重量',
+            align: 'center',
+            showOverflowTooltip: true,
+            slot: 'newSumOrderWeight'
+          },
+
+          {
           prop: 'moCount',
           label: '模数',
           align: 'center'
@@ -316,167 +312,169 @@ export default {
           showOverflowTooltip: true,
           minWidth: 110
         },
-        {
-          prop: 'reqMoldTime',
-          label: '要求生产日期',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
+          {
+            prop: 'reqMoldTime',
+            label: '要求生产日期',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
 
-        ...opt[this.activeName],
+          ...opt[this.activeName],
 
-        {
-          prop: 'orderType',
-          label: '计划类型',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (row) => {
-            const obj = this.planType.find((i) => i.value == row.planType);
-            return obj && obj.label;
-          }
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          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;
-          }
-        },
-        // ...(this.activeName === 'second'
-        //   ? [
-        //       {
-        //         prop: 'releaseTime',
-        //         label: '发布时间',
-        //         align: 'center',
-        //         showOverflowTooltip: true,
-        //         minWidth: 110
-        //       }
-        //     ]
-        //   : []),
-        ...(this.activeName === 'first'
-          ? [
-              {
-                columnKey: 'action',
-                label: '操作',
-                width: 250,
-                align: 'center',
-                resizable: false,
-                fixed: 'right',
-                slot: 'action',
-                showOverflowTooltip: true
-              }
-            ]
-          : [])
-      ];
-    }
-  },
-  methods: {
-    statusFormatter(status) {
-      const obj = this.statusOpt[this.activeName].find(
-        (i) => i.value == status
-      );
-
-      return obj && obj.label;
-    },
-    /* 表格数据源 */
-    datasource({ page, limit, where }) {
-      return getList({
-        pageNum: page,
-        size: limit,
-        ...where,
-        ...this.sort
-      });
-    },
-    // 发布工单
-    handleOrderPublish(type, row) {
-      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');
+          {
+            prop: 'orderType',
+            label: '计划类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (row) => {
+              const obj = this.planType.find((i) => i.value == row.planType);
+              return obj && obj.label;
             }
-            // 反显对象会报错 status
-            const data = await release([row.id]);
-            if (data || data === 0) {
-              this.$message.success('发布成功!');
-            } else {
-              this.$message.error('发布失败,请重新发布!');
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            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;
             }
-            this.reload();
-          } catch (error) {
-            console.error(error);
-          }
-          loading.close();
-        })
-        .catch((err) => {
-          console.error(err);
+          },
+          // ...(this.activeName === 'second'
+          //   ? [
+          //       {
+          //         prop: 'releaseTime',
+          //         label: '发布时间',
+          //         align: 'center',
+          //         showOverflowTooltip: true,
+          //         minWidth: 110
+          //       }
+          //     ]
+          //   : []),
+          ...(this.activeName === 'first'
+            ? [
+                {
+                  columnKey: 'action',
+                  label: '操作',
+                  width: 250,
+                  align: 'center',
+                  resizable: false,
+                  fixed: 'right',
+                  slot: 'action',
+                  showOverflowTooltip: true
+                }
+              ]
+            : [])
+        ];
+      }
+    },
+    methods: {
+      statusFormatter(status) {
+        const obj = this.statusOpt[this.activeName].find(
+          (i) => i.value == status
+        );
+
+        return obj && obj.label;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        return getList({
+          pageNum: page,
+          size: limit,
+          ...where,
+          ...this.sort
         });
+      },
+      // 发布工单
+      handleOrderPublish(type, row) {
+        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);
+          });
 
-      // this.$router.push({
-      //   path: '/productionPlan/workOrderPublish',
-      //   query: {
-      //     type,
-      //     id: row.id
-      //   }
-      // });
-    },
-    // 修改计划
-    planEdit({ id }) {
-      this.$router.push({
-        path: '/saleOrder/salesToProduction',
-        query: {
-          type: 'edit',
-          id
-        }
-      });
-    },
-    handleTabChange() {
-      this.$refs.searchRef.reset();
-    },
+        // this.$router.push({
+        //   path: '/productionPlan/workOrderPublish',
+        //   query: {
+        //     type,
+        //     id: row.id
+        //   }
+        // });
+      },
+      // 修改计划
+      planEdit({ id }) {
+        this.$router.push({
+          path: '/saleOrder/salesToProduction',
+          query: {
+            type: 'edit',
+            id
+          }
+        });
+      },
+      handleTabChange() {
+        this.$refs.searchRef.reset();
+      },
 
-    /* 刷新表格 */
-    reload(where) {
-      this.$nextTick(() => {
-        this.$refs.table.reload({ page: 1, where });
-      });
-    },
+      /* 刷新表格 */
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
 
-    goDetail({ id }) {
-      this.$router.push({
-        path: '/productionPlan/detail/' + id
-      });
-    },
-    handleDelete({ id }) {
-      this.$confirm('确定删除当前数据?', '提示')
-        .then(async () => {
-          await del(id);
-          this.$message.success('删除成功!');
-          this.reload();
-        })
-        .catch((err) => {
-          console.error(err);
+      goDetail({ id }) {
+        this.$router.push({
+          path: '/productionPlan/detail/' + id
         });
-    },
-    onSortChange(e) {
+      },
+      handleDelete({ id }) {
+        this.$confirm('确定删除当前数据?', '提示')
+          .then(async () => {
+            await del(id);
+            this.$message.success('删除成功!');
+            this.reload();
+          })
+          .catch((err) => {
+            console.error(err);
+          });
+      },
+
+      
+      onSortChange(e) {
         let sort = {
           orderBy: e.order,
           sortName:  e.prop,
@@ -486,36 +484,36 @@ export default {
        
       },
 
-    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);
-    },
+      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) {
+      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)
-  }
-};
+        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></style>

+ 5 - 3
src/views/saleOrder/components/order-search.vue

@@ -69,12 +69,14 @@
           <el-input v-model="where.salesman" placeholder="请输入"></el-input>
         </el-form-item>
       </el-col>
-    </el-row>
-    <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
         <el-form-item label="产品名称:">
           <el-input v-model="where.productName" placeholder="请输入"></el-input>
         </el-form-item>
       </el-col>
+      
+    </el-row>
     <el-row :gutter="15">
       <el-col v-bind="styleResponsive ? { lg: 12, md: 12 } : { span: 12 }">
         <el-form-item label="交货日期:">
@@ -150,7 +152,7 @@ export default {
       proStu: '',
       orderLibraryType: 0,
       salesman: '',
-      productName:''
+      productName: ''
     };
     return {
       fileUrl,

+ 46 - 44
src/views/saleOrder/components/plan-submit.vue

@@ -47,7 +47,7 @@
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 产品重量 </template>
-          {{ info.sumOrderWeight }} {{ info.newWeightUnit }}
+          {{ info.sumOrderWeight }} {{  info.newWeightUnit }}
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 要求生产数量 </template>
@@ -55,16 +55,18 @@
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 要求生产重量 </template>
-          {{ info.newSumOrderWeight }} {{ info.newWeightUnit }}
+          {{ info.newSumOrderWeight }} {{  info.newWeightUnit }}
         </el-descriptions-item>
         <el-descriptions-item>
           <template slot="label"> 生产完成日期 </template>
           {{ info.reqMoldTime }}
         </el-descriptions-item>
+
         <el-descriptions-item>
           <template slot="label"> 批号 </template>
           {{ info.batchNo }}
         </el-descriptions-item>
+
         <el-descriptions-item :span="3">
           <template slot="label"> 计划备注 </template>
           {{ info.notes }}
@@ -86,52 +88,52 @@
 </template>
 
 <script>
-import { getCode } from '@/api/codeManagement';
-import dictMixins from '@/mixins/dictMixins';
-export default {
-  mixins: [dictMixins],
-  props: {
-    info: Object,
-    type: String
-  },
-  data() {
-    return {
-      visible: false,
-      loading: false,
-      tableList: []
-    };
-  },
-  computed: {},
-  created() {
-    this.requestDict('订单计划类型');
-  },
-  methods: {
-    open() {
-      this.visible = true;
-      if (this.type != 'edit') {
-        this.getPlanCode();
-      }
+  import { getCode } from '@/api/codeManagement';
+  import dictMixins from '@/mixins/dictMixins';
+  export default {
+    mixins: [dictMixins],
+    props: {
+      info: Object,
+      type: String
     },
-    cancel() {
-      this.visible = false;
+    data() {
+      return {
+        visible: false,
+        loading: false,
+        tableList: []
+      };
     },
-    async getPlanCode() {
-      this.loading = true;
-      try {
-        const code = await getCode('product_code');
-        this.$set(this.info, 'code', code);
-      } catch (err) {}
-      this.loading = false;
+    computed: {},
+    created() {
+      this.requestDict('订单计划类型');
     },
-    submit(type) {
-      this.$emit('publish', type);
-      this.visible = false;
+    methods: {
+      open() {
+        this.visible = true;
+        if (this.type != 'edit') {
+          this.getPlanCode();
+        }
+      },
+      cancel() {
+        this.visible = false;
+      },
+      async getPlanCode() {
+        this.loading = true;
+        try {
+          const code = await getCode('product_code');
+          this.$set(this.info, 'code', code);
+        } catch (err) {}
+        this.loading = false;
+      },
+      submit(type) {
+        this.$emit('publish', type);
+        this.visible = false;
+      }
     }
-  }
-};
+  };
 </script>
 <style lang="scss" scoped>
-.basic-details-title {
-  margin: 10px 0;
-}
+  .basic-details-title {
+    margin: 10px 0;
+  }
 </style>

+ 296 - 294
src/views/saleOrder/index.vue

@@ -21,19 +21,22 @@
         :selection.sync="selection"
         cache-key="systemRoleTable1"
         row-key="id"
+        @sort-change="onSortChange"  
       >
         <template v-slot:code="{ row }">
           <el-link :underline="false" @click="openDetails(row)">
             {{ row.code }}
           </el-link>
         </template>
+
         <template v-slot:priority="{ row }">
+       
           <el-input
             v-model="row.priority"
             type="number"
             size="mini"
-            :min="0"
-            :max="10"
+              :min="0"
+         :max="10"
             @change="priorityChange(row)"
           ></el-input>
           <el-popover
@@ -42,12 +45,13 @@
             trigger="hover"
             content="数值越大优先级越高(0-3普通, 4-6优先, 7-10紧急)"
           >
-            <div class="sort-wrap" slot="reference">
+            <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>
             </div>
           </el-popover>
         </template>
+
         <template v-slot:productSumWeight="{ row }">
           {{ row.productSumWeight }}
         </template>
@@ -85,142 +89,135 @@
 </template>
 
 <script>
-import OrderSearch from './components/order-search.vue';
-import OrderDetail from './components/order-detail.vue';
-import CreateOrder from './components/create-order.vue';
-import { getPageList, deleteOrder, updatePriority } from '@/api/saleOrder';
-import dictMixins from '@/mixins/dictMixins';
-import { debounce } from 'lodash';
-export default {
-  name: 'saleOrder',
-  mixins: [dictMixins],
-  components: {
-    OrderSearch,
-    OrderDetail,
-    CreateOrder
-  },
-  data() {
-    return {
-      // 加载状态
-      loading: false,
-      activeName: 'first',
-      selection: []
-    };
-  },
-  computed: {
-    // 表格列配置
-    columns() {
-      const privateColumn = [];
-      if (this.activeName == 'first') {
-        privateColumn.push({
-          columnKey: 'action',
-          label: '操作',
-          width: 150,
-          align: 'center',
-          resizable: false,
-          slot: 'action',
-          showOverflowTooltip: true,
-          fixed: 'right'
-        });
-      }
-      return [
-        {
-          width: 45,
-          type: 'selection',
-          columnKey: 'selection',
-          align: 'center'
-        },
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          prop: 'code',
-          label: '销售订单号',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 150,
-          slot: 'code'
-        },
-        {
-          prop: 'lineNumber',
-          label: '行号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'productCode',
-          label: '产品编码',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 140,
-          sortable: true
-        },
+  import OrderSearch from './components/order-search.vue';
+  import OrderDetail from './components/order-detail.vue';
+  import CreateOrder from './components/create-order.vue';
+  import { getPageList, deleteOrder, updatePriority } from '@/api/saleOrder';
+  import dictMixins from '@/mixins/dictMixins';
+  import { debounce } from 'lodash';
+  export default {
+    name: 'saleOrder',
+    mixins: [dictMixins],
+    components: {
+      OrderSearch,
+      OrderDetail,
+      CreateOrder
+    },
+    data() {
+      return {
+        // 加载状态
+        loading: false,
+        activeName: 'first',
+        selection: []
+      };
+    },
+    computed: {
+      // 表格列配置
+      columns() {
+        const privateColumn = [];
+        if (this.activeName == 'first') {
+          privateColumn.push({
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            resizable: false,
+            slot: 'action',
+            showOverflowTooltip: true,
+            fixed: 'right'
+          });
+        }
+        return [
+          {
+            width: 45,
+            type: 'selection',
+            columnKey: 'selection',
+            align: 'center'
+          },
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'code',
+            label: '销售订单号',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 150,
+            slot: 'code'
+          },
+          {
+            prop: 'lineNumber',
+            label: '行号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 140,
+            sortable: true
+          },
 
-        {
-          prop: 'productName',
-          label: '产品名称',
-          align: 'center',
-          minWidth: 120
-        },
+          {
+            prop: 'productName',
+            label: '产品名称',
+            align: 'center',
+            minWidth: 120
+          },
 
-        {
-          prop: 'produceRoutingName',
-          label: '工艺路线',
-          align: 'center',
-          minWidth: 120
-        },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center',
+            minWidth: 120
+          },
 
-        {
-          prop: 'brandNo',
-          label: '牌号',
-          align: 'center'
-        },
-        {
-          prop: 'model',
-          label: '型号',
-          align: 'center',
-          minWidth: 120,
-          sortable: true
-        },
-        {
-          prop: 'specification',
-          label: '规格',
-          align: 'center',
-          minWidth: 120
-        },
-        {
-          prop: 'priority',
-          label: '优先级',
-          align: 'center',
-          minWidth: 120,
-          slot: 'priority',
-          sortable: 'custom'
-        },
-        {
-          prop: 'productSumWeight',
-          label: '合同重量',
-          align: 'center',
-          slot: 'productSumWeight'
-        },
-        {
-          prop: 'contractNum',
-          label: '合同数量(方)',
-          minWidth: 120,
-          align: 'center'
-        },
-        {
-          prop: 'lackNum',
-          label: '欠交数量(方)',
-          minWidth: 120,
-          align: 'center'
-        },
-        {
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center'
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            minWidth: 120,
+            sortable: true
+          },
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: 'custom'
+          },
+
+          {
+            prop: 'productSumWeight',
+            label: '合同重量',
+            align: 'center',
+            slot: 'productSumWeight'
+          },
+          {
+            prop: 'contractNum',
+            label: '合同数量(方)',
+            align: 'center'
+          },
+          {
+            prop: 'lackNum',
+            label: '欠交数量(方)',
+            align: 'center'
+          },
+          {
           prop: 'moCount',
           label: '模数',
           align: 'center'
@@ -230,143 +227,144 @@ export default {
           label: '块数',
           align: 'center'
         },
-        {
-          prop: 'orderLibraryType',
-          label: '按单按库',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return this.getDictValue('按单按库', _row.orderLibraryType);
-          }
-        },
-        {
-          prop: 'deliveryRequirements',
-          label: '交付要求',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return this.getDictValue('交付要求', _row.deliveryRequirements);
-          }
-        },
-        {
-          prop: 'orderType',
-          label: '订单类型',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return this.getDictValue('订单类型', _row.orderType);
-          }
-        },
-        {
-          prop: 'orderSource',
-          label: '订单来源',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return this.getDictValue('订单来源', _row.orderSource);
-          }
-        },
-        {
-          prop: 'status',
-          label: '生产状态',
-          align: 'center',
-          showOverflowTooltip: true,
-          formatter: (_row, _column, cellValue) => {
-            return this.getDictValue('生产状态', _row.status);
-          }
-        },
-        {
-          prop: 'releaseTime',
-          label: '下达时间',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'deliveryTime',
-          label: '交付日期',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'customerName',
-          label: '客户名称',
-          align: 'center',
-          showOverflowTooltip: true
-        },
+          {
+            prop: 'orderLibraryType',
+            label: '按单按库',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('按单按库', _row.orderLibraryType);
+            }
+          },
+          {
+            prop: 'deliveryRequirements',
+            label: '交付要求',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('交付要求', _row.deliveryRequirements);
+            }
+          },
+          {
+            prop: 'orderType',
+            label: '订单类型',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('订单类型', _row.orderType);
+            }
+          },
+          {
+            prop: 'orderSource',
+            label: '订单来源',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('订单来源', _row.orderSource);
+            }
+          },
+          {
+            prop: 'status',
+            label: '生产状态',
+            align: 'center',
+            showOverflowTooltip: true,
+            formatter: (_row, _column, cellValue) => {
+              return this.getDictValue('生产状态', _row.status);
+            }
+          },
+          {
+            prop: 'releaseTime',
+            label: '下达时间',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'deliveryTime',
+            label: '交付日期',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'customerName',
+            label: '客户名称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
 
-        {
-          prop: 'serialNo',
-          label: '客户代号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
+          {
+            prop: 'serialNo',
+            label: '客户代号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
 
-        {
-          prop: 'simpleName',
-          label: '客户简称',
-          align: 'center',
-          showOverflowTooltip: true
-        },
+          {
+            prop: 'simpleName',
+            label: '客户简称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
 
-        {
-          prop: 'salesman',
-          label: '业务员',
-          align: 'center',
-          showOverflowTooltip: true
-        },
-        ...privateColumn
-      ];
-    }
-  },
-  created() {
-    this.requestDict('按单按库');
-    this.requestDict('交付要求');
-    this.requestDict('订单类型');
-    this.requestDict('订单来源');
-    this.requestDict('生产状态');
-  },
-  methods: {
-    /* 表格数据源 */
-    async datasource({ page, limit, where, order }) {
-      if (this.activeName == 'first') {
-        where.status = [1];
-      } else {
-        if (where.proStu) {
-          where.status = [where.proStu];
-        } else {
-          where.status = [2, 3, 4, 5, 6, 7];
-        }
+          {
+            prop: 'salesman',
+            label: '业务员',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          ...privateColumn
+        ];
       }
-      const params = {
-        size: limit,
-        pageNum: page,
-        ...where,
-        ...this.sort
-      };
-      const data = await getPageList(params);
-      return data;
     },
-
-    /* 刷新表格 */
-    reload(where) {
-      this.$nextTick(() =>
-        this.$refs.table.reload({ page: 1, limit: 10, where })
-      );
+    created() {
+      this.requestDict('按单按库');
+      this.requestDict('交付要求');
+      this.requestDict('订单类型');
+      this.requestDict('订单来源');
+      this.requestDict('生产状态');
     },
+    methods: {
+      /* 表格数据源 */
+      async datasource({ page, limit, where, order }) {
+        if (this.activeName == 'first') {
+          where.status = [1];
+        } else {
+          if (where.proStu) {
+            where.status = [where.proStu];
+          } else {
+            where.status = [2, 3, 4, 5, 6, 7];
+          }
+        }
+        const params = {
+          size: limit,
+          pageNum: page,
+          ...where,
+          ...this.sort
+        };
+        const data = await getPageList(params);
+        return data;
+      },
 
-    openDetails(row) {
-      this.$refs.detailDialog.open(row);
-    },
-    toUpdate(row) {
-      this.$refs.createDialog.open(row);
-    },
-    remove(row) {
-      deleteOrder([row.id]).then((res) => {
-        this.$message.success(res);
-        this.reload();
-      });
-    },
-    onSortChange(e) {
+      /* 刷新表格 */
+      reload(where) {
+        this.$nextTick(() =>
+          this.$refs.table.reload({ page: 1, limit: 10, where })
+        );
+      },
+
+      openDetails(row) {
+        this.$refs.detailDialog.open(row);
+      },
+      toUpdate(row) {
+        this.$refs.createDialog.open(row);
+      },
+      remove(row) {
+        deleteOrder([row.id]).then((res) => {
+          this.$message.success(res);
+          this.reload();
+        });
+      },
+
+      onSortChange(e) {
         let sort = {
           orderBy: e.order,
           sortName:  e.prop,
@@ -374,36 +372,40 @@ export default {
         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);
-    },
+      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);
+      },
 
-    priorityFn: debounce(function (row) {
-      let params = {
-        id: row.id,
-        priority: row.priority
-      };
-      updatePriority(params).then((res) => {});
-    }, 800)
-  }
-};
+      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></style>

+ 31 - 59
src/views/saleOrder/salesToProduction.vue

@@ -49,16 +49,14 @@
               ></el-checkbox>
             </el-form-item>
           </el-col>
-
           <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
             <el-form-item label="余量系数:" prop="marginCoefficient">
-              <!-- <DictSelection
-                @itemChange="itemChange"
-                style="width: 200px"
-                dictName="余量系数"
+              <el-select
                 v-model="form.marginCoefficient"
-              ></DictSelection> -->
-              <el-select filterable allow-create @change="itemChange" v-model="form.marginCoefficient">
+                filterable
+                allow-create
+                @change="itemChange"
+              >
                 <el-option
                   v-for="(item, index) in marginList"
                   :key="index"
@@ -68,6 +66,7 @@
               </el-select>
             </el-form-item>
           </el-col>
+
           <el-col v-bind="styleResponsive ? { lg: 4, md: 8 } : { span: 4 }">
             <el-form-item label="批号:" prop="batchNo">
               <el-input
@@ -123,6 +122,7 @@
             sortable
           >
           </el-table-column>
+
           <el-table-column
             label="产品名称"
             align="center"
@@ -130,6 +130,7 @@
             width="120"
           >
           </el-table-column>
+
           <el-table-column label="行号" align="center" prop="lineNumber">
           </el-table-column>
           <el-table-column
@@ -138,7 +139,6 @@
             prop="contractNum"
           >
           </el-table-column>
-
           <el-table-column
             label="合同重量"
             align="center"
@@ -172,10 +172,11 @@
                 <el-input
                   v-model.number="scope.row.planProductNum"
                   size="small"
+                  oninput="value=value.replace(/[^\d]/g,'')"
+                  style="width: 100%"
                   @input="
                     tableHandleKeyUp(scope.row, scope.$index, $event, 'sum')
                   "
-                  style="width: 100%"
                   placeholder="输入数量"
                 ></el-input>
               </el-form-item>
@@ -185,7 +186,7 @@
             label="要求生产数量(方)"
             align="center"
             prop="requiredFormingNum"
-            width="140"
+            width="120"
           >
             <template slot-scope="scope">
               <el-form-item
@@ -202,6 +203,7 @@
                   v-model.number="scope.row.requiredFormingNum"
                   size="small"
                   disabled
+                  oninput="value=value.replace(/[^\d]/g,'')"
                   style="width: 100%"
                   placeholder="输入数量"
                 ></el-input>
@@ -322,7 +324,6 @@
               {{ getDictValue('订单类型', row.orderType) }}
             </template>
           </el-table-column>
-
           <el-table-column
             label="交付日期"
             align="center"
@@ -383,27 +384,11 @@
               {{ getDictValue('交付要求', row.deliveryRequirements) }}
             </template>
           </el-table-column>
-          <!-- <el-table-column
-            prop="priority"
-            label="优先级"
-            width="100"
-            align="center"
-          >
-            <template slot-scope="{ row }"
-              >{{ row.priority }}
-              <div class="sort-wrap">
-                <i class="el-icon-caret-top" @click="sortTop(row)"></i>
-                <i class="el-icon-caret-bottom" @click="sortBottom(row)"></i>
-              </div>
-            </template>
-          </el-table-column> -->
           <el-table-column
             prop="priority"
             label="优先级"
             width="100"
             align="center"
-            :min="0"
-            :max="10"
           >
             <template slot-scope="{ row, $index }">
               <el-input
@@ -411,6 +396,8 @@
                 v-model="row.priority"
                 type="number"
                 size="mini"
+                :min="0"
+                :max="10"
                 @change="priorityChange(row)"
               ></el-input>
               <el-popover
@@ -427,6 +414,7 @@
               </el-popover>
             </template>
           </el-table-column>
+
           <el-table-column label="操作" align="center" width="70" fixed="right">
             <template slot-scope="scope">
               <el-button type="text" @click="handleDeleteItem(scope.$index)"
@@ -471,7 +459,6 @@
   </div>
 </template>
 <script>
-import { debounce } from 'lodash';
 import AdditionalOrder from './components/AdditionalOrder.vue';
 import PlanSubmit from './components/plan-submit.vue';
 import ProductionVersion from '@/components/CreatePlan/ProductionVersion2.vue';
@@ -484,12 +471,15 @@ import {
   getUpdateInfoById,
   getProductVersion
 } from '@/api/saleOrder';
+
+import { getByCode } from '@/api/system/dictionary-data';
+
 import dictMixins from '@/mixins/dictMixins';
 import { deepClone } from '@/utils/index';
 import { getRouteTabKey, removePageTab } from '@/utils/page-tab-util';
 import { getCode } from '@/api/codeManagement';
-import { getByCode } from '@/api/system/dictionary-data';
 import dayjs from 'dayjs';
+import { debounce } from 'lodash';
 export default {
   mixins: [dictMixins],
   components: {
@@ -516,9 +506,12 @@ export default {
         stockCountBase: '',
         salesOrders: [],
         produceRoutingName: '',
-        marginCoefficient: '1.0'
+        marginCoefficient: '1.0',
+        batchNo: null
       },
 
+      marginList: [],
+
       // 表单验证规则
       rules: {
         produceRoutingName: [
@@ -526,9 +519,7 @@ export default {
         ]
       },
       // selection: [],
-      loading: false,
-      batchNo: null,
-      marginList: []
+      loading: false
     };
   },
   computed: {
@@ -553,16 +544,13 @@ export default {
       const data = await getUpdateInfoById(id);
 
       this.form = data;
-      this.form.salesOrders.forEach((item) => {
-        item.slottingType = item.slottingType && item.slottingType + '';
-      });
-      // console.log(this.form.salesOrders, ';dsdsds');
     },
     async _getInventory() {
       const res = await getInventory(this.form.productCode, this.form.planType);
 
       this.form.stockCountBase = res;
     },
+
     getByCodeFn() {
       getByCode('margin_code').then((res) => {
         let _arr = [];
@@ -586,8 +574,6 @@ export default {
         this.form.salesOrders.map((item, index) => {
           this.tableHandleKeyUp(item, '', item.lackNum, 'sum');
           item.slottingType = item.slottingType && item.slottingType + '';
-
-          // console.log( item.slottingType,' item.slottingType')
           item.priority = index + 1;
           item.planProductNum = item.lackNum;
           item.requiredFormingNum = item.lackNum;
@@ -612,13 +598,13 @@ export default {
         this.$set(
           item,
           'requiredFormingNum',
-          item.planProductNum * (this.form.marginCoefficient || 1)
+          (item.planProductNum * (this.form.marginCoefficient || 1))
         );
       });
     },
 
     toInt(planProductNum) {
-      return planProductNum * (this.form.marginCoefficient || 1);
+      return (planProductNum * (this.form.marginCoefficient || 1))
     },
 
     cancel() {
@@ -705,6 +691,7 @@ export default {
     },
 
     priorityFn: debounce(function (row) {}, 800),
+
     // 删除产品
     handleDeleteItem(index) {
       this.form.salesOrders.splice(index, 1);
@@ -720,8 +707,8 @@ export default {
       this.$set(this.form, 'produceRoutingId', data.id);
       this.$set(this.form, 'produceVersionName', data.produceVersionName);
     },
-    // 表格:模数、数量(方)、块数输入框 输入事件
-    tableHandleKeyUp(row, index, e, name) {
+ // 表格:模数、数量(方)、块数输入框 输入事件
+ tableHandleKeyUp(row, index, e, name) {
       if (!row.specification) {
         return;
       }
@@ -906,7 +893,7 @@ export default {
                 data.workOrder.productionPlanId = params.id;
               }
 
-              await releaseSave(data)
+              await releaseSave(data)(data)
                 .then((res) => {
                   if (res === 1) {
                     this.$message.success('工单已发布!');
@@ -988,21 +975,6 @@ export default {
   margin-bottom: 20px;
 }
 
-.sort-wrap {
-  i {
-    font-size: 30px;
-    cursor: pointer;
-  }
-
-  .el-icon-caret-top {
-    color: red;
-  }
-
-  .el-icon-caret-bottom {
-    color: #157a2c;
-  }
-}
-
 .add-product {
   width: 100%;
   display: flex;

+ 264 - 255
src/views/workOrder/index.vue

@@ -11,8 +11,8 @@
         ref="table"
         :columns="columns"
         :datasource="datasource"
-        @sort-change="onSortChange"
         cache-key="workOrderTable"
+        @sort-change="onSortChange"
       >
         <template v-slot:code="{ row }">
           {{ row.code }}
@@ -21,6 +21,7 @@
         <template v-slot:formingWeight="{ row }">
           {{ row.formingWeight }} {{ row.newWeightUnit }}
         </template>
+
         <template v-slot:priority="{ row }">
           <el-input
             v-model="row.priority"
@@ -56,6 +57,7 @@
             icon="el-icon-truck"
             @click="toRelease(row)"
             v-if="row.status == 8 && !row.productName.includes('板材')"
+
           >
             下达
           </el-link>
@@ -82,277 +84,284 @@
 </template>
 
 <script>
-import {
-  getList,
-  releaseWorkOrder,
-  updatePriority
-} from '@/api/workOrder/index.js';
-import { teamPage } from '@/api/mainData/index.js';
-import OrderSearch from './components/order-search.vue';
-import { debounce } from 'lodash';
-export default {
-  components: {
-    OrderSearch
-  },
-  data() {
-    return {
-      visible: false,
-      loading: false,
-      releasParams: {
-        teamId: '',
-        id: ''
-      },
-      teamList: [],
+  import {
+    getList,
+    releaseWorkOrder,
+    updatePriority
+  } from '@/api/workOrder/index.js';
+  import { teamPage } from '@/api/mainData/index.js';
+  import OrderSearch from './components/order-search.vue';
+  import { debounce } from 'lodash';
+  export default {
+    components: {
+      OrderSearch
+    },
+    data() {
+      return {
+        visible: false,
+        loading: false,
+        releasParams: {
+          teamId: '',
+          id: ''
+        },
+        teamList: [],
 
-      statusOpt: [
-        { label: '待生产', value: 4 },
-        { label: '生产中', value: 5 },
-        { label: '待下达', value: 8 }
-      ],
+        statusOpt: [
+          { label: '待生产', value: 4 },
+          { label: '生产中', value: 5 },
+          { label: '待下达', value: 8 }
+        ],
 
-      current: null
-    };
-  },
-  computed: {
-    // 表格列配置
-    columns() {
-      return [
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          slot: 'code',
-          label: '生产订单号',
-          align: 'center',
-          minWidth: 110
-        },
-        {
-          prop: 'productionPlanCode',
-          label: '计划编号',
-          align: 'center'
-        },
-        {
-          prop: 'produceRoutingName',
-          label: '工艺路线',
-          align: 'center'
-        },
-        {
-          prop: 'productCode',
-          label: '产品编号',
-          align: 'center'
-        },
-        {
-          prop: 'productName',
-          label: '产品名称',
-          align: 'center'
-        },
-        {
-          prop: 'brandNo',
-          label: '牌号',
-          align: 'center'
-        },
-        {
-          prop: 'batchNo',
-          label: '批号',
-          align: 'center',
-          minWidth: 100,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'model',
-          label: '型号',
-          align: 'center'
-        },
+        current: null
+      };
+    },
+    computed: {
+      // 表格列配置
+      columns() {
+        return [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            slot: 'code',
+            label: '生产订单号',
+            align: 'center',
+            minWidth: 110
+          },
+          {
+            prop: 'productionPlanCode',
+            label: '计划编号',
+            align: 'center'
+          },
+          {
+            prop: 'produceRoutingName',
+            label: '工艺路线',
+            align: 'center'
+          },
+          {
+            prop: 'productCode',
+            label: '产品编码',
+            align: 'center'
+          },
+          {
+            prop: 'productName',
+            label: '产品名称',
+            align: 'center'
+          },
+          {
+            prop: 'brandNo',
+            label: '牌号',
+            align: 'center'
+          },
 
-        {
-          prop: 'priority',
-          label: '优先级',
-          align: 'center',
-          minWidth: 120,
-          slot: 'priority',
-          sortable: 'custom'
-        },
-        {
-          prop: 'formingNum',
-          label: '要求生产数量',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          prop: 'formingWeight',
-          label: '要求生产重量',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110,
-          slot: 'formingWeight'
-        },
-        {
-          prop: 'planStartTime',
-          label: '计划开始时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
+          {
+            prop: 'batchNo',
+            label: '批号',
+            align: 'center',
+            minWidth: 100,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center'
+          },
+ 
 
-        {
-          prop: 'planCompleteTime',
-          label: '计划结束时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
+          {
+            prop: 'priority',
+            label: '优先级',
+            align: 'center',
+            minWidth: 120,
+            slot: 'priority',
+            sortable: 'custom'
+          },
 
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          showOverflowTooltip: true,
-          minWidth: 110
-        },
-        {
-          slot: 'status',
-          label: '状态',
-          align: 'center',
-          formatter: (row) => {
-            const obj = this.statusOpt.find((i) => i.value == row.status);
-            return obj && obj.label;
-          }
-        },
+          {
+            prop: 'formingNum',
+            label: '要求生产数量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'formingWeight',
+            label: '要求生产重量',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110,
+            slot: 'formingWeight'
+          },
+          {
+            prop: 'planStartTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
 
-        {
-          prop: 'serialNo',
-          label: '客户代号',
-          align: 'center',
-          showOverflowTooltip: true
-        },
+          {
+            prop: 'planCompleteTime',
+            label: '计划结束时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
 
-        {
-          prop: 'simpleName',
-          label: '客户简称',
-          align: 'center',
-          showOverflowTooltip: true
-        },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            slot: 'status',
+            label: '状态',
+            align: 'center',
+            formatter: (row) => {
+              const obj = this.statusOpt.find((i) => i.value == row.status);
+              return obj && obj.label;
+            }
+          },
 
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 90,
-          align: 'center',
-          resizable: false,
-          fixed: 'right',
-          slot: 'action',
-          showOverflowTooltip: true
-        }
-      ];
-    }
-  },
-  created() {},
-  methods: {
-    statusFormatter(status) {
-      const obj = this.statusOpt.find((i) => i.value == status);
-      return obj && obj.label;
-    },
-    /* 表格数据源 */
-    datasource({ page, limit, where }) {
-      if (where.status) {
-        where.statusList = [];
-        where.statusList.push(where.status);
+          {
+            prop: 'serialNo',
+            label: '客户代号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            prop: 'simpleName',
+            label: '客户简称',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 90,
+            align: 'center',
+            resizable: false,
+            fixed: 'right',
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ];
       }
-      return getList({
-        pageNum: page,
-        size: limit,
-        ...where,
-        ...this.sort
-      });
     },
-    async _teamPage() {
-      const res = await teamPage({
-        page: 1,
-        size: -1,
-        produceVersionId: this.current.produceVersionId
-      });
+    created() {},
+    methods: {
+      statusFormatter(status) {
+        const obj = this.statusOpt.find((i) => i.value == status);
+        return obj && obj.label;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        if (where.status) {
+          where.statusList = [];
+          where.statusList.push(where.status);
+        }
+        return getList({
+          pageNum: page,
+          size: limit,
+          ...where,
+          ...this.sort
+        });
+      },
+      async _teamPage() {
+        const res = await teamPage({
+          page: 1,
+          size: -1,
+          produceVersionId: this.current.produceVersionId
+        });
 
-      this.teamList = res.list;
-    },
-    // 下达
-    toRelease(row) {
-      this.current = row;
-      this.visible = true;
-      this._teamPage();
-    },
-    // 下达
-    confirm() {
-      if (!this.releasParams.teamId) {
-        return this.$message.error('请选择班组');
-      }
+        this.teamList = res.list;
+      },
+      // 下达
+      toRelease(row) {
+        this.current = row;
+        this.visible = true;
+        this._teamPage();
+      },
+      // 下达
+      confirm() {
+        if (!this.releasParams.teamId) {
+          return this.$message.error('请选择班组');
+        }
 
-      const loading = this.$loading({ text: '加载中...' });
-      releaseWorkOrder({
-        id: this.current.id,
-        teamId: this.releasParams.teamId
-      })
-        .then((res) => {
-          if (res) {
-            this.$message.success('成功');
-            this.reload();
-            this.visible = false;
-          }
+        const loading = this.$loading({ text: '加载中...' });
+        releaseWorkOrder({
+          id: this.current.id,
+          teamId: this.releasParams.teamId
         })
-        .finally(() => {
-          loading.close();
+          .then((res) => {
+            if (res) {
+              this.$message.success('成功');
+              this.reload();
+              this.visible = false;
+            }
+          })
+          .finally(() => {
+            loading.close();
+          });
+      },
+      /* 刷新表格 */
+      reload(where) {
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
         });
-    },
-    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);
-    },
+      onSortChange(e) {
+        let sort = {
+          orderBy: e.order,
+          sortName:  e.prop,
+        }
+        this.sort = sort
+        this.reload()
+       
+      },
 
-    priorityFn: debounce(function (row) {
-      let params = {
-        id: row.id,
-        priority: row.priority
-      };
-      updatePriority(params).then((res) => {});
-    }, 800),
-    /* 刷新表格 */
-    reload(where) {
-      this.$nextTick(() => {
-        this.$refs.table.reload({ page: 1, where });
-      });
+      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></style>