浏览代码

修改产品类别的新增

zhuliu 1 年之前
父节点
当前提交
81ae17c13a

+ 14 - 11
src/views/pms/product/components/ProductInfoDetail.vue

@@ -5,7 +5,7 @@
         <el-cascader
           style="width:100%"
           :props="categoryProp()"
-          v-model="value.productCategoryId "
+          v-model="selectProductCateValue "
           :options="productCateOptions">
         </el-cascader>
       </el-form-item>
@@ -96,15 +96,15 @@
         if(newValue===undefined||newValue==null||newValue===0)return;
         this.handleEditCreated();
       },
-      selectProductCateValue: function (newValue) {
-        if (newValue != null && newValue.length === 2) {
-          this.value.productCategoryId = newValue[1];
-          this.value.productCategoryName= this.getCateNameById(this.value.productCategoryId);
-        } else {
-          this.value.productCategoryId = null;
-          this.value.productCategoryName=null;
-        }
-      },
+      // selectProductCateValue: function (newValue) {
+      //   if (newValue != null && newValue.length === 2) {
+      //     this.value.productCategoryId = newValue[1];
+      //     this.value.productCategoryName= this.getCateNameById(this.value.productCategoryId);
+      //   } else {
+      //     this.value.productCategoryId = null;
+      //     this.value.productCategoryName=null;
+      //   }
+      // },
       value(){
         this.files = this.value.systemFileList
       }
@@ -141,7 +141,7 @@
       //处理编辑逻辑
       handleEditCreated(){
         if(this.value.productCategoryId!=null){
-          this.selectProductCateValue.push(this.value.cateParentId);
+          // this.selectProductCateValue.push(this.value.cateParentId);
           this.selectProductCateValue.push(this.value.productCategoryId);
         }
         this.hasEditCreated=true;
@@ -197,6 +197,9 @@
           return false
         }
         this.value.fileGuids = guids
+        if(this.selectProductCateValue && this.selectProductCateValue.length>0){
+          this.productCate.parentId = this.parentId[this.selectProductCateValue.length-1]
+        }
         this.$refs[formName].validate((valid) => {
           if (valid) {
             this.$emit('finishCommit');

+ 5 - 1
src/views/pms/productCate/components/ProductCateDetail.vue

@@ -13,7 +13,7 @@
               clearable
               style="width:100%"
               :props="categoryProp()"
-              v-model="productCate.parentId"
+              v-model="parentId"
               :options="selectProductCateList">
             </el-cascader>
 
@@ -67,6 +67,7 @@
     },
     data() {
       return {
+        parentId:null,
         files:[],
         productCate: Object.assign({}, defaultProductCate),
         selectProductCateList: [],
@@ -172,6 +173,9 @@
           return false
         }
         this.productCate.fileGuids = guids
+        if(this.parentId && this.parentId.length>0){
+          this.productCate.parentId = this.parentId[this.parentId.length-1]
+        }
         this.$refs[formName].validate((valid) => {
           if (valid) {
             this.$confirm('是否提交数据', '提示', {

+ 19 - 11
src/views/pms/productCate/index.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="app-container">
-    <el-card class="operate-container" shadow="never">
+    <el-card class="operate-container card" shadow="never">
       <i class="el-icon-tickets" style="margin-top: 5px"></i>
       <span style="margin-top: 5px">数据列表</span>
       <el-button
@@ -15,7 +15,12 @@
         size="mini">
         添加
       </el-button>
+
+
     </el-card>
+    <div v-if="showProgress">
+        <el-progress :percentage="percentage"></el-progress>
+    </div>
     <div class="table-container">
       <el-table ref="productCateTable"
                 style="width: 100%"
@@ -33,7 +38,7 @@
           <template slot-scope="scope">{{scope.row.name}}</template>
         </el-table-column>
         <el-table-column label="级别" width="100" align="center">
-          <template slot-scope="scope">{{scope.row.level | levelFilter}}</template>
+          <template slot-scope="scope">{{scope.row.level}}</template>
         </el-table-column>
         <el-table-column label="路径" align="center">
           <template slot-scope="scope">{{scope.row.path}}</template>
@@ -102,6 +107,8 @@
     name: "productCateList",
     data() {
       return {
+        showProgress:false,
+        percentage:0,
         list: null,
         total: null,
         listLoading: false,
@@ -137,7 +144,7 @@
       },
       //导入产品类别
       handleImportProductCate(){},
-      
+
       //获取产品类别列表
       getList() {
         var params = {
@@ -207,18 +214,19 @@
       }
     },
     filters: {
-      levelFilter(value) {
-        if (value === 0) {
-          return '一级';
-        } else if (value === 1) {
-          return '二级';
-        }
-      },
+
 
     }
   }
 </script>
 
 <style scoped>
-
+  .card{
+    position: relative;
+  }
+  .progress{
+    width: calc(100% - 40px);
+    position: absolute;
+    bottom: 0;
+  }
 </style>