zs há 1 ano atrás
pai
commit
1b8fd24b44

+ 5 - 0
src/router/index.ts

@@ -28,6 +28,11 @@ const system = [
     meta: { title: '平台设置' },
     component: () => import('@/views/system/config/index.vue')
   },
+  {
+    path: '/system/module',
+    meta: { title: '模块设置' },
+    component: () => import('@/views/system/module/index.vue')
+  },
   {
     path: '/acccount/updatepd',
     meta: { title: '修改密码' },

+ 43 - 0
src/stores/system/module.ts

@@ -0,0 +1,43 @@
+import { defineStore } from 'pinia';
+import { AxiosWrapper } from '@/util/axios-wrapper';
+import _ from 'lodash';
+
+import type { IQueryType, IQueryResult, IQueryParams } from '@/util/types.util';
+const axios = new AxiosWrapper();
+const api = {
+  url: `/module`
+};
+export const ModuleStore = defineStore('module', () => {
+  const query = async ({ skip = 0, limit = undefined, ...info }: IQueryParams = {}): Promise<IQueryResult> => {
+    let cond: IQueryType = {};
+    if (skip) cond.skip = skip;
+    if (limit) cond.limit = limit;
+    cond = { ...cond, ...info };
+    const res = await axios.$get(`${api.url}`, cond);
+    return res;
+  };
+  const fetch = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$get(`${api.url}/${payload}`);
+    return res;
+  };
+  const create = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$post(`${api.url}`, payload);
+    return res;
+  };
+  const update = async (payload: any): Promise<IQueryResult> => {
+    const id = _.get(payload, 'id', _.get(payload, '_id'));
+    const res = await axios.$post(`${api.url}/${id}`, payload);
+    return res;
+  };
+  const del = async (payload: any): Promise<IQueryResult> => {
+    const res = await axios.$delete(`${api.url}/${payload}`);
+    return res;
+  };
+  return {
+    query,
+    fetch,
+    create,
+    update,
+    del
+  };
+});

+ 11 - 29
src/views/core/apply/index.vue

@@ -3,7 +3,7 @@
     <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 #is_use>
+          <template #status>
             <el-option v-for="i in statusList" :key="i._id" :label="i.label" :value="i.value"></el-option>
           </template>
         </cSearch>
@@ -19,26 +19,7 @@
   <cDialog :dialog="dialog" @toClose="toClose">
     <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
       <cForm :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave" label-width="auto">
-        <template #params>
-          <el-button class="button" type="primary" size="mini" @click="paramsAdd()">添加</el-button>
-          <el-table :data="form.params" border size="mini">
-            <el-table-column label="参数名" prop="label" align="center">
-              <template #default="scope">
-                <el-input v-model="scope.row.label" placeholder="请输入参数名"></el-input>
-              </template>
-            </el-table-column>
-            <el-table-column label="参数值" prop="value" align="center">
-              <template #default="scope">
-                <el-input v-model="scope.row.value" placeholder="请输入参数值"></el-input>
-              </template>
-            </el-table-column>
-            <el-table-column label="操作" align="center">
-              <template #default="scope">
-                <el-button type="danger" size="mini" @click="paramsDel(scope.$index)">删除</el-button>
-              </template>
-            </el-table-column>
-          </el-table>
-        </template>
+        <template #params> </template>
         <template #img>
           <cUpload model="img" :list="form.img" :limit="1" url="/files/notarization/apply/upload" listType="picture-card" @change="onUpload"></cUpload>
         </template>
