|
@@ -327,6 +327,7 @@
|
|
>
|
|
>
|
|
<el-form-item label="部门人员" prop="listUser">
|
|
<el-form-item label="部门人员" prop="listUser">
|
|
<el-tree-select
|
|
<el-tree-select
|
|
|
|
+ :loading="loadingSetUserDeptListUser"
|
|
v-model="setUserDeptId"
|
|
v-model="setUserDeptId"
|
|
:data="deptOptions"
|
|
:data="deptOptions"
|
|
@change="onSetUserDeptChange"
|
|
@change="onSetUserDeptChange"
|
|
@@ -343,15 +344,15 @@
|
|
>
|
|
>
|
|
<el-option
|
|
<el-option
|
|
v-for="item in setUserDeptListUser"
|
|
v-for="item in setUserDeptListUser"
|
|
- :key="item.value"
|
|
|
|
- :label="item.label"
|
|
|
|
- :value="item.value"
|
|
|
|
|
|
+ :key="item.guid"
|
|
|
|
+ :label="item.name"
|
|
|
|
+ :value="item.guid"
|
|
/>
|
|
/>
|
|
</el-select>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
<el-form-item label="已设置网格员" prop="listUser">
|
|
<el-form-item label="已设置网格员" prop="listUser">
|
|
- <span v-for="item in formSetUser.listUser" :key="item.guid" class="grid-user-container">
|
|
|
|
- <div class="grid-user" :title="item.name">{{item.name}}</div>
|
|
|
|
|
|
+ <span v-for="item in formSetUser.listUser" :key="item.userGuid" class="grid-user-container">
|
|
|
|
+ <div class="grid-user" :title="item.userealNamerName">{{item.realName}}</div>
|
|
<span class="grid-user-content">
|
|
<span class="grid-user-content">
|
|
<el-tooltip
|
|
<el-tooltip
|
|
class="box-item"
|
|
class="box-item"
|
|
@@ -359,7 +360,7 @@
|
|
content="删除"
|
|
content="删除"
|
|
placement="top"
|
|
placement="top"
|
|
>
|
|
>
|
|
- <span class="grid-user-close" @click="onRemoveUser(item.guid)">x</span>
|
|
|
|
|
|
+ <span class="grid-user-close" @click="onRemoveUser(item.userGuid)">x</span>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
<el-tooltip
|
|
<el-tooltip
|
|
class="box-item"
|
|
class="box-item"
|
|
@@ -367,7 +368,7 @@
|
|
content="点击设置网格管理员"
|
|
content="点击设置网格管理员"
|
|
placement="top"
|
|
placement="top"
|
|
>
|
|
>
|
|
- <span :class="'grid-user-type' + (item.isAdmin ? ' grid-user-admin' : ' grid-user-user')" @click="onChangeIsAdmin(item.guid)">{{item.isAdmin ? '管' : '员'}}</span>
|
|
|
|
|
|
+ <span :class="'grid-user-type' + (item.isAdmin===1 ? ' grid-user-admin' : ' grid-user-user')" @click="onChangeIsAdmin(item.userGuid)">{{item.isAdmin===1 ? '管' : '员'}}</span>
|
|
</el-tooltip>
|
|
</el-tooltip>
|
|
</span>
|
|
</span>
|
|
</span>
|
|
</span>
|
|
@@ -400,7 +401,7 @@
|
|
<script setup name="GridIndex">
|
|
<script setup name="GridIndex">
|
|
import { listAllGridCategory } from "@/api/grid/GridCategory";
|
|
import { listAllGridCategory } from "@/api/grid/GridCategory";
|
|
import { listAllDangerCategory } from "@/api/danger/DangerCategory";
|
|
import { listAllDangerCategory } from "@/api/danger/DangerCategory";
|
|
-import { detail, modify, create, search } from "@/api/grid/GridIndex";
|
|
|
|
|
|
+import { detail, modify, create, search, setListPerson, getListPerson } from "@/api/grid/GridIndex";
|
|
import { deptTreeSelect } from "@/api/system/user";
|
|
import { deptTreeSelect } from "@/api/system/user";
|
|
import { listUser4Department } from "@/api/system/dept";
|
|
import { listUser4Department } from "@/api/system/dept";
|
|
|
|
|
|
@@ -473,6 +474,7 @@ const formSetUser = ref({
|
|
listUser: []
|
|
listUser: []
|
|
});
|
|
});
|
|
const setUserDeptId = ref(undefined);
|
|
const setUserDeptId = ref(undefined);
|
|
|
|
+const loadingSetUserDeptListUser = ref(false);
|
|
const setUserDeptListUser = ref([]);
|
|
const setUserDeptListUser = ref([]);
|
|
const setUserDeptListSelect = ref([]);
|
|
const setUserDeptListSelect = ref([]);
|
|
|
|
|
|
@@ -642,21 +644,32 @@ function submitModify() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
/** 设置网格员按钮 */
|
|
/** 设置网格员按钮 */
|
|
function onSetUser(row) {
|
|
function onSetUser(row) {
|
|
dialogOpenSetUser.value = true;
|
|
dialogOpenSetUser.value = true;
|
|
formSetUser.value = {
|
|
formSetUser.value = {
|
|
- id: row.id,
|
|
|
|
- deptId: undefined,
|
|
|
|
- listUser: [
|
|
|
|
- ]
|
|
|
|
-};
|
|
|
|
|
|
+ id: row.id,
|
|
|
|
+ deptId: undefined,
|
|
|
|
+ listUser: [
|
|
|
|
+ ]
|
|
|
|
+ };
|
|
|
|
+
|
|
|
|
+ // 获取现有网格员列表
|
|
|
|
+ getListPerson(row.id)
|
|
|
|
+ .then((response) => {
|
|
|
|
+ formSetUser.value.listUser = response.data;
|
|
|
|
+ })
|
|
|
|
+ .finally(() => {
|
|
|
|
+ loadingSetUser.value = false;
|
|
|
|
+ });
|
|
}
|
|
}
|
|
/** 设置网格员提交 */
|
|
/** 设置网格员提交 */
|
|
function submitSetUser() {
|
|
function submitSetUser() {
|
|
loadingSetUser.value = true;
|
|
loadingSetUser.value = true;
|
|
|
|
|
|
- modify(formSetUser.value)
|
|
|
|
|
|
+ setListPerson(formSetUser.value)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
proxy.$modal.msgSuccess("设置成功");
|
|
proxy.$modal.msgSuccess("设置成功");
|
|
dialogOpenSetUser.value = false;
|
|
dialogOpenSetUser.value = false;
|
|
@@ -672,28 +685,33 @@ function cancelSetUser() {
|
|
}
|
|
}
|
|
/** 设置网格员,部门选择变化 */
|
|
/** 设置网格员,部门选择变化 */
|
|
function onSetUserDeptChange(value) {
|
|
function onSetUserDeptChange(value) {
|
|
- console.log(value);
|
|
|
|
|
|
+ loadingSetUserDeptListUser.value = true;
|
|
|
|
+ loadingSetUser.value = true;
|
|
|
|
+
|
|
listUser4Department(value)
|
|
listUser4Department(value)
|
|
.then((response) => {
|
|
.then((response) => {
|
|
setUserDeptListUser.value = response.data;
|
|
setUserDeptListUser.value = response.data;
|
|
})
|
|
})
|
|
.finally(() => {
|
|
.finally(() => {
|
|
|
|
+ loadingSetUserDeptListUser.value = false;
|
|
loadingSetUser.value = false;
|
|
loadingSetUser.value = false;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
/** 设置网格员,人员选择变化 */
|
|
/** 设置网格员,人员选择变化 */
|
|
function onSetUserChange(value) {
|
|
function onSetUserChange(value) {
|
|
- console.log(value);
|
|
|
|
- console.log(formSetUser.value.listUser);
|
|
|
|
- if (formSetUser.value.listUser.filter(c => c.guid === value).length > 0) {
|
|
|
|
|
|
+ console.log('listUser: ' + JSON.stringify(formSetUser.value.listUser));
|
|
|
|
+ if (formSetUser.value.listUser.filter(c => c.userGuid === value).length > 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- let findList = setUserDeptListUser.value.filter(c => c.value === value);
|
|
|
|
- console.log(findList);
|
|
|
|
|
|
+ console.log('allUser: ' + JSON.stringify(setUserDeptListUser.value));
|
|
|
|
+ let findList = setUserDeptListUser.value.filter(c => c.guid === value);
|
|
formSetUser.value.listUser.push({
|
|
formSetUser.value.listUser.push({
|
|
- guid: value,
|
|
|
|
- name: findList[0].name,
|
|
|
|
- isAdmin: false
|
|
|
|
|
|
+ userGuid: value,
|
|
|
|
+ realName: findList[0].name,
|
|
|
|
+ isAdmin: 0,
|
|
|
|
+ deptId: findList[0].deptId,
|
|
|
|
+ deptGuid: findList[0].deptGuid,
|
|
|
|
+ deptName: findList[0].deptName,
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
@@ -718,18 +736,18 @@ function initListDangerCategory() {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
function onChangeIsAdmin(guid) {
|
|
function onChangeIsAdmin(guid) {
|
|
- let findList = formSetUser.value.listUser.filter(c => c.guid === guid);
|
|
|
|
|
|
+ let findList = formSetUser.value.listUser.filter(c => c.userGuid === guid);
|
|
if (!findList || findList == null || findList.length == 0) {
|
|
if (!findList || findList == null || findList.length == 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- findList[0].isAdmin = !findList[0].isAdmin;
|
|
|
|
|
|
+ findList[0].isAdmin = (findList[0].isAdmin === 1 ? 0 : 1);
|
|
}
|
|
}
|
|
function onRemoveUser(guid) {
|
|
function onRemoveUser(guid) {
|
|
- let findList = formSetUser.value.listUser.filter(c => c.guid === guid);
|
|
|
|
|
|
+ let findList = formSetUser.value.listUser.filter(c => c.userGuid === guid);
|
|
if (!findList || findList == null || findList.length == 0) {
|
|
if (!findList || findList == null || findList.length == 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- formSetUser.value.listUser = formSetUser.value.listUser.filter(c => c.guid != guid);
|
|
|
|
|
|
+ formSetUser.value.listUser = formSetUser.value.listUser.filter(c => c.userGuid != guid);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|