ソースを参照

系统管理接口调试

zhangjie 1 年間 前
コミット
0a65be00da
25 ファイル変更613 行追加258 行削除
  1. 5 0
      components.d.ts
  2. 15 11
      src/api/system.js
  3. 5 0
      src/api/user.js
  4. 49 0
      src/components/common/select-role/index.vue
  5. 49 0
      src/components/common/select-service-level/index.vue
  6. 52 0
      src/components/common/select-supplier/index.vue
  7. 55 0
      src/components/common/select-user/index.vue
  8. 6 3
      src/components/global/search-form/components/search-form-item.vue
  9. 3 3
      src/config/constants.js
  10. 1 1
      src/router/modules/myWorkbenches.js
  11. 4 0
      src/utils/filter.js
  12. 1 1
      src/utils/request.js
  13. 54 52
      src/views/system/config-manage/checkin-manage/edit-checkin-dialog.vue
  14. 37 7
      src/views/system/config-manage/checkin-manage/index.vue
  15. 13 23
      src/views/system/config-manage/customer-manage/edit-customer-dialog.vue
  16. 72 58
      src/views/system/config-manage/customer-manage/index.vue
  17. 29 11
      src/views/system/config-manage/device-manage/edit-device-dialog.vue
  18. 18 5
      src/views/system/config-manage/device-manage/index.vue
  19. 7 1
      src/views/system/config-manage/service-level-manage/edit-service-level-dialog.vue
  20. 18 5
      src/views/system/config-manage/service-level-manage/index.vue
  21. 7 1
      src/views/system/config-manage/supplier-manage/edit-supplier-dialog.vue
  22. 11 5
      src/views/system/config-manage/supplier-manage/index.vue
  23. 8 1
      src/views/system/notice-log/log-manage/index.vue
  24. 7 1
      src/views/system/notice-log/notice-manage/edit-notice-dialog.vue
  25. 87 69
      src/views/system/notice-log/notice-manage/index.vue

+ 5 - 0
components.d.ts

