Просмотр исходного кода

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

LAPTOP-16IUEB3P\Lenovo 2 лет назад
Родитель
Сommit
1c7bf6a39b

+ 12 - 3
src/api/login/index.js

@@ -4,7 +4,7 @@ import { setToken } from '@/utils/token-util';
 /**
  * 登录
  */
-export async function login(data) {
+export async function login (data) {
   const res = await request.post('/main/user/login', data);
   if (res.data.code == 0) {
     setToken(res.data.data.token, data.remember);
@@ -12,11 +12,20 @@ export async function login(data) {
   }
   return Promise.reject(new Error(res.data.message));
 }
-
+/**
+ * 获取用户信息
+ */
+export async function getLoginUser (data) {
+  const res = await request.get('/system/account/getLoginUser', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
 /**
  * 获取验证码
  */
-export async function getCaptcha() {
+export async function getCaptcha () {
   const res = await request.get('/captcha');
   if (res.data.code === 0) {
     return res.data.data;

+ 6 - 0
src/router/index.js

@@ -10,6 +10,7 @@ import { getToken } from '@/utils/token-util';
 import { routes, getMenuRoutes } from './routes';
 import { SYSTEM_NAME } from '@/config/setting';
 
+import { getLoginUser } from '@/api/login';
 Vue.use(VueRouter);
 // const originalPush = VueRouter.prototype.push
 // VueRouter.prototype.push = function push (location) {
@@ -36,6 +37,11 @@ router.beforeEach((to, from, next) => {
   }
   // 判断是否登录
   if (getToken()) {
+    if (!store.state.user.info?.userId) {
+      getLoginUser().then((res) => {
+        store.commit('user/setUserInfo', res);
+      });
+    }
     // 还未注册动态路由则先获取
     if (!store.state.user.menus) {
       store

+ 27 - 20
src/views/materialPlan/components/plan-view.vue

@@ -47,8 +47,7 @@
       </div> -->
     </div>
     <el-form :model="{ tableData }" label-width="0" ref="formRef">
-      <el-table :data="tableData"
-	  >
+      <el-table :data="tableData">
         <el-table-column type="index" label="序号"></el-table-column>
         <el-table-column label="工单号" prop="code"></el-table-column>
         <el-table-column label="生产重量" prop="" width="120">
@@ -157,6 +156,7 @@
 
   import { release } from '@/api/materialPlan/order.js';
   import { getCode } from '@/api/codeManagement';
+  import { getRouteTabKey, removePageTab } from '@/utils/page-tab-util';
   import { deepClone } from '@/utils';
   export default {
     components: { equipmentDailog, classesSelect },
@@ -219,7 +219,7 @@
             list: [{ label: '末单均衡', value: 0 }]
           }
         ],
-		selectionList:[]
+        selectionList: []
       };
     },
     computed: {
@@ -258,15 +258,20 @@
       }
     },
     methods: {
-	 // chooseItem(selection){
-		//  this.selectionList = selection
-	 // },
+      back () {
+        const key = getRouteTabKey();
+        this.$router.push('/productionPlan');
+        removePageTab({ key });
+      },
+      // chooseItem(selection){
+      //  this.selectionList = selection
+      // },
       // 发布
       handleRelease () {
         this.$refs.formRef.validate((value) => {
           if (value) {
-            this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认').then(
-              async () => {
+            this.$confirm('发布工单后不可撤回,确定发布吗?', '发布确认')
+              .then(async () => {
                 const loading = this.$loading({
                   lock: true,
                   fullscreen: true,
@@ -289,13 +294,13 @@
                   } else {
                     this.$message.error('发布失败,请重新发布!');
                   }
-                  this.$router.back();
+                  this.back();
                 } catch (error) {
                   console.error(error);
                 }
                 loading.close();
-              }).catch(() => {         
-			  });
+              })
+              .catch(() => {});
           }
         });
       },
@@ -319,7 +324,8 @@
         row.executorName = executorName.substring(1);
       },
       addOrder () {
-		if(this.tableData.length>0) return  this.$message.warning('工单只能添加一条!');
+        if (this.tableData.length > 0)
+          return this.$message.warning('工单只能添加一条!');
         this.$refs.equipmentDailogRef.open();
       },
       editOrder (row) {
@@ -366,15 +372,16 @@
         }
       },
       handleDelete (index) {
-        this.$confirm('确定删除当前数据?', '提示').then(() => {
-          const [item] = this.tableData.splice(index, 1);
+        this.$confirm('确定删除当前数据?', '提示')
+          .then(() => {
+            const [item] = this.tableData.splice(index, 1);
 
-          if (this.orderList.find((i) => i.id == item.id)) {
-            item.deleted = 1;
-            this.deleteList.push(item);
-          }
-        }).catch(() => {         
-		});
+            if (this.orderList.find((i) => i.id == item.id)) {
+              item.deleted = 1;
+              this.deleteList.push(item);
+            }
+          })
+          .catch(() => {});
       }
     }
   };

+ 15 - 14
src/views/materialPlan/index.vue

@@ -133,20 +133,20 @@
             action: 'code',
             label: '计划编号',
             align: 'center',
-		    width: 200
+            width: 200
           },
           {
             prop: 'materialCode',
             label: '编号',
             align: 'center',
-			width: 150
+            width: 150
           },
           {
             prop: 'materialName',
             label: '物料名称',
             align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
+            showOverflowTooltip: true,
+            minWidth: 110
           },
           {
             prop: 'brandNo',
@@ -160,8 +160,8 @@
                 ? '计划生产重量(KG)'
                 : '生产重量(KG)',
             align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 150
+            showOverflowTooltip: true,
+            minWidth: 150
           },
           ...(this.activeName === 'second'
             ? [
@@ -169,8 +169,8 @@
                   prop: 'producedWeight',
                   label: '已生产重量(KG)',
                   align: 'center',
-				  showOverflowTooltip: true,
-				  minWidth: 150
+                  showOverflowTooltip: true,
+                  minWidth: 150
                 }
               ]
             : []),
@@ -192,8 +192,8 @@
             prop: 'deliveryTime',
             label: '要求交付日期',
             align: 'center',
-			showOverflowTooltip: true,
-			minWidth: 110
+            showOverflowTooltip: true,
+            minWidth: 110
           },
           ...(this.activeName === 'second'
             ? [
@@ -201,12 +201,13 @@
                   prop: 'completeTime',
                   label: '实际完成时间',
                   align: 'center',
-				  showOverflowTooltip: true,
-				  minWidth: 110
+                  showOverflowTooltip: true,
+                  minWidth: 110
                 }
               ]
             : []),
           {
+            columnKey: 'status',
             label: '状态',
             align: 'center',
             slot: 'status',
@@ -221,7 +222,7 @@
             prop: 'createTime',
             label: '创建时间',
             align: 'center',
-			width: 160
+            width: 160
           },
           ...(this.activeName === 'second'
             ? [
@@ -290,7 +291,7 @@
 
       /* 刷新表格 */
       reload (where = {}) {
-		where.statusList = this.statusOpt[this.activeName][0].value.split(',')
+        where.statusList = this.statusOpt[this.activeName][0].value.split(',');
         this.$nextTick(() => {
           this.$refs.table.reload({ page: 1, where });
         });

+ 5 - 4
src/views/productionPlan/components/detail/plan.vue

@@ -6,7 +6,7 @@
         productionPlan.code
       }}</el-descriptions-item>
       <el-descriptions-item label="计划生产数量">{{
-        productionPlan.requiredFormingNum
+        productionPlan.planProductNum
       }}</el-descriptions-item>
       <!-- <el-descriptions-item label="已交货数量">已交货数量</el-descriptions-item>
       <el-descriptions-item label="未交货数量">未交货数量</el-descriptions-item> -->
@@ -14,10 +14,11 @@
         productionPlan.createUserName
       }}</el-descriptions-item>
       <el-descriptions-item label="计划类型">{{
-        ['', '内销计划', '外销计划', '预制计划'][productionPlan.orderType]
+        ['', '内销计划', '外销计划', '预制计划'][productionPlan.planType]
       }}</el-descriptions-item>
       <el-descriptions-item label="计划生产重量">{{
-        productionPlan.code
+        productionPlan.planProductNum &&
+        productionPlan.planProductNum * productionPlan.productUnitWeight
       }}</el-descriptions-item>
       <!-- <el-descriptions-item label="已交货重量">已交货重量</el-descriptions-item>
       <el-descriptions-item label="未交货重量">未交货重量</el-descriptions-item> -->
@@ -177,7 +178,7 @@
             prop: 'orderType',
             label: '订单类型',
             formatter: (row) =>
-              ['', '内销订单', '外销订单', '预制订单'][row.orderLibraryType]
+              ['', '内销订单', '外销订单', '预制订单'][row.orderType]
           },
           {
             prop: 'releaseTime',

+ 27 - 13
src/views/productionPlan/components/plan-view.vue

@@ -63,21 +63,19 @@
               <el-input
                 type="number"
                 v-model.number="row.formingNum"
-				@input="writeNum(row.formingNum,row)"
+                @input="writeNum(row.formingNum, row)"
               ></el-input>
             </el-form-item>
           </template>
         </el-table-column>
         <el-table-column label="成型重量" prop="" width="120">
           <template v-slot="{ row, $index }">
-			  <!-- :prop="`tableData.${$index}.formingWeight`" -->
-            <el-form-item
-              :rules="rule.formingWeight"
-            >
+            <!-- :prop="`tableData.${$index}.formingWeight`" -->
+            <el-form-item :rules="rule.formingWeight">
               <el-input
                 type="number"
                 v-model.number="row.formingWeight"
-		        		readonly
+                readonly
               ></el-input>
             </el-form-item>
           </template>
@@ -175,6 +173,7 @@
 
   import { release } from '@/api/productionPlan/order.js';
   import { getCode } from '@/api/codeManagement';
+  import { getRouteTabKey, removePageTab } from '@/utils/page-tab-util';
   import { deepClone } from '@/utils';
   export default {
     components: { equipmentDailog, classesSelect },
@@ -281,9 +280,13 @@
       }
     },
     methods: {
-	  writeNum(val,row){
-		  this.$set(row,'formingWeight',val*Number(this.infoData.productUnitWeight))
-	  },
+      writeNum (val, row) {
+        this.$set(
+          row,
+          'formingWeight',
+          val * Number(this.infoData.productUnitWeight)
+        );
+      },
       // 发布
       handleRelease () {
         this.$refs.formRef.validate((value) => {
@@ -302,17 +305,21 @@
                       Object.assign({}, i, {
                         status: 4,
                         model: this.infoData.model,
-                        brandNo: this.infoData.brandNo
+                        brandNo: this.infoData.brandNo,
+                        categoryId: this.infoData.categoryId
                       })
                     ),
-                    ...this.deleteList
+                    ...this.deleteList.map((i) => ({
+                      ...i,
+                      categoryId: this.infoData.categoryId
+                    }))
                   ]);
                   if (data) {
                     this.$message.success('发布成功!');
                   } else {
                     this.$message.error('发布失败,请重新发布!');
                   }
-                  this.$router.back();
+                  this.back();
                 } catch (error) {
                   console.error(error);
                 }
@@ -322,6 +329,12 @@
           }
         });
       },
+
+      back () {
+        const key = getRouteTabKey();
+        this.$router.push('/productionPlan');
+        removePageTab({ key });
+      },
       // 班次改变选择执行人
       async handleClasseChange (val, row) {
         if (!val) {
@@ -342,7 +355,8 @@
         row.executorName = executorName.substring(1);
       },
       addOrder () {
-				if(this.tableData.length>0) return  this.$message.warning('工单只能添加一条!');
+        if (this.tableData.length > 0)
+          return this.$message.warning('工单只能添加一条!');
         this.$refs.equipmentDailogRef.open(1);
       },
       editOrder (row) {

+ 1 - 0
src/views/productionPlan/index.vue

@@ -256,6 +256,7 @@
             minWidth: 110
           },
           {
+            columnKey: 'status',
             slot: 'status',
             label: '状态',
             align: 'center',

+ 11 - 4
src/views/saleOrder/components/plan-submit.vue

@@ -64,8 +64,10 @@
     <div slot="footer" class="footer">
       <div>
         <el-button @click="cancel">取消</el-button>
-        <el-button @click="submit(2)">提交并发布</el-button>
-        <el-button type="primary" @click="submit(1)">提交</el-button>
+        <el-button @click="submit(2)" :loading="loading">提交并发布</el-button>
+        <el-button type="primary" @click="submit(1)" :loading="loading"
+          >提交</el-button
+        >
       </div>
     </div>
   </el-dialog>
@@ -83,6 +85,7 @@
     data () {
       return {
         visible: false,
+        loading: false,
         tableList: []
       };
     },
@@ -101,8 +104,12 @@
         this.visible = false;
       },
       async getPlanCode () {
-        const code = await getCode('product_code');
-        this.$set(this.info, 'code', code);
+        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);

+ 16 - 14
src/views/saleOrder/salesToProduction.vue

@@ -299,7 +299,7 @@
         ref="versionRefs"
         @confirm="confirmVersion"
         :productCode="form.productCode"
-		:produceVersionId="form.produceVersionId"
+        :produceVersionId="form.produceVersionId"
       ></ProductionVersion>
       <PlanSubmit
         ref="submitRefs"
@@ -319,7 +319,7 @@
     saveSaleToPlan,
     updateSaleToPlan,
     getUpdateInfoById,
-	getProductVersion
+    getProductVersion
   } from '@/api/saleOrder';
   import dictMixins from '@/mixins/dictMixins';
   import { deepClone } from '@/utils/index';
@@ -373,8 +373,8 @@
       async getPlanInfo (id) {
         const data = await getUpdateInfoById(id);
         this.form = data;
-        if(data.productCode){
-        	this.getVersionData()
+        if (data.productCode) {
+          this.getVersionData();
         }
       },
       getSaleInfo (params) {
@@ -395,16 +395,16 @@
           }
         });
       },
-	  
-	  getVersionData () {
-	    getProductVersion(this.form.productCode).then((res) => {
-	       res.map(item=>{
-			    if(item.produceVersionId==this.form.produceVersionId){
-					this.lineNamesList = Array.from(new Set(item.lineNames || []));
-				}
-		   })
-	    });
-	  },
+
+      getVersionData () {
+        getProductVersion(this.form.productCode).then((res) => {
+          res.map((item) => {
+            if (item.produceVersionId == this.form.produceVersionId) {
+              this.lineNamesList = Array.from(new Set(item.lineNames || []));
+            }
+          });
+        });
+      },
       cancel () {
         this.$router.go(-1);
       },
@@ -551,6 +551,8 @@
 
       publishData (type) {
         let params = deepClone(this.form);
+        params.categoryId = params.salesOrders[0]?.categoryId;
+
         let request =
           this.$route.query.type == 'edit' ? updateSaleToPlan : saveSaleToPlan;
         if (this.$route.query.type != 'edit') {

+ 2 - 2
vue.config.js

@@ -31,12 +31,12 @@ module.exports = {
     proxy: {
       // 当我们的本地的请求 有/api的时候,就会代理我们的请求地址向另外一个服务器发出请求
       '/api': {
-        target: 'http://192.168.3.35:8080', // kang杨威
+        // target: 'http://192.168.3.35:8080', // kang杨威
         // target: 'http://192.168.3.38:8080', // 陈潇
         // 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.51:18086', // 测试环境
+        target: 'http://192.168.3.51:18086', // 测试环境
 
         changeOrigin: true, // 只有这个值为true的情况下 才表示开启跨域
         pathRewrite: {