qymljy пре 4 месеци
родитељ
комит
0b61f5ca36

+ 51 - 87
src/SDrpManagement/QuotedPrice/detail/modules/itemClass/add.vue

@@ -18,6 +18,14 @@
     >
       <div class="drawer__panel" style="margin-bottom: 0 !important;">
         <div class="flex-between" style="margin-bottom: 10px">
+          <el-button
+              class="inline-16"
+              type="primary"
+              size="small"
+              @click="batchSelect"
+              :disabled="tableSelectData.length === 0"
+          >{{$t('批量添加')}}</el-button
+          >
           <uploadAllData
             style="display: inline-block !important"
             :total="total"
@@ -25,14 +33,6 @@
             @handleUploadApi="handleUploadApi"
             @onSuccess="onSuccess"
           ></uploadAllData>
-          <el-button
-            class="inline-16"
-            type="primary"
-            size="small"
-            @click="batchSelect"
-            :disabled="tableSelectData.length === 0"
-            >{{$t('批量添加')}}</el-button
-          >
           <el-input
             size="small"
             style="width: 200px"
@@ -46,82 +46,7 @@
           >&nbsp;
         </div>
         <div class="produtMag-panel">
-          <el-table
-            ref="multipleTable"
-            height="calc(100vh - 260px)"
-            :data="list"
-            style="width: 100%"
-            :header-cell-style="{
-              height: '50px',
-              color: '#606266',
-              fontWeight: '400',
-            }"
-            :cell-style="{
-              height: '50px',
-              color: '#666666',
-              fontWeight: '400',
-            }"
-            @selection-change="selectionChange"
-          >
-            <el-table-column type="selection" width="42" fixed>
-            </el-table-column>
-            <el-table-column
-              prop="itemclassnum"
-              :label="$t(`类别编号`)"
-              width="180"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="itemclassfullname"
-              :label="$t(`类别名称`)"
-              width="0"
-            >
-            </el-table-column>
-            <el-table-column
-              prop="upitemclassname"
-              :label="$t(`上级类别`)"
-              width="0"
-            >
-            </el-table-column>
-            <el-table-column :label="$t(`品牌名称`)" width="180">
-              <template slot-scope="scope">
-                <p>
-                  <span>{{ scope.row.brandname }}</span>
-                </p>
-              </template>
-            </el-table-column>
-            <!--            <el-table-column
-                prop="discountrate"
-                :label="$t(`折扣(%)`)"
-                width="150">
-              <template slot-scope="scope">
-                <span>{{scope.row.discountrate || '&#45;&#45;'}}</span>
-              </template>
-            </el-table-column>-->
-            <el-table-column fixed="right" :label="$t('操作')" width="80">
-              <template slot-scope="scope">
-                <el-button type="text" @click="onSelect(scope.row)">{{
-                  $t("添 加")
-                }}</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-          <div>
-            <div style="float: left">{{$t('已选')}}:{{ selectTotal }}{{$t('个商品')}}</div>
-            <div style="margin-top: 16px; text-align: right">
-              <el-pagination
-                background
-                @size-change="handleSizeChange"
-                @current-change="handleCurrentChange"
-                :current-page="params.content.pageNumber"
-                :page-sizes="[20, 50, 100, 200]"
-                :page-size="100"
-                layout="total,sizes, prev, pager, next, jumper"
-                :total="total"
-              >
-              </el-pagination>
-            </div>
-          </div>
+
         </div>
       </div>
       <div class="fixed__btn__panel">
@@ -151,7 +76,7 @@ export default {
       selectData: [],
       selectTotal: 0,
       params: {
-        id: 20230219162803,
+        id: 2026012210022602,
         content: {
           sa_quotedpriceid: this.$route.query.id,
           pageNumber: 1,
@@ -164,6 +89,7 @@ export default {
         },
       },
       timer: 0,
+      currentKey:null
     };
   },
   methods: {
@@ -173,8 +99,36 @@ export default {
     },
     async listData() {
       const res = await this.$api.requested(this.params);
-      this.list = res.data;
-      this.total = res.total;
+      this.list = this.createMenu(res.data);
+      console.log(this.list,'输出111')
+    },
+    createMenu (array) {
+      var that = this
+      let arr = []
+      function convertToElementTree(node) {
+        // 新节点
+        var elNode = {
+          label: node["itemclassname"],
+          itemclassnum:node["itemclassnum"],
+          disabled:!node["isCheck"],
+          isCheck:node["isCheck"],
+          itemclassid:node['itemclassid'],
+          children: []
+        }
+
+        if (node.subitemclass && node.subitemclass.length > 0) {
+          // 如果存在子节点
+          for (var index = 0; index < node.subitemclass.length; index++) {
+            // 遍历子节点, 把每个子节点看做一颗独立的树, 传入递归构造子树, 并把结果放回到新node的children中
+            elNode.children.push(convertToElementTree(node.subitemclass[index]));
+          }
+        }
+        return elNode;
+      }
+      array.forEach((element) => {
+        arr.push(convertToElementTree(element))
+      });
+      return arr
     },
     debounce(fn, wait) {
       let that = this;
@@ -266,6 +220,16 @@ export default {
     onSuccess() {
       this.listData();
     },
+    handleClick (row,node,VueComponent) {
+      console.log(row)
+
+      this.tableSelectData.push({
+        sa_quotedprice_itemclassid: 0,
+        itemclassid: row.itemclassid,
+        discountrate: row.discountrate,
+      })
+
+    },
   },
   mounted() {},
 };

+ 13 - 0
src/components/treeTable/index.vue

@@ -0,0 +1,13 @@
+<template>
+
+</template>
+
+<script>
+export default {
+  name: "index"
+}
+</script>
+
+<style scoped>
+
+</style>