@@ -14,6 +14,11 @@ declare module 'vue' {
     SButtons: typeof import('./src/components/global/s-buttons/index.vue')['default']
     SearchForm: typeof import('./src/components/global/search-form/index.vue')['default']
     SearchFormItem: typeof import('./src/components/global/search-form/components/search-form-item.vue')['default']
+    SelectRole: typeof import('./src/components/common/select-role/index.vue')['default']
+    SelectServiceLevel: typeof import('./src/components/common/select-service-level/index.vue')['default']
+    SelectSupplier: typeof import('./src/components/common/select-supplier/index.vue')['default']
+    SelectUser: typeof import('./src/components/common/select-user/index.vue')['default']
+    ServiceLevel: typeof import('./src/components/common/service-level/index.vue')['default']
     TAside: typeof import('tdesign-vue-next')['Aside']
     TButton: typeof import('tdesign-vue-next')['Button']
     TCheckbox: typeof import('tdesign-vue-next')['Checkbox']

+ 15 - 11
src/api/system.js

@@ -40,11 +40,13 @@ export const supplierListApi = (data) =>
   request({
     url: '/api/sys/supplier/list',
     params: data,
+    method: 'get',
   });
 export const supplierDetailApi = (id) =>
   request({
     url: '/api/sys/supplier/get',
     params: { id },
+    method: 'get',
   });
 export const supplierEditApi = (data) => {
   if (data.id) {
@@ -110,11 +112,13 @@ export const serviceLevelListApi = (data) =>
   request({
     url: '/api/sys/level/list',
     params: data,
+    method: 'get',
   });
 export const serviceLevelDetailApi = (id) =>
   request({
     url: '/api/sys/level/get',
     params: { id },
+    method: 'get',
   });
 export const serviceLevelEditApi = (data) => {
   if (data.id) {
@@ -132,19 +136,19 @@ export const serviceLevelEditApi = (data) => {
 export const serviceLevelDeleteApi = (id) =>
   request({
     url: '/api/sys/level/delete',
-    data: { id },
+    params: { id },
   });
 
 // checkin-manage
 export const checkinQueryApi = (data) =>
   request({
     url: '/api/sys/ding/group/query',
-    data,
+    params: data,
   });
 export const checkinListApi = (data) =>
   request({
     url: '/api/sys/ding/group/list',
-    data,
+    params: data,
   });
 export const checkinEditApi = (data) => {
   if (data.id) {
@@ -162,21 +166,21 @@ export const checkinEditApi = (data) => {
 export const checkinDeleteApi = (id) =>
   request({
     url: '/api/sys/ding/group/delete',
-    data: { id },
+    params: { id },
   });
 
 // log-manage
 export const logListApi = (data) =>
   request({
     url: '/api/sys/log/list',
-    data,
+    params: data,
   });
 
 // notice-manage
-export const noticeListApi = (data) =>
+export const noticeQueryApi = (data) =>
   request({
-    url: '/api/sys/notice/list',
-    data,
+    url: '/api/sys/notice/query',
+    params: data,
   });
 export const noticeEditApi = (data) => {
   if (data.id) {
@@ -194,15 +198,15 @@ export const noticeEditApi = (data) => {
 export const noticePublishApi = (id) =>
   request({
     url: '/api/sys/notice/publish',
-    data: { id },
+    params: { id },
   });
 export const noticeCancelPublishApi = (id) =>
   request({
     url: '/api/sys/notice/cancel-publish',
-    data: { id },
+    params: { id },
   });
 export const noticeDestroyApi = (id) =>
   request({
     url: '/api/sys/notice/destroy',
-    data: { id },
+    params: { id },
   });

+ 5 - 0
src/api/user.js

@@ -34,6 +34,11 @@ export const getRoleList = (data) =>
     url: '/api/admin/role/list',
     params: data,
   });
+export const getAllRoleList = (data) =>
+  request({
+    url: '/api/admin/common/get_role_list',
+    params: data,
+  });
 export const addUser = (data) =>
   request({
     url: '/api/admin/user/save',

+ 49 - 0
src/components/common/select-role/index.vue

@@ -0,0 +1,49 @@
+<template>
+  <t-select v-model="selected" filterable v-bind="attrs" @change="onChange">
+    <t-option
+      v-for="item in optionList.value"
+      :key="item.id"
+      :value="item.id"
+      :label="item.name"
+    />
+  </t-select>
+</template>
+
+<script setup name="SelectSupplier">
+import { onMounted, reactive, ref, useAttrs, watch } from 'vue';
+import { getAllRoleList } from '@/api/user';
+
+let optionList = reactive([]);
+let selected = ref('');
+
+const attrs = useAttrs();
+
+const emit = defineEmits(['update:value', 'change']);
+const props = defineProps({
+  value: { type: [Number, String], default: '' },
+});
+
+const search = async () => {
+  optionList.value = [];
+  const res = await getAllRoleList().catch(() => {});
+  if (!res) return;
+
+  optionList.value = res;
+};
+
+const onChange = () => {
+  emit('update:value', selected.value);
+  emit('change', selected.value);
+};
+
+onMounted(() => {
+  search();
+});
+
+watch(
+  () => props.value,
+  (val) => {
+    selected.value = val;
+  }
+);
+</script>

+ 49 - 0
src/components/common/select-service-level/index.vue

@@ -0,0 +1,49 @@
+<template>
+  <t-select v-model="selected" filterable v-bind="attrs" @change="onChange">
+    <t-option
+      v-for="item in optionList.value"
+      :key="item.id"
+      :value="item.id"
+      :label="item.level"
+    />
+  </t-select>
+</template>
+
+<script setup name="SelectServiceLevel">
+import { onMounted, reactive, ref, useAttrs, watch } from 'vue';
+import { serviceLevelListApi } from '@/api/system';
+
+let optionList = reactive([]);
+let selected = ref('');
+
+const attrs = useAttrs();
+
+const emit = defineEmits(['update:value', 'change']);
+const props = defineProps({
+  value: { type: [Number, String], default: '' },
+});
+
+const search = async () => {
+  optionList.value = [];
+  const res = await serviceLevelListApi().catch(() => {});
+  if (!res) return;
+
+  optionList.value = res;
+};
+
+const onChange = () => {
+  emit('update:value', selected.value);
+  emit('change', selected.value);
+};
+
+onMounted(() => {
+  search();
+});
+
+watch(
+  () => props.value,
+  (val) => {
+    selected.value = val;
+  }
+);
+</script>

+ 52 - 0
src/components/common/select-supplier/index.vue

@@ -0,0 +1,52 @@
+<template>
+  <t-select v-model="selected" filterable v-bind="attrs" @change="onChange">
+    <t-option
+      v-for="item in optionList.value"
+      :key="item.id"
+      :value="item.id"
+      :label="item.name"
+    />
+  </t-select>
+</template>
+
+<script setup name="SelectSupplier">
+import { onMounted, reactive, ref, useAttrs, watch } from 'vue';
+import { supplierListApi } from '@/api/system';
+
+let optionList = reactive([]);
+let selected = ref('');
+
+const attrs = useAttrs();
+
+const emit = defineEmits(['update:value', 'change']);
+const props = defineProps({
+  value: { type: [Number, String], default: '' },
+  type: { type: String, default: '' },
+});
+
+const search = async () => {
+  optionList.value = [];
+  let data = { enable: true };
+  if (props.type) data.type = props.type;
+  const res = await supplierListApi(data).catch(() => {});
+  if (!res) return;
+
+  optionList.value = res;
+};
+
+const onChange = () => {
+  emit('update:value', selected.value);
+  emit('change', selected.value);
+};
+
+onMounted(() => {
+  search();
+});
+
+watch(
+  () => props.value,
+  (val) => {
+    selected.value = val;
+  }
+);
+</script>

+ 55 - 0
src/components/common/select-user/index.vue

@@ -0,0 +1,55 @@
+<template>
+  <t-select v-model="selected" filterable v-bind="attrs" @change="onChange">
+    <t-option
+      v-for="item in optionList.value"
+      :key="item.id"
+      :value="item.id"
+      :label="item.realName"
+    />
+  </t-select>
+</template>
+
+<script setup name="SelectUser">
+import { onMounted, reactive, ref, useAttrs, watch } from 'vue';
+import { getUserList } from '@/api/user';
+
+let optionList = reactive([]);
+let selected = ref('');
+
+const attrs = useAttrs();
+
+const emit = defineEmits(['update:value', 'change']);
+const props = defineProps({
+  value: { type: [Number, String], default: '' },
+  roleType: { type: String, default: '' },
+});
+
+const search = async () => {
+  optionList.value = [];
+  const res = await getUserList({
+    enable: true,
+    // roleType: props.roleType,
+    pageNumber: 1,
+    pageSize: 20,
+  }).catch(() => {});
+  if (!res) return;
+
+  optionList.value = res.records;
+};
+
+const onChange = () => {
+  emit('update:value', selected.value);
+  emit('change', selected.value);
+};
+
+onMounted(() => {
+  search();
+});
+
+watch(
+  () => props.value,
+  (val) => {
+    selected.value = val;
+  }
+);
+</script>

+ 6 - 3
src/components/global/search-form/components/search-form-item.vue

@@ -67,8 +67,7 @@
     <t-date-picker
       v-model="params[item.prop]"
       :mode="item.mode || 'date'"
-      value-format="YYYY-MM-DD"
-      type="date"
+      value-type="time-stamp"
       v-bind="attrs"
     />
   </template>
@@ -90,7 +89,11 @@
   </template>
   <!-- 日期范围选择 -->
   <template v-if="item.type == 'daterange'">
-    <t-date-range-picker v-model="params[item.prop]" v-bind="attrs" />
+    <t-date-range-picker
+      v-model="params[item.prop]"
+      value-type="time-stamp"
+      v-bind="attrs"
+    />
   </template>
 </template>
 

+ 3 - 3
src/config/constants.js

@@ -6,13 +6,13 @@ export const CUSTOMER_TYPE = {
 };
 // 供应商类型
 export const SUPPLIER_TYPE = {
-  HUMAN: '人力',
-  DEVICE: '设备',
+  HUMAN: '人力供应商',
+  DEVICE: '设备供应商',
 };
 // 设备状态
 export const RUNNING_STATUS = {
   NORMAL: '正常',
-  ERRBREAK_DOWNOR: '故障',
+  BREAK_DOWN: '故障',
 };
 // 公告类型
 export const NOTICE_TYPE = {

+ 1 - 1
src/router/modules/myWorkbenches.js

@@ -52,7 +52,7 @@ export default {
           meta: {
             title: '通知公告',
             sort: 3,
-            alias: 'notice',
+            alias: 'notice1',
           },
         },
       ],

+ 4 - 0
src/utils/filter.js

@@ -4,6 +4,7 @@ import {
   RUNNING_STATUS,
   NOTICE_TYPE,
 } from '@/config/constants';
+import { dateFormat } from './tool';
 
 const DEFAULT_FIELD = '--';
 
@@ -11,6 +12,9 @@ const DEFAULT_FIELD = '--';
 export function enableFilter(val) {
   return val ? '启用' : '禁用';
 }
+export function timestampFilter(val) {
+  return dateFormat(val);
+}
 // 系统管理
 export function customerTypeFilter(val) {
   return CUSTOMER_TYPE[val] || DEFAULT_FIELD;

+ 1 - 1
src/utils/request.js

@@ -68,7 +68,7 @@ function createService() {
       return response.data?.data;
     },
     (error) => {
-      if (error.config.loading) {
+      if (error.config?.loading) {
         LoadingPlugin(false);
       }
       const err = (text) => {

+ 54 - 52
src/views/system/config-manage/checkin-manage/edit-checkin-dialog.vue

@@ -15,67 +15,38 @@
           </t-form-item>
         </t-col>
         <t-col :span="6">
-          <t-form-item label="服务单元" name="service">
-            <t-select v-model="formData.service">
-              <t-option
-                v-for="(val, key) in CUSTOMER_TYPE"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+          <t-form-item label="服务单元" name="serviceId">
+            <t-select v-model="formData.serviceId"> </t-select>
           </t-form-item>
         </t-col>
         <t-col :span="6">
-          <t-form-item label="适用考勤对象" name="tdingObjs">
-            <t-select v-model="formData.tdingObjs">
-              <t-option
-                v-for="(val, key) in CUSTOMER_TYPE"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+          <t-form-item label="适用考勤对象" name="dingRoleIds">
+            <select-role v-model="formData.dingRoleIds" multiple> </select-role>
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="适用供应商" name="supplierId">
-            <t-select v-model="formData.supplierId">
-              <t-option
-                v-for="(val, key) in CUSTOMER_TYPE"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+            <select-supplier v-model="formData.supplierId" type="HUMAN">
+            </select-supplier>
           </t-form-item>
         </t-col>
-        <t-col :span="12">
+        <t-col :span="6">
           <t-form-item label="签到时段" name="signInTime">
-            <t-time-range-picker
-              v-model="formData.signInTime"
-              format="HH:mm:ss"
-            />
+            <t-time-range-picker v-model="formData.signInTime" format="HH:mm" />
           </t-form-item>
         </t-col>
-        <t-col :span="12">
+        <t-col :span="6">
           <t-form-item label="签退时段" name="signOutTime">
             <t-time-range-picker
               v-model="formData.signOutTime"
-              format="HH:mm:ss"
+              format="HH:mm"
             />
           </t-form-item>
         </t-col>
-        <t-col :span="12">
-          <t-form-item label="审核角色" name="auditRoles">
-            <t-select v-model="formData.auditRoles">
-              <t-option
-                v-for="(val, key) in CUSTOMER_TYPE"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+        <t-col :span="6">
+          <t-form-item label="审核角色" name="approveRoleIds">
+            <select-role v-model="formData.approveRoleIds" multiple>
+            </select-role>
           </t-form-item>
         </t-col>
         <t-col :span="6">
@@ -108,6 +79,7 @@ import { MessagePlugin } from 'tdesign-vue-next';
 import useClearDialog from '@/hooks/useClearDialog';
 import { CUSTOMER_TYPE } from '@/config/constants';
 import { checkinEditApi } from '@/api/system';
+import { omit } from 'lodash';
 const emit = defineEmits(['update:visible', 'success']);
 const formRef = ref(null);
 
@@ -122,18 +94,32 @@ const title = computed(() => {
 
 const { formData, isEdit } = useClearDialog(
   {
+    id: null,
     name: '',
-    serviceId: '',
-    tdingObjs: [],
+    serviceId: '1',
+    dingRoleIds: [],
     supplierId: '',
-    signInTime: [],
-    signOutTime: [],
-    auditRoles: [],
+    signInTime: ['06:00', '10:00'],
+    signOutTime: ['16:00', '23:59'],
+    approveRoleIds: [],
     faceOpen: false,
     reissueCardCount: 2,
   },
   props,
-  null
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+    formData.signInTime = props.curRow.signInTime.split('~');
+    formData.signOutTime = props.curRow.signOutTime.split('~');
+    formData.dingRoleIds = props.curRow.dingObjs
+      .filter((item) => item.type === 'DING')
+      .map((item) => item.roleId);
+    formData.approveRoleIds = props.curRow.dingObjs
+      .filter((item) => item.type === 'APPROVE')
+      .map((item) => item.roleId);
+  }
 );
 const rules = {
   name: [
@@ -159,7 +145,7 @@ const rules = {
       trigger: 'change',
     },
   ],
-  tdingObjs: [
+  dingRoleIds: [
     {
       required: true,
       message: '适用考勤对象必选',
@@ -191,7 +177,7 @@ const rules = {
       trigger: 'change',
     },
   ],
-  auditRoles: [
+  approveRoleIds: [
     {
       required: true,
       message: '审核角色必选',
@@ -204,7 +190,23 @@ const save = async () => {
   const valid = await formRef.value.validate();
   if (valid !== true) return;
 
-  const res = await checkinEditApi(formData).catch(() => {});
+  let data = {};
+  for (let key in formData) {
+    data[key] = formData[key];
+  }
+  data.signInTime = formData.signInTime.join('~');
+  data.signOutTime = formData.signOutTime.join('~');
+  data.dingObjs = [
+    ...formData.dingRoleIds.map((item) => {
+      return { roleId: item, type: 'DING' };
+    }),
+    ...formData.approveRoleIds.map((item) => {
+      return { roleId: item, type: 'APPROVE' };
+    }),
+  ];
+  data = omit(data, ['dingRoleIds', 'approveRoleIds']);
+
+  const res = await checkinEditApi(data).catch(() => {});
   if (!res) return;
 
   MessagePlugin.success('保存成功');

+ 37 - 7
src/views/system/config-manage/checkin-manage/index.vue

@@ -18,7 +18,30 @@
           total: pagination.total,
           current: pagination.page,
         }"
+        v-loading="tableLoading"
       >
+        <template #face-open="{ item, row }">
+          {{ row[columns.colKey] ? '是' : '否' }}
+        </template>
+        <template #ding-objs="{ row }">
+          {{
+            row.dingObjs
+              .filter((item) => item.type === 'DING')
+              .map((item) => item.roleName)
+              .join(',')
+          }}
+        </template>
+        <template #approve-objs="{ item, row }">
+          {{
+            row.dingObjs
+              .filter((item) => item.type === 'APPROVE')
+              .map((item) => item.roleName)
+              .join(',')
+          }}
+        </template>
+        <template #create-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
       </t-table>
     </div>
 
@@ -36,6 +59,7 @@ import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import useFetchTable from '@/hooks/useFetchTable';
 import EditCheckinDialog from './edit-checkin-dialog.vue';
 import { checkinQueryApi, checkinDeleteApi } from '@/api/system';
+import { timestampFilter } from '@/utils/filter';
 
 const showEditCheckinDialog = ref(false);
 const curRow = ref(null);
@@ -44,15 +68,15 @@ const columns = [
   { colKey: 'service', title: '服务单元' },
   { colKey: 'status', title: '发布状态' },
   { colKey: 'name', title: '考勤组名称' },
-  { colKey: 'tdingObjs', title: '适用考勤对象' },
+  { colKey: 'dingObjs', title: '适用考勤对象', cell: 'ding-objs' },
   { colKey: 'supplier', title: '适用供应商' },
   { colKey: 'signInTime', title: '签到时段' },
   { colKey: 'signOutTime', title: '签退时段' },
-  { colKey: 'auditRoles', title: '审核角色' },
-  { colKey: 'faceOpen', title: '是否开启人脸' },
-  { colKey: 'reissueCardCount', title: '允许补卡次数' },
+  { colKey: 'auditRoles', title: '审核角色', cell: 'approve-objs' },
+  { colKey: 'faceOpen', title: '是否开启人脸', cell: 'face-open' },
+  { colKey: 'reissueCardCount', title: '允许补卡次数', width: 110 },
   { colKey: 'createName', title: '创建人' },
-  { colKey: 'createTime', title: '创建时间', width: 170 },
+  { colKey: 'createTime', title: '创建时间', cell: 'create-time', width: 170 },
   {
     title: '管理',
     colKey: 'operate',
@@ -87,8 +111,14 @@ const columns = [
     },
   },
 ];
-const { pagination, tableData, fetchData, search, onChange } =
-  useFetchTable(checkinQueryApi);
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  fetchData,
+  search,
+  onChange,
+} = useFetchTable(checkinQueryApi);
 
 const fields = ref([
   {

+ 13 - 23
src/views/system/config-manage/customer-manage/edit-customer-dialog.vue

@@ -9,11 +9,6 @@
   >
     <t-form ref="formRef" :data="formData" :rules="rules" :labelWidth="100">
       <t-row :gutter="[0, 20]">
-        <t-col :span="6">
-          <t-form-item label="客户ID" name="id">
-            <t-input v-model="formData.id" clearable />
-          </t-form-item>
-        </t-col>
         <t-col :span="6">
           <t-form-item label="客户名称" name="name">
             <t-input v-model="formData.name" clearable />
@@ -38,26 +33,13 @@
         </t-col>
         <t-col :span="6">
           <t-form-item label="客户经理" name="managerId">
-            <t-select v-model="formData.managerId">
-              <t-option
-                v-for="(val, key) in CUSTOMER_TYPE"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+            <select-user v-model="formData.managerId" clearable> </select-user>
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="服务档位">
-            <t-select v-model="formData.levelId">
-              <t-option
-                v-for="(val, key) in CUSTOMER_TYPE"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+            <select-service-level v-model="formData.levelId" clearable>
+            </select-service-level>
           </t-form-item>
         </t-col>
         <t-col :span="6">
@@ -102,13 +84,21 @@ const { formData, isEdit } = useClearDialog(
     id: null,
     name: '',
     type: '',
-    address: '',
+    province: '湖北省',
+    city: '武汉市',
+    area: '洪山区',
+    address: '光谷梦工厂',
     managerId: null,
     levelId: null,
     peoperDay: 1,
   },
   props,
-  null
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+  }
 );
 
 const rules = {

+ 72 - 58
src/views/system/config-manage/customer-manage/index.vue

@@ -2,10 +2,12 @@
   <div class="registration-query flex flex-col h-full">
     <SearchForm :fields="fields" :params="params">
       <template #manager="{ item, params }">
-        <t-select v-model="params[item.prop]">
-          <t-option label="label1" :value="1" />
-          <t-option label="label2" :value="2" />
-        </t-select>
+        <select-user v-model="params[item.prop]" clearable role-type="manager">
+        </select-user>
+      </template>
+      <template #level="{ item, params }">
+        <select-service-level v-model="params[item.prop]" clearable>
+        </select-service-level>
       </template>
     </SearchForm>
     <div class="flex-1 page-wrap">
@@ -31,7 +33,14 @@
           total: pagination.total,
           current: pagination.page,
         }"
+        v-loading="tableLoading"
       >
+        <template #type="{ col, row }">
+          {{ customerTypeFilter(row[col.colKey]) }}
+        </template>
+        <template #create-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
         <template #role-list="{ col, row }">
           {{
             row[col.colKey]
@@ -58,61 +67,11 @@ import EditCustomerDialog from './edit-customer-dialog.vue';
 import { customeryQueryApi, customerDeleteApi } from '@/api/system';
 import { CUSTOMER_TYPE } from '@/config/constants';
 import { dictToOptionList } from '@/utils/tool';
+import { customerTypeFilter, timestampFilter } from '@/utils/filter';
 
 const showEditCustomerDialog = ref(false);
 const curRow = ref(null);
 
-const columns = [
-  { colKey: 'id', title: '客户ID' },
-  { colKey: 'name', title: '客户名称' },
-  { colKey: 'type', title: '客户类型' },
-  { colKey: 'province', title: '省份' },
-  { colKey: 'city', title: '城市' },
-  { colKey: 'area', title: '县区' },
-  { colKey: 'address', title: '地址' },
-  { colKey: 'managerName', title: '客户经理' },
-  { colKey: 'level', title: '服务档位名称' },
-  { colKey: 'roleList', title: '项目角色配置', cell: 'role-list', width: 170 },
-  { colKey: 'peoperDay', title: '标准人天', width: 80 },
-  { colKey: 'createName', title: '创建人' },
-  { colKey: 'createTime', title: '创建时间', width: 170 },
-  {
-    title: '管理',
-    colKey: 'operate',
-    fixed: 'right',
-    width: 120,
-    align: 'center',
-    cell: (h, { row }) => {
-      return (
-        <div class="table-operations">
-          <t-link
-            theme="primary"
-            hover="color"
-            onClick={(e) => {
-              e.stopPropagation();
-              handleEdit(row);
-            }}
-          >
-            修改
-          </t-link>
-          <t-link
-            theme="danger"
-            hover="color"
-            onClick={(e) => {
-              e.stopPropagation();
-              handleDelete(row);
-            }}
-          >
-            删除
-          </t-link>
-        </div>
-      );
-    },
-  },
-];
-const { pagination, tableData, fetchData, search, onChange } =
-  useFetchTable(customeryQueryApi);
-
 const fields = ref([
   {
     prop: 'type',
@@ -129,7 +88,6 @@ const fields = ref([
     type: 'select',
     labelWidth: 100,
     colSpan: 5,
-    // options: [{ value: 1, label: '张三' }],
   },
   {
     prop: 'name',
@@ -143,12 +101,11 @@ const fields = ref([
   },
   {
     prop: 'levelId',
+    cell: 'level',
     label: '服务档位',
     type: 'select',
     labelWidth: 100,
     colSpan: 5,
-    // ToDo:异步加载 测试
-    options: [{ value: 1, label: '一档' }],
   },
   {
     type: 'buttons',
@@ -171,6 +128,63 @@ const params = reactive({
   levelId: '',
 });
 
+const columns = [
+  { colKey: 'id', title: '客户ID', width: 180 },
+  { colKey: 'name', title: '客户名称' },
+  { colKey: 'type', title: '客户类型', cell: 'type', width: 100 },
+  { colKey: 'province', title: '省份', width: 100 },
+  { colKey: 'city', title: '城市', width: 100 },
+  { colKey: 'area', title: '县区', width: 100 },
+  { colKey: 'address', title: '地址', minWidth: 160 },
+  { colKey: 'managerName', title: '客户经理' },
+  { colKey: 'level', title: '服务档位名称' },
+  { colKey: 'roleList', title: '项目角色配置', cell: 'role-list', width: 170 },
+  { colKey: 'peoperDay', title: '标准人天', width: 80 },
+  { colKey: 'createName', title: '创建人' },
+  { colKey: 'createTime', title: '创建时间', width: 170, cell: 'create-time' },
+  {
+    title: '管理',
+    colKey: 'operate',
+    fixed: 'right',
+    width: 120,
+    align: 'center',
+    cell: (h, { row }) => {
+      return (
+        <div class="table-operations">
+          <t-link
+            theme="primary"
+            hover="color"
+            onClick={(e) => {
+              e.stopPropagation();
+              handleEdit(row);
+            }}
+          >
+            修改
+          </t-link>
+          <t-link
+            theme="danger"
+            hover="color"
+            onClick={(e) => {
+              e.stopPropagation();
+              handleDelete(row);
+            }}
+          >
+            删除
+          </t-link>
+        </div>
+      );
+    },
+  },
+];
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  fetchData,
+  search,
+  onChange,
+} = useFetchTable(customeryQueryApi, { params });
+
 const handleAdd = () => {
   curRow.value = null;
   showEditCustomerDialog.value = true;

+ 29 - 11
src/views/system/config-manage/device-manage/edit-device-dialog.vue

@@ -14,6 +14,11 @@
             <t-input v-model="formData.name" clearable />
           </t-form-item>
         </t-col>
+        <t-col :span="6">
+          <t-form-item label="序列号" name="serialNo">
+            <t-input v-model="formData.serialNo" clearable />
+          </t-form-item>
+        </t-col>
         <t-col :span="6">
           <t-form-item label="品牌" name="brand">
             <t-input v-model="formData.brand" clearable />
@@ -24,21 +29,14 @@
             <t-date-picker
               v-model="formData.buyTime"
               mode="date"
-              value-format="YYYY-MM-DD"
-              type="date"
+              value-type="time-stamp"
             />
           </t-form-item>
         </t-col>
         <t-col :span="6">
           <t-form-item label="供应商" name="supplierId">
-            <t-select v-model="formData.supplierId">
-              <t-option
-                v-for="(val, key) in RUNNING_STATUS"
-                :key="key"
-                :label="val"
-                :value="key"
-              />
-            </t-select>
+            <select-supplier v-model="formData.supplierId" type="DEVICE">
+            </select-supplier>
           </t-form-item>
         </t-col>
         <t-col :span="6">
@@ -97,6 +95,7 @@ const title = computed(() => {
 
 const { formData, isEdit } = useClearDialog(
   {
+    id: null,
     name: '',
     serialNo: '',
     brand: '',
@@ -107,7 +106,12 @@ const { formData, isEdit } = useClearDialog(
     scanCount: null,
   },
   props,
-  null
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+  }
 );
 const rules = {
   name: [
@@ -124,6 +128,20 @@ const rules = {
       trigger: 'change',
     },
   ],
+  serialNo: [
+    {
+      required: true,
+      message: '序列号必填',
+      type: 'error',
+      trigger: 'change',
+    },
+    {
+      max: 100,
+      message: '至多需要100个字',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
   brand: [
     { required: true, message: '品牌必填', type: 'error', trigger: 'change' },
     {

+ 18 - 5
src/views/system/config-manage/device-manage/index.vue

@@ -16,7 +16,14 @@
           onChange,
           total: pagination.total,
         }"
+        v-loading="tableLoading"
       >
+        <template #buy-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
+        <template #status="{ col, row }">
+          {{ runningStatusFilter(row[col.colKey]) }}
+        </template>
       </t-table>
     </div>
 
@@ -34,6 +41,7 @@ import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import useFetchTable from '@/hooks/useFetchTable';
 import EditDeviceDialog from './edit-device-dialog.vue';
 import { deviceQueryApi, deviceDestroyApi } from '@/api/system';
+import { runningStatusFilter, timestampFilter } from '@/utils/filter';
 
 const showEditDeviceDialog = ref(false);
 const curRow = ref(null);
@@ -42,11 +50,11 @@ const columns = [
   { colKey: 'name', title: '设备编号' },
   { colKey: 'serialNo', title: '序列号' },
   { colKey: 'brand', title: '品牌' },
-  { colKey: 'buyTime', title: '购买时间' },
+  { colKey: 'buyTime', title: '购买时间', cell: 'buy-time', width: 170 },
   { colKey: 'supplier', title: '供应商' },
-  { colKey: 'status', title: '运行状态' },
+  { colKey: 'status', title: '运行状态', cell: 'status', width: 80 },
   { colKey: 'location', title: '当前所在地' },
-  { colKey: 'scanCount', title: '总扫描量' },
+  { colKey: 'scanCount', title: '总扫描量', width: 80 },
   {
     title: '操作',
     colKey: 'operate',
@@ -81,8 +89,13 @@ const columns = [
     },
   },
 ];
-const { pagination, tableData, fetchData, onChange } =
-  useFetchTable(deviceQueryApi);
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  fetchData,
+  onChange,
+} = useFetchTable(deviceQueryApi);
 
 const handleAdd = () => {
   curRow.value = null;

+ 7 - 1
src/views/system/config-manage/service-level-manage/edit-service-level-dialog.vue

@@ -78,13 +78,19 @@ const title = computed(() => {
 
 const { formData, isEdit } = useClearDialog(
   {
+    id: null,
     level: '',
     type: '',
     devices: null,
     roleList: [],
   },
   props,
-  null
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+  }
 );
 const rules = {
   level: [

+ 18 - 5
src/views/system/config-manage/service-level-manage/index.vue

@@ -16,7 +16,14 @@
           onChange,
           total: pagination.total,
         }"
+        v-loading="tableLoading"
       >
+        <template #type="{ col, row }">
+          {{ customerTypeFilter(row[col.colKey]) }}
+        </template>
+        <template #create-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
         <template #role-list="{ col, row }">
           {{
             row[col.colKey]
@@ -41,6 +48,7 @@ import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import useFetchTable from '@/hooks/useFetchTable';
 import EditServiceLevelDialog from './edit-service-level-dialog.vue';
 import { serviceLevelQueryApi, serviceLevelDeleteApi } from '@/api/system';
+import { customerTypeFilter, timestampFilter } from '@/utils/filter';
 
 const showEditServiceLevelDialog = ref(false);
 const curRow = ref(null);
@@ -48,10 +56,10 @@ const curRow = ref(null);
 const columns = [
   { colKey: 'level', title: '服务档位名称' },
   { colKey: 'type', title: '业务类型', width: 100 },
-  { colKey: 'roleList', title: '项目角色配置', cell: 'role-list', width: 170 },
-  { colKey: 'devices', title: '设备配置(台)' },
+  { colKey: 'roleList', title: '项目角色配置', cell: 'role-list' },
+  { colKey: 'devices', title: '设备配置(台)', width: 120 },
   { colKey: 'createName', title: '创建人' },
-  { colKey: 'createTime', title: '创建时间', width: 170 },
+  { colKey: 'createTime', title: '创建时间', width: 170, cell: 'create-time' },
   {
     title: '操作',
     colKey: 'operate',
@@ -86,8 +94,13 @@ const columns = [
     },
   },
 ];
-const { pagination, tableData, fetchData, onChange } =
-  useFetchTable(serviceLevelQueryApi);
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  fetchData,
+  onChange,
+} = useFetchTable(serviceLevelQueryApi);
 
 const handleAdd = () => {
   curRow.value = null;

+ 7 - 1
src/views/system/config-manage/supplier-manage/edit-supplier-dialog.vue

@@ -66,6 +66,7 @@ const title = computed(() => {
 
 const { formData, isEdit } = useClearDialog(
   {
+    id: null,
     code: '',
     name: '',
     type: '',
@@ -73,7 +74,12 @@ const { formData, isEdit } = useClearDialog(
     enable: true,
   },
   props,
-  null
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+  }
 );
 const rules = {
   name: [

+ 11 - 5
src/views/system/config-manage/supplier-manage/index.vue

@@ -16,6 +16,7 @@
           onChange,
           total: pagination.total,
         }"
+        v-loading="tableLoading"
       >
         <template #type="{ row }">
           {{ supplierTypeFilter(row.type) }}
@@ -38,7 +39,7 @@
               修改
             </t-link>
             <t-link
-              :theme="row.enable ? 'primary' : 'danger'"
+              :theme="row.enable ? 'danger' : 'primary'"
               hover="color"
               @click="
                 (e) => {
@@ -83,13 +84,18 @@ const columns = [
     title: '操作',
     colKey: 'operate',
     fixed: 'right',
-    width: 120,
+    width: 100,
     align: 'center',
     cell: 'operate',
   },
 ];
-const { pagination, tableData, fetchData, onChange } =
-  useFetchTable(supplierQueryApi);
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  fetchData,
+  onChange,
+} = useFetchTable(supplierQueryApi);
 
 const handleAdd = () => {
   curRow.value = null;
@@ -104,6 +110,6 @@ const handleEnable = async (row) => {
 
   if (!res) return;
   MessagePlugin.success('操作成功');
-  fetchData();
+  row.enable = !row.enable;
 };
 </script>

+ 8 - 1
src/views/system/notice-log/log-manage/index.vue

@@ -16,6 +16,7 @@
             total: pagination.total,
             current: pagination.page,
           }"
+          v-loading="tableLoading"
         >
         </t-table>
       </div>
@@ -32,7 +33,13 @@ const columns = [
   { colKey: 'a', title: '时间', width: 170 },
   { colKey: 'b', title: '内容' },
 ];
-const { pagination, tableData, search, onChange } = useFetchTable(logListApi);
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  search,
+  onChange,
+} = useFetchTable(logListApi);
 
 const fields = ref([
   {

+ 7 - 1
src/views/system/notice-log/notice-manage/edit-notice-dialog.vue

@@ -77,13 +77,19 @@ const title = computed(() => {
 
 const { formData, isEdit } = useClearDialog(
   {
+    id: null,
     type: '',
     unit: '',
     name: '',
     content: '',
   },
   props,
-  null
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+  }
 );
 const rules = {
   name: [

+ 87 - 69
src/views/system/notice-log/notice-manage/index.vue

@@ -25,6 +25,7 @@
           total: pagination.total,
           current: pagination.page,
         }"
+        v-loading="tableLoading"
         @select-change="selectChange"
       >
       </t-table>
@@ -39,25 +40,95 @@
 </template>
 
 <script setup lang="jsx" name="NoticeManage">
-import { ref, reactive } from 'vue';
+import { ref, reactive, computed } from 'vue';
 import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
+import { omit } from 'lodash';
 import useFetchTable from '@/hooks/useFetchTable';
 import EditNoticeDialog from './edit-notice-dialog.vue';
 import {
-  noticeListApi,
+  noticeQueryApi,
   noticeDestroyApi,
   noticePublishApi,
   noticeCancelPublishApi,
 } from '@/api/system';
+
 const showEditNoticeDialog = ref(false);
 const curRow = ref(null);
 const selectedRowKeys = ref([]);
 
+const fields = ref([
+  {
+    prop: 'status',
+    label: '发布状态',
+    type: 'select',
+    labelWidth: 100,
+    colSpan: 5,
+    options: [
+      { value: 1, label: '已发布' },
+      { value: 2, label: '未发布' },
+    ],
+  },
+  {
+    prop: 'type',
+    label: '类型',
+    type: 'select',
+    labelWidth: 60,
+    colSpan: 5,
+    options: [{ value: 1, label: '公告' }],
+  },
+  {
+    prop: 'publishTime',
+    label: '发布时间',
+    type: 'daterange',
+    labelWidth: 100,
+    colSpan: 7,
+    attrs: {
+      clearable: true,
+    },
+  },
+  {
+    prop: 'query',
+    label: '消息名称',
+    labelWidth: 100,
+    colSpan: 5,
+    attrs: {
+      placeholder: '消息名称模糊查询',
+      clearable: true,
+    },
+  },
+  {
+    type: 'buttons',
+    colSpan: 2,
+    children: [
+      {
+        type: 'button',
+        text: '查询',
+        onClick: () => {
+          search();
+        },
+      },
+    ],
+  },
+]);
+const params = reactive({
+  status: '',
+  type: '',
+  query: '',
+  publishTime: [],
+});
+
+const computedParams = computed(() => {
+  let data = omit(params.value, ['publishTime']);
+  data.startTime = params.publishTime[0];
+  data.endTime = params.publishTime[1];
+  return data;
+});
+
 const columns = [
   { colKey: 'row-select', type: 'multiple', width: 50 },
-  { colKey: 'a', title: '类型' },
-  { colKey: 'b', title: '消息名称' },
-  { colKey: 'c', title: '发布状态' },
+  { colKey: 'type', title: '类型' },
+  { colKey: 'title', title: '消息名称' },
+  { colKey: 'status', title: '发布状态' },
   {
     title: '操作',
     colKey: 'operate',
@@ -112,71 +183,18 @@ const columns = [
     },
   },
 ];
-const { pagination, tableData, fetchData, search, onChange } = useFetchTable(
-  noticeListApi,
-  {
-    fetchDataHandle: () => {
-      selectedRowKeys.value = [];
-    },
-  }
-);
-
-const fields = ref([
-  {
-    prop: 'a',
-    label: '发布状态',
-    type: 'select',
-    labelWidth: 100,
-    colSpan: 5,
-    options: [
-      { value: 1, label: '已发布' },
-      { value: 2, label: '未发布' },
-    ],
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  fetchData,
+  search,
+  onChange,
+} = useFetchTable(noticeQueryApi, {
+  fetchDataHandle: () => {
+    selectedRowKeys.value = [];
   },
-  {
-    prop: 'b',
-    label: '类型',
-    type: 'select',
-    labelWidth: 60,
-    colSpan: 5,
-    options: [{ value: 1, label: '公告' }],
-  },
-  {
-    prop: 'c',
-    label: '发布时间',
-    type: 'daterange',
-    labelWidth: 100,
-    colSpan: 7,
-  },
-  {
-    prop: 'd',
-    label: '消息名称',
-    labelWidth: 100,
-    colSpan: 5,
-    attrs: {
-      placeholder: '消息名称模糊查询',
-      clearable: true,
-    },
-  },
-  {
-    type: 'buttons',
-    colSpan: 2,
-    children: [
-      {
-        type: 'button',
-        text: '查询',
-        onClick: () => {
-          search();
-        },
-      },
-    ],
-  },
-]);
-const params = reactive({
-  a: '',
-  b: '',
-  c: [],
-  d: '',
+  params: computedParams,
 });
 
 const selectChange = (value) => {