Quellcode durchsuchen

商品类别下拉框修改

sunlupeng vor 6 Monaten
Ursprung
Commit
03cd9eab35
3 geänderte Dateien mit 57 neuen und 18 gelöschten Zeilen
  1. 4 4
      config/dev.env.js
  2. 32 6
      src/views/goodsManage/goodsList.vue
  3. 21 8
      src/views/goodsManage/goodsTypeList.vue

+ 4 - 4
config/dev.env.js

@@ -3,11 +3,11 @@ module.exports = {
 	ENV_CONFIG: '"dev"',
   // 登录用户名 admin123,密码 admin123
   // 本地环境
-  BASE_API: '"http://192.168.100.188:9086/admin"',
-  OS_API: '"http://192.168.100.188:9086/oneportal/login"',
+  // BASE_API: '"http://192.168.100.188:9086/admin"',
+  // OS_API: '"http://192.168.100.188:9086/oneportal/login"',
 	// 阿里云环境
-  // BASE_API: '"http://47.103.79.143:9086/admin"',
-  // OS_API: '"http://dgtcloud.dgtis.com/oneportal/login"'
+  BASE_API: '"http://47.103.79.143:9086/admin"',
+  OS_API: '"http://dgtcloud.dgtis.com/oneportal/login"'
   //正式环境
   // BASE_API: '"https://xiaoyou.dgtis.com/admin"',
   // OS_API: '"http://dgt.dgtis.com/oneportal/login"'

+ 32 - 6
src/views/goodsManage/goodsList.vue

@@ -8,8 +8,22 @@
             <el-input clearable class="filter-item" style="width: 200px;" placeholder="商品简称"
                 v-model="listQuery.productShortForm"></el-input>
 
-            <treeselect class="filter-item" default-expand-all v-model="listQuery.categoryId" :options="categoryOptions"
-                :normalizer="normalizer" placeholder="商品类别" style="width: 200px" />
+            <!-- <treeselect class="filter-item" default-expand-all v-model="listQuery.categoryId" :options="categoryOptions"
+                :normalizer="normalizer" placeholder="商品类别" style="width: 200px" /> -->
+                 <el-cascader
+                 clearable
+                 class="filter-item"
+                 placeholder="商品类别"
+                 style="width: 200px"
+                  v-model="listQuery.categoryId"
+                  :options="categoryOptions"
+                  :props="{
+                    label: 'categoryName',
+                    value: 'id',
+                    emitPath: false,
+                    checkStrictly: true
+                  }"
+                />
             <el-select class="filter-item" style="width: 200px" v-model="listQuery.brandId" filterable placeholder="品牌">
                 <el-option v-for="item in brandOptions" :key="item.value" :label="item.label" :value="item.value">
                 </el-option>
@@ -86,8 +100,20 @@
 
 
                         <el-form-item label="商品类别" prop="categoryId">
-                            <treeselect default-expand-all v-model="dataForm.categoryId" :options="categoryOptions"
-                                :normalizer="normalizer" placeholder="请选择商品类别" />
+                            <el-cascader
+                            placeholder="请选择商品类别"
+                            style="width: 100%;"
+                            v-model="dataForm.categoryId"
+                            :options="categoryOptions"
+                            :props="{
+                                label: 'categoryName',
+                                value: 'id',
+                                emitPath: false,
+                                checkStrictly: true
+                            }"
+                            />
+                            <!-- <treeselect default-expand-all v-model="dataForm.categoryId" :options="categoryOptions"
+                                :normalizer="normalizer" placeholder="请选择商品类别" /> -->
                         </el-form-item>
 
                         <el-form-item label="品牌" prop="brandId">
@@ -176,8 +202,8 @@
                             <el-date-picker style="width: 100%;" v-model="dataForm.productDate" type="date"
                                 placeholder="选择日期" value-format="yyyy-MM-dd"></el-date-picker>
                         </el-form-item>
-                        <el-form-item label="陈年份">
-                            <el-input v-model="dataForm.teaAgingYear" placeholder="输入陈华年份"></el-input>
+                        <el-form-item label="陈年份">
+                            <el-input v-model="dataForm.teaAgingYear" placeholder="请输入陈化年份"></el-input>
                         </el-form-item>
                         <el-form-item label="溯源信息" prop="teaFiles">
                             <el-upload :limit="1" :action="fileImgUrl" :file-list="dataForm.files" :on-success="handleFileSuccess"

+ 21 - 8
src/views/goodsManage/goodsTypeList.vue

@@ -64,8 +64,20 @@
         <el-form ref="form" :model="form" :rules="rules" label-width="80px">
           <el-row>
             <el-col :span="24" v-if="isShowParent">
+              
               <el-form-item label="上级名称" prop="parentId">
-                <treeselect v-model="form.parentId" @select="departTreeSelected" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" />
+                 <el-cascader
+                 style="width: 100%;"
+                  v-model="form.parentId"
+                  :options="deptList"
+                  :props="{
+                    label: 'categoryName',
+                    value: 'id',
+                    emitPath: false,
+                    checkStrictly: true
+                  }"
+                />
+                <!-- <treeselect v-model="form.parentId" @select="departTreeSelected" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" /> -->
               </el-form-item>
             </el-col>
           </el-row>
@@ -116,7 +128,7 @@
         // 表格树数据
         deptList: [],
         // 类别树选项
-        deptOptions: [],
+        // deptOptions: [],
         // 弹出层标题
         title: "",
         // 是否显示弹出层
@@ -220,9 +232,9 @@
         }
         this.open = true;
         this.title = "添加类别";
-        listDept().then(response => {
-          this.deptOptions = this.handleTree(response.data.data, "id");
-        });
+        // listDept().then(response => {
+        //   this.deptOptions = this.handleTree(response.data.data, "id");
+        // });
       },
       /** 展开/折叠操作 */
       toggleExpandAll() {
@@ -241,12 +253,13 @@
           this.form = data;
           if (data.parentId) {
             this.isShowParent = true;
+            this.form.parentId = data.id;
           }
           this.open = true;
           this.title = "修改类别";
-          listDept().then(response => {
-            this.deptOptions = this.handleTree(response.data.data, "id");
-          });
+          // listDept().then(response => {
+          //   this.deptOptions = this.handleTree(response.data.data, "id");
+          // });
           // listDeptExcludeChild({id:row.id}).then(response => {
           //   this.deptOptions = this.handleTree(response.data.data, "id");
           //   if (this.deptOptions.length == 0) {