zhengnaiwen_citu 3 kuukautta sitten
vanhempi
commit
4f68dd2021

+ 24 - 66
src/views/sandbox/index.vue

@@ -14,29 +14,18 @@
       @sort-change="onSortChange"
     >
       <template #actions="{ row }">
-        <m-button text type="primary" size="small" @click="onOpen('sandboxDetailsRefs', row)">查看规则</m-button>
-        <m-button text type="primary" size="small" @click="onOpen('sandboxParamRefs', row)">系数导向</m-button>
-        <m-button text type="success" size="small" @click="onCalculate(row)">开始测算</m-button>
-        <m-button text type="primary" size="small" @click="onCalculateHistory(row)">测算历史</m-button>
-        <m-button text type="success" size="small" @click="onSend(row)">发布</m-button>
+        <m-button text type="primary" size="small" @click="onOpen('sandboxListRefs', row)">选择规则</m-button>
       </template>
     </m-table>
-    <SandboxDetails ref="sandboxDetailsRefs"></SandboxDetails>
-    <SandboxParam ref="sandboxParamRefs" @refresh="onInit"></SandboxParam>
-    <SandboxCalculate ref="sandboxCalculateRefs"></SandboxCalculate>
-    <SandboxHistory ref="sandboxHistoryRefs"></SandboxHistory>
+    <SandboxList ref="sandboxListRefs"></SandboxList>
   </div>
 </template>
 
 <script>
 import {
-  sendSalaryRelease,
   getSolutionPage
 } from '@/api/salary'
