Browse Source

Merge branch 'dev' of http://39.106.8.246:3003/zhangyu/PDM into dev

 Conflicts:
	src/components/brand/detail/sagaBrandDetail.vue
shaun-sheep 4 years ago
parent
commit
102fdbce7c

+ 44 - 65
src/components/brand/detail/sagaBrandDetail.vue

@@ -6,37 +6,34 @@
           <el-breadcrumb-item>所有品牌</el-breadcrumb-item>
           <el-breadcrumb-item>{{this.$route.query.BrandCname}}:</el-breadcrumb-item>
         </el-breadcrumb>
-        <template v-for="item in system">
-          <template v-for="i in item">
-            <span v-for="(j,index) in i.DefClass" v-if="j.show" class="select">{{j.AliasName}}
-              <i class="el-icon-close" @click="deleteCurrent(index)"></i></span>
-            <span class="total poa">共<b>{{total}}</b>件相关产品</span>
-          </template>
+        <template v-for="i in system">
+          <span v-for="classItem in i.DefClass" :key="classItem.Code" v-show="classItem.show" class="select">{{classItem.AliasName}}
+            <i class="el-icon-close" @click="deleteCurrent(classItem)"></i>
+          </span>
         </template>
-
+        <span class="total poa">共<b>{{total}}</b>件相关产品</span>
       </div>
-      <template v-for="(item,index) in system">
-        <div class="device-sys" v-for="(i,idx) in item" :key="index">
-          <div class="left">{{i.AliasName}}:</div>
-          <div class="main">
-            <ul>
-              <li v-for="(group,index) in i.DefClass"
-                  style="cursor: pointer"
-                  :key="index"
-                  v-if="index < limitSys"
-                  @click="currentSys(index,group)"
-                  :class="group.show ? 'light':''">
-                {{group.AliasName}}
-              </li>
-            </ul>
-          </div>
-          <div class="right" @click="allData" :class="more == '更多' ? 'dark' :'light'">
-            <p style="cursor: pointer;">{{more}}
-              <span :class="more=='更多' ? 'el-icon-caret-bottom':'el-icon-caret-top'"></span>
-            </p>
-          </div>
+
+      <div class="device-sys" v-for="systemItem in system" :key="systemItem.Code">
+        <div class="left">{{systemItem.AliasName}}:</div>
+        <div class="main">
+          <ul>
+            <li v-for="(group,index) in systemItem.DefClass"
+                style="cursor: pointer"
+                :key="group.Code"
+                v-show="index < limitSys"
+                @click="currentSys(group)"
+                :class="group.show ? 'light':''">
+              {{group.AliasName}}
+            </li>
+          </ul>
+        </div>
+        <div class="right" @click="allData(systemItem)" :class="systemItem.more? 'dark' :'light'">
+          <p style="cursor: pointer;">{{systemItem.more?'更多':'收起'}}
+            <span :class="systemItem.more?'el-icon-caret-bottom':'el-icon-caret-top'"></span>
+          </p>
         </div>
-      </template>
+      </div>
 
     </div>
     <div class="saga-brand-box mt20">
@@ -62,12 +59,11 @@
 
     data() {
       return {
-        more: '更多',
         limitSys: 14,
-        isShow: false,
         system: [],
         total: 0,
         table: [],
+        defClassList: [],
       }
     },
     computed: {
@@ -83,14 +79,12 @@
           Orders: 'name asc, createTime desc'
         }
         classQueryByBrand(param, res => {
-          this.system = res.Content ? res.Content.map(i => {
-            i.forEach(j => {
+          this.system = res.Content ? res.Content.map(j => {
+              j.more = true
               j.DefClass.forEach((k, index) => {
-                this.$set(k, 'show', false)
+                k.show = false
               })
-
-            })
-            return i
+            return j
           }) : []
         })
       },
@@ -114,48 +108,33 @@
           this.getDate()
         })
       },
-      allData() {
-        this.isShow = !this.isShow
-        if (this.isShow) {
-          this.more = '收起'
-          this.limitSys = this.system.length
-        } else {
-          this.more = '更多'
-          this.limitSys = 18
-        }
+      allData(systemItem) {
+       systemItem.more = systemItem.more?false:true
       },
-      currentSys(index,val) {
-        for (let i = 0; i < this.system.length; i++) {
-          for (let j = 0; j < this.system[i].length; j++) {
-            let def = this.system[i][j].DefClass
-            for (let k = 0; k < def.length; k++) {
-              def[k].show = k == index ? true : false
-              this.$emit('systemCode', def[k].Code)
-            }
+      currentSys(group) {
+        this.defClassList = []
+        this.system.forEach(item => {
+          if (item.DefClass) {
+            this.defClassList = this.defClassList.concat(item.DefClass)
           }
-        }
+        })
+        this.defClassList.forEach(item => {
+          item.show = item.Code == group.Code?true:false
+        })
         let params = {
           GroupId: this.dictionary.groupId,
           Type: this.dictionary.dictionaryType,
           ProjectId: this.dictionary.projectId,
-          Filters: `prodCode='${val.Code}';BrandID='${this.$route.query.BrandID}'`
+          Filters: `prodCode='${group.Code}';BrandID='${this.$route.query.BrandID}'`
         }
         prodTypeQuery(params, res => {
           this.total = res.Total
           this.table = res.Content.map(i => ({...i, Brand: this.$route.query}))
         })
       },
-      deleteCurrent(index) {
-        for (let i = 0; i < this.system.length; i++) {
-          for (let j = 0; j < this.system[i].length; j++) {
-            let def = this.system[i][j].DefClass
-            for (let k = 0; k < def.length; k++) {
-              def[k].show = k == index ? false : true
-            }
-          }
-        }
+      deleteCurrent(group) {
+        group.show = false
         this.getProductList()
-
       }
     }
   }

+ 1 - 1
src/components/public/remoteSearch.vue

@@ -67,7 +67,7 @@ export default {
           query: {
             BrandCname: item.BrandCname,
             BrandID:item.BrandID,
-            BrandName: item.BrandID
+            BrandName: item.BrandName
           }
         })
       } else {