quwangxin há 2 anos atrás
pai
commit
a7256c963f

+ 1 - 1
package.json

@@ -62,4 +62,4 @@
     "vue-template-compiler": "^2.7.10",
     "webpack": "^5.74.0"
   }
-}
+}

+ 1 - 0
src/enum/dict.js

@@ -10,3 +10,4 @@ export default {
   金额单位: 'money_unit',
   时间单位: 'time_unit'
 };
+export const numberList = [];

+ 2 - 1
src/router/index.js

@@ -12,9 +12,10 @@ import { routes, getMenuRoutes } from './routes';
 Vue.use(VueRouter);
 
 const router = new VueRouter({
+  base: window.__POWERED_BY_QIANKUN__ ? '/page-mes/' : '/mes/',
   routes,
   mode: 'history',
-  scrollBehavior() {
+  scrollBehavior () {
     return { y: 0 };
   }
 });

+ 1 - 0
src/store/index.js

@@ -23,6 +23,7 @@ export default new Vuex.Store({
   getters,
   plugins: [
     createPersistedState({
+      key: 'vuex-mes',
       storage: window.sessionStorage,
       paths: ['user']
     })

+ 47 - 44
src/store/modules/dict.js

@@ -1,15 +1,16 @@
-import dictEnum from '@/enum/dict';
+import dictEnum, { numberList } from '@/enum/dict';
 import Vue from 'vue';
 import { getByCode } from '@/api/system/dictionary-data';
+
 //非枚举定义
-const otherDictConfig = {
-  //   [dictEnum.物品类型]: {
-  //     request: getSubListByParentId,
-  //     dictCode: 'type',
-  //     dictValue: 'name',
-  //     resKey: '' //为空选 data
-  //   }
-};
+// const otherDictConfig = {
+//   //   [dictEnum.物品类型]: {
+//   //     request: getSubListByParentId,
+//   //     dictCode: 'type',
+//   //     dictValue: 'name',
+//   //     resKey: '' //为空选 data
+//   //   }
+// };
 
 const state = {};
 
@@ -22,52 +23,54 @@ const mutations = {
 
 const actions = {
   // 根据字典enumName请求字典 已获取的不做重复请求
-  async requestDict({ commit, state }, enumName) {
+  async requestDict ({ commit, state }, enumName) {
     const code = dictEnum[enumName];
 
     if (state[code]?.length) return state[code];
     let res;
-    if (otherDictConfig[dictEnum[enumName]]) {
-      const config = otherDictConfig[dictEnum[enumName]];
-      console.log(config);
-      //非枚举定义
-      res = await config.request();
-      if (res?.code == 0) {
-        let list = config.resKey ? res.data[config.resKey] : res.data;
-        commit('ADD_DICT', {
-          code,
-          dict: list.map((item) => ({
-            ...item,
-            dictCode: item[config.dictCode],
-            dictValue: item[config.dictValue]
-          }))
-        });
-        return res.list;
-      }
-    } else {
-      res = await getByCode(code);
-      if (res?.code == 0) {
-        commit('ADD_DICT', {
-          code,
-          dict: res.data.map((item) => {
-            const arr = Object.entries(item)[0] || [];
+    // if (otherDictConfig[dictEnum[enumName]]) {
+    //   const config = otherDictConfig[dictEnum[enumName]];
+    //   console.log(config);
+    //   //非枚举定义
+    //   res = await config.request();
+    //   if (res?.code == 0) {
+    //     let list = config.resKey ? res.data[config.resKey] : res.data;
+    //     commit('ADD_DICT', {
+    //       code,
+    //       dict: list.map((item) => ({
+    //         ...item,
+    //         dictCode: item[config.dictCode],
+    //         dictValue: item[config.dictValue]
+    //       }))
+    //     });
+    //     return res.list;
+    //   }
+    // } else {
+    res = await getByCode(code);
+    if (res?.code == 0) {
+      const isNumber = numberList.includes(code);
+      commit('ADD_DICT', {
+        code,
+        dict: res.data.map((item) => {
+          const arr = Object.entries(item)[0] || [];
 
-            return {
-              dictCode: arr[0],
-              dictValue: arr[1]
-            };
-          })
-        });
-        return res.data;
-      }
+          return {
+            dictCode: isNumber ? Number(arr[0]) : arr[0],
+            dictValue: arr[1]
+          };
+        })
+      });
+      return res.data;
     }
+    // }
 
     return [];
   },
   // 更新字典
-  async reloadRequestDict({ commit }, enumName) {
+  async reloadRequestDict ({ commit }, enumName) {
     const code = dictEnum[enumName];
     const res = await getByCode(code);
+    const isNumber = numberList.includes(code);
     if (res?.code == 0) {
       commit('ADD_DICT', {
         code,
@@ -75,7 +78,7 @@ const actions = {
           const arr = Object.entries(item);
 
           return {
-            dictCode: arr[0],
+            dictCode: isNumber ? Number(arr[0]) : arr[0],
             dictValue: arr[1]
           };
         })

+ 18 - 0
src/store/modules/selectCache.js

@@ -0,0 +1,18 @@
+// 公共选择组件数据缓存
+import Vue from 'vue';
+const state = {};
+
+const mutations = {
+  ADD_SELECT: (state, { name, dict }) => {
+    Vue.set(state, name, dict);
+  }
+};
+
+const actions = {};
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions
+};

+ 75 - 0
src/views/produceOrder/components/createDialog.vue

@@ -0,0 +1,75 @@
+<template>
+  <ele-modal
+    width="60vw"
+    :visible.sync="visible"
+    :close-on-click-modal="true"
+    custom-class="ele-dialog-form"
+    :title="titleOpt[type]"
+  >
+    <el-form :model="formData" label-width="0">
+      <el-descriptions title="" :column="2" border>
+        <el-descriptions-item label="计划编号">
+          <el-form-item prop="code">
+            <el-input v-model="formData.code"></el-input>
+          </el-form-item>
+        </el-descriptions-item>
+        <el-descriptions-item label="产品编码">
+          <el-form-item prop="code">
+            <el-input v-model="formData.code"></el-input> </el-form-item
+        ></el-descriptions-item>
+        <el-descriptions-item label="产品名称"></el-descriptions-item>
+        <el-descriptions-item label="牌号|型号"> </el-descriptions-item>
+        <el-descriptions-item label="计划生产数量"
+          >江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
+        >
+        <el-descriptions-item label="要求成型数量"
+          >江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
+        >
+        <el-descriptions-item
+          label="成型数量"
+          label-class-name="produce-create-bg"
+          content-class-name="produce-create-bg"
+          >江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
+        >
+        <el-descriptions-item
+          label="计划开始时间"
+          label-class-name="produce-create-bg"
+          content-class-name="produce-create-bg"
+          >江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
+        >
+        <el-descriptions-item
+          label="设备编码/名称"
+          label-class-name="produce-create-bg"
+          content-class-name="produce-create-bg"
+          >江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item
+        >
+      </el-descriptions>
+    </el-form>
+  </ele-modal>
+</template>
+
+<script>
+  export default {
+    data () {
+      return {
+        visible: true,
+        titleOpt: ['创建工单'],
+        type: 0,
+        formData: {}
+      };
+    },
+    methods: {
+      open (type = 0) {
+        this.type = type;
+        this.visible = true;
+      }
+    }
+  };
+</script>
+
+<style lang="scss">
+  .produce-create-bg {
+    background-color: var(--color-primary) !important;
+    color: #fff !important;
+  }
+</style>

+ 198 - 0
src/views/produceOrder/components/produceOrder-search.vue

@@ -0,0 +1,198 @@
+<!-- 搜索表单 -->
+<template>
+  <el-form
+    label-width="90px"
+    class="ele-form-search"
+    @keyup.enter.native="search"
+    @submit.native.prevent
+  >
+    <el-row :gutter="15">
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="生产工单号:">
+          <el-input clearable v-model="where.code" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划编码:">
+          <el-input
+            clearable
+            v-model="where.productCode"
+            placeholder="请输入"
+          />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="计划类型:">
+          <el-select
+            clearable
+            v-model="where.planType"
+            placeholder="请选择"
+            class="w100"
+          >
+            <el-option
+              v-for="item in planType"
+              :label="item.label"
+              :value="item.value"
+              :key="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="生产版本:">
+          <el-select
+            clearable
+            v-model="where.planType"
+            placeholder="请选择"
+            class="w100"
+          >
+            <el-option
+              v-for="item in planType"
+              :label="item.label"
+              :value="item.value"
+              :key="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="产品编码:">
+          <el-input clearable v-model="where.brandNo" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="产品名称:">
+          <el-input clearable v-model="where.brandNo" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="牌号:">
+          <el-input clearable v-model="where.brandNo" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="型号:">
+          <el-input clearable v-model="where.model" placeholder="请输入" />
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <el-form-item label="状态:">
+          <el-select v-model="where.status" placeholder="请选择" class="w100">
+            <el-option
+              v-for="item in statusOpt[activeName]"
+              :label="item.label"
+              :value="item.value"
+              :key="item.value"
+            ></el-option>
+          </el-select>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 9, md: 12 } : { span: 9 }">
+        <el-form-item label="创建时间:">
+          <el-date-picker
+            class="w100"
+            v-model="where.createTime"
+            type="daterange"
+            range-separator="至"
+            start-placeholder="开始日期"
+            end-placeholder="结束日期"
+            value-format="yyyy-MM-dd HH:mm:ss"
+            :default-time="['00:00:00', '23:59:59']"
+          >
+          </el-date-picker>
+        </el-form-item>
+      </el-col>
+      <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
+        <div class="ele-form-actions">
+          <el-button
+            type="primary"
+            icon="el-icon-search"
+            class="ele-btn-icon"
+            @click="search"
+          >
+            查询
+          </el-button>
+          <el-button @click="reset" icon="el-icon-refresh-left" type="primary"
+            >重置</el-button
+          >
+        </div>
+      </el-col>
+    </el-row>
+  </el-form>
+</template>
+
+<script>
+  export default {
+    props: ['activeName', 'statusOpt', 'planType'],
+    data () {
+      // 默认表单数据
+      const defaultWhere = {
+        code: '',
+        productCode: '',
+        status: '',
+        model: '',
+        brandNo: '',
+        planType: '',
+        createTime: [],
+        deliveryTime: [],
+        formingTime: [],
+        reqMoldTime: [],
+        planFormingTime: [],
+        executeUserName: ''
+      };
+      return {
+        // 表单数据
+        deliveryVal: 'deliveryTime',
+        shapeVal: 'reqMoldTime',
+        where: { ...defaultWhere },
+        treeData: []
+      };
+    },
+    computed: {
+      // 是否开启响应式布局
+      styleResponsive () {
+        return this.$store.state.theme.styleResponsive;
+      }
+    },
+    watch: {
+      activeName: {
+        handler () {
+          if (this.activeName) {
+            this.where.status = this.statusOpt[this.activeName][0].value;
+            this.search();
+          }
+        },
+        immediate: true
+      }
+    },
+    created () {},
+    methods: {
+      /* 搜索 */
+      search () {
+        const where = { ...this.where };
+        for (const key in where) {
+          if (Array.isArray(where[key])) {
+            where[`${key}End`] = where[key][1];
+            where[key] = where[key][0];
+          }
+        }
+
+        where.status = where.status.split(',');
+
+        this.$emit('search', where);
+      },
+      /*  重置 */
+      reset () {
+        this.where = { ...this.defaultWhere };
+        this.search();
+      }
+    }
+  };
+</script>
+<style lang="scss" scoped>
+  .ele-form-actions {
+    display: flex;
+    align-items: center;
+    justify-content: flex-end;
+  }
+</style>

+ 0 - 0
src/views/produceOrder/detail.vue


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

@@ -0,0 +1,343 @@
+<template>
+  <div class="ele-body">
+    <el-card shadow="never" v-loading="loading">
+      <produceOrder-search
+        @search="reload"
+        ref="searchRef"
+        :statusOpt="statusOpt"
+        :planType="planType"
+        :activeName="activeName"
+      >
+      </produceOrder-search>
+      <el-tabs v-model="activeName" type="card">
+        <el-tab-pane label="未完成工单" name="first"></el-tab-pane>
+        <el-tab-pane label="已完成工单" name="second"></el-tab-pane>
+      </el-tabs>
+      <!-- 数据表格 -->
+      <ele-pro-table
+        ref="table"
+        :key="activeName"
+        :initLoad="false"
+        :columns="columns"
+        :datasource="datasource"
+        :cache-key="`${activeName}produceOrderTable`"
+      >
+        <template v-slot:toolbar>
+          <el-button type="primary">工单刷新</el-button>
+          <el-button type="success">领料</el-button>
+          <el-button type="success">批量完结</el-button>
+          <el-button type="success" @click="handleCreate">创建工单</el-button>
+          <el-button type="success">工单操作控制</el-button>
+        </template>
+        <template v-slot:code="{ row }">
+          <el-link type="primary" :underline="false" @click="goDetail(row)">
+            {{ row.code }}
+          </el-link>
+        </template>
+
+        <template v-slot:status="{ row }">
+          <span :class="{ 'ele-text-danger': row.status == 3 }">
+            {{ statusFormatter(row.status) }}
+          </span>
+        </template>
+        <!-- 操作列 -->
+        <template v-slot:action="{ row }">
+          <template v-if="activeName == 'second'">
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-truck"
+              v-if="row.status == 2"
+              @click="handleOrderPublish(1, row)"
+            >
+              取消完结
+            </el-link></template
+          >
+          <template v-else>
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-truck"
+              v-if="row.status == 2"
+              @click="handleOrderPublish(1, row)"
+            >
+              报工
+            </el-link>
+            <el-link
+              type="primary"
+              v-if="row.status == 3"
+              :underline="false"
+              icon="el-icon-truck"
+              @click="handleOrderPublish(2, row)"
+            >
+              拆分
+            </el-link>
+            <el-link
+              type="primary"
+              :underline="false"
+              icon="el-icon-edit"
+              @click="planEdit(row)"
+            >
+              完结
+            </el-link>
+          </template>
+        </template>
+      </ele-pro-table>
+    </el-card>
+    <createDialog ref="createRef" />
+  </div>
+</template>
+
+<script>
+  // import { getList, del } from '@/api/produceOrder/index.js';
+  import produceOrderSearch from './components/produceOrder-search.vue';
+  import createDialog from './components/createDialog.vue';
+  export default {
+    components: {
+      produceOrderSearch,
+      createDialog
+    },
+    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' }
+          ]
+        },
+        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'
+            },
+            {
+              prop: 'formingTime',
+              label: '生产周期',
+              align: 'center'
+            }
+          ]
+        };
+
+        return [
+          {
+            columnKey: 'index',
+            label: '序号',
+            type: 'index',
+            width: 55,
+            align: 'center',
+            showOverflowTooltip: true,
+            fixed: 'left'
+          },
+          {
+            prop: 'releaseTime',
+            label: '生产工单号',
+            align: 'center'
+          },
+          {
+            prop: 'planFormingTime',
+            label: '计划编号',
+            align: 'center'
+          },
+          {
+            prop: 'deliveryTime',
+            label: '计划类型',
+            align: 'center'
+          },
+          {
+            label: '生产版本',
+            align: 'center'
+          },
+          {
+            prop: 'productCode',
+            label: '产品编号',
+            align: 'center'
+          },
+          {
+            prop: 'brandNo',
+            label: '产品名称',
+            align: 'center'
+          },
+          {
+            prop: 'model',
+            label: '牌号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'model',
+            label: '型号',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productNum',
+            label: '要求成型数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'productWeight',
+            label: '要求成型重量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'requiredFormingNum',
+            label: '已成型数量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'requiredFormingNum',
+            label: '已成型重量',
+            align: 'center',
+            showOverflowTooltip: true
+          },
+          {
+            prop: 'reqMoldTime',
+            label: '计划开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            prop: 'reqMoldTime',
+            label: '实际开始时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+
+          ...opt[this.activeName],
+          {
+            prop: 'createTime',
+            label: '创建时间',
+            align: 'center',
+            showOverflowTooltip: true,
+            minWidth: 110
+          },
+          {
+            slot: 'status',
+            label: '状态',
+            align: 'center',
+            formatter: (row) => {
+              const obj = this.statusOpt[this.activeName].find(
+                (i) => i.value == row.status
+              );
+              return obj && obj.label;
+            }
+          },
+          {
+            columnKey: 'action',
+            label: '操作',
+            width: 350,
+            align: 'center',
+            resizable: false,
+            fixed: 'right',
+            slot: 'action',
+            showOverflowTooltip: true
+          }
+        ];
+      }
+    },
+    methods: {
+      /* 表格数据源 */
+      datasource ({ page, limit, where }) {
+        return [];
+        // getList({
+        //   pageNum: page,
+        //   size: limit,
+        //   ...where
+        // });
+      },
+      handleCreate () {
+        this.$refs.createRef.open(0);
+      },
+      // 发布工单
+      handleOrderPublish (type, row) {
+        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 });
+        });
+      },
+
+      goDetail (row) {
+        this.$router.push({
+          path: '/productionPlan/detail',
+          query: {
+            id: row.id
+          }
+        });
+      },
+      handleDelete ({ id }) {
+        this.$confirm('确定删除当前数据?', '提示').then(async () => {
+          await del(id);
+          this.$message.success('删除成功!');
+          this.reload();
+        });
+      }
+    }
+  };
+</script>
+
+<style lang="scss" scoped></style>

+ 2 - 2
vue.config.js

@@ -31,12 +31,12 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        // target: 'http://192.168.3.51:86', // 测试
+        target: 'http://192.168.3.51:18086', // 测试
 
         // target: 'http://192.168.3.35:8080', // kang杨威
         // target: 'http://192.168.3.25:8080', // 黄峥嵘
         // target: 'http://192.168.3.41:8080', // 何江鹏
-        target: 'http://192.168.3.33:8080', // 谢一平
+        // target: 'http://192.168.3.33:8080', // 谢一平
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {