Browse Source

物料分类修改之后,带出一二三级分类

002390 1 year ago
parent
commit
51771cd982
2 changed files with 31 additions and 22 deletions
  1. 31 6
      src/views/material/basicFile/details.vue
  2. 0 16
      src/views/material/basicFile/index.vue

+ 31 - 6
src/views/material/basicFile/details.vue

@@ -140,7 +140,6 @@
                   <el-row :gutter="10">
                   <el-row :gutter="10">
                     <el-col :span="8" v-for="f in basicData.form" style="text-align: right;">
                     <el-col :span="8" v-for="f in basicData.form" style="text-align: right;">
                       <template v-if="f.show">
                       <template v-if="f.show">
-                        <!--  :disabled="!(headerParam.isEdit && f.edit)" -->
 
 
                         <!-- 多选框 -->
                         <!-- 多选框 -->
                         <el-form-item v-if="f.attribute == 'checkbox'" style="text-align: left;" :prop="f.prop">
                         <el-form-item v-if="f.attribute == 'checkbox'" style="text-align: left;" :prop="f.prop">
@@ -650,7 +649,8 @@
   import materialApi from '@/api/material/basic';
   import materialApi from '@/api/material/basic';
   import {getDicts as getDicts} from '@/api/system/dict/data'
   import {getDicts as getDicts} from '@/api/system/dict/data'
   import arrayUtils from '../tools/arrayUtils';
   import arrayUtils from '../tools/arrayUtils';
-  import { initRules} from './init/index'
+  import { initRules} from './init/index';
+  import { getDetail } from '@/api/classify/basic';
 
 
   export default {
   export default {
     name: 'material-details',
     name: 'material-details',
@@ -921,7 +921,6 @@
       },
       },
       // 主标签页 列表双击
       // 主标签页 列表双击
       handleMaindbClick(e) {
       handleMaindbClick(e) {
-        console.log(e, '主标签页 列表双击');
         this.otherDeatils.queryKey = e.id;
         this.otherDeatils.queryKey = e.id;
         this.otherDeatils.show = true;
         this.otherDeatils.show = true;
         let activeTab = this.detailsTabs.filter(item => item.code == this.activeMainTab)[0];
         let activeTab = this.detailsTabs.filter(item => item.code == this.activeMainTab)[0];
@@ -932,12 +931,10 @@
       },
       },
       // 主页签 列表数据选择
       // 主页签 列表数据选择
       handleMainChange(e) {
       handleMainChange(e) {
-        console.log(e, '主页签 列表数据选择');
         this.mainMsg.checkedList = e;
         this.mainMsg.checkedList = e;
       },
       },
       // 上传图片
       // 上传图片
       handleUpImage() {
       handleUpImage() {
-        console.log('上传图片');
       },
       },
       // 编辑状态下,参照弹窗显示查询数据
       // 编辑状态下,参照弹窗显示查询数据
       handleQueryMore(msg, val, target) {
       handleQueryMore(msg, val, target) {
@@ -2153,6 +2150,7 @@
         },
         },
         deep: true,
         deep: true,
       },
       },
+      // 通过一级分类判断业务线是否必填
       "basicData.value.oneClass": {
       "basicData.value.oneClass": {
         handler(nVal, oVal) {
         handler(nVal, oVal) {
 
 
@@ -2175,7 +2173,35 @@
         },
         },
         deep: true,
         deep: true,
       },
       },
+      // 物料分类改变同时改变一二三级分类
+      "basicData.value.classifyId": {
 
 
+        async handler(nVal, oVal) {
+
+          if(nVal !== oVal){
+
+            try {
+
+              let {code, data }  = await getDetail(nVal);
+
+              if( code == 200){
+
+                let {oneClass,twoClass,threeClass} = data;
+
+                this.basicData.value['oneClass'] = oneClass;
+
+                this.basicData.value['twoClass'] = twoClass;
+
+                this.basicData.value['threeClass'] = threeClass;
+
+              }
+              
+            } catch (error) {}
+          }
+         
+        },
+        deep: true,
+      },
 
 
     },
     },
 
 
@@ -2184,7 +2210,6 @@
       // 基本信息
       // 基本信息
       this.handleRest();
       this.handleRest();
       if (window.name === '') {
       if (window.name === '') {
-        console.log('页面首次被加载')
         this.$route.query.isEdit && this.handleBasicEdit();
         this.$route.query.isEdit && this.handleBasicEdit();
       } else {
       } else {
         console.log('页面被刷新')
         console.log('页面被刷新')

+ 0 - 16
src/views/material/basicFile/index.vue

@@ -215,7 +215,6 @@ export default {
     },
     },
     // 修改
     // 修改
     handleEdit() {
     handleEdit() {
-      console.log(this.checkedList, 'this.checkedList');
       if (this.checkedList.length == 1) {
       if (this.checkedList.length == 1) {
         this.$router.push({
         this.$router.push({
           path: `/material/basicFile/detail/${this.checkedList[0].id}`,
           path: `/material/basicFile/detail/${this.checkedList[0].id}`,
@@ -258,8 +257,6 @@ export default {
     },
     },
     //查询 
     //查询 
     handleQuery() {
     handleQuery() {
-
-      console.log('查询');
       this.getMaterialList('material');
       this.getMaterialList('material');
     },
     },
     // 重置查询条件
     // 重置查询条件
@@ -271,7 +268,6 @@ export default {
     },
     },
     // 刷新
     // 刷新
     handleRefresh() {
     handleRefresh() {
-      console.log('刷新');
       this.getMaterialList('material');
       this.getMaterialList('material');
       for (const key in this.queryForm) {
       for (const key in this.queryForm) {
         this.queryForm[key] = '';
         this.queryForm[key] = '';
@@ -295,7 +291,6 @@ export default {
         id: this.checkedList[0].id
         id: this.checkedList[0].id
       };
       };
       materialApi.updateEnableMaterial(param).then(res => {
       materialApi.updateEnableMaterial(param).then(res => {
-        console.log(res, '启用/停用');
         if (res.code == 200) {
         if (res.code == 200) {
           this.handleRefresh();
           this.handleRefresh();
           // 清空选中数据
           // 清空选中数据
@@ -314,7 +309,6 @@ export default {
     },
     },
     // 批量导入
     // 批量导入
     handleImport() {
     handleImport() {
-      console.log('批量导入');
       this.importData.show = true
       this.importData.show = true
     },
     },
     // 导入弹窗关闭前
     // 导入弹窗关闭前
@@ -324,7 +318,6 @@ export default {
     },
     },
     // 导入弹窗操作
     // 导入弹窗操作
     handleImportData(type) {
     handleImportData(type) {
-      console.log('导入弹窗操作');
       switch (type) {
       switch (type) {
         // 取消
         // 取消
         case 'cancal':
         case 'cancal':
@@ -333,7 +326,6 @@ export default {
           break;
           break;
         // 确认
         // 确认
         case 'confirm':
         case 'confirm':
-          console.log(this.importData.list, 'this.fileList');
           if (this.importData.list.length) {
           if (this.importData.list.length) {
 
 
             let formData = new FormData();
             let formData = new FormData();
@@ -367,11 +359,9 @@ export default {
     // 文件发生改变
     // 文件发生改变
     handleChangeFile(file, fileList) {
     handleChangeFile(file, fileList) {
       this.importData.list = fileList;
       this.importData.list = fileList;
-      console.log(this.importData.list, '文件发生改变');
     },
     },
     // 批量导出
     // 批量导出
     handleExport() {
     handleExport() {
-      console.log('批量导出', this.checkedList);
 
 
       let ids = this.checkedList.length ? this.checkedList.map(i => i.id) : [];
       let ids = this.checkedList.length ? this.checkedList.map(i => i.id) : [];
 
 
@@ -392,7 +382,6 @@ export default {
     },
     },
     // 下载模板
     // 下载模板
     handleDownTemplate() {
     handleDownTemplate() {
-      console.log('下载模板');
       this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
       this.download('/system/material/download', {}, `物料基本信息模板.xlsx`)
     },
     },
 
 
@@ -418,7 +407,6 @@ export default {
 
 
     // 双击行
     // 双击行
     handledbClick(e) {
     handledbClick(e) {
-      console.log(e, '双击行');
       this.$router.push({
       this.$router.push({
         path: `/material/basicFile/detail/${e.id}`,
         path: `/material/basicFile/detail/${e.id}`,
       });
       });
@@ -436,7 +424,6 @@ export default {
     // 选中数据改变
     // 选中数据改变
     handleSelectionChange(list) {
     handleSelectionChange(list) {
       // this.checkedList = this.handleUnique([...this.checkedList, ...list], 'id');
       // this.checkedList = this.handleUnique([...this.checkedList, ...list], 'id');
-      // console.log(this.checkedList, '选中数据改变');
       // this.$emit('headerOption', JSON.stringify({ checkedList: [... this.checkedList] }))
       // this.$emit('headerOption', JSON.stringify({ checkedList: [... this.checkedList] }))
     },
     },
     // 行数据勾选操作 
     // 行数据勾选操作 
@@ -448,7 +435,6 @@ export default {
     },
     },
     //手动勾选全选 
     //手动勾选全选 
     handleSelectAll(selection) {
     handleSelectAll(selection) {
-      // console.log(selection, '手动勾选全选--------------');
       this.checkedList = selection;
       this.checkedList = selection;
     },
     },
     // 获取物料列表信息
     // 获取物料列表信息
@@ -497,7 +483,6 @@ export default {
     // this.getTagList('material');
     // this.getTagList('material');
   },
   },
   beforeRouteEnter(to, from, next) {
   beforeRouteEnter(to, from, next) {
-    console.log(to, 'to', from, 'beforeRouteEnter');
 
 
     next((vm) => {
     next((vm) => {
       if (from.name == 'materialDetail') {
       if (from.name == 'materialDetail') {
@@ -514,7 +499,6 @@ export default {
   },
   },
   // 进入详情,保留查询条件
   // 进入详情,保留查询条件
   beforeRouteLeave(to, from, next) {
   beforeRouteLeave(to, from, next) {
-    console.log(to, 'to', from, 'beforeRouteLeave');
     if (to.name == 'materialDetail') {
     if (to.name == 'materialDetail') {
       this.$store.commit('SET_QUERY', this.queryForm);
       this.$store.commit('SET_QUERY', this.queryForm);
     } else {
     } else {