sunlupeng 8 months ago
parent
commit
0d4c443652

+ 22 - 10
src/views/goodsManage/brand.vue

@@ -7,9 +7,10 @@
       </el-input>
       <el-input clearable class="filter-item" style="width: 200px;" placeholder="请输入品牌商名称" v-model="listQuery.name">
       </el-input>
-      <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
-      <el-button class="filter-item" type="primary" icon="el-icon-edit" @click="handleCreate">添加</el-button>
-      <el-button class="filter-item" type="primary" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
+      <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleQuery">查找</el-button>
+      <el-button class="filter-item" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
+      <el-button class="filter-item" type="primary" icon="el-icon-plus" @click="handleCreate">添加</el-button>
+      <el-button class="filter-item" v-waves icon="el-icon-download" @click="handleDownload" :loading="downloadLoading">导出</el-button>
     </div>
 
     <!-- 查询结果 -->
@@ -41,8 +42,8 @@
 
       <el-table-column align="center" label="操作" width="250" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button type="primary" size="mini" @click="handleUpdate(scope.row)">编辑</el-button>
-          <el-button type="danger" size="mini"  @click="handleDelete(scope.row)">删除</el-button>
+          <el-button type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
+          <el-button type="danger" size="small"  @click="handleDelete(scope.row)">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -61,7 +62,7 @@
           <el-input v-model="dataForm.name" ></el-input>
         </el-form-item>
         <el-form-item label="介绍" prop="simpleDesc">
-          <el-input type="textarea" v-model="dataForm.simpleDesc"  row="2"></el-input>
+          <el-input type="textarea" v-model="dataForm.simpleDesc"  autosize></el-input>
         </el-form-item>
         <!-- 
         <el-form-item label="品牌商图片" prop="picUrl">
@@ -137,7 +138,7 @@
           <el-input v-model="dataForm.floorPrice"></el-input>
         </el-form-item>
         <el-form-item label="是否显示" prop="isShow">
-          <el-select v-model="dataForm.isShow" placeholder="请选择">
+          <el-select v-model="dataForm.isShow" placeholder="请选择" style="width: 400px;">
             <el-option label="显示" :value="true">
             </el-option>
             <el-option label="不显示" :value="false">
@@ -145,7 +146,7 @@
           </el-select>
         </el-form-item>
         <el-form-item label="是否新上" prop="isNew">
-          <el-select v-model="dataForm.isNew" placeholder="请选择">
+          <el-select v-model="dataForm.isNew" placeholder="请选择" style="width: 400px;">
             <el-option label="新上" :value="true">
             </el-option>
             <el-option label="不是新上" :value="false">
@@ -235,7 +236,7 @@ export default {
       listLoading: true,
       listQuery: {
         page: 1,
-        limit: 20,
+        limit: 10,
         id: undefined,
         name: undefined,
         sort: '+id'
@@ -269,6 +270,17 @@ export default {
     this.getList()
   },
   methods: {
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.listQuery = {
+        page: 1,
+        limit: 10,
+        id: undefined,
+        name: undefined,
+        sort: '+id'
+        };
+        this.handleQuery();
+    },
     judgeIsnew(data){
         return data.isNew=='1' ? '是' : '不是'
     },
@@ -284,7 +296,7 @@ export default {
         this.listLoading = false
       })
     },
-    handleFilter() {
+    handleQuery() {
       this.listQuery.page = 1
       this.getList()
     },

+ 1 - 1
src/views/goodsManage/goodsList.vue

@@ -322,7 +322,7 @@ export default {
             }
             return {
                 id: node.id,
-                label: node.typeName,
+                label: node.categoryName,
                 children: node.children
             };
         },

+ 35 - 25
src/views/goodsManage/goodsTypeList.vue

@@ -19,7 +19,7 @@
           <el-button class="filter-item" type="primary" icon="el-icon-search" @click="handleQuery">查找</el-button>
           <el-button class="filter-item" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
           <el-button class="filter-item" type="primary" icon="el-icon-plus" @click="handleAdd">添加</el-button>
-          <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download" @click="handleDownload">导出</el-button>
+          <el-button class="filter-item" v-waves icon="el-icon-download" @click="handleDownLoad">导出</el-button>
           <el-button class="filter-item" type="info" icon="el-icon-sort" @click="toggleExpandAll">展开/折叠</el-button>
 
         </div>
@@ -34,7 +34,7 @@
       >
         <el-table-column prop="categoryCode" label="类型编号" align="center"></el-table-column>
         <el-table-column prop="categoryName" label="类型名称" min-width="180px"></el-table-column>
-        <!-- <el-table-column prop="categoryParentId" label="备注" align="center"></el-table-column> -->
+        <!-- <el-table-column prop="parentId" label="备注" align="center"></el-table-column> -->
         <el-table-column label="创建时间" align="center" prop="createDate">
         </el-table-column>
         <el-table-column label="操作" align="center" min-width="110px">
