zhengnaiwen_citu 5 bulan lalu
induk
melakukan
87f784db0d

+ 6 - 1
src/components/AutoComponents/MTable/MTableColumn.vue

@@ -1,5 +1,5 @@
 <template>
-  <el-table-column v-bind="item">
+  <el-table-column v-bind="item" :sortable="(item.prop === 'actions' || hideSortable) ? false : item.sortable ?? 'custom'">
     <template slot="header" slot-scope="scope">
       <template v-if="$scopedSlots[`${item.prop}-header`]">
         <slot :name="`${item.prop}-header`" v-bind="scope"></slot>
@@ -24,6 +24,7 @@
       <m-table-column
         v-for="(_item, i) in item.children"
         :key="i"
+        :hideSortable="hideSortable"
         :item="_item"
       >
         <!-- 将插槽逐层传递 -->
@@ -39,6 +40,10 @@
 export default {
   name: 'm-table-column',
   props: {
+    hideSortable: {
+      type: Boolean,
+      default: false
+    },
     item: {
       type: Object,
       default: () => ({})

+ 2 - 1
src/components/AutoComponents/MTable/index.vue

@@ -21,6 +21,7 @@
         <!-- <el-table-column v-if="['selection','index'].includes(header.type)" v-bind="header" :key="index" /> -->
         <m-table-column
           :key="(header.prop ?? header.label) || index"
+          :hideSortable="!($listeners.sortChange || $listeners['sort-change'])"
           :item="header"
         >
           <template v-if="$scopedSlots[header.prop]" #[header.prop]="scope">
@@ -99,7 +100,7 @@ export default {
         return
       }
       this.$emit('sort-change', [
-        { column: e.prop, asc: e.order === 'ascending' }
+        { column: e.prop.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`), asc: e.order === 'ascending' }
       ])
     }
   }

+ 8 - 1
src/views/accumulatePoints/accumulatePointsIntegralList/index.vue

@@ -9,6 +9,7 @@
       :page-current="pageInfo.current"
       :total="total"
       @page-change="onPageChange"
+      @sort-change="onSortChange"
     >
       <template #score="{ row }">
         <el-tag type="orange">{{ row.score }}</el-tag>
@@ -47,6 +48,7 @@ export default {
         current: 1,
         size: 10
       },
+      orders: [],
       loading: false,
       searchValues: {
         employeeName: null,
@@ -88,7 +90,8 @@ export default {
       try {
         const { data } = await getAccumulatePointList({
           page: {
-            ...this.pageInfo
+            ...this.pageInfo,
+            orders: this.orders
           },
           entity: {
             ...this.searchValues
@@ -114,6 +117,10 @@ export default {
     onPageChange (index) {
       this.pageInfo.current = index
       this.onInit()
+    },
+    onSortChange (v) {
+      this.orders = v
+      this.onInit()
     }
   }
 }

+ 5 - 0
src/views/humanResources/panorama/index.vue

@@ -33,6 +33,7 @@
       :page-current="pageInfo.current"
       :total="total"
       @page-change="onPageChange"
+      @sort-change="onSortChange"
     >
       <template #parentOrganizationName="{ row }">
         <span class="text-link" @click="onJump(row.parentOrganizationNo)">
@@ -155,6 +156,10 @@ export default {
     onSearch () {
       this.pageInfo.current = 1
       this.onInit()
+    },
+    onSortChange (e) {
+      this.orders = e
+      this.onInit()
     }
   }
 }

+ 10 - 7
src/views/humanResources/roster/index.vue

@@ -12,6 +12,7 @@
       :total="total"
       :default-sort="{ prop: 'sort', order: 'ascending' }"
       @page-change="pageChange"
+      @sort-change="sortChange"
     >
       <template #card-tools v-if="!$attrs.panorama">
         <m-button type="orange" size="small" icon="el-icon-plus" @click="onAdd">新增</m-button>
@@ -43,6 +44,9 @@ import {
   exportRoster,
   downloadRosterTemplate
 } from '@/api/system'
+import {
+  dateFormat
+} from '@/utils/date'
 import { mapGetters } from 'vuex'
 export default {
   name: 'sys-roster',
@@ -112,7 +116,7 @@ export default {
         { label: '岗位类别', prop: 'positionCategory' },
         { label: '职务层级', prop: 'jobLevel' },
         { label: '通行证号', prop: 'passes' },
-        { label: '工行时间', prop: 'tradeUnionsTimeText' },
+        { label: '工行时间', prop: 'tradeUnionsTime' },
         { label: '薪酬档次', align: 'center', prop: 'salaryCategory' },
         { label: '薪酬级别', align: 'center', prop: 'salaryLevel' }
       ]
@@ -170,14 +174,9 @@ export default {
           ...query
         })
         this.items = data.records.map(e => {
-          const date = new Date(e.tradeUnionsTime)
-          // 获取年、月、日
-          const year = date.getFullYear()
-          const month = String(date.getMonth() + 1).padStart(2, '0') // 月份从0开始,所以要加1
-          const day = String(date.getDate()).padStart(2, '0')
           return {
             ...e,
-            tradeUnionsTimeText: `${year}年${month}月${day}日`
+            tradeUnionsTime: dateFormat('YYYY-mm-dd', new Date(e.tradeUnionsTime))
           }
         })
         this.total = data.total
@@ -250,6 +249,10 @@ export default {
       this.pageInfo.current = index
       this.init()
     },
+    sortChange (v) {
+      this.orders = v
+      this.init()
+    },
     onChange () {
       this.$refs.rosterVersionRefs.open(this.headers.slice(0, -1))
     }

+ 10 - 6
src/views/salary/solution/components/ListTemplate.vue

@@ -14,6 +14,7 @@
       :page-current="pageInfo.current"
       v-bind="$attrs"
       @page-change="onPageChange"
+      @sort-change="onSortChange"
     >
       <template #card-tools>
         <slot name="tool"></slot>
@@ -67,6 +68,10 @@ export default {
       ],
       loading: false,
       total: 0,
+      orders: [{
+        asc: false,
+        column: 'performance_solution_id'
+      }],
       pageInfo: {
         current: 1,
         size: 10
@@ -80,12 +85,7 @@ export default {
         const { data } = await getSolutionPage({
           page: {
             ...this.pageInfo,
-            orders: [
-              {
-                asc: false,
-                column: 'performance_solution_id'
-              }
-            ]
+            orders: this.orders
           },
           entity: {
             ...this.searchQuery,
@@ -108,6 +108,10 @@ export default {
     onPageChange (page) {
       this.pageInfo.current = page
       this.onInit()
+    },
+    onSortChange (v) {
+      this.orders = v
+      this.onInit()
     }
   }
 }

+ 5 - 21
src/views/salary/upload/index.vue

@@ -122,27 +122,11 @@ export default {
       ]
     }
   },
-  // created () {
-  //   this.onInit()
-  // },
+  created () {
+    this.onInit()
+  },
   methods: {
     async onInit () {
-      this.onGetHistory()
-      // try {
-      //   const { data } = await getSalaryCalculateTemplate()
-      //   this.categoryItems = data
-      //   if (!data.length) {
-      //     return
-      //   }
-      //   this.searchValues.category = data[0].category
-      //   this.queryValues = { ...this.searchValues }
-      //   this.onChange()
-      //   this.onGetHistory()
-      // } catch (error) {
-      //   this.$message.error(error)
-      // }
-    },
-    async onGetHistory () {
       try {
         this.loading = true
         const { data } = await getSalaryCalculateFiles(this.queryValues)
@@ -158,7 +142,7 @@ export default {
       //   this.searchValues.category = this.categoryItems[0]?.category ?? null
       // }
       this.queryValues = { ...this.searchValues }
-      this.onGetHistory()
+      this.onInit()
     },
     // onChange () {
     //   const items = this.categoryItems.find(e => e.category === this.queryValues.category)?.files ?? []
@@ -212,7 +196,7 @@ export default {
           formData.append('category', this.queryValues.category)
           await uploadSalaryCalculateFiles(formData)
           this.$message.success('保存成功')
-          this.onGetHistory()
+          this.onInit()
         } catch (error) {
           this.$message.error(error)
         } finally {

+ 16 - 10
src/views/welfare/components/ListTemplate.vue

@@ -14,6 +14,7 @@
       :page-current="pageInfo.current"
       v-bind="$attrs"
       @page-change="onPageChange"
+      @sort-change="onSortChange"
     >
       <template #card-tools>
         <slot name="tool"></slot>
@@ -76,12 +77,18 @@ export default {
       pageInfo: {
         current: 1,
         size: 10
-      }
+      },
+      orders: [
+        {
+          asc: false,
+          column: 'subsidy_id'
+        }
+      ]
     }
   },
-  // created () {
-  //   this.onInit()
-  // },
+  created () {
+    this.onInit()
+  },
   methods: {
     async onInit () {
       this.loading = true
@@ -89,12 +96,7 @@ export default {
         const { data } = await getWelfarePage({
           page: {
             ...this.pageInfo,
-            orders: [
-              {
-                asc: false,
-                column: 'subsidy_id'
-              }
-            ]
+            orders: this.orders
           },
           entity: {
             ...this.searchQuery,
@@ -117,6 +119,10 @@ export default {
     onPageChange (page) {
       this.pageInfo.current = page
       this.onInit()
+    },
+    onSortChange (sort) {
+      this.orders = sort
+      this.onInit()
     }
   }
 }