<template>
|
<FYTable @search="onSearch" :row-class-name="tableRowClassName">
|
<template #options>
|
<FYOptionLocation
|
:allOption="true"
|
:level="4"
|
v-model:value="formSearch._locations"
|
></FYOptionLocation>
|
<FYOptionText
|
label="关键字"
|
placeholder="输入名称关键字"
|
v-model:value="formSearch.searchText"
|
></FYOptionText>
|
<FYOptionScene
|
:allOption="true"
|
:type="1"
|
v-model:value="formSearch.scensetype"
|
></FYOptionScene>
|
<FYOptionOnlineStatus
|
:allOption="true"
|
v-model:value="formSearch.online"
|
></FYOptionOnlineStatus>
|
</template>
|
|
<template #table-column>
|
<el-table-column type="index" fixed="left" prop="userInfo.realname" label="名称" width="400">
|
<template #default="scope">
|
<el-tooltip
|
effect="dark"
|
:content="scope.row.userInfo.realname"
|
placement="top-start"
|
:show-after="500"
|
>
|
{{ scope.row.userInfo.realname }}
|
</el-tooltip>
|
</template>
|
</el-table-column>
|
<el-table-column prop="userInfo.acountname" label="账号" width="110" />
|
<el-table-column prop="sceneTypeName" label="类型" width="130" />
|
<el-table-column prop="biProvinceName" label="省" width="90" />
|
<el-table-column prop="biCityName" label="市" width="90" />
|
<!-- <el-table-column prop="districtname" label="区县" width="90" /> -->
|
<el-table-column prop="userInfo.extension1" label="区县" width="90" />
|
<el-table-column prop="biTownName" label="街道" width="110" />
|
<el-table-column prop="biArea" label="集中区" width="110" />
|
<el-table-column prop="biManagementCompany" label="物业" min-width="110" />
|
<el-table-column prop="userInfo.isenable" label="状态" width="90">
|
<template #default="scope">
|
{{ scope.row.userInfo.isenable ? '上线中' : '已下线' }}
|
</template>
|
</el-table-column>
|
<el-table-column prop="userInfo.usertype" label="用户类型" width="90" />
|
<el-table-column fixed="right" align="right" label="操作" width="160">
|
<template #header>
|
<el-button icon="DocumentAdd" size="default" type="success" @click="drawer = true"
|
>新增用户</el-button
|
>
|
</template>
|
<template #default="scope">
|
<el-button
|
:loading="scope.row.loading1"
|
type="primary"
|
size="small"
|
@click="editRow(scope)"
|
>查看</el-button
|
>
|
<el-button
|
:loading="scope.row.loading2"
|
:type="scope.row.userInfo.isenable != '0' ? 'danger' : 'primary'"
|
size="small"
|
@click="itemActive(scope)"
|
>{{ scope.row.userInfo.isenable != '0' ? '下线' : '上线' }}</el-button
|
>
|
</template>
|
</el-table-column>
|
</template>
|
</FYTable>
|
<CompUserInfoAddDrawer v-model:drawer="drawer"></CompUserInfoAddDrawer>
|
</template>
|
|
<script>
|
import userApi from '@/api/fytz/userApi';
|
import { useLoadingStore } from '@/stores/loadingStore';
|
import { mapStores } from 'pinia';
|
import { useMessageBoxTip } from '@/composables/messageBox';
|
import CompUserInfoAddDrawer from '@/views/fytz/user/components/CompUserInfoAddDrawer.vue';
|
|
export default {
|
components: {
|
CompUserInfoAddDrawer
|
},
|
data() {
|
return {
|
formSearch: {
|
_locations: {},
|
searchText: '',
|
scensetype: {},
|
online: {}
|
},
|
drawer: false
|
};
|
},
|
computed: {
|
...mapStores(useLoadingStore)
|
},
|
methods: {
|
onSearch(page, func) {
|
const f = this.formSearch;
|
const area = {};
|
// 行政区划
|
area.provinceCode = f._locations.pCode;
|
area.provinceName = f._locations.pName;
|
if (area.provinceCode == null) {
|
area.provinceCode = null;
|
area.provinceName = null;
|
}
|
area.cityCode = f._locations.cCode;
|
area.cityName = f._locations.cName;
|
area.districtCode = f._locations.dCode;
|
area.districtName = f._locations.dName;
|
area.townCode = f._locations.tCode;
|
area.townName = f._locations.tName;
|
// 场景类型
|
area.sceneTypes = [];
|
f.scensetype.value == null
|
? (area.sceneTypes = [])
|
: (area.sceneTypes = [f.scensetype.value]);
|
// 上下线状态
|
area.online = f.online.value;
|
// 关键字
|
area.searchText = f.searchText;
|
|
userApi.fetchUser(page.currentPage, page.pageSize, area).then((res) => {
|
if (res) {
|
func({
|
data: res.data,
|
total: res.head.totalCount
|
});
|
}
|
});
|
},
|
editRow(scope) {
|
scope.row.loading1 = true;
|
this.loadingStore.pushLoading(() => (scope.row.loading1 = false));
|
this.$router.push(`userEdit/${scope.row.userInfo.guid}`);
|
},
|
itemActive(scope) {
|
const param = {
|
guid: scope.row.userInfo.guid,
|
isenable: !scope.row.userInfo.isenable
|
};
|
const msg = scope.row.userInfo.isenable ? '下线' : '上线';
|
useMessageBoxTip({
|
confirmMsg: `确认${msg}该场景?`,
|
confirmTitle: msg,
|
onConfirm: async () => {
|
scope.row.loading2 = true;
|
return userApi
|
.updateUserInfo(param)
|
.then((res) => {
|
if (res.success) {
|
scope.row.userInfo.isenable = param.isenable;
|
}
|
})
|
.finally(() => {
|
scope.row.loading2 = false;
|
});
|
}
|
});
|
},
|
tableRowClassName({ row }) {
|
return row.userInfo.isenable ? 'online-row' : 'offline-row';
|
}
|
}
|
};
|
</script>
|
<style></style>
|