|
@@ -0,0 +1,175 @@
|
|
|
+<template>
|
|
|
+ <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">
|
|
|
+ <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" :total="total" @query="search" @view="toView" @exam="toExam" @edit="toEdit" @del="toDel"></cTable>
|
|
|
+ </el-col>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ <cDialog :dialog="dialog" @handleClose="toClose">
|
|
|
+ <template v-slot:info>
|
|
|
+ <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
|
|
|
+ <cForm :fields="infofields" :form="form" labelWidth="auto" @save="toSave">
|
|
|
+ <template #status>
|
|
|
+ <el-option v-for="i in statusList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ </template>
|
|
|
+ </cForm>
|
|
|
+ </el-col>
|
|
|
+ </template>
|
|
|
+ </cDialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup lang="ts">
|
|
|
+// 基础
|
|
|
+import type { Ref } from 'vue';
|
|
|
+import { onMounted, ref, getCurrentInstance } from 'vue';
|
|
|
+import { ElMessage } from 'element-plus';
|
|
|
+import { useRouter } from 'vue-router';
|
|
|
+// 接口
|
|
|
+import { CompanyStore } from '@common/src/stores/admins/company';
|
|
|
+import { DictDataStore } from '@common/src/stores/system/dictData';
|
|
|
+import type { IQueryResult } from '@/util/types.util';
|
|
|
+const companyAxios = CompanyStore();
|
|
|
+const dictAxios = DictDataStore();
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance() as any;
|
|
|
+// 路由
|
|
|
+const router = useRouter();
|
|
|
+// 加载中
|
|
|
+const loading: Ref<any> = ref(false);
|
|
|
+// 分页数据
|
|
|
+const list: Ref<any> = ref([]);
|
|
|
+const total: Ref<any> = ref(0);
|
|
|
+const skip = 0;
|
|
|
+const limit = proxy.$limit;
|
|
|
+const fields: Ref<any> = ref([
|
|
|
+ { label: '邀请码', model: 'code', isSearch: true },
|
|
|
+ { label: '账号', model: 'account', isSearch: true },
|
|
|
+ { label: '姓名', model: 'name', isSearch: true },
|
|
|
+ { label: '手机号', model: 'phone', isSearch: true },
|
|
|
+ { 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' }
|
|
|
+]);
|
|
|
+const opera: Ref<any> = ref([
|
|
|
+ { label: '查看', method: 'view' },
|
|
|
+ { label: '审核', method: 'exam', display: (i) => i.status == '0' },
|
|
|
+ { label: '修改', method: 'edit', type: 'warning' },
|
|
|
+ { label: '删除', method: 'del', confirm: true, type: 'danger' }
|
|
|
+]);
|
|
|
+// 查询
|
|
|
+const searchInfo: Ref<any> = ref({});
|
|
|
+// 字典表
|
|
|
+const statusList: Ref<any> = ref([]);
|
|
|
+const areaList: Ref<any> = ref([]);
|
|
|
+
|
|
|
+// 弹框
|
|
|
+const dialog: Ref<any> = ref({ title: '审核管理', show: false, type: '1' });
|
|
|
+const form: Ref<any> = ref({});
|
|
|
+const infofields: Ref<any> = ref([{ label: '审核状态', model: 'status', type: 'select' }]);
|
|
|
+
|
|
|
+// 请求
|
|
|
+onMounted(async () => {
|
|
|
+ loading.value = true;
|
|
|
+ await searchOther();
|
|
|
+ await search({ skip, limit });
|
|
|
+ loading.value = false;
|
|
|
+});
|
|
|
+const search = async (e: { skip: number; limit: number }) => {
|
|
|
+ const info = { skip: e.skip, limit: e.limit, ...searchInfo.value };
|
|
|
+ const res: IQueryResult = await companyAxios.query(info);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ list.value = res.data;
|
|
|
+ total.value = res.total;
|
|
|
+ }
|
|
|
+};
|
|
|
+const toSearch = (e) => {
|
|
|
+ searchInfo.value = e;
|
|
|
+ search({ skip, limit });
|
|
|
+};
|
|
|
+const getDict = (e, model) => {
|
|
|
+ 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 '暂无';
|
|
|
+ }
|
|
|
+};
|
|
|
+// 查看
|
|
|
+const toView = (e) => {
|
|
|
+ router.push({ path: '/user/company/info', query: { id: e._id } });
|
|
|
+};
|
|
|
+// 添加
|
|
|
+const toAdd = () => {
|
|
|
+ router.push({ path: '/user/company/detail' });
|
|
|
+};
|
|
|
+// 修改
|
|
|
+const toEdit = (e) => {
|
|
|
+ router.push({ path: '/user/company/detail', query: { id: e._id } });
|
|
|
+};
|
|
|
+// 删除
|
|
|
+const toDel = async (e) => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ res = await companyAxios.del(e._id);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ ElMessage({ message: `删除信息成功`, type: 'success' });
|
|
|
+ search({ skip, limit });
|
|
|
+ } else {
|
|
|
+ ElMessage({ message: `${res.errmsg}`, type: 'error' });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 审核
|
|
|
+const toExam = (e) => {
|
|
|
+ form.value = e;
|
|
|
+ dialog.value = { title: '审核管理', show: true, type: '1' };
|
|
|
+};
|
|
|
+// 提交保存
|
|
|
+const toSave = async (data) => {
|
|
|
+ let res: IQueryResult = await companyAxios.update(data);
|
|
|
+ if (res.errcode == '0') {
|
|
|
+ ElMessage({ message: `审核信息成功`, type: 'success' });
|
|
|
+ toClose();
|
|
|
+ } else {
|
|
|
+ ElMessage({ message: `${res.errmsg}`, type: 'error' });
|
|
|
+ }
|
|
|
+};
|
|
|
+// 关闭弹框
|
|
|
+const toClose = () => {
|
|
|
+ form.value = {};
|
|
|
+ dialog.value = { title: '审核管理', show: false, type: '1' };
|
|
|
+ search({ skip, limit });
|
|
|
+};
|
|
|
+// 查询其他信息
|
|
|
+const searchOther = async () => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 状态
|
|
|
+ res = await dictAxios.query({ type: 'common_status' });
|
|
|
+ if (res.errcode == '0') statusList.value = res.data;
|
|
|
+ // 辖区
|
|
|
+ res = await dictAxios.query({ type: 'jl_area' });
|
|
|
+ if (res.errcode == '0') areaList.value = res.data;
|
|
|
+};
|
|
|
+</script>
|
|
|
+<style scoped lang="scss">
|
|
|
+.main {
|
|
|
+ .two {
|
|
|
+ margin: 0 0 10px 0;
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|