Explorar el Código

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

longfenglin hace 1 año
padre
commit
c6f43175ec
Se han modificado 1 ficheros con 317 adiciones y 275 borrados
  1. 317 275
      src/views/materialPlan/index.vue

+ 317 - 275
src/views/materialPlan/index.vue

@@ -1,12 +1,24 @@
 <template>
   <div class="ele-body">
     <el-card shadow="never" v-loading="loading">
-      <materialPlan-search @search="reload" :statusOpt="statusOpt" :activeName="activeName" ref="searchRef">
+      <materialPlan-search
+        @search="reload"
+        :statusOpt="statusOpt"
+        :activeName="activeName"
+        ref="searchRef"
+      >
       </materialPlan-search>
 
       <!-- 数据表格 -->
-      <ele-pro-table ref="table" :initLoad="false" :columns="columns" :datasource="datasource"
-        cache-key="`materialPlanTable`" :pageSize="20" :pageSizes="[20, 30, 40, 50, 100]">
+      <ele-pro-table
+        ref="table"
+        :initLoad="false"
+        :columns="columns"
+        :datasource="datasource"
+        cache-key="`materialPlanTable`"
+        :pageSize="20"
+        :pageSizes="[20, 30, 40, 50, 100]"
+      >
         <template v-slot:toolbar>
           <el-dropdown trigger="click" @command="handleClick">
             <el-link type="primary" icon="el-icon-plus">创建采购计划</el-link>
@@ -20,16 +32,18 @@
           <template v-if="row.flagTry">
             <el-tooltip placement="top">
               <div slot="content">采购需求数量与采购实际采购入库数量不同!</div>
-              <i class="el-icon-info" style="color:red;"></i>
+              <i class="el-icon-info" style="color: red"></i>
             </el-tooltip>
           </template>
-          {{ row.demandType == 1
-            ? '生产性物资采购'
-            : row.demandType == 6
+          {{
+            row.demandType == 1
+              ? '生产性物资采购'
+              : row.demandType == 6
               ? '外协自供料采购'
               : row.demandType == 7
-                ? '外协客供料采购'
-                : '' }}
+              ? '外协客供料采购'
+              : ''
+          }}
         </template>
         <template v-slot:name="{ row }">
           <el-link type="primary" @click="handleEdit('detail', row)">{{
@@ -55,29 +69,47 @@
               row.orderType == 1
                 ? '销售订单'
                 : row.orderType == 2
-                  ? '生产计划'
-                  : ''
+                ? '生产计划'
+                : ''
             }}
           </span>
         </template>
 
         <template v-slot:approvalStatus="{ row }">
-          <el-link type="primary" :underline="false" @click="handleDetails(row)">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="handleDetails(row)"
+          >
             {{ approvalStatusFormatter(row.approvalStatus) }}
           </el-link>
         </template>
         <!-- 操作列 0未提交 1审核中 2审核通过 3审核未通过-->
         <template v-slot:action="{ row }">
-          <el-link type="primary" :underline="false" @click="todo(row)"
-            v-if="row.approvalStatus == 0 || row.approvalStatus == 3">
+          <el-link
+            type="primary"
+            :underline="false"
+            @click="todo(row)"
+            v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
+          >
             提交
           </el-link>
-          <el-link type="primary" :underline="false" icon="el-icon-edit" @click="handleEdit('edit', row)"
-            v-if="row.approvalStatus != 2 && row.approvalStatus != 1">
+          <el-link
+            type="primary"
+            :underline="false"
+            icon="el-icon-edit"
+            @click="handleEdit('edit', row)"
+            v-if="row.approvalStatus != 2 && row.approvalStatus != 1"
+          >
             修改
           </el-link>
-          <el-link @click="handleDel(row)" type="danger" :underline="false" icon="el-icon-delete"
-            v-if="row.approvalStatus == 0 || row.approvalStatus == 3">
+          <el-link
+            @click="handleDel(row)"
+            type="danger"
+            :underline="false"
+            icon="el-icon-delete"
+            v-if="row.approvalStatus == 0 || row.approvalStatus == 3"
+          >
             删除
           </el-link>
         </template>
@@ -98,282 +130,292 @@
 </template>
 
 <script>
