From 6416b40cf242340eaa163c498bd49d8103e73610 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Mon, 29 Jul 2024 17:01:52 +0800
Subject: [PATCH] 代码优化

---
 src/views/publicSecurity/keynotePersonnelManageTree.vue |  429 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 429 insertions(+), 0 deletions(-)

diff --git a/src/views/publicSecurity/keynotePersonnelManageTree.vue b/src/views/publicSecurity/keynotePersonnelManageTree.vue
new file mode 100644
index 0000000..4e099f9
--- /dev/null
+++ b/src/views/publicSecurity/keynotePersonnelManageTree.vue
@@ -0,0 +1,429 @@
+<template>
+  <basic-container>
+    <avue-crud :option="option" :table-loading="loading" :data="data" :page.sync="page" ref="crud" @row-del="rowDel"
+      v-model="form" :permission="permissionList" @row-update="rowUpdate" @row-save="rowSave" :before-open="beforeOpen"
+      @search-change="searchChange" @search-reset="searchReset" @selection-change="selectionChange"
+      @current-change="currentChange" @size-change="sizeChange" @refresh-change="refreshChange" @on-load="onLoad">
+
+      <template slot-scope="scope" slot="menu">
+        <el-button type="text" size="small" icon="el-icon-view" plain @click="lookDetail(scope.row)">查 看
+        </el-button>
+      </template>
+
+      <template slot-scope="{row, size}" slot="regionName">
+        <el-button :size="size" type="text" @click="lookDetail(row)">
+          {{ row.regionName }}
+        </el-button>
+      </template>
+
+      <template slot-scope="{row, size}" slot="number1">
+        <el-button :size="size" type="text" @click="showStringDispose(row, '1033')">
+          {{ row.number1 }}
+        </el-button>
+      </template>
+
+      <template slot-scope="{row, size}" slot="number2">
+        <el-button :size="size" type="text" @click="showStringDispose(row, '15')">
+          {{ row.number2 }}
+        </el-button>
+      </template>
+    </avue-crud>
+
+    <el-dialog title="" append-to-body :visible.sync="auditBasePopup" width="80%">
+      <communityKeyNotePersonnel ref="communityKeyNotePersonnel"></communityKeyNotePersonnel>
+    </el-dialog>
+
+    <el-dialog title="" append-to-body :visible.sync="userPopup" width="80%">
+      <userHouseList ref="userHouseList"></userHouseList>
+    </el-dialog>
+
+  </basic-container>
+</template>
+
+<script>
+  import {
+    getFollowStatisticalLabels
+  } from "@/api/userHouse/list/userHouseList"
+
+
+  import {
+    mapGetters
+  } from "vuex"
+
+  import userHouseList from './components/userHouseList.vue'
+
+  import communityKeyNotePersonnel from './components/communityKeyNotePersonnel.vue'
+
+  import website from '@/config/website'
+
+  export default {
+    data() {
+      return {
+        taskType: 0,
+        curRow: {},
+        roleBox: false,
+
+        form: {},
+        query: {},
+        loading: true,
+
+        page: {
+          pageSize: 10,
+          currentPage: 1,
+          total: 0,
+        },
+        datetime: "",
+        selectionList: [],
+        option: {
+          height: "auto",
+          calcHeight: 54,
+          dialogWidth: 950,
+          tip: false,
+          searchShow: true,
+          searchMenuSpan: 3,
+          // menuWidth: 280,
+          menu: false,
+          border: true,
+          //stripe:true,
+          index: true,
+          // viewBtn: true,
+          editBtn: false,
+          delBtn: false,
+          addBtn: false,
+          // selection: true,
+          header: false,
+          dialogClickModal: false,
+          column: [{
+              span: 12,
+              label: "行政区域",
+              prop: "regionName",
+              searchSpan: 4,
+              align: 'center',
+              // search: true,
+              // hide: true,
+            },
+            {
+              span: 12,
+              label: "孤寡老人",
+              prop: "number1",
+              align: 'center',
+              searchSpan: 4,
+            },
+            {
+              span: 12,
+              label: "留守儿童",
+              prop: "number2",
+              align: 'center',
+              searchSpan: 4,
+            }
+          ],
+        },
+        data: [],
+
+        auditBasePopup: false,
+        userPopup: false,
+      }
+    },
+
+    provide() {
+      return {
+        placeElement: this,
+      }
+    },
+
+    components: {
+      communityKeyNotePersonnel,
+      userHouseList,
+      // labelReporting,
+    },
+
+    watch: {},
+
+    computed: {
+      ...mapGetters(["permission", "userInfo"]),
+      permissionList() {
+        return {
+          addBtn: this.vaildData(this.permission.place_add, true),
+          viewBtn: this.vaildData(this.permission.place_view, true),
+          delBtn: this.vaildData(this.permission.place_delete, true),
+          editBtn: this.vaildData(this.permission.place_edit, true),
+        }
+      },
+      ids() {
+        let ids = []
+        this.selectionList.forEach((ele) => {
+          ids.push(ele.id)
+        })
+        return ids.join(",")
+      },
+
+    },
+    methods: {
+
+      colseDetail() {
+        this.auditBasePopup = false
+        this.onLoad(this.page)
+      },
+
+      showStringDispose(row, type) {
+        row.labelId = type
+        row.parentId = 1032
+        this.userPopup = true
+        var that = this
+        this.$nextTick(() => {
+          that.$refs.userHouseList.init(row)
+        })
+      },
+
+      lookDetail(row) {
+        this.auditBasePopup = true
+        var that = this
+        this.$nextTick(() => {
+          that.$refs.communityKeyNotePersonnel.init(row)
+        })
+      },
+
+
+      auditCur(row) {
+        this.curAuditRow = row
+        this.auditBasePopup = true
+      },
+
+      roleBoxClose() {
+        this.curRow = {}
+      },
+
+      ManageTenants(item) {
+        this.curRow = item
+        this.roleBox = true
+      },
+
+      rowSave(row, done, loading) {
+        if (row.imageUrls.length > 0) {
+          var urls = []
+          var split = row.imageUrls.split(",").filter(item => item != '')
+          split.forEach(url => {
+            var names = url.split("jczz/")
+            urls.push(names[1])
+          })
+          row.imageUrls = urls.join(",")
+        }
+
+        let label = row.label
+
+        if (row.smallLabel != '') {
+          label = label + ',' + row.smallLabel
+        }
+
+        delete row.smallLabel
+
+        add({
+          ...row,
+          label
+        }).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
+
+      rowUpdate(row, index, done, loading) {
+        if (row.imageUrls.length > 0) {
+          var urls = []
+          var split = row.imageUrls.split(",").filter(item => item != '')
+          split.forEach(url => {
+            var names = url.split("jczz/")
+            urls.push(names[1])
+          })
+          row.imageUrls = urls.join(",")
+        }
+
+        let label = row.label
+
+        if (row.smallLabel != '') {
+          label = label + ',' + row.smallLabel
+        }
+
+        delete row.smallLabel
+
+        update({
+          ...row,
+          label
+        }).then(
+          () => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            done()
+          },
+          (error) => {
+            window.console.log(error)
+            loading()
+          }
+        )
+      },
+
+      rowDel(row) {
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          })
+          .then(() => {
+            row.isDeleted = 1
+            return removeTask(row)
+          })
+          .then(() => {
+            this.onLoad(this.page)
+
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+          })
+      },
+      searchReset() {
+        this.query = {}
+        this.onLoad(this.page)
+      },
+      searchChange(params, done) {
+        this.query = params
+        this.page.currentPage = 1
+        this.onLoad(this.page, params)
+        done()
+      },
+      selectionChange(list) {
+        this.selectionList = list
+      },
+      selectionClear() {
+        this.selectionList = []
+        this.$nextTick(() => {
+          this.$refs.crud && this.$refs.crud.toggleSelection()
+        })
+      },
+      handleDelete() {
+        if (this.selectionList.length === 0) {
+          this.$message.warning("请选择至少一条数据")
+          return
+        }
+        this.$confirm("确定将选择数据删除?", {
+            confirmButtonText: "确定",
+            cancelButtonText: "取消",
+            type: "warning",
+          })
+          .then(() => {
+            return remove(this.ids)
+          })
+          .then(() => {
+            this.onLoad(this.page)
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            })
+            this.$refs.crud.toggleSelection()
+          })
+      },
+
+      beforeOpen(done, type) {
+        if (["edit", "view"].includes(type)) {
+          // getPlace(this.form.id).then((res) => {
+          //   this.form = res.data.data
+          //   if (this.form.imageUrls.length) {
+          //     this.form.imageUrls = this.form.imageUrls.split(",").filter(item => item != '').map(item => website
+          //       .minioUrl + item).join(',')
+          //   }
+          //   if (this.form.placePoiLabelVOList.length) {
+          //     let lebelTwo = this.form.placePoiLabelVOList.find(item => {
+          //       return item.type == 2
+          //     })
+          //     if (lebelTwo) this.form.label = String(lebelTwo.poiCode)
+          //     let lebelThree = this.form.placePoiLabelVOList.find(item => {
+          //       return item.type == 3
+          //     })
+          //     if (lebelThree) this.form.smallLabel = String(lebelThree.poiCode)
+          //   }
+          //   done()
+          // })
+        } else {
+          done()
+        }
+      },
+
+      currentChange(currentPage) {
+        this.page.currentPage = currentPage
+      },
+      sizeChange(pageSize) {
+        this.page.pageSize = pageSize
+      },
+      refreshChange() {
+        this.onLoad(this.page, this.query)
+      },
+      onLoad(page, params = {}) {
+        const {
+          dateTime
+        } = this.query
+        let values = {
+          ...params,
+        }
+        this.loading = true
+        getFollowStatisticalLabels(page.currentPage, page.pageSize, values).then((res) => {
+          const data = res.data.data
+          this.page.total = data.total
+          this.data = data.records
+          this.data.forEach(item => {
+            if (item.imageUrls && item.imageUrls != '' && item.imageUrls != null && item.imageUrls.length) {
+              var urls = []
+              var names = item.imageUrls.split(",").filter(item => item != '')
+              names.forEach(name => {
+                urls.push(website.minioUrl + name)
+              })
+              item.imageUrls = urls.join(",")
+            }
+          })
+          this.loading = false
+          this.selectionClear()
+        })
+      }
+    }
+  }
+</script>
+
+<style lang="scss" scoped>
+  .avue-upload__icon {
+    line-height: 6;
+  }
+
+  .cur-container-box {
+    display: flex;
+    flex-direction: column;
+    width: 100%;
+    height: 100%;
+    overflow: hidden;
+
+    .content-box {
+      margin: 0 4px;
+      padding: 0 16px;
+      height: 0;
+      flex: 1;
+      overflow: hidden;
+      overflow-y: auto;
+    }
+
+    .footer-btn-box {
+      margin-top: 10px;
+      display: flex;
+      justify-content: center;
+    }
+  }
+</style>
\ No newline at end of file

--
Gitblit v1.9.3