From 6a25d60a2d20de57fbbecade2a4176ed65d28e1f Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Wed, 28 Feb 2024 11:29:22 +0800
Subject: [PATCH] 标签

---
 src/views/userHouse/lable/lableStatistics.vue      |   41 ++
 src/views/userHouse/components/placeStatistics.vue |  156 ++++++++++
 src/views/userHouse/lable/lableList.vue            |   41 ++
 src/views/userHouse/components/categoryList.vue    |  205 +++++++++++++
 src/views/userHouse/components/houseLableList.vue  |  199 +++++++++++++
 src/views/userHouse/components/houseStatistics.vue |  214 ++++++++++++++
 6 files changed, 856 insertions(+), 0 deletions(-)

diff --git a/src/views/userHouse/components/categoryList.vue b/src/views/userHouse/components/categoryList.vue
new file mode 100644
index 0000000..bb8a42c
--- /dev/null
+++ b/src/views/userHouse/components/categoryList.vue
@@ -0,0 +1,205 @@
+<template>
+  <el-row>
+    <el-col :span="24">
+      <basicContainer>
+        <avue-crud ref="crud" :option="option" :before-open="beforeOpen" :before-close="beforeClose" :data="data"
+          @tree-load="treeLoad" @row-save="rowSave" @row-del="rowDel" @refresh-change="refreshChange"
+          @row-update="rowUpdate" @on-load="onLoad">
+
+          <template slot-scope="{row, size}" slot="menu">
+            <el-button :size="size" type="text" icon="el-icon-circle-plus-outline" @click="handleAdd(row)">新增子级
+            </el-button>
+          </template>
+
+        </avue-crud>
+      </basicContainer>
+    </el-col>
+
+  </el-row>
+</template>
+<script>
+  import {
+    getTreeList,
+    submit,
+    update,
+    remove
+  } from '@/api/categoryLabel/category'
+
+  export default {
+    data() {
+      return {
+        query: {
+          parentId: 0
+        },
+        data: [],
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        parentId: undefined,
+        option: {
+          labelWidth: 96,
+          searchLabelWidth: 96,
+          menuWidth: 240,
+          lazy: true,
+          rowKey: 'id',
+          // defaultExpandAll: true,
+          column: [{
+            label: '名称',
+            prop: 'name'
+          }, {
+            label: 'ID',
+            prop: 'id',
+            display: false
+          }, {
+            label: '层级',
+            prop: 'level',
+            // display: false
+          }, {
+            label: '编码',
+            prop: 'categoryNo',
+            // display: false
+          }, {
+            label: '父级id',
+            prop: 'parentId',
+            type: "tree",
+            dicData: [],
+            hide: true,
+            addDisabled: false,
+            props: {
+              label: "name",
+              value: 'id'
+            },
+          }]
+        },
+        data1: [],
+        selectionList: [],
+      }
+    },
+
+    methods: {
+
+      refreshChange() {
+        this.onLoad()
+      },
+
+      beforeOpen(done, type) {
+        if (["add", "edit"].includes(type)) {
+          this.initData()
+        }
+        done()
+      },
+
+      beforeClose(done) {
+        this.parentId = ""
+        const column = this.findObject(this.option.column, "parentId")
+        column.value = ""
+        column.addDisabled = false
+        done()
+      },
+
+      initData() {
+        const column = this.findObject(this.option.column, "parentId")
+        column.dicData = this.data
+      },
+
+      selectionClear() {
+        this.selectionList = []
+      },
+
+      onLoad(page, params = {}) {
+        this.loading = true
+        getTreeList().then(res => {
+          const data = res.data.data
+          this.data = data
+          this.loading = false
+          this.selectionClear()
+        })
+      },
+
+      rowDel(row, index, done) {
+        console.log("*************" + JSON.stringify(row))
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.ids)
+          })
+          .then(() => {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+            done(row)
+          })
+      },
+
+      rowSave(row, done) {
+        row.parentNo = row.parentId
+        row.categoryName = row.name
+        submit(row).then(() => {
+          this.initFlag = false
+          this.onLoad(this.page)
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          })
+          done()
+        }, error => {
+          window.console.log(error)
+          loading()
+        })
+      },
+
+      rowUpdate(row, index, done) {
+        const column = this.findObject(this.option.column, "parentId")
+        column.value = row.id
+        row.parentNo = row.parentId
+        row.id = row.ids
+        update(row).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+        done(row)
+      },
+
+      handleAdd(row) {
+        const column = this.findObject(this.option.column, "parentId")
+        column.value = row.id
+        column.addDisabled = true
+        this.parentId = row.id
+        this.$refs.crud.rowAdd()
+      },
+
+      treeLoad(tree, treeNode, resolve) {
+        setTimeout(() => {
+          resolve([{
+            id: new Date().getTime(),
+            date: '2016-05-01',
+            name: '王小虎',
+            address: '上海市普陀区金沙江路 1519 弄',
+            hasChildren: true
+          }])
+        }, 1000)
+      }
+    }
+  }
+</script>
+
+
+
+<style></style>
\ No newline at end of file
diff --git a/src/views/userHouse/components/houseLableList.vue b/src/views/userHouse/components/houseLableList.vue
new file mode 100644
index 0000000..a8250b2
--- /dev/null
+++ b/src/views/userHouse/components/houseLableList.vue
@@ -0,0 +1,199 @@
+<template>
+  <el-row>
+    <el-col :span="24">
+      <basicContainer>
+        <avue-crud ref="crud" :option="option" :before-open="beforeOpen" :before-close="beforeClose" :data="data"
+          @tree-load="treeLoad" @row-save="rowSave" @row-del="rowDel" @refresh-change="refreshChange"
+          @row-update="rowUpdate" @on-load="onLoad">
+
+          <template slot-scope="{row, size}" slot="menu">
+            <el-button :size="size" type="text" icon="el-icon-circle-plus-outline" @click="handleAdd(row)">新增子级
+            </el-button>
+          </template>
+
+        </avue-crud>
+      </basicContainer>
+    </el-col>
+
+  </el-row>
+</template>
+<script>
+  import {
+    getTreeList,
+    add,
+    update,
+    remove
+  } from '@/api/label/label'
+
+  export default {
+    data() {
+      return {
+        query: {
+          parentId: 0
+        },
+        data: [],
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        parentId: undefined,
+        option: {
+          labelWidth: 96,
+          searchLabelWidth: 96,
+          menuWidth: 240,
+
+          lazy: true,
+          rowKey: 'id',
+          // defaultExpandAll: true,
+          column: [{
+            label: '名称',
+            prop: 'name'
+          }, {
+            label: 'ID',
+            prop: 'id',
+            display: false
+          }, {
+            label: '排序',
+            prop: 'sort',
+          }, {
+            label: '父级id',
+            prop: 'parentId',
+            type: "tree",
+            dicData: [],
+            hide: true,
+            addDisabled: false,
+            props: {
+              label: "name",
+              value: 'id'
+            },
+          }]
+        },
+        data1: [],
+        selectionList: [],
+      }
+    },
+
+    methods: {
+
+      refreshChange() {
+        this.onLoad()
+      },
+
+      beforeOpen(done, type) {
+        if (["add", "edit"].includes(type)) {
+          this.initData()
+        }
+        done()
+      },
+
+      beforeClose(done) {
+        this.parentId = ""
+        const column = this.findObject(this.option.column, "parentId")
+        column.value = ""
+        column.addDisabled = false
+        done()
+      },
+
+      initData() {
+        const column = this.findObject(this.option.column, "parentId")
+        column.dicData = this.data
+      },
+
+      selectionClear() {
+        this.selectionList = []
+      },
+
+      onLoad(page, params = {}) {
+        this.loading = true
+        getTreeList().then(res => {
+          const data = res.data.data
+          this.data = data
+          this.loading = false
+          this.selectionClear()
+        })
+      },
+
+      rowDel(row, index, done) {
+        console.log("*************")
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning"
+          })
+          .then(() => {
+            return remove(row.id)
+          })
+          .then(() => {
+            this.$message({
+              type: "success",
+              message: "操作成功!"
+            })
+            done(row)
+          })
+      },
+
+      rowSave(row, done) {
+        row.parentId = this.parentId
+        row.labelName = row.name
+        add(row).then(() => {
+          this.initFlag = false
+          this.onLoad(this.page)
+          this.$message({
+            type: "success",
+            message: "操作成功!"
+          })
+          done()
+        }, error => {
+          window.console.log(error)
+          loading()
+        })
+      },
+
+      rowUpdate(row, index, done) {
+        const column = this.findObject(this.option.column, "parentId")
+        column.value = row.id
+        update(row).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+        done(row)
+      },
+
+      handleAdd(row) {
+        const column = this.findObject(this.option.column, "parentId")
+        column.value = row.id
+        column.addDisabled = true
+        this.parentId = row.id
+        this.$refs.crud.rowAdd()
+      },
+
+      treeLoad(tree, treeNode, resolve) {
+        setTimeout(() => {
+          resolve([{
+            id: new Date().getTime(),
+            date: '2016-05-01',
+            name: '王小虎',
+            address: '上海市普陀区金沙江路 1519 弄',
+            hasChildren: true
+          }])
+        }, 1000)
+      }
+    }
+  }
+</script>
+
+
+
+<style></style>
diff --git a/src/views/userHouse/components/houseStatistics.vue b/src/views/userHouse/components/houseStatistics.vue
new file mode 100644
index 0000000..f69c444
--- /dev/null
+++ b/src/views/userHouse/components/houseStatistics.vue
@@ -0,0 +1,214 @@
+<template>
+  <basic-container style="margin-bottom: 40px;">
+    <div class="current-page-box">
+      <div v-for="(item, index) in data" :key="index">
+        <div v-if="index == 0">
+          <!-- <box-title class="m10" :classVal="9" :title="item.name"></box-title> -->
+          <div v-for="(item1, childIndex) in item.children" :key="childIndex">
+            <div v-if="item1.name === '民政标签'">
+              <box-title class="m10" :classVal="9" :title="item1.name"></box-title>
+              <div v-for="(item2, index2) in item1.children" :key="index2">
+                <!-- <box-title class="m10" :classVal="9" :title="item2.name"></box-title> -->
+                <div class="m20 m-t-28 grid-content bg-purple-dark">
+                  <el-divider content-position="left">{{ item2.name }}</el-divider>
+                </div>
+
+                <div class="grid-container" v-if="item2.children">
+                  <div v-for="(item3, index3) in item2.children" :key="index3">
+                    <div>
+                      {{ item3.count }}
+                    </div>
+                    <div>
+                      {{ item3.name }}
+                    </div>
+                  </div>
+                </div>
+              </div>
+            </div>
+
+            <div v-else>
+              <!--  <div class="m20 m-t-28 grid-content bg-purple-dark">
+                <el-divider content-position="left">{{ item1.name }}</el-divider>
+              </div> -->
+              <box-title class="m10" :classVal="9" :title="item1.name"></box-title>
+
+              <div class="grid-container" v-if="item1.children">
+                <div v-for="(item2, childChildIndex) in item1.children" :key="childChildIndex">
+                  <div>
+                    {{ item2.count }}
+                  </div>
+                  <div>
+                    {{ item2.name }}
+                  </div>
+                </div>
+              </div>
+            </div>
+
+          </div>
+        </div>
+
+
+        <div v-if="index == 1">
+          <box-title class="m10" :classVal="9" :title="item.name"></box-title>
+
+          <div class="grid-container">
+            <div v-for="(item1, childIndex) in item.children" :key="childIndex">
+              <div>
+                {{ item1.count }}
+              </div>
+              <div>
+                {{ item1.name }}
+              </div>
+            </div>
+          </div>
+        </div>
+
+        <!-- <div v-if="index == 2">
+        <box-title class="m10" :classVal="9" :title="item.name"></box-title>
+
+        <div class="grid-container">
+          <div>
+            <div>
+              {{ item.count }}
+            </div>
+            <div>
+              {{ item.name }}
+            </div>
+          </div>
+        </div>
+      </div> -->
+
+      </div>
+    </div>
+  </basic-container>
+</template>
+<script>
+  import {
+    getTreeList,
+    add,
+    update,
+    remove
+  } from '@/api/label/label'
+
+  import boxTitle from '../components/boxTitle.vue'
+
+  export default {
+    data() {
+      return {
+        items: [],
+        query: {
+          parentId: 0
+        },
+        data: [],
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        option: {
+          span: 4,
+          data: []
+        },
+      }
+    },
+
+    components: {
+      boxTitle
+    },
+
+    mounted() {
+      this.onLoad()
+    },
+
+    methods: {
+      onLoad(page, params = {}) {
+        this.loading = true
+        getTreeList().then(res => {
+          const data = res.data.data
+          this.data = data
+          this.loading = false
+          // this.selectionClear();
+        })
+      },
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  .m10 {
+    margin: 10px;
+  }
+
+  .m20 {
+    margin: 20px;
+  }
+
+  .m-t-28 {
+    margin-top: 28px;
+  }
+
+  .grid-container {
+    display: flex;
+    flex-wrap: wrap;
+    font-size: 15px;
+    color: #fff;
+  }
+
+  .grid-container>div {
+    margin: 18px;
+    padding: 10px 8px;
+    display: flex;
+    flex-direction: column;
+    width: calc(100% / 6 - 36px);
+    background-color: #429FFF;
+    text-align: center;
+    border-radius: 10px;
+    box-sizing: border-box;
+
+    &>div {
+      font-size: 14px;
+      line-height: 22px;
+      text-align: center;
+    }
+
+    &>div:first-child {
+      font-size: 18px;
+      font-weight: bold;
+    }
+  }
+
+  /* .el-row {
+    margin-bottom: 20px;
+
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+
+  .el-col {
+    border-radius: 4px;
+  }
+
+  .bg-purple-dark {
+    background: #99a9bf;
+  }
+
+  .bg-purple {
+    background: #d3dce6;
+  }
+
+  .bg-purple-light {
+    background: #e5e9f2;
+  }
+
+  .grid-content {
+    border-radius: 4px;
+    min-height: 36px;
+  }
+
+  .row-bg {
+    padding: 10px 0;
+    background-color: #f9fafc;
+  } */
+</style>
\ No newline at end of file
diff --git a/src/views/userHouse/components/placeStatistics.vue b/src/views/userHouse/components/placeStatistics.vue
new file mode 100644
index 0000000..3bd79bd
--- /dev/null
+++ b/src/views/userHouse/components/placeStatistics.vue
@@ -0,0 +1,156 @@
+<template>
+  <basic-container style="margin-bottom: 40px;">
+    <div class="current-page-box">
+      <div v-for="(item, index) in data" :key="index">
+        <box-title class="m10" :classVal="9" :title="item.name"></box-title>
+        <div v-for="(item1, childIndex) in item.children" :key="childIndex">
+          <div class="m20 m-t-28 grid-content bg-purple-dark">
+            <el-divider content-position="left">{{ item1.name }}</el-divider>
+          </div>
+          <!-- <box-title class="m10" :classVal="9" :title="item1.name"></box-title> -->
+          <div class="grid-container" v-if="item1.children">
+            <div v-for="(item2, childChildIndex) in item1.children" :key="childChildIndex">
+              <div>
+                {{ item2.count }}
+              </div>
+              <div>
+                {{ item2.name }}
+              </div>
+            </div>
+          </div>
+        </div>
+      </div>
+
+    </div>
+  </basic-container>
+</template>
+<script>
+  import {
+    getTreeList,
+    submit,
+    update,
+    remove
+  } from '@/api/categoryLabel/category'
+
+  import boxTitle from '../components/boxTitle.vue'
+
+  export default {
+    data() {
+      return {
+        items: [],
+        query: {
+          parentId: 0
+        },
+        data: [],
+        loading: true,
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0
+        },
+        option: {
+          span: 4,
+          data: []
+        },
+      }
+    },
+
+    components: {
+      boxTitle
+    },
+
+    mounted() {
+      this.onLoad()
+    },
+
+    methods: {
+      onLoad(page, params = {}) {
+        this.loading = true
+        getTreeList().then(res => {
+          const data = res.data.data
+          this.data = data
+          this.loading = false
+          // this.selectionClear();
+        })
+      },
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  .m10 {
+    margin: 10px;
+  }
+
+  .m20 {
+    margin: 20px;
+  }
+
+  .m-t-28 {
+    margin-top: 28px;
+  }
+
+  .grid-container {
+    display: flex;
+    flex-wrap: wrap;
+    font-size: 15px;
+    color: #fff;
+  }
+
+  .grid-container>div {
+    margin: 18px;
+    padding: 10px 8px;
+    display: flex;
+    flex-direction: column;
+    width: calc(100% / 6 - 36px);
+    background-color: #429FFF;
+    text-align: center;
+    border-radius: 10px;
+    box-sizing: border-box;
+
+    &>div {
+      font-size: 14px;
+      line-height: 22px;
+      text-align: center;
+    }
+
+    &>div:first-child {
+      font-size: 18px;
+      font-weight: bold;
+    }
+  }
+
+  /* .el-row {
+    margin-bottom: 20px;
+
+    &:last-child {
+      margin-bottom: 0;
+    }
+  }
+
+  .el-col {
+    border-radius: 4px;
+  }
+
+  .bg-purple-dark {
+    background: #99a9bf;
+  }
+
+  .bg-purple {
+    background: #d3dce6;
+  }
+
+  .bg-purple-light {
+    background: #e5e9f2;
+  }
+
+  .grid-content {
+    border-radius: 4px;
+    min-height: 36px;
+  }
+
+  .row-bg {
+    padding: 10px 0;
+    background-color: #f9fafc;
+  } */
+</style>
\ No newline at end of file
diff --git a/src/views/userHouse/lable/lableList.vue b/src/views/userHouse/lable/lableList.vue
new file mode 100644
index 0000000..c17b6be
--- /dev/null
+++ b/src/views/userHouse/lable/lableList.vue
@@ -0,0 +1,41 @@
+<template>
+
+  <div>
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+      <el-tab-pane label="人/房标签" name="first"></el-tab-pane>
+      <el-tab-pane label="场所标签" name="second"></el-tab-pane>
+    </el-tabs>
+
+    <div v-if="activeName ==='first'">
+      <houseLableList ref="houseLableList" />
+    </div>
+
+    <div v-else>
+      <categoryList ref="categoryList" />
+    </div>
+
+
+  </div>
+
+
+</template>
+<script>
+  import houseLableList from '../components/houseLableList.vue'
+  import categoryList from '../components/categoryList.vue'
+  export default {
+    data() {
+      return {
+        activeName: 'first'
+      };
+    },
+    components: {
+      houseLableList,
+      categoryList
+    },
+    methods: {
+      handleClick(tab, event) {
+        console.log(tab, event);
+      }
+    }
+  };
+</script>
\ No newline at end of file
diff --git a/src/views/userHouse/lable/lableStatistics.vue b/src/views/userHouse/lable/lableStatistics.vue
new file mode 100644
index 0000000..1ae12de
--- /dev/null
+++ b/src/views/userHouse/lable/lableStatistics.vue
@@ -0,0 +1,41 @@
+<template>
+
+  <div>
+    <el-tabs v-model="activeName" @tab-click="handleClick">
+      <el-tab-pane label="人/房标签统计" name="first"></el-tab-pane>
+      <el-tab-pane label="场所标签统计" name="second"></el-tab-pane>
+    </el-tabs>
+
+    <div v-if="activeName ==='first'">
+      <houseStatistics ref="houseStatistics" />
+    </div>
+
+    <div v-else>
+      <placeStatistics ref="placeStatistics" />
+    </div>
+
+
+  </div>
+
+
+</template>
+<script>
+  import houseStatistics from '../components/houseStatistics.vue'
+  import placeStatistics from '../components/placeStatistics.vue'
+  export default {
+    data() {
+      return {
+        activeName: 'first'
+      };
+    },
+    components: {
+      houseStatistics,
+      placeStatistics
+    },
+    methods: {
+      handleClick(tab, event) {
+        console.log(tab, event);
+      }
+    }
+  };
+</script>
\ No newline at end of file

--
Gitblit v1.9.3