|
@@ -17,22 +17,21 @@
|
|
|
<template v-slot:info>
|
|
|
<el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
|
|
|
<cForm :span="24" :fields="formFields" :form="form" :rules="rules" @save="toSave">
|
|
|
- <template #url>
|
|
|
- <cUpload
|
|
|
- :model="`${'url'}`"
|
|
|
- :limit="1"
|
|
|
- listType="picture"
|
|
|
- url="/files/material/module/upload"
|
|
|
- accept="*"
|
|
|
- :list="form.url"
|
|
|
- @change="onUpload"
|
|
|
- ></cUpload>
|
|
|
- </template>
|
|
|
- <template #type>
|
|
|
- <el-option v-for="i in typeList" :key="i.value" :label="i.label" :value="i.value"></el-option>
|
|
|
+ <template #office>
|
|
|
+ <el-option @click="toChange(i)" v-for="i in officeList" :key="i._id" :label="i.name" :value="i._id"></el-option>
|
|
|
</template>
|
|
|
<template #is_use>
|
|
|
- <el-radio v-for="i in is_useList" :key="i._id" :label="i.value">{{ i.label }}</el-radio>
|
|
|
+ <el-radio v-for="i in is_useList" :key="i.value" :label="i.label">{{ i.label }}</el-radio>
|
|
|
+ </template>
|
|
|
+ <template #leader>
|
|
|
+ <el-select v-model="form.leader" multiple placeholder="请选择审批领导" style="width: 100%">
|
|
|
+ <el-option v-for="item in ldList" :key="item._id" :label="item.name" :value="item._id" />
|
|
|
+ </el-select>
|
|
|
+ </template>
|
|
|
+ <template #accounting>
|
|
|
+ <el-select v-model="form.accounting" multiple placeholder="请选择审批会计" style="width: 100%">
|
|
|
+ <el-option v-for="item in kjList" :key="item._id" :label="item.name" :value="item._id" />
|
|
|
+ </el-select>
|
|
|
</template>
|
|
|
</cForm>
|
|
|
</el-col>
|
|
@@ -49,11 +48,15 @@ import type { Ref } from 'vue';
|
|
|
import { ref, onMounted, getCurrentInstance, reactive } from 'vue';
|
|
|
import { ElMessage } from 'element-plus';
|
|
|
// 接口
|
|
|
-import { ModuleStore } from '@/stores/module/module';
|
|
|
+import { CollectionStore } from '@/stores/collection/collection';
|
|
|
import { DictDataStore } from '@/stores/dict/dictData';
|
|
|
+import { OfficeStore } from '@/stores/office/office';
|
|
|
+import { UserStore } from '@/stores/users/user';
|
|
|
import type { IQueryResult } from '@/util/types.util';
|
|
|
const dictData = DictDataStore();
|
|
|
-const moduleAxios = ModuleStore();
|
|
|
+const collectionAxios = CollectionStore();
|
|
|
+const officeAxios = OfficeStore();
|
|
|
+const userAxios = UserStore();
|
|
|
const { proxy } = getCurrentInstance() as any;
|
|
|
// 加载中
|
|
|
const loading: Ref<any> = ref(false);
|
|
@@ -63,10 +66,9 @@ let total: Ref<number> = ref(0);
|
|
|
let skip = 0;
|
|
|
let limit: number = proxy.$limit;
|
|
|
let fields: Ref<any[]> = ref([
|
|
|
- { label: '名称', model: 'name', isSearch: true },
|
|
|
- { label: '类型', model: 'type', format: (i: any) => getDict(i, 'type') },
|
|
|
- { label: '路由', model: 'route' },
|
|
|
- { label: '排序', model: 'sort', type: 'number' },
|
|
|
+ { label: '街道/社区', model: 'office', format: (i: any) => getDict(i, 'office') },
|
|
|
+ { label: '领导', model: 'leader' },
|
|
|
+ { label: '会计', model: 'accounting' },
|
|
|
{ label: '是否使用', model: 'is_use', format: (i: any) => getDict(i, 'is_use') }
|
|
|
]);
|
|
|
// 操作
|
|
@@ -76,14 +78,12 @@ let opera: Ref<any[]> = ref([
|
|
|
]);
|
|
|
// 弹框
|
|
|
const dialog: Ref<{ type: string; show: boolean; title: string }> = ref({ type: '1', show: false, title: '信息管理' });
|
|
|
-let form: Ref<{}> = ref({});
|
|
|
+let form: Ref<{ leader: Array<any>; accounting: Array<any> }> = ref({ leader: [], accounting: [] });
|
|
|
// 表单
|
|
|
let formFields: Ref<any[]> = ref([
|
|
|
- { label: '名称', model: 'name' },
|
|
|
- { label: '类型', model: 'type', type: 'select' },
|
|
|
- { label: '路由', model: 'route' },
|
|
|
- { label: '图片', model: 'url', custom: true },
|
|
|
- { label: '排序', model: 'sort', type: 'number' },
|
|
|
+ { label: '街道/社区', model: 'office', type: 'select' },
|
|
|
+ { label: '领导', model: 'leader', custom: true },
|
|
|
+ { label: '会计', model: 'accounting', custom: true },
|
|
|
{ label: '是否使用', model: 'is_use', type: 'radio' }
|
|
|
]);
|
|
|
const rules = reactive<FormRules>({
|
|
@@ -97,7 +97,9 @@ const rules = reactive<FormRules>({
|
|
|
let searchForm: Ref<any> = ref({});
|
|
|
// 字典表
|
|
|
let is_useList: Ref<any> = ref([]);
|
|
|
-let typeList: Ref<any> = ref([]);
|
|
|
+let officeList: Ref<any> = ref([]);
|
|
|
+let ldList: Ref<any> = ref([]);
|
|
|
+let kjList: Ref<any> = ref([]);
|
|
|
|
|
|
// 请求
|
|
|
onMounted(async () => {
|
|
@@ -110,7 +112,7 @@ const search = async (e: { skip: number; limit: number }) => {
|
|
|
const { skip, limit } = e;
|
|
|
const condition = _.cloneDeep(searchForm.value);
|
|
|
let info = { limit: limit, skip: skip, ...condition };
|
|
|
- let res: IQueryResult = await moduleAxios.query(info);
|
|
|
+ let res: IQueryResult = await collectionAxios.query(info);
|
|
|
if (res.errcode == 0) {
|
|
|
list.value = res.data;
|
|
|
total.value = res.total;
|
|
@@ -120,6 +122,15 @@ const toSearch = (query: any) => {
|
|
|
searchForm.value = query;
|
|
|
search({ skip, limit });
|
|
|
};
|
|
|
+const toChange = async (val: any) => {
|
|
|
+ let res: IQueryResult;
|
|
|
+ // 领导
|
|
|
+ res = await userAxios.query({ status: '1', belong: val.belong, role: '64c213db894448b6ed4f9a43' });
|
|
|
+ if (res.errcode == '0') ldList.value = res.data;
|
|
|
+ // 会计
|
|
|
+ res = await userAxios.query({ status: '1', belong: val.belong, role: '64c213ce894448b6ed4f9a3b' });
|
|
|
+ if (res.errcode == '0') kjList.value = res.data;
|
|
|
+};
|
|
|
const getDict = (value: any, model: any) => {
|
|
|
if (model == 'is_use') {
|
|
|
if (value) {
|
|
@@ -127,10 +138,6 @@ const getDict = (value: any, model: any) => {
|
|
|
if (data) return data.label;
|
|
|
else return '暂无';
|
|
|
}
|
|
|
- } else if (model == 'type') {
|
|
|
- let data = typeList.value.find((i: any) => i.value == value);
|
|
|
- if (data) return data.label;
|
|
|
- else return '暂无';
|
|
|
}
|
|
|
};
|
|
|
// 新增
|
|
@@ -145,8 +152,8 @@ const toEdit = async (data: any) => {
|
|
|
// 提交保存
|
|
|
const toSave = async (data: any) => {
|
|
|
let res: IQueryResult;
|
|
|
- if (data._id) res = await moduleAxios.update(data);
|
|
|
- else res = await moduleAxios.create(data);
|
|
|
+ if (data._id) res = await collectionAxios.update(data);
|
|
|
+ else res = await collectionAxios.create(data);
|
|
|
if (res.errcode == 0) {
|
|
|
ElMessage({ type: `success`, message: `维护信息成功` });
|
|
|
toClose();
|
|
@@ -154,20 +161,15 @@ const toSave = async (data: any) => {
|
|
|
};
|
|
|
// 删除
|
|
|
const toDel = async (data: any) => {
|
|
|
- let res: IQueryResult = await moduleAxios.del(data._id);
|
|
|
+ let res: IQueryResult = await collectionAxios.del(data._id);
|
|
|
if (res.errcode == 0) {
|
|
|
ElMessage({ type: `success`, message: `刪除信息成功` });
|
|
|
search({ skip, limit });
|
|
|
}
|
|
|
};
|
|
|
-// 上传图片
|
|
|
-const onUpload = (e: { model: string; value: Array<[]> }) => {
|
|
|
- const { model, value } = e;
|
|
|
- form.value[model] = value;
|
|
|
-};
|
|
|
// 弹框关闭
|
|
|
const toClose = () => {
|
|
|
- form.value = {};
|
|
|
+ form.value = { leader: [], accounting: [] };
|
|
|
dialog.value = { title: '信息管理', show: false, type: '1' };
|
|
|
search({ skip, limit });
|
|
|
};
|
|
@@ -177,9 +179,9 @@ const searchOther = async () => {
|
|
|
// 是否使用
|
|
|
res = await dictData.query({ type: 'is_use' });
|
|
|
if (res.errcode == '0') is_useList.value = res.data;
|
|
|
- // 类型
|
|
|
- res = await dictData.query({ type: 'goods_type' });
|
|
|
- if (res.errcode == '0') typeList.value = res.data;
|
|
|
+ // 街道
|
|
|
+ res = await officeAxios.query({ is_use: '0' });
|
|
|
+ if (res.errcode == '0') officeList.value = res.data;
|
|
|
};
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
@@ -189,3 +191,4 @@ const searchOther = async () => {
|
|
|
}
|
|
|
}
|
|
|
</style>
|
|
|
+@/stores/collection/collection
|