-import materialPlanSearch from './components/materialPlan-search.vue';
-import planEditDialog from './components/plan-edit-dialog.vue';
-import producePlan from './components/producePlan.vue';
-import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
+  import materialPlanSearch from './components/materialPlan-search.vue';
+  import planEditDialog from './components/plan-edit-dialog.vue';
+  import producePlan from './components/producePlan.vue';
+  import processSubmitDialog from '@/components/processSubmitDialog/processSubmitDialog.vue';
 
-import detail from './components/detail.vue';
-import { getList, del, submit } from '@/api/materialPlan/index';
-export default {
-  components: {
-    planEditDialog,
-    materialPlanSearch,
-    detail,
-    producePlan,processSubmitDialog
-  },
+  import detail from './components/detail.vue';
+  import { getList, del, submit } from '@/api/materialPlan/index';
+  export default {
+    components: {
+      planEditDialog,
+      materialPlanSearch,
+      detail,
+      producePlan,
+      processSubmitDialog
+    },
 
-  data() {
-    return {
-      activeName: 'first',
+    data() {
+      return {
+        activeName: 'first',
 
-      // 加载状态
-      loading: false,
-      processSubmitDialogFlag: false,
+        // 加载状态
+        loading: false,
+        processSubmitDialogFlag: false,
 
-      statusOpt: {
-        first: [
-          { label: '所有状态', value: null },
-          { label: '待排产', value: '1' },
-          { label: '待发布', value: '2' },
-          { label: '发布失败', value: '3' },
-          { label: '已完成', value: '6' }
-        ]
-      },
-      approvalStatusOpt: {
-        first: [
-          { label: '未提交', value: '0' },
-          { label: '审核中', value: '1' },
-          { label: '审核通过', value: '2' },
-          { label: '审核未通过', value: '3' }
-        ]
-      },
-      purchasePlanProgressStatus: {
-        first: [
-          { value: 0, label: '未开始' },
-          { value: 100, label: '待核价' },
-          { value: 101, label: '核价中' },
-          { value: 102, label: '核价完成' },
-          { value: 200, label: '在途' },
-          { value: 201, label: '部分入库' },
-          { value: 300, label: '已入库' },
-          { value: 1000, label: '完成' }]
-      },
-    };
-  },
-  computed: {
-    // 表格列配置
-    columns() {
-      return [
-        {
-          columnKey: 'index',
-          label: '序号',
-          type: 'index',
-          width: 55,
-          align: 'center',
-          fixed: 'left'
-        },
-        {
-          slot: 'demandType',
-          prop: 'demandType',
-          label: '需求类型',
-          align: 'center',
-          width: 130,
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          slot: 'name',
-          prop: 'name',
-          label: '名称',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          slot: 'code',
-          prop: 'code',
-          label: '编号',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true,
-          fixed: 'left'
-        },
-        {
-          prop: 'planStr',
-          label: '生产计划编码',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'orderStr',
-          label: '销售订单号',
-          align: 'center',
-          width: 160,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'serialNoStr',
-          label: '客户代号',
-          align: 'center',
-          width: 120,
-          showOverflowTooltip: true
-        },
-        {
-          columnKey: 'status',
-          label: '状态',
-          align: 'center',
-          slot: 'status',
-          action: 'status',
-          width: 120,
-          showOverflowTooltip: true
-        },
-        {
-          columnKey: 'progress',
-          label: '订单整体进度',
-          align: 'center',
-          slot: 'progress',
-          action: 'progress',
-          width: 120,
-          showOverflowTooltip: true
+        statusOpt: {
+          first: [
+            { label: '所有状态', value: null },
+            { label: '待排产', value: '1' },
+            { label: '待发布', value: '2' },
+            { label: '发布失败', value: '3' },
+            { label: '已完成', value: '6' }
+          ]
         },
-        {
-          prop: 'approvalStatus',
-          label: '审批状态',
-          align: 'center',
-          slot: 'approvalStatus',
-          action: 'approvalStatus',
-          width: 120,
-          showOverflowTooltip: true
+        approvalStatusOpt: {
+          first: [
+            { label: '未提交', value: '0' },
+            { label: '审核中', value: '1' },
+            { label: '审核通过', value: '2' },
+            { label: '审核未通过', value: '3' }
+          ]
         },
-
-        {
-          prop: 'orderType',
-          label: '来源类型',
-          align: 'center',
-          slot: 'orderType',
-          action: 'orderType',
-          width: 120,
-          showOverflowTooltip: true
-        },
-
-        {
-          prop: 'createUserName',
-          label: '创建人',
-          align: 'center',
-          width: 120,
-          showOverflowTooltip: true
-        },
-        {
-          prop: 'createTime',
-          label: '创建时间',
-          align: 'center',
-          width: 120,
-          showOverflowTooltip: true
-        },
-        {
-          columnKey: 'action',
-          label: '操作',
-          width: 180,
-          align: 'center',
-          resizable: false,
-          fixed: 'right',
-          slot: 'action'
+        purchasePlanProgressStatus: {
+          first: [
+            { value: 0, label: '未开始' },
+            { value: 100, label: '待核价' },
+            { value: 101, label: '核价中' },
+            { value: 102, label: '核价完成' },
+            { value: 200, label: '在途' },
+            { value: 201, label: '部分入库' },
+            { value: 300, label: '已入库' },
+            { value: 1000, label: '完成' }
+          ]
         }
-      ];
-    }
-  },
-  methods: {
-    statusFormatter(status) {
-      const obj = this.statusOpt[this.activeName].find(
-        (i) => i.value == status
-      );
-
-      return obj && obj.label;
-    },
-    purchasePlanProgressStatusEnum(progress) {
-      const obj = this.purchasePlanProgressStatus[this.activeName].find(
-        (i) => i.value == progress
-      );
-      return obj && obj.label;
+      };
     },
-    approvalStatusFormatter(status) {
-      const obj = this.approvalStatusOpt[this.activeName].find(
-        (i) => i.value == status
-      );
+    computed: {
+      // 表格列配置
+      columns() {
+        return [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            fixed: 'left'
+          },
+          {
+            slot: 'demandType',
+            prop: 'demandType',
+            label: '需求类型',
+            align: 'center',
+            width: 130,
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            slot: 'name',
+            prop: 'name',
+            label: '名称',
+            align: 'center',
+            minWidth: 160,
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            slot: 'code',
+            prop: 'code',
+            label: '编号',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'planStr',
+            label: '生产计划编码',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'orderStr',
+            label: '销售订单号',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'serialNoStr',
+            label: '客户代号',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'status',
+            label: '状态',
+            align: 'center',
+            slot: 'status',
+            action: 'status',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'progress',
+            label: '订单整体进度',
+            align: 'center',
+            slot: 'progress',
+            action: 'progress',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'approvalStatus',
+            label: '审批状态',
+            align: 'center',
+            slot: 'approvalStatus',
+            action: 'approvalStatus',
+            width: 120,
+            showOverflowTooltip: true
+          },
 
-      return obj && obj.label;
-    },
-    /* 表格数据源 */
-    datasource({ page, limit, where }) {
-      where.type = 1;
-      return getList({
-        pageNum: page,
-        size: limit,
-        ...where
-      });
-    },
-    handleEdit(type, row) {
+          {
+            prop: 'orderType',
+            label: '来源类型',
+            align: 'center',
+            slot: 'orderType',
+            action: 'orderType',
+            width: 120,
+            showOverflowTooltip: true
+          },
 
-      console.log(row.orderType, '---------------');
-      if (row.orderType == 1) {
-        this.$refs.planEditDialogRef.open(type, row);
-      } else if (row.orderType == 2) {
-        this.$refs.produceRef.open(type, row);
+          {
+            prop: 'createUserName',
+            label: '创建人',
+            align: 'center',
+            width: 120,
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            width: 160,
+            showOverflowTooltip: true
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 180,
+            align: 'center',
+            resizable: false,
+            fixed: 'right',
+            slot: 'action'
+          }
+        ];
       }
     },
-    handleDel({ id }) {
-      this.$confirm('确认删除当前数据!', '提示').then(async () => {
-        await del([id]);
-        this.$message.success('删除成功!');
-        this.reload();
-      });
-    },
+    methods: {
+      statusFormatter(status) {
+        const obj = this.statusOpt[this.activeName].find(
+          (i) => i.value == status
+        );
 
-    handleClick(tab) {
-      if (tab == 1) {
-        this.$refs.planEditDialogRef.open('add');
-      } else if (tab == 2) {
-        this.$refs.produceRef.open('add');
-      }
-    },
+        return obj && obj.label;
+      },
+      purchasePlanProgressStatusEnum(progress) {
+        const obj = this.purchasePlanProgressStatus[this.activeName].find(
+          (i) => i.value == progress
+        );
+        return obj && obj.label;
+      },
+      approvalStatusFormatter(status) {
+        const obj = this.approvalStatusOpt[this.activeName].find(
+          (i) => i.value == status
+        );
 
-    todo(row) {
-      this.processSubmitDialogFlag = true;
-      this.$nextTick(() => {
-        let params = {
-          businessId: row.id,
-          businessKey: 'release_purchase_plan',
-          formCreateUserId: row.createUserId,
-          variables: {
-            businessCode: row.code
-          }
-        };
-        this.$refs.processSubmitDialogRef.init(params);
-      });
-      // submit({ businessId: row.id }).then((res) => {
-      //   if (res) {
-      //     this.$message.success('提交成功!');
-      //     this.reload();
-      //   }
-      // });
-    },
+        return obj && obj.label;
+      },
+      /* 表格数据源 */
+      datasource({ page, limit, where }) {
+        where.type = 1;
+        return getList({
+          pageNum: page,
+          size: limit,
+          ...where
+        });
+      },
+      handleEdit(type, row) {
+        console.log(row.orderType, '---------------');
+        if (row.orderType == 1) {
+          this.$refs.planEditDialogRef.open(type, row);
+        } else if (row.orderType == 2) {
+          this.$refs.produceRef.open(type, row);
+        }
+      },
+      handleDel({ id }) {
+        this.$confirm('确认删除当前数据!', '提示').then(async () => {
+          await del([id]);
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      },
 
-    handleTabChange() {
-      this.$refs.searchRef.reset();
-    },
+      handleClick(tab) {
+        if (tab == 1) {
+          this.$refs.planEditDialogRef.open('add');
+        } else if (tab == 2) {
+          this.$refs.produceRef.open('add');
+        }
+      },
 
-    /* 刷新表格 */
-    reload(where = {}) {
-      if (where.statusList) {
-        where.statusList = where.statusList.split(',');
-      }
-      this.$nextTick(() => {
-        this.$refs.table.reload({ page: 1, where });
-      });
-    },
+      todo(row) {
+        this.processSubmitDialogFlag = true;
+        this.$nextTick(() => {
+          let params = {
+            businessId: row.id,
+            businessKey: 'release_purchase_plan',
+            formCreateUserId: row.createUserId,
+            variables: {
+              businessCode: row.code,
+              businessName: row.name,
+              businessType:
+                row.demandType == 1
+                  ? '生产性物资采购'
+                  : row.demandType == 6
+                  ? '外协自供料采购'
+                  : row.demandType == 7
+                  ? '外协客供料采购'
+                  : ''
+            }
+          };
+          this.$refs.processSubmitDialogRef.init(params);
+        });
+        // submit({ businessId: row.id }).then((res) => {
+        //   if (res) {
+        //     this.$message.success('提交成功!');
+        //     this.reload();
+        //   }
+        // });
+      },
 
-    handleDetails(row) {
-      if (row.approvalStatus == 0) {
-        this.$message.info('未提交没有审核流程');
-      } else {
-        this.$refs.detailRef.open(row.processInstanceId);
+      handleTabChange() {
+        this.$refs.searchRef.reset();
+      },
+
+      /* 刷新表格 */
+      reload(where = {}) {
+        if (where.statusList) {
+          where.statusList = where.statusList.split(',');
+        }
+        this.$nextTick(() => {
+          this.$refs.table.reload({ page: 1, where });
+        });
+      },
+
+      handleDetails(row) {
+        if (row.approvalStatus == 0) {
+          this.$message.info('未提交没有审核流程');
+        } else {
+          this.$refs.detailRef.open(row.processInstanceId);
+        }
       }
     }
-  }
-};
+  };
 </script>
 
 <style lang="scss" scoped></style>