From 5e2aafeede13d337380f736567caf74f49713be7 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:38:32 +0800
Subject: [PATCH] 代码优化
---
src/views/publicSecurity/components/userHouseList.vue | 82 +++++++++++++++++++----------------------
1 files changed, 38 insertions(+), 44 deletions(-)
diff --git a/src/views/publicSecurity/components/userHouseList.vue b/src/views/publicSecurity/components/userHouseList.vue
index ea49734..18e5980 100644
--- a/src/views/publicSecurity/components/userHouseList.vue
+++ b/src/views/publicSecurity/components/userHouseList.vue
@@ -6,18 +6,7 @@
v-model="form" :permission="permissionList" @row-del="rowDel" @row-update="rowUpdate" @row-save="rowSave"
:before-open="beforeOpen" :page.sync="page" @search-change="searchChange" @search-reset="searchReset"
@selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
- @refresh-change="refreshChange" @on-load="onLoad">
- <!-- <template slot="menuLeft">
- <el-button type="danger" size="small" plain icon="el-icon-delete" v-if="permission.household_delete"
- @click="handleDelete">删 除
- </el-button>
- <el-button type="success" size="small" plain v-if="this.permission.household_import" icon="el-icon-upload2"
- @click="handleImport">导入
- </el-button>
- <el-button type="warning" size="small" plain v-if="this.permission.household_export" icon="el-icon-download"
- @click="handleExport">导出
- </el-button>
- </template> -->
+ @refresh-change="refreshChange">
<template slot-scope="{row, size}" slot="menu">
<el-button :size="size" type="text" icon="el-icon-circle-plus-outline" v-if="permission.househould_manager"
@@ -50,26 +39,15 @@
</el-dialog>
<el-dialog title="标签管理" append-to-body :visible.sync="labelFlag" center width="600px">
- <div v-for="(item, index) in labelData" :key="index">
- <el-row>
- <el-col :span="24">
- <div>
- <el-divider content-position="left">{{ item.name }}</el-divider>
- </div>
- </el-col>
- </el-row>
- <div class="grid-container2" v-if="item.children">
- <div class="grid-item" :style="{ backgroundColor: item2.color }" v-for="(item2, index2) in item.children"
- @click="changLabel(item2)" :key="index2">
+ <div>
+ <div class="grid-container2">
+ <div class="grid-item" :style="{ backgroundColor: item2.color,color: item2.fontColor}"
+ v-for="(item2, index2) in labelData" @click="changLabel(item2)" :key="index2">
{{ item2.name }}
</div>
</div>
</div>
- <!-- <span slot="footer" class="dialog-footer">
- <el-button @click="labelFlag = false">取 消</el-button>
- <el-button type="primary" @click="submitRole">确 定</el-button>
- </span> -->
</el-dialog>
<el-dialog :title="'编辑标签 ' + currentLabel.name" append-to-body :visible.sync="editLabelFlge" width="655px">
@@ -97,7 +75,7 @@
<script>
import {
- getList,
+ getKeynotePersonnelPage,
remove,
add,
update,
@@ -219,8 +197,10 @@
border: true,
index: true,
selection: true,
- viewBtn: true,
- addBtn: true,
+ viewBtn: false,
+ addBtn: false,
+ delBtn: false,
+ editBtn: false,
dialogType: 'drawer',
dialogClickModal: false,
menuFixed: 'right',
@@ -859,7 +839,19 @@
mounted() {},
methods: {
init(row) {
-
+ if (row.regionCode) {
+ this.query.regionCode = row.regionCode.slice(0, 10)
+ }
+ if (row.communityCode) {
+ this.query.regionCode = row.communityCode
+ }
+ if (row.parentId) {
+ this.query.parentId = row.parentId
+ } else {
+ this.query.parentId = 103
+ }
+ this.query.labelId = row.labelId
+ this.onLoad(this.page, this.query)
},
onsubmit() {
if (this.labelForm.color === '#EBEDF0') {
@@ -882,6 +874,7 @@
this.labelForm.houseCode = this.currentRow.houseCode
this.labelForm.householdId = this.currentRow.id
this.labelForm.labelId = this.currentLabel.id
+ this.labelForm.userId = this.currentRow.associatedUserId
this.labelForm.lableType = 1
saveOrUpdateHouseholdLabel(this.labelForm).then(res => {
@@ -910,7 +903,7 @@
this.currentRow = item
this.labelFlag = true
let params = {
- parentId: 1000
+ parentId: this.query.parentId
}
// 查询标签
getLabelList(Object.assign(params)).then(res => {
@@ -920,19 +913,20 @@
getDetatils(item.id).then(res => {
this.householdLabelList = res.data.data.householdLabelList
// 将细类放到一起
- data.forEach(e => {
- e.children.forEach(f => {
- if (this.householdLabelList.length > 0) {
- this.householdLabelList.forEach(h => {
- if (Number(f.id) == h.labelId) {
- f['color'] = h.color
- f['remark'] = h.remark
- }
- })
- }
- })
+ console.log("*********123*********", res.data.data.householdLabelList)
+ data.forEach(f => {
+ if (this.householdLabelList.length > 0) {
+ this.householdLabelList.forEach(h => {
+ if (f.id == h.labelId) {
+ f.color = h.color
+ f.fontColor = '#080808'
+ // f['remark'] = h.remark
+ }
+ })
+ }
})
this.labelData = data
+ console.log("******************", data)
this.loading = false
})
})
@@ -1076,7 +1070,7 @@
onLoad(page, params = {}) {
this.loading = true
- getList(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
+ getKeynotePersonnelPage(page.currentPage, page.pageSize, Object.assign(params, this.query)).then(res => {
const data = {
...res.data.data,
records: res.data.data.records.map(item => {
--
Gitblit v1.9.3