|
@@ -3,35 +3,33 @@
|
|
|
<el-row>
|
|
|
<el-col :span="24" class="main animate__animated animate__backInRight" v-loading="loading">
|
|
|
<el-col :span="24" class="one">
|
|
|
- <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch"> </cSearch>
|
|
|
+ <cSearch :is_title="false" :is_search="true" :fields="fields" @search="toSearch">
|
|
|
+ <template #area>
|
|
|
+ <el-option v-for="i in areaList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </cSearch>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="two">
|
|
|
<cButton @toAdd="toAdd()"> </cButton>
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="thr">
|
|
|
- <cTable
|
|
|
- :fields="fields"
|
|
|
- :opera="opera"
|
|
|
- :list="list"
|
|
|
- @query="search"
|
|
|
- :total="total"
|
|
|
- @view="toView"
|
|
|
- @edit="toEdit"
|
|
|
- @exam="toExam"
|
|
|
- @del="toDel"
|
|
|
- :select="false"
|
|
|
- >
|
|
|
+ <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @view="toView" @edit="toEdit" @exam="toExam" @del="toDel">
|
|
|
</cTable>
|
|
|
</el-col>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
<cDialog :dialog="dialog" @handleClose="toClose">
|
|
|
<template v-slot:info>
|
|
|
- <cForm v-if="dialog.type == '1'" :span="24" :fields="formFields" :form="form" :rules="{}" @save="onSubmit">
|
|
|
- <template #status>
|
|
|
- <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
- </template>
|
|
|
- </cForm>
|
|
|
+ <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
|
|
|
+ <cForm :span="24" :fields="formFields" :form="form" @save="toSave">
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="(i, index) in statusList" :key="index" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </cForm>
|
|
|
+ </el-col>
|
|
|
</template>
|
|
|
</cDialog>
|
|
|
</div>
|
|
@@ -42,13 +40,17 @@ import type { Ref } from 'vue';
|
|
|
import { ref, onMounted, getCurrentInstance } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
import { useRouter } from 'vue-router';
|
|
|
+
|
|
|
import { PersonalStore } from '@common/src/stores/admins/personal';
|
|
|
import { DictDataStore } from '@common/src/stores/system/dictData'; // 字典表
|
|
|
import type { IQueryResult } from '@/util/types.util';
|
|
|
const personal = PersonalStore();
|
|
|
const dictData = DictDataStore();
|
|
|
-const router = useRouter();
|
|
|
+
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
+
|
|
|
+const router = useRouter();
|
|
|
+// 加载中
|
|
|
const loading = ref(false);
|
|
|
// 列表数据
|
|
|
let list: Ref<any> = ref([]);
|
|
@@ -62,23 +64,28 @@ let fields: Ref<any[]> = ref([
|
|
|
{ label: '账号', model: 'account', isSearch: true },
|
|
|
{ label: '姓名', model: 'name', isSearch: true },
|
|
|
{ label: '手机号', model: 'phone', isSearch: true },
|
|
|
- { label: '所属辖区', model: 'area' },
|
|
|
- { label: '状态', model: 'status', format: (i) => getDict(i, 'status') }
|
|
|
+ { label: '电子邮箱', model: 'email' },
|
|
|
+ { label: '所属辖区', model: 'area', format: (i) => getDict(i, 'area'), isSearch: true, type: 'select' },
|
|
|
+ { label: '审核状态', model: 'status', format: (i) => getDict(i, 'status'), isSearch: true, type: 'select' }
|
|
|
]);
|
|
|
// 操作
|
|
|
let opera: Ref<any[]> = ref([
|
|
|
{ label: '查看', method: 'view', type: 'success' },
|
|
|
- { label: '修改', method: 'edit' },
|
|
|
- { label: '审核', method: 'exam', type: 'warning' },
|
|
|
+ { label: '审核', method: 'exam', display: (i) => i.status == '0' },
|
|
|
+ { label: '修改', method: 'edit', type: 'warning' },
|
|
|
{ label: '删除', method: 'del', confirm: true, type: 'danger' }
|
|
|
]);
|
|
|
-const dialog: Ref<{ type: string; show: boolean; title: string }> = ref({ type: '1', show: false, title: '信息管理' });
|
|
|
+// 弹框
|
|
|
+const dialog: Ref<any> = ref({ type: '1', show: false, title: '信息管理' });
|
|
|
let form: Ref<{}> = ref({});
|
|
|
-// 表单
|
|
|
let formFields: Ref<any[]> = ref([{ label: '状态', model: 'status', type: 'select' }]);
|
|
|
+
|
|
|
// 查询数据
|
|
|
let searchForm: Ref<any> = ref({});
|
|
|
+// 字典表
|
|
|
let statusList: Ref<any> = ref([]);
|
|
|
+const areaList: Ref<any> = ref([]);
|
|
|
+
|
|
|
onMounted(async () => {
|
|
|
loading.value = true;
|
|
|
await searchOther();
|
|
@@ -101,8 +108,12 @@ const toSearch = (query) => {
|
|
|
search({ skip, limit });
|
|
|
};
|
|
|
const getDict = (e, model) => {
|
|
|
- if (model == 'status') {
|
|
|
- let data: any = statusList.value.find((i: any) => i.value == e);
|
|
|
+ if (model == 'area') {
|
|
|
+ let data = areaList.value.find((i) => i.value == e);
|
|
|
+ if (data) return data.label;
|
|
|
+ else return '暂无';
|
|
|
+ } else if (model == 'status') {
|
|
|
+ let data = statusList.value.find((i) => i.value == e);
|
|
|
if (data) return data.label;
|
|
|
else return '暂无';
|
|
|
}
|
|
@@ -111,13 +122,15 @@ const getDict = (e, model) => {
|
|
|
const toAdd = () => {
|
|
|
router.push({ path: '/user/personal/detail' });
|
|
|
};
|
|
|
+// 查看
|
|
|
const toView = (data) => {
|
|
|
- router.push({ path: '/user/personal/detail', query: { id: data._id, isdisabled: 'true' } });
|
|
|
+ router.push({ path: '/user/personal/detail', query: { id: data._id, isdisabled: `${true}` } });
|
|
|
};
|
|
|
// 修改
|
|
|
const toEdit = async (data) => {
|
|
|
router.push({ path: '/user/personal/detail', query: { id: data._id } });
|
|
|
};
|
|
|
+// 审核
|
|
|
const toExam = async (data) => {
|
|
|
let res: IQueryResult = await personal.fetch(data._id);
|
|
|
if (res.errcode == 0) {
|
|
@@ -126,13 +139,13 @@ const toExam = async (data) => {
|
|
|
}
|
|
|
};
|
|
|
// 提交
|
|
|
-const onSubmit = async (data) => {
|
|
|
- let res: IQueryResult;
|
|
|
- if (data._id) res = await personal.update(data);
|
|
|
- else res = await personal.create(data);
|
|
|
- if (res.errcode == 0) {
|
|
|
+const toSave = async (data) => {
|
|
|
+ let res: IQueryResult = await personal.update(data);
|
|
|
+ if (res.errcode == '0') {
|
|
|
ElMessage({ type: `success`, message: `审核成功` });
|
|
|
toClose();
|
|
|
+ } else {
|
|
|
+ ElMessage({ type: `error`, message: `${res.errmsg}` });
|
|
|
}
|
|
|
};
|
|
|
// 弹框关闭
|
|
@@ -155,6 +168,9 @@ const searchOther = async () => {
|
|
|
// 状态
|
|
|
res = await dictData.query({ type: 'common_status' });
|
|
|
if (res.errcode == 0) statusList.value = res.data;
|
|
|
+ // 辖区
|
|
|
+ res = await dictData.query({ type: 'jl_area' });
|
|
|
+ if (res.errcode == '0') areaList.value = res.data;
|
|
|
};
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|