浏览代码

工时统计页面增加姓名查询条件

刘洋 5 月之前
父节点
当前提交
a5d16818f4
共有 1 个文件被更改,包括 51 次插入43 次删除
  1. 51 43
      src/views/work-hours/work-hours-manage/work-statistics/index.vue

+ 51 - 43
src/views/work-hours/work-hours-manage/work-statistics/index.vue

@@ -73,7 +73,7 @@
 </template>
 
 <script setup name="WorkStatistics">
-import { ref, reactive, onMounted, computed } from 'vue';
+import { ref, reactive, onMounted, computed, watch } from 'vue';
 import { DialogPlugin, MessagePlugin } from 'tdesign-vue-next';
 import { ErrorCircleFilledIcon } from 'tdesign-icons-vue-next';
 import useFetchTable from '@/hooks/useFetchTable';
@@ -104,52 +104,52 @@ const str2Html = (str) => {
 const curRow = ref(null);
 const showAppendDialog = ref(false);
 
-const fields = ref([
-  {
-    prop: 'serviceId',
-    label: '服务单元',
-    type: 'select',
-    labelWidth: 90,
-    colSpan: 6,
-    cell: 'service',
-  },
-  {
-    prop: 'type',
-    label: '统计维度',
-    type: 'select',
-    labelWidth: 80,
-    colSpan: 6,
-    options: dictToOptionList(STATISTICAL_DIMENSION),
-    attrs: {
-      onChange: () => {
-        mixinSearch();
-      },
+const fields = computed(() => {
+  return [
+    {
+      prop: 'serviceId',
+      label: '服务单元',
+      type: 'select',
+      labelWidth: 90,
+      colSpan: 6,
+      cell: 'service',
     },
-  },
-  {
-    type: 'buttons',
-    colSpan: 3,
-    children: [
-      {
-        type: 'button',
-        text: '搜索',
-        onClick: () => {
+    {
+      prop: 'type',
+      label: '统计维度',
+      type: 'select',
+      labelWidth: 80,
+      colSpan: 6,
+      options: dictToOptionList(STATISTICAL_DIMENSION),
+      attrs: {
+        onChange: () => {
           mixinSearch();
         },
       },
-      // {
-      //   type: 'button',
-      //   text: '导出统计结果',
-      //   attrs: {
-      //     theme: 'success',
-      //   },
-      //   onClick: () => {
-      //     exportFile();
-      //   },
-      // },
-    ],
-  },
-]);
+    },
+    params.type === 'BY_PERSON'
+      ? {
+          prop: 'personName',
+          label: '姓名',
+          labelWidth: 55,
+          colSpan: 6,
+        }
+      : null,
+    {
+      type: 'buttons',
+      colSpan: 3,
+      children: [
+        {
+          type: 'button',
+          text: '搜索',
+          onClick: () => {
+            mixinSearch();
+          },
+        },
+      ],
+    },
+  ];
+});
 const mixinSearch = () => {
   if (params.serviceId) {
     tableData.value = [];
@@ -159,6 +159,7 @@ const mixinSearch = () => {
 const params = reactive({
   serviceId: '',
   type: 'BY_PERSON',
+  personName: '',
 });
 
 const exportFile = () => {
@@ -349,4 +350,11 @@ const appendSuccess = () => {
   showAppendDialog.value = false;
   fetchData();
 };
+
+watch(
+  () => params.type,
+  () => {
+    params.personName = '';
+  }
+);
 </script>