zhangjie 1 жил өмнө
parent
commit
1c9a7f1780

+ 1 - 0
components.d.ts

@@ -16,6 +16,7 @@ declare module 'vue' {
     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']
+    SelectServiceUnit: typeof import('./src/components/common/select-service-unit/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']

+ 33 - 0
src/api/service-unit.js

@@ -0,0 +1,33 @@
+import { request } from '@/utils/request.js';
+
+// unit-manage
+export const serviceUnitQueryApi = (data) =>
+  request({
+    url: '/api/service/service/unit/page',
+    params: data,
+  });
+export const serviceUnitEditApi = (data) =>
+  request({
+    url: '/api/service/service/unit/edit',
+    data,
+  });
+export const serviceUnitPublishApi = (id) =>
+  request({
+    url: '/api/service/service/unit/publish',
+    params: { id },
+  });
+export const serviceUnitClozeApi = (id) =>
+  request({
+    url: '/api/service/service/unit/cloze',
+    params: { id },
+  });
+export const serviceUnitRestartApi = (id) =>
+  request({
+    url: '/api/service/service/unit/restart',
+    params: { id },
+  });
+export const serviceUnitCancelApi = (id) =>
+  request({
+    url: '/api/service/service/unit/cancel',
+    params: { id },
+  });

+ 1 - 1
src/api/system.js

@@ -172,7 +172,7 @@ export const checkinDeleteApi = (id) =>
 // log-manage
 export const logListApi = (data) =>
   request({
-    url: '/api/sys/log/list',
+    url: '/api/sys/log/page',
     params: data,
   });
 

+ 51 - 0
src/components/common/select-service-unit/index.vue

@@ -0,0 +1,51 @@
+<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="SelectServiceUnit">
+import { onMounted, reactive, ref, useAttrs, watch } from 'vue';
+import { serviceUnitQueryApi } from '@/api/service-unit';
+
+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 serviceUnitQueryApi({ pageNumber: 1, pageSize: 100 }).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>

+ 9 - 0
src/config/constants.js

@@ -24,3 +24,12 @@ export const PUBLISH_STATUS = {
   PUBLISH: '已发布',
   UN_PUBLISH: '未发布',
 };
+
+// 服务单元管理 ------->
+// 服务单元管理
+export const SERVICE_UNIT_STATUS = {
+  NEW: '新建',
+  PUBLISH: '已发布',
+  FINISH: '已完结',
+  CANCEL: '已作废',
+};

+ 5 - 0
src/utils/filter.js

@@ -4,6 +4,7 @@ import {
   RUNNING_STATUS,
   NOTICE_TYPE,
   PUBLISH_STATUS,
+  SERVICE_UNIT_STATUS,
 } from '@/config/constants';
 import { dateFormat } from './tool';
 
@@ -32,3 +33,7 @@ export function noticeTypeFilter(val) {
 export function publishStatusFilter(val) {
   return PUBLISH_STATUS[val] || DEFAULT_FIELD;
 }
+// 服务单元管理
+export function serviceUnitStatusFilter(val) {
+  return SERVICE_UNIT_STATUS[val] || DEFAULT_FIELD;
+}

+ 126 - 34
src/views/service-unit/service-unit-manage/unit-manage/add-unit-dialog.vue

@@ -1,47 +1,61 @@
 <template>
   <my-dialog
     :visible="visible"
-    @close="emit('update:visible', false)"
     :header="`${isEdit ? '修改' : '新增'}服务单元`"
-    :width="600"
+    :width="650"
     :closeOnOverlayClick="false"
+    @close="emit('update:visible', false)"
   >
-    <t-form ref="formRef" :model="formData" labelWidth="120px">
-      <t-form-item label="服务单元名称:">
-        <t-input v-model="formData.a"></t-input>
+    <t-form ref="formRef" :data="formData" :rules="rules" labelWidth="140px">
+      <t-form-item label="服务单元名称:" name="name">
+        <t-input v-model="formData.name"></t-input>
       </t-form-item>
-      <t-form-item label="业务类型:">
-        <t-select v-model="formData.b"></t-select>
+      <t-form-item label="业务类型:" name="type">
+        <t-select v-model="formData.type">
+          <t-option
+            v-for="(val, key) in CUSTOMER_TYPE"
+            :key="key"
+            :label="val"
+            :value="key"
+          />
+        </t-select>
       </t-form-item>
-      <t-form-item label="服务开始时间:">
-        <t-date-picker v-model="formData.c" />
+      <t-form-item label="服务开始时间:" name="startTime">
+        <t-date-picker
+          v-model="formData.startTime"
+          :disable-date="{ after: formData.endTime }"
+          value-type="time-stamp"
+        />
       </t-form-item>
-      <t-form-item label="服务截止时间:">
-        <t-date-picker v-model="formData.d" />
+      <t-form-item label="服务截止时间:" name="endTime">
+        <t-date-picker
+          v-model="formData.endTime"
+          :disable-date="{ before: formData.startTime }"
+          value-type="time-stamp"
+        />
       </t-form-item>
-      <t-form-item label="区域配比:">
+      <t-form-item label="区域配比:" name="regionPeopleCount" required-mark>
         <t-input-number
-          v-model="formData.e"
+          v-model="formData.regionPeopleCount"
           theme="column"
           :decimalPlaces="0"
-          align="center"
           :max="1000"
           :min="0"
-          style="width: 80px"
+          style="width: 100px"
         ></t-input-number>
         <span style="padding: 0 10px">:</span>
         <t-input-number
-          v-model="formData.f"
+          v-model="formData.regionProjectCount"
           theme="column"
           :decimalPlaces="0"
-          align="center"
           :max="1000"
           :min="0"
-          style="width: 80px"
+          style="width: 100px"
         ></t-input-number>
+        <span style="padding: 0 10px"> (区域协调人数量/项目数量)</span>
       </t-form-item>
-      <t-form-item label="负责人:">
-        <t-select v-model="formData.g"></t-select>
+      <t-form-item label="负责人:" name="serviceLeadId">
+        <select-user v-model="formData.serviceLeadId"></select-user>
       </t-form-item>
     </t-form>
     <template #foot>
@@ -53,8 +67,12 @@
   </my-dialog>
 </template>
 <script setup name="AddUnitDialog">
-import useClearDialog from '@/hooks/useClearDialog';
 import { ref } from 'vue';
+import { MessagePlugin } from 'tdesign-vue-next';
+import useClearDialog from '@/hooks/useClearDialog';
+import { serviceUnitEditApi } from '@/api/service-unit';
+import { CUSTOMER_TYPE } from '@/config/constants';
+
 const emit = defineEmits(['update:visible']);
 const formRef = ref(null);
 
@@ -62,22 +80,96 @@ const props = defineProps({
   visible: Boolean,
   curRow: Object,
 });
-const getDetail = async () => {
-  //编辑状态下获取回显数据的接口请求业务,如果curRow里的字段够用,就直接把curRow里的字段赋值给formData
-  alert('获取详情中...');
-};
+
 const { formData, isEdit } = useClearDialog(
   {
-    a: '',
-    b: '',
-    c: '',
-    d: '',
-    e: '',
-    f: '',
-    g: '',
+    id: null,
+    name: '',
+    type: '',
+    startTime: '',
+    endTime: '',
+    regionPeopleCount: '',
+    regionProjectCount: '',
+    serviceLeadId: '',
   },
   props,
-  getDetail
+  formRef,
+  () => {
+    for (let key in formData) {
+      formData[key] = props.curRow[key];
+    }
+  }
 );
-const save = () => {};
+
+const rules = {
+  name: [
+    {
+      required: true,
+      message: '名称必填',
+      type: 'error',
+      trigger: 'change',
+    },
+    {
+      max: 50,
+      message: '至多需要50个字',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  type: [
+    {
+      required: true,
+      message: '类型必选',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  startTime: [
+    {
+      required: true,
+      message: '服务开始时间必填',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  endTime: [
+    {
+      required: true,
+      message: '服务截止时间必填',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+  regionPeopleCount: [
+    {
+      validator: () => {
+        if (!formData.regionPeopleCount || !formData.regionProjectCount)
+          return { result: false, message: '请完成区域配比设置' };
+
+        return { result: true, type: 'success' };
+      },
+      type: 'error',
+      trigger: 'blur',
+    },
+  ],
+  serviceLeadId: [
+    {
+      required: true,
+      message: '负责人必选',
+      type: 'error',
+      trigger: 'change',
+    },
+  ],
+};
+const save = async () => {
+  const valid = await formRef.value.validate();
+  if (valid !== true) return;
+
+  const res = await serviceUnitEditApi(formData).catch(() => {});
+  if (!res) return;
+
+  MessagePlugin.success('保存成功');
+  emit('update:visible', false);
+  emit('success');
+};
 </script>

+ 240 - 79
src/views/service-unit/service-unit-manage/unit-manage/index.vue

@@ -1,16 +1,13 @@
 <template>
   <div class="unit-manage flex flex-col h-full">
-    <SearchForm :fields="fields" :params="params"></SearchForm>
+    <SearchForm :fields="fields" :params="params">
+      <template #leader="{ item, params }">
+        <select-user v-model="params[item.prop]" clearable></select-user>
+      </template>
+    </SearchForm>
     <div class="flex-1 page-wrap">
       <div class="btn-group">
-        <t-button
-          theme="success"
-          @click="
-            curRow = null;
-            showAddUnitDialog = true;
-          "
-          >新增</t-button
-        >
+        <t-button theme="success" @click="handleAdd">新增</t-button>
       </div>
       <t-table
         size="small"
@@ -23,110 +20,154 @@
           defaultPageSize: 10,
           onChange,
           total: pagination.total,
+          current: pagination.page,
         }"
+        v-loading="tableLoading"
       >
+        <template #type="{ col, row }">
+          {{ customerTypeFilter(row[col.colKey]) }}
+        </template>
+        <template #status="{ col, row }">
+          {{ serviceUnitStatusFilter(row[col.colKey]) }}
+        </template>
+        <template #start-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
+        <template #end-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
+        <template #create-time="{ col, row }">
+          {{ timestampFilter(row[col.colKey]) }}
+        </template>
+        <template #operate="{ row }">
+          <div class="table-operations">
+            <t-link
+              v-if="row.status !== 'FINISH'"
+              theme="primary"
+              hover="color"
+              @click="handleEdit(row)"
+            >
+              修改
+            </t-link>
+            <t-link
+              v-if="row.status === 'NEW'"
+              theme="primary"
+              hover="color"
+              @click="handlePublish(row)"
+            >
+              发布
+            </t-link>
+            <t-link
+              v-if="row.status === 'NEW'"
+              theme="danger"
+              hover="color"
+              @click="handleDestroy(row)"
+            >
+              作废
+            </t-link>
+            <t-link
+              v-if="row.status === 'FINISH'"
+              theme="primary"
+              hover="color"
+              @click="handleRestart(row)"
+            >
+              重启
+            </t-link>
+            <t-link
+              v-if="row.status === 'PUBLISH'"
+              theme="danger"
+              hover="color"
+              @click="handleCloze(row)"
+            >
+              关闭
+            </t-link>
+            <t-link
+              v-if="row.status === 'NEW'"
+              theme="primary"
+              hover="color"
+              @click="handleSetGroup(row)"
+            >
+              设置考勤组
+            </t-link>
+          </div>
+        </template>
       </t-table>
     </div>
 
     <AddUnitDialog
       v-model:visible="showAddUnitDialog"
       :curRow="curRow"
+      @success="fetchData"
     ></AddUnitDialog>
   </div>
 </template>
 
 <script setup lang="jsx" name="UnitManage">
-import { ref, reactive } from 'vue';
-import { getTableData } from '@/api/test';
+import { ref, reactive, computed } from 'vue';
+import { omit } from 'lodash';
+import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import useFetchTable from '@/hooks/useFetchTable';
 import AddUnitDialog from './add-unit-dialog.vue';
+import {
+  timestampFilter,
+  customerTypeFilter,
+  serviceUnitStatusFilter,
+} from '@/utils/filter';
+import { SERVICE_UNIT_STATUS, CUSTOMER_TYPE } from '@/config/constants';
+import { dictToOptionList } from '@/utils/tool';
+import {
+  serviceUnitQueryApi,
+  serviceUnitCancelApi,
+  serviceUnitClozeApi,
+  serviceUnitRestartApi,
+  serviceUnitPublishApi,
+} from '@/api/service-unit';
+import { useRouter } from 'vue-router';
+
 const showAddUnitDialog = ref(false);
 const curRow = ref(null);
-
-const columns = [
-  { colKey: 'a', title: '服务单元名称' },
-  { colKey: 'b', title: '服务开始时间' },
-  { colKey: 'c', title: '服务截止时间' },
-  { colKey: 'd', title: '业务类型' },
-  { colKey: 'e', title: '负责人' },
-  { colKey: 'f', title: '区域配比' },
-  { colKey: 'g', title: '当前状态' },
-  { colKey: 'h', title: '创建人' },
-  { colKey: 'i', title: '创建时间' },
-  {
-    title: '操作',
-    colKey: 'operate',
-    fixed: 'right',
-    width: 260,
-    cell: (h, { row }) => {
-      return (
-        <div class="table-operations">
-          <t-link
-            theme="primary"
-            hover="color"
-            onClick={(e) => {
-              e.stopPropagation();
-              curRow.value = row;
-              showAddUnitDialog.value = true;
-            }}
-          >
-            修改
-          </t-link>
-          <t-link theme="primary" hover="color">
-            作废
-          </t-link>
-          <t-link theme="primary" hover="color">
-            重启
-          </t-link>
-          <t-link theme="primary" hover="color">
-            关闭
-          </t-link>
-          <t-link theme="primary" hover="color">
-            设置考勤组
-          </t-link>
-        </div>
-      );
-    },
-  },
-];
-const {
-  loading: tableLoading,
-  pagination,
-  tableData,
-  fetchData,
-  onChange,
-} = useFetchTable(getTableData);
-
-const refresh = async () => {};
+const router = useRouter();
 
 const fields = ref([
   {
-    prop: 'a',
+    prop: 'type',
     label: '业务类型',
     type: 'select',
     labelWidth: 100,
     colSpan: 5,
+    options: dictToOptionList(CUSTOMER_TYPE),
+    attrs: {
+      clearable: true,
+    },
   },
   {
-    prop: 'b',
+    prop: 'serviceLeadId',
     label: '负责人',
     type: 'select',
     labelWidth: 100,
     colSpan: 5,
+    cell: 'leader',
   },
   {
-    prop: 'c',
+    prop: 'status',
     label: '当前状态',
     type: 'select',
     labelWidth: 100,
     colSpan: 5,
+    options: dictToOptionList(SERVICE_UNIT_STATUS),
+    attrs: {
+      clearable: true,
+    },
   },
   {
-    prop: 'd',
+    prop: 'createTime',
     label: '创建时间',
     type: 'daterange',
     labelWidth: 100,
     colSpan: 7,
+    attrs: {
+      clearable: true,
+    },
   },
   {
     type: 'buttons',
@@ -135,23 +176,143 @@ const fields = ref([
       {
         type: 'button',
         text: '查询',
+        onClick: () => {
+          search();
+        },
       },
     ],
   },
   {
-    prop: 'e',
+    prop: 'serviceUnitName',
     label: '服务单元名称',
     labelWidth: 100,
     colSpan: 5,
+    attrs: {
+      clearable: true,
+    },
   },
 ]);
 const params = reactive({
-  a: '',
-  b: '',
-  c: '',
-  d: [],
-  e: '',
+  type: '',
+  serviceLeadId: '',
+  status: '',
+  createTime: [],
+  serviceUnitName: '',
+});
+
+const computedParams = computed(() => {
+  let data = omit(params, ['createTime']);
+  data.createStartTime = params.createTime[0];
+  data.createEndTime = params.createTime[1];
+  return data;
 });
-</script>
 
-<style></style>
+const columns = [
+  { colKey: 'name', title: '服务单元名称' },
+  {
+    colKey: 'startTime',
+    title: '服务开始时间',
+    cell: 'start-time',
+    width: 170,
+  },
+  { colKey: 'endTime', title: '服务截止时间', cell: 'end-time', width: 170 },
+  { colKey: 'type', title: '业务类型', cell: 'type', width: 100 },
+  { colKey: 'serviceLeadName', title: '负责人' },
+  { colKey: 'rate', title: '区域配比', width: 80 },
+  { colKey: 'status', title: '当前状态', cell: 'status', width: 80 },
+  { colKey: 'creatorName', title: '创建人' },
+  { colKey: 'createTime', title: '创建时间', cell: 'create-time', width: 170 },
+  {
+    title: '操作',
+    colKey: 'operate',
+    fixed: 'right',
+    width: 240,
+    cell: 'operate',
+  },
+];
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  search,
+  fetchData,
+  onChange,
+} = useFetchTable(serviceUnitQueryApi, { params: computedParams });
+
+const handleAdd = () => {
+  curRow.value = null;
+  showAddUnitDialog.value = true;
+};
+const handleEdit = (row) => {
+  curRow.value = row;
+  showAddUnitDialog.value = true;
+};
+const handleDestroy = (row) => {
+  const confirmDia = DialogPlugin({
+    header: '作废提示',
+    body: `您确定要作废当前服务单元吗?`,
+    confirmBtn: '确定',
+    cancelBtn: '取消',
+    onConfirm: async () => {
+      confirmDia.hide();
+      const res = await serviceUnitCancelApi(row.id).catch(() => {});
+      if (!res) return;
+      MessagePlugin.success('删除成功');
+      fetchData();
+    },
+  });
+};
+const handlePublish = (row) => {
+  const confirmDia = DialogPlugin({
+    header: '发布提示',
+    body: `您确定要发布当前服务单元吗?`,
+    confirmBtn: '确定',
+    cancelBtn: '取消',
+    onConfirm: async () => {
+      confirmDia.hide();
+      const res = await serviceUnitPublishApi(row.id).catch(() => {});
+      if (!res) return;
+      MessagePlugin.success('删除成功');
+      fetchData();
+    },
+  });
+};
+const handleRestart = (row) => {
+  const confirmDia = DialogPlugin({
+    header: '重启提示',
+    body: `您确定要重启当前服务单元吗?`,
+    confirmBtn: '确定',
+    cancelBtn: '取消',
+    onConfirm: async () => {
+      confirmDia.hide();
+      const res = await serviceUnitRestartApi(row.id).catch(() => {});
+      if (!res) return;
+      MessagePlugin.success('删除成功');
+      fetchData();
+    },
+  });
+};
+const handleCloze = (row) => {
+  const confirmDia = DialogPlugin({
+    header: '关闭提示',
+    body: `您确定要关闭当前服务单元吗?`,
+    confirmBtn: '确定',
+    cancelBtn: '取消',
+    onConfirm: async () => {
+      confirmDia.hide();
+      const res = await serviceUnitClozeApi(row.id).catch(() => {});
+      if (!res) return;
+      MessagePlugin.success('删除成功');
+      fetchData();
+    },
+  });
+};
+const handleSetGroup = (row) => {
+  router.push({
+    name: 'CheckinManage',
+    query: {
+      serviceId: row.id,
+    },
+  });
+};
+</script>

+ 45 - 33
src/views/system/config-manage/checkin-manage/index.vue

@@ -1,6 +1,13 @@
 <template>
   <div class="registration-query flex flex-col h-full">
-    <SearchForm :fields="fields" :params="params"></SearchForm>
+    <SearchForm :fields="fields" :params="params">
+      <template #service="{ item, params }">
+        <select-service-unit
+          v-model="params[item.prop]"
+          clearable
+        ></select-service-unit>
+      </template>
+    </SearchForm>
     <div class="flex-1 page-wrap">
       <div class="btn-group">
         <t-button theme="success" @click="handleAdd">新增</t-button>
@@ -54,7 +61,8 @@
 </template>
 
 <script setup lang="jsx" name="CheckinManage">
-import { ref, reactive } from 'vue';
+import { ref, reactive, onMounted } from 'vue';
+import { useRoute } from 'vue-router';
 import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import useFetchTable from '@/hooks/useFetchTable';
 import EditCheckinDialog from './edit-checkin-dialog.vue';
@@ -64,6 +72,35 @@ import { timestampFilter } from '@/utils/filter';
 const showEditCheckinDialog = ref(false);
 const curRow = ref(null);
 
+const route = useRoute();
+
+const fields = ref([
+  {
+    prop: 'serviceId',
+    label: '服务单元名称',
+    type: 'select',
+    labelWidth: 100,
+    colSpan: 5,
+    cell: 'service',
+  },
+  {
+    type: 'buttons',
+    colSpan: 2,
+    children: [
+      {
+        type: 'button',
+        text: '查询',
+        onClick: () => {
+          search();
+        },
+      },
+    ],
+  },
+]);
+const params = reactive({
+  serviceId: '',
+});
+
 const columns = [
   { colKey: 'service', title: '服务单元' },
   { colKey: 'status', title: '发布状态' },
@@ -118,37 +155,7 @@ const {
   fetchData,
   search,
   onChange,
-} = useFetchTable(checkinQueryApi);
-
-const fields = ref([
-  {
-    prop: 'serviceId',
-    label: '服务单元名称',
-    type: 'select',
-    labelWidth: 100,
-    colSpan: 5,
-    options: [
-      { value: 1, label: '已发布' },
-      { value: 2, label: '未发布' },
-    ],
-  },
-  {
-    type: 'buttons',
-    colSpan: 2,
-    children: [
-      {
-        type: 'button',
-        text: '查询',
-        onClick: () => {
-          search();
-        },
-      },
-    ],
-  },
-]);
-const params = reactive({
-  serviceId: '',
-});
+} = useFetchTable(checkinQueryApi, { params }, false);
 
 const handleAdd = () => {
   curRow.value = null;
@@ -173,4 +180,9 @@ const handleDelete = (row) => {
     },
   });
 };
+
+onMounted(() => {
+  params.serviceId = route.query.serviceId || '';
+  search();
+});
 </script>

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

@@ -79,7 +79,7 @@ const columns = [
             hover="color"
             onClick={(e) => {
               e.stopPropagation();
-              handleDistroy(row);
+              handleDestroy(row);
             }}
           >
             作废
@@ -101,7 +101,7 @@ const handleAdd = () => {
   curRow.value = null;
   showEditDeviceDialog.value = true;
 };
-const handleDistroy = (row) => {
+const handleDestroy = (row) => {
   const confirmDia = DialogPlugin({
     header: '操作提示',
     body: `确定要作废选中的记录吗`,

+ 33 - 17
src/views/system/notice-log/log-manage/index.vue

@@ -18,6 +18,9 @@
           }"
           v-loading="tableLoading"
         >
+          <template #create-time="{ col, row }">
+            {{ timestampFilter(row[col.colKey]) }}
+          </template>
         </t-table>
       </div>
     </div>
@@ -25,32 +28,25 @@
 </template>
 
 <script setup lang="jsx" name="LogManage">
-import { ref, reactive } from 'vue';
+import { ref, reactive, computed } from 'vue';
+import { omit } from 'lodash';
 import { logListApi } from '@/api/system';
 import useFetchTable from '@/hooks/useFetchTable';
-
-const columns = [
-  { colKey: 'a', title: '时间', width: 170 },
-  { colKey: 'b', title: '内容' },
-];
-const {
-  loading: tableLoading,
-  pagination,
-  tableData,
-  search,
-  onChange,
-} = useFetchTable(logListApi);
+import { timestampFilter } from '@/utils/filter';
 
 const fields = ref([
   {
-    prop: 'a',
+    prop: 'createTime',
     label: '时间范围',
     type: 'daterange',
     labelWidth: 100,
     colSpan: 7,
+    attrs: {
+      clearable: true,
+    },
   },
   {
-    prop: 'b',
+    prop: 'content',
     label: '关键字',
     labelWidth: 80,
     colSpan: 5,
@@ -74,7 +70,27 @@ const fields = ref([
   },
 ]);
 const params = reactive({
-  a: [],
-  b: '',
+  createTime: [],
+  content: '',
+});
+const computedParams = computed(() => {
+  let data = omit(params, ['createTime']);
+  data.startTime = params.createTime[0];
+  data.endTime = params.createTime[1];
+  return data;
+});
+
+const columns = [
+  { colKey: 'createTime', title: '时间', cell: 'create-time', width: 170 },
+  { colKey: 'content', title: '内容' },
+];
+const {
+  loading: tableLoading,
+  pagination,
+  tableData,
+  search,
+  onChange,
+} = useFetchTable(logListApi, {
+  params: computedParams,
 });
 </script>

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

@@ -202,7 +202,7 @@ const params = reactive({
 });
 
 const computedParams = computed(() => {
-  let data = omit(params.value, ['publishTime']);
+  let data = omit(params, ['publishTime']);
   data.startTime = params.publishTime[0];
   data.endTime = params.publishTime[1];
   return data;