@@ -50,7 +50,7 @@
               @click="handleAdd(scope.row)"
             >添加</el-button>
             <el-button
-              v-if="scope.row.categoryParentId != 0"
+              v-if="!scope.row.children"
               size="small"
               type="danger"
               @click="handleDelete(scope.row)"
@@ -63,16 +63,16 @@
       <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
         <el-form ref="form" :model="form" :rules="rules" label-width="80px">
           <el-row>
-            <el-col :span="24" v-if="form.categoryParentId">
-              <el-form-item label="上级名称" prop="categoryParentId">
-                <treeselect default-expand-all v-model="form.categoryParentId" @select="departTreeSelected" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级类型" />
+            <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-form-item>
             </el-col>
           </el-row>
           <el-row>
-            <el-col :span="24" v-if="form.categoryParentId">
-              <el-form-item label="上级编号" prop="categoryParentId">
-                <el-input v-model="form.categoryParentId" readonly />
+            <el-col :span="24" v-if="isShowParent">
+              <el-form-item label="上级编号" prop="categoryParentCode">
+                <el-input v-model="form.categoryParentCode" readonly />
               </el-form-item>
             </el-col>
           </el-row>
@@ -109,6 +109,7 @@
     directives: { waves },
     data() {
       return {
+        isShowParent:false,
         downloadLoading: false,
         // 遮罩层
         loading: true,
@@ -133,7 +134,7 @@
         form: {},
         // 表单校验
         rules: {
-          categoryParentId: [
+          parentId: [
             { required: true, message: "上级类型不能为空", trigger: "blur" }
           ],
           categoryParentCode: [
@@ -158,7 +159,7 @@
         this.form.categoryParentCode = node.categoryCode;
       },
       handleDownLoad(){
-            window.location.href = process.env.BASE_API + '/product-category/export/category?categoryCode=' + this.listQuery.categoryCode + '&categoryName=' + this.listQuery.categoryName;
+            window.location.href = process.env.BASE_API + '/product-category/export/category?categoryCode=' + this.listQuery.categoryCode + '&categoryName=' + this.listQuery.categoryCode;
         },
       /** 查询类别列表 */
       getList() {
@@ -189,14 +190,10 @@
       reset() {
         this.form = {
           id: undefined,
-          categoryParentId: undefined,
+          parentId: undefined,
+          categoryParentCode:undefined,
           categoryName: undefined,
           categoryCode: undefined,
-          categoryParentId:undefined,
-          leader: undefined,
-          phone: undefined,
-          email: undefined,
-          status: "0"
         };
         this.resetForm("form");
       },
@@ -215,8 +212,11 @@
       /** 新增按钮操作 */
       handleAdd(row) {
         this.reset();
+        this.isShowParent = false;
         if (row.id) {
-          this.form.categoryParentId = row.id;
+          this.isShowParent = true;
+          this.form.parentId = row.id;
+          this.form.categoryParentCode = row.categoryCode;
         }
         this.open = true;
         this.title = "添加类别";
@@ -235,19 +235,28 @@
       /** 修改按钮操作 */
       handleUpdate(row) {
         this.reset();
+        this.isShowParent = false;
         getDept({id:row.id}).then(response => {
-          this.form = response.data.data;
+          let data = response.data.data;
+          this.form = data;
+          if (data.categoryParentId) {
+            this.isShowParent = true;
+          }
           this.open = true;
           this.title = "修改类别";
-          listDeptExcludeChild({id:row.id}).then(response => {
+          listDept().then(response => {
             this.deptOptions = this.handleTree(response.data.data, "id");
-            if (this.deptOptions.length == 0) {
-              const noResultsOptions = { id: this.form.categoryParentId, children: [] };
-              // const noResultsOptions = { id: this.form.categoryParentId, categoryName: this.form.parentName, children: [] };
-              this.deptOptions.push(noResultsOptions);
-            }
           });
+          // listDeptExcludeChild({id:row.id}).then(response => {
+          //   this.deptOptions = this.handleTree(response.data.data, "id");
+          //   if (this.deptOptions.length == 0) {
+          //     const noResultsOptions = { id: this.form.parentId, children: [] };
+          //     // const noResultsOptions = { id: this.form.parentId, categoryName: this.form.parentName, children: [] };
+          //     this.deptOptions.push(noResultsOptions);
+          //   }
+          // });
         });
+
       },
       /** 提交按钮 */
       submitForm: function() {
@@ -281,6 +290,7 @@
       },
       /** 删除按钮操作 */
       handleDelete(row) {
+        console.log(row);
         this.$confirm('是否确认删除名称为"' + row.categoryName + '"的数据项?', "提示", {
                 confirmButtonText: "确定",
                 cancelButtonText: "取消",