@@ -125,17 +106,18 @@ const toChangeUse = async (data) => {
 // #region 表格及操作
 // NeedChange
 let fields: Ref<any[]> = ref([
-  { label: '菜品名称', model: 'name', isSearch: true },
-  { label: '卡路里(大卡)', model: 'reserve' },
-  { label: '是否使用', model: 'is_use', format: (i) => getDict(i, 'is_use'), isSearch: true, type: 'select' }
+  { label: '申请人', model: 'user', isSearch: true },
+  { label: '业务员', model: 'admin' },
+  { label: '业务名称', model: 'business' },
+  { label: '类型', model: 'type' },
+  { label: '时间', model: 'time' },
+  { label: '状态', model: 'status', format: (i) => getDict(i, 'status'), isSearch: true, type: 'select' }
 ]);
 // 操作
 let opera: Ref<any[]> = ref([
-  { label: '修改', method: 'edit' },
-  { label: '评价', method: 'rate' },
-  { label: '禁用', method: 'changeUse', type: 'warning', confirm: true, display: (i) => i.is_use === '0' },
-  { label: '使用', method: 'changeUse', type: 'success', confirm: true, display: (i) => i.is_use === '1' },
-  { label: '删除', method: 'del', confirm: true, type: 'danger' }
+  { label: '查看详情', method: 'view' },
+  { label: '上传合同', method: 'file', display: (i) => i.is_use === '0' },
+  { label: '上传证书', method: 'file', display: (i) => i.is_use === '0' }
 ]);
 
 const getDict = (data, model) => {

+ 37 - 13
src/views/core/business/index.vue

@@ -12,7 +12,8 @@
         <cButton @toAdd="toAdd"> </cButton>
       </el-col>
       <el-col :span="24" class="thr">
-        <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel" @changeUse="toChangeUse"> </cTable>
+        <cTable :fields="fields" :opera="opera" :list="list" @query="search" :total="total" @edit="toEdit" @del="toDel"
+          @changeUse="toChangeUse"> </cTable>
       </el-col>
     </el-col>
   </el-row>
@@ -22,14 +23,21 @@
         <template #material>
           <el-button class="button" type="primary" size="mini" @click="materialAdd('material')">添加</el-button>
           <el-table :data="form.material" border size="mini">
-            <el-table-column label="字段名称" prop="label" align="center">
+            <el-table-column label="所需材料名称" prop="label" align="center">
               <template #default="scope">
-                <el-input v-model="scope.row.label" placeholder="请输入字段名称"></el-input>
+                <el-input v-model="scope.row.label" placeholder="请输入所需材料名称"></el-input>
               </template>
             </el-table-column>
-            <el-table-column label="字段值" prop="model" align="center">
+            <el-table-column label="类型" prop="type" align="center">
               <template #default="scope">
-                <el-input v-model="scope.row.model" placeholder="请输入字段值"></el-input>
+                <el-select v-model="scope.row.type" placeholder="请选择" style="width: 150px">
+                  <el-option v-for="item in typeList" :key="item._id" :label="item.label" :value="item.value" />
+                </el-select>
+              </template>
+            </el-table-column>
+            <el-table-column label="备注" prop="remark" align="center">
+              <template #default="scope">
+                <el-input v-model="scope.row.remark" placeholder="请输入备注"></el-input>
               </template>
             </el-table-column>
             <el-table-column label="操作" align="center" width="90px">
@@ -39,6 +47,9 @@
             </el-table-column>
           </el-table>
         </template>
+        <template #content>
+          <cEditor v-model="form.content" url="/files/notarization/business/upload"></cEditor>
+        </template>
       </cForm>
     </el-col>
   </cDialog>
@@ -69,12 +80,15 @@ const $checkRes = inject('$checkRes') as Function;
 // #region 字典
 // NeedChange
 const statusList: Ref<any> = ref([]);
-
+const typeList: Ref<any> = ref([]);
 const searchOther = async () => {
   let res: IQueryResult;
   // 是否使用
   res = await dictDataStore.query({ code: 'isUse', is_use: '0' });
   if ($checkRes(res)) statusList.value = res.data;
+  //资料类型
+  res = await dictDataStore.query({ code: 'type', is_use: '0' });
+  if ($checkRes(res)) typeList.value = res.data;
 };
 // #endregion
 
@@ -121,8 +135,9 @@ const toChangeUse = async (data) => {
 // NeedChange
 let fields: Ref<any[]> = ref([
   { label: '名称', model: 'name', isSearch: true },
-  { label: '收费标准', model: 'money' },
+  { label: '收费金额', model: 'money' },
   { label: '收费依据', model: 'basic' },
+  { label: '邮费', model: 'postage' },
   { label: '是否使用', model: 'is_use', format: (i) => getDict(i, 'is_use'), isSearch: true, type: 'select' }
 ]);
 // 操作
@@ -179,16 +194,17 @@ const toDel = async (data) => {
 
 // #region 表单及操作
 // NeedChange
-const defaultForm = { is_use: '0' };
+const defaultForm = { is_use: '0', material: [] };
 const formFields: Ref<any> = ref([
   { label: '名称', model: 'name' },
-  { label: '收费标准', model: 'money' },
+  { label: '收费金额', model: 'money' },
   { label: '收费依据', model: 'basic' },
+  { label: '邮费', model: 'postage' },
   { label: '所需资料', model: 'material', custom: true },
-  { label: '内容', model: 'content', type: 'textarea' }
+  { label: '内容', model: 'content', custom: true }
 ]);
 const dialog: Ref<any> = ref({ title: '数据信息', show: false, type: '1' });
-const form: Ref<any> = ref({});
+const form: Ref<any> = ref({ material: [] });
 // 关闭弹框
 const toClose = () => {
   form.value = {};
@@ -198,7 +214,7 @@ const toClose = () => {
 const materialAdd = (text) => {
   let list = form.value[text] || [];
   list.push({});
-  form.value.work = list;
+  form.value[text] = list;
 };
 // 删除参数
 const materialkDel = (index: number, text: string) => {
@@ -208,4 +224,12 @@ const materialkDel = (index: number, text: string) => {
 };
 // #endregion
 </script>
-<style scoped lang="scss"></style>
+
+<style scoped lang="scss">
+.dialog_one {
+  .button {
+    margin: 0 0 5px 0;
+  }
+}
+</style>
+

+ 1 - 1
src/views/core/personnel/index.vue

@@ -230,7 +230,7 @@ const form: Ref<any> = ref({ logo: [], work: [] });
 const workAdd = (text) => {
   let list = form.value[text] || [];
   list.push({});
-  form.value.work = list;
+  form.value[text] = list;
 };
 // 删除参数
 const workDel = (index: number, text: string) => {

+ 5 - 1
src/views/system/config/index.vue

@@ -6,6 +6,9 @@
           <template #logo>
             <cUpload model="logo" :list="form.logo" :limit="1" url="/files/notarization/config/upload" listType="picture-card" @change="onUpload"></cUpload>
           </template>
+          <template #file>
+            <cUpload model="file" :list="form.file" :limit="3" url="/files/notarization/config/upload" listType="picture-card" @change="onUpload"></cUpload>
+          </template>
           <template #brief>
             <cEditor v-model="form.brief" url="/files/notarization/config/upload"></cEditor>
           </template>
@@ -66,6 +69,7 @@ const toSave = async () => {
 // NeedChange
 const formFields: Ref<any> = ref([
   { label: 'logo', model: 'logo', custom: true },
+  { label: '首页轮播图', model: 'file', custom: true },
   { label: '联系电话', model: 'phone' },
   { label: '邮箱', model: 'email' },
   { label: '工作时间', model: 'time' },
@@ -74,7 +78,7 @@ const formFields: Ref<any> = ref([
   { label: '办证须知', model: 'notice', custom: true },
   { label: '用户协议', model: 'agreement', custom: true }
 ]);
-const form: Ref<any> = ref({ logo: [] });
+const form: Ref<any> = ref({ logo: [], file: [] });
 const onUpload = (e: { model: string; value: Array<[]> }) => {
   const { model, value } = e;
   form.value[model] = value;

+ 192 - 0
src/views/system/module/index.vue

@@ -0,0 +1,192 @@
+<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 #is_use>
+            <el-option v-for="i in statusList" :key="i._id" :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" @edit="toEdit" @del="toDel" @changeUse="toChangeUse"> </cTable>
+      </el-col>
+    </el-col>
+  </el-row>
+  <cDialog :dialog="dialog" @toClose="toClose">
+    <el-col :span="24" class="dialog_one" v-if="dialog.type == '1'">
+      <cForm :span="24" :fields="formFields" :form="form" :rules="{}" @save="toSave" label-width="auto">
+        <template #file>
+          <cUpload model="file" :list="form.file" :limit="1" url="/files/notarization/module/upload" listType="picture-card" @change="onUpload"></cUpload>
+        </template>
+      </cForm>
+    </el-col>
+  </cDialog>
+</template>
+
+<script setup lang="ts">
+import { ref, Ref, onMounted, inject } from 'vue';
+// NeedChange
+import { ModuleStore } from '@/stores/system/module';
+import { DictDataStore } from '@/stores/system/dictData';
+import type { IQueryResult } from '@/util/types.util';
+import { cloneDeep, get } from 'lodash';
+import baseStore from '@/stores/counter';
+const user = ref(baseStore.state.user);
+onMounted(async () => {
+  loading.value = true;
+  await searchOther();
+  await search({ skip, limit });
+  loading.value = false;
+});
+// 路由
+const loading: Ref<any> = ref(false);
+// NeedChange
+const store = ModuleStore();
+const dictDataStore = DictDataStore();
+const $checkRes = inject('$checkRes') as Function;
+
+// #region 字典
+// NeedChange
+const statusList: Ref<any> = ref([]);
+
+const searchOther = async () => {
+  let res: IQueryResult;
+  // 是否使用
+  res = await dictDataStore.query({ code: 'isUse', is_use: '0' });
+  if ($checkRes(res)) statusList.value = res.data;
+};
+// #endregion
+
+// #region 查询相关
+let list: Ref<any> = ref([]);
+let total: Ref<number> = ref(0);
+let skip = 0;
+let limit = inject('$limit') as number;
+let searchForm: Ref<any> = ref({});
+
+const search = async (e: { skip: number; limit: number }) => {
+  const info = { skip: e.skip, limit: e.limit, ...searchForm.value };
+  const res: IQueryResult = await store.query(info);
+  if (res.errcode == '0') {
+    list.value = res.data;
+    total.value = res.total;
+  }
+};
+const toSearch = (query) => {
+  searchForm.value = query;
+  search({ skip, limit });
+};
+const toChangeUse = async (data) => {
+  let status = '0';
+  switch (data.is_use) {
+    case '0':
+      status = '1';
+      break;
+    case '1':
+      status = '0';
+      break;
+    default:
+      break;
+  }
+  const udata = { _id: data._id, is_use: status };
+  const res = await store.update(udata);
+  if ($checkRes(res, true)) {
+    search({ skip: 0, limit });
+  }
+};
+// #endregion
+
+// #region 表格及操作
+// NeedChange
+let fields: Ref<any[]> = ref([
+  { label: '标题', model: 'title', isSearch: true },
+  { label: '路由', model: 'route' },
+  { label: '是否使用', model: 'is_use', format: (i) => getDict(i, 'is_use'), isSearch: true, type: 'select' }
+]);
+// 操作
+let opera: Ref<any[]> = ref([
+  { label: '修改', method: 'edit' },
+  { label: '禁用', method: 'changeUse', type: 'warning', confirm: true, display: (i) => i.is_use === '0' },
+  { label: '使用', method: 'changeUse', type: 'success', confirm: true, display: (i) => i.is_use === '1' },
+  { label: '删除', method: 'del', confirm: true, type: 'danger' }
+]);
+
+const getDict = (data, model) => {
+  let list;
+  switch (model) {
+    case 'is_use':
+      list = statusList.value;
+      break;
+    default:
+      break;
+  }
+  if (!list) return;
+  const res = list.find((f) => f.value == data);
+  return get(res, 'label');
+};
+const toAdd = () => {
+  // 所属人是自己,需要把自己的id放进去
+  form.value = { ...cloneDeep(defaultForm) };
+  dialog.value.show = true;
+};
+const toEdit = async (data) => {
+  form.value = { ...data };
+  dialog.value.show = true;
+};
+// #endregion
+
+// #region 常规接口
+const toSave = async () => {
+  const data = cloneDeep(form.value);
+  let res: IQueryResult;
+  if (get(data, '_id')) res = await store.update(data);
+  else res = await store.create(data);
+  if ($checkRes(res, true)) {
+    search({ skip: 0, limit });
+    toClose();
+  }
+};
+const toDel = async (data) => {
+  const res = await store.del(data._id);
+  if ($checkRes(res, true)) {
+    search({ skip: 0, limit });
+  }
+};
+
+// #endregion
+
+// #region 表单及操作
+// NeedChange
+const defaultForm = { is_use: '0', file: [] };
+const formFields: Ref<any> = ref([
+  { label: '图片', model: 'file', custom: true },
+  { label: '标题', model: 'title' },
+  { label: '路由', model: 'route' },
+  { label: '简介', model: 'brief', type: 'textarea' }
+]);
+const dialog: Ref<any> = ref({ title: '数据信息', show: false, type: '1' });
+const form: Ref<any> = ref({ file: [] });
+// 关闭弹框
+const toClose = () => {
+  form.value = {};
+  dialog.value.show = false;
+};
+const onUpload = (e: { model: string; value: Array<[]> }) => {
+  console.log(e);
+  const { model, value } = e;
+  form.value[model] = value;
+};
+// #endregion
+</script>
+
+<style scoped lang="scss">
+.dialog_one {
+  .button {
+    margin: 0 0 5px 0;
+  }
+}
+</style>