-import SandboxDetails from './sandboxDetails.vue'
-import SandboxParam from './sandboxParam.vue'
-import SandboxCalculate from './sandboxCalculate.vue'
-import SandboxHistory from './sandboxHistory.vue'
+import SandboxList from './sandboxList.vue'
 export default {
   name: 'salary-solution-list',
   props: {
@@ -46,10 +35,7 @@ export default {
     }
   },
   components: {
-    SandboxDetails,
-    SandboxParam,
-    SandboxCalculate,
-    SandboxHistory
+    SandboxList
   },
   data () {
     return {
@@ -60,21 +46,21 @@ export default {
           prop: 'title',
           type: 'input',
           options: {
-            placeholder: '请输入方案名称'
-          }
-        },
-        {
-          label: '时间',
-          type: 'datePicker',
-          prop: 'time',
-          options: {
-            rangeSeparator: '至',
-            startPlaceholder: '开始时间',
-            endPlaceholder: '结束时间',
-            valueFormat: 'yyyy-MM-dd',
-            type: 'daterange'
+            placeholder: '请输入规则名称'
           }
         }
+        // {
+        //   label: '时间',
+        //   type: 'datePicker',
+        //   prop: 'time',
+        //   options: {
+        //     rangeSeparator: '至',
+        //     startPlaceholder: '开始时间',
+        //     endPlaceholder: '结束时间',
+        //     valueFormat: 'yyyy-MM-dd',
+        //     type: 'daterange'
+        //   }
+        // }
       ],
       searchValues: {},
       items: [],
@@ -101,7 +87,7 @@ export default {
   methods: {
     async onInit () {
       this.loading = true
-      const { time, ...query } = this.searchValues
+      // const { time, ...query } = this.searchValues
       try {
         const { data } = await getSolutionPage({
           page: {
@@ -109,12 +95,12 @@ export default {
             orders: this.orders
           },
           entity: {
-            ...query,
-            history: 1,
+            ...this.searchValues,
+            history: 0,
             env: 0
-          },
-          startDate: time?.[0],
-          endDate: time?.[1]
+          }
+          // startDate: time?.[0],
+          // endDate: time?.[1]
         })
         this.items = data.records.map(e => e.entity)
         this.total = data.total
@@ -136,38 +122,10 @@ export default {
       this.orders = v
       this.onInit()
     },
-    async onSend (row) {
-      this.loading = true
-      try {
-        await sendSalaryRelease({ performanceSolutionId: row.performanceSolutionId })
-        this.$message.success('发布成功')
-        this.onInit()
-      } catch (error) {
-        this.$message.error(error)
-      } finally {
-        this.loading = false
-      }
-    },
-    onCalculate (item) {
-      this.$refs.sandboxCalculateRefs.open(item)
-    },
-    onCalculateHistory (item) {
-      this.$refs.sandboxHistoryRefs.open(item)
-    },
+
     onOpen (ref, item) {
       this.$refs[ref]?.open && this.$refs[ref].open(item)
     }
-    // onDel (item) {
-    //   this.$confirm(`确定删除${item.title}吗?`, '提示').then(async () => {
-    //     try {
-    //       await deleteSolution({ performanceSolutionId: item.performanceSolutionId })
-    //       this.$message.success('删除成功')
-    //       this.onInit()
-    //     } catch (error) {
-    //       this.$message.error(error)
-    //     }
-    //   }).catch(_ => {})
-    // }
   }
 }
 </script>

+ 1 - 1
src/views/sandbox/sandboxCalculate.vue

@@ -1,5 +1,5 @@
 <template>
-  <m-dialog title="绩效测算"  ref="dialog">
+  <m-dialog title="绩效测算" v-bind="$attrs" ref="dialog">
     <div v-if="!isSuccess" style="height: 200px;" class="d-flex flex-column justify-center align-center">
       <el-date-picker
         v-model="month"

+ 9 - 9
src/views/sandbox/sandboxHistory.vue

@@ -1,5 +1,5 @@
 <template>
-  <m-dialog title="测算历史" ref="dialog">
+  <m-dialog title="测算历史" v-bind="$attrs" ref="dialog">
     <m-table
       shadow="never"
       clearHeader
@@ -15,7 +15,7 @@
         </div>
       </template>
       <template #actions="{ row }">
-        <m-button text type="primary" @click="onDetails(row)">查看方案</m-button>
+        <m-button text type="primary" @click="onDetails(row)">查看规则</m-button>
         <m-button text type="primary" @click="onResult(row)">查看结果</m-button>
       </template>
     </m-table>
@@ -42,17 +42,17 @@ export default {
       headers: [
         { type: 'selection', width: 55, prop: 'selection' },
         { label: '测算时间', prop: 'time' },
-        { label: '方案名称', prop: 'name' },
+        { label: '规则名称', prop: 'name' },
         { label: '绩效汇总', prop: 'performance' },
         { label: '操作', prop: 'actions' }
       ],
       items: [
-        { id: 0, time: '2020-01-01 12:00:00', name: '方案1', performance: '100' },
-        { id: 1, time: '2020-01-01 12:00:00', name: '方案2', performance: '100' },
-        { id: 2, time: '2020-01-01 12:00:00', name: '方案3' },
-        { id: 3, time: '2020-01-01 12:00:00', name: '方案4' },
-        { id: 4, time: '2020-01-01 12:00:00', name: '方案5' },
-        { id: 5, time: '2020-01-01 12:00:00', name: '方案6' }
+        { id: 0, time: '2020-01-01 12:00:00', name: '规则1', performance: '100' },
+        { id: 1, time: '2020-01-01 12:00:00', name: '规则2', performance: '100' },
+        { id: 2, time: '2020-01-01 12:00:00', name: '规则3' },
+        { id: 3, time: '2020-01-01 12:00:00', name: '规则4' },
+        { id: 4, time: '2020-01-01 12:00:00', name: '规则5' },
+        { id: 5, time: '2020-01-01 12:00:00', name: '规则6' }
       ]
     }
   },

+ 126 - 0
src/views/sandbox/sandboxList.vue

@@ -0,0 +1,126 @@
+<template>
+  <m-dialog title="规则选择" ref="dialog" width="1200">
+    <m-table
+      shadow="never"
+      clearHeader
+      :headers="headers"
+      :items="items"
+      :total="total"
+      :page-size="pageInfo.size"
+      :page-current="pageInfo.current"
+      @page-change="onPageChange"
+      @sort-change="onSortChange"
+    >
+      <template #actions="{ row }">
+        <m-button text type="primary" size="small" @click="onOpen('sandboxDetailsRefs', row)">查看规则</m-button>
+        <m-button text type="primary" size="small" @click="onOpen('sandboxParamRefs', row)">系数导向</m-button>
+        <m-button text type="success" size="small" @click="onOpen('sandboxCalculateRefs', row)">开始测算</m-button>
+        <m-button text type="primary" size="small" @click="onOpen('sandboxHistoryRefs', row)">测算历史</m-button>
+        <m-button text type="success" size="small" @click="onSend(row)">发布</m-button>
+      </template>
+    </m-table>
+    <SandboxDetails ref="sandboxDetailsRefs" append-to-body></SandboxDetails>
+    <SandboxParam ref="sandboxParamRefs" append-to-body @refresh="getList"></SandboxParam>
+    <SandboxCalculate ref="sandboxCalculateRefs" append-to-body></SandboxCalculate>
+    <SandboxHistory ref="sandboxHistoryRefs" append-to-body></SandboxHistory>
+  </m-dialog>
+</template>
+
+<script>
+import SandboxDetails from './sandboxDetails.vue'
+import SandboxParam from './sandboxParam.vue'
+import SandboxCalculate from './sandboxCalculate.vue'
+import SandboxHistory from './sandboxHistory.vue'
+import {
+  getSolutionPage,
+  sendSalaryRelease
+} from '@/api/salary'
+export default {
+  name: 'sandboxList',
+  components: {
+
+    SandboxDetails,
+    SandboxParam,
+    SandboxCalculate,
+    SandboxHistory
+  },
+  data () {
+    return {
+      headers: [
+        { label: '名称', prop: 'title' },
+        { label: '修改说明', prop: 'versionTag' },
+        { label: '创建日期', prop: 'createDate' },
+        { label: '操作', prop: 'actions', width: 400, fixed: 'right' }
+      ],
+      items: [],
+      loading: false,
+      total: 0,
+      orders: [{
+        asc: false,
+        column: 'performance_solution_id'
+      }],
+      pageInfo: {
+        current: 1,
+        size: 10
+      },
+      uuid: null
+    }
+  },
+  methods: {
+    open (item) {
+      this.$refs.dialog.open()
+      this.uuid = item.uuid
+      this.getList()
+    },
+    async getList () {
+      this.loading = true
+      try {
+        const { data } = await getSolutionPage({
+          page: {
+            ...this.pageInfo,
+            orders: this.orders
+          },
+          entity: {
+            history: 2,
+            uuid: this.uuid,
+            env: 0
+          }
+        })
+        this.items = data.records.map(e => e.entity)
+        this.total = data.total
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onOpen (ref, item) {
+      this.$refs[ref]?.open && this.$refs[ref].open(item)
+    },
+    async onSend (row) {
+      this.loading = true
+      try {
+        await sendSalaryRelease({ performanceSolutionId: row.performanceSolutionId })
+        this.$message.success('发布成功')
+        this.onInit()
+      } catch (error) {
+        this.$message.error(error)
+      } finally {
+        this.loading = false
+      }
+    },
+    onPageChange (index) {
+      this.pageInfo.current = index
+      this.getList()
+    },
+    onSortChange (orders) {
+      this.orders = orders
+      this.getList()
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>

+ 1 - 1
src/views/sandbox/sandboxParam.vue

@@ -1,5 +1,5 @@
 <template>
-  <m-dialog ref="dialog" title="系数管理" @sure="onSure">
+  <m-dialog ref="dialog" title="系数管理" v-bind="$attrs" @sure="onSure">
     <el-form v-loading="loading" label-width="100px">
       <el-form-item label="名称">
         <el-tag color="primary">{{ itemData.title }}</el-tag>