zhengnaiwen_citu 4 månader sedan
förälder
incheckning
74479a7044

+ 7 - 2
src/views/sandbox/index.vue

@@ -32,6 +32,7 @@
     <SalarySolutionRules ref="salarySolutionRulesRefs" @refresh="onInit"></SalarySolutionRules>
     <SandboxParam ref="sandboxParamRefs" @refresh="onInit"></SandboxParam>
     <SandboxCalculate ref="sandboxCalculateRefs"></SandboxCalculate>
+    <SandboxHistory ref="sandboxHistoryRefs"></SandboxHistory>
   </div>
 </template>
 
@@ -46,6 +47,7 @@ import SalarySolutionRules from './salarySolutionRules.vue'
 import SandboxDetails from './sandboxDetails.vue'
 import SandboxParam from './sandboxParam.vue'
 import SandboxCalculate from './sandboxCalculate.vue'
+import SandboxHistory from './sandboxHistory.vue'
 export default {
   name: 'salary-solution-list',
   props: {
@@ -59,7 +61,8 @@ export default {
     SalarySolutionRules,
     SandboxDetails,
     SandboxParam,
-    SandboxCalculate
+    SandboxCalculate,
+    SandboxHistory
   },
   data () {
     return {
@@ -147,7 +150,9 @@ export default {
     onCalculate (item) {
       this.$refs.sandboxCalculateRefs.open(item)
     },
-    onCalculateHistory () {},
+    onCalculateHistory (item) {
+      this.$refs.sandboxHistoryRefs.open(item)
+    },
     onOpen (ref, item) {
       this.$refs[ref]?.open && this.$refs[ref].open(item)
     },

+ 76 - 34
src/views/sandbox/sandboxCalculate.vue

@@ -1,32 +1,38 @@
 <template>
-  <m-dialog title="绩效测算"  ref="dialog" v-loading="loading" width="1200px">
-    <div v-if="!isCalculate && !isSuccess" class="d-flex align-center justify-center">
+  <m-dialog title="绩效测算"  ref="dialog" width="1200px">
+    <div v-if="!isSuccess" class="d-flex align-center justify-center">
       正在测算中,请稍后...
     </div>
-    <el-result v-if="isCalculate" icon="success" title="测算完成"></el-result>
-    <template v-if="isSuccess">
-      <el-radio-group v-model="choose" @input="getList">
-        <el-radio
-          v-for="item in radioItems"
-          :key="item.id"
-          :label="item.id"
-        >
-          {{ item.name }}
-        </el-radio>
-      </el-radio-group>
-      <m-table
-        class="mt-3"
-        shadow="never"
-        clearHeader
-        :items="tableItems"
-        :headers="tableHeaders"
-        :page-size="tablePageInfo.size"
-        :page-current="tablePageInfo.current"
-        :total="tableTotal"
-        @page-change="onPageChange"
-        @sort-change="onSortChange"
-      ></m-table>
-    </template>
+    <div v-loading="loading">
+      <template v-if="isSuccess">
+        <m-card shadow="never">
+          <el-radio-group v-model="choose" @input="getList">
+            <el-radio
+              v-for="item in radioItems"
+              :key="item.id"
+              :label="item.id"
+            >
+              {{ item.name }}
+            </el-radio>
+          </el-radio-group>
+        </m-card>
+
+        <m-search class="mt-3" shadow="never" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
+
+        <m-table
+          class="mt-3"
+          shadow="never"
+          clearHeader
+          :items="tableItems"
+          :headers="tableHeaders"
+          :page-size="tablePageInfo.size"
+          :page-current="tablePageInfo.current"
+          :total="tableTotal"
+          @page-change="onPageChange"
+          @sort-change="onSortChange"
+        ></m-table>
+      </template>
+    </div>
   </m-dialog>
 </template>
 
@@ -41,7 +47,6 @@ export default {
     return {
       choose: null,
       loading: false,
-      isCalculate: false,
       isSuccess: false,
       radioItems: [],
       tableTotal: 0,
@@ -51,12 +56,40 @@ export default {
         current: 1
       },
       tableItems: [],
-      tableHeaders: []
+      tableHeaders: [],
+      searchValues: {}
+    }
+  },
+  computed: {
+    searchItems () {
+      return [
+        {
+          label: '列名',
+          prop: 'column',
+          type: 'select',
+          options: {
+            placeholder: '请选择列名',
+            items: this.tableHeaders.map(e => {
+              return {
+                label: e.label,
+                value: e.prop
+              }
+            })
+          }
+        },
+        {
+          label: '值',
+          prop: 'value',
+          type: 'input',
+          options: {
+            placeholder: '请输入值'
+          }
+        }
+      ]
     }
   },
   methods: {
     async open (item) {
-      this.isCalculate = false
       this.isSuccess = false
       this.$refs.dialog.open()
       this.loading = true
@@ -68,9 +101,7 @@ export default {
         if (this.radioItems.length) {
           this.choose = this.radioItems[0].id
         }
-        this.isCalculate = true
         await this.getList()
-        this.isCalculate = false
         this.isSuccess = true
       } catch (error) {
         this.$message.error(error)
@@ -80,14 +111,21 @@ export default {
     },
     async getList () {
       this.loading = true
+      const item = this.radioItems.find(e => e.id === this.choose)
       try {
-        const { data } = await getSandboxResultPage({
+        const param = {
           page: {
             ...this.tablePageInfo,
             orders: this.tableOrders
           },
-          id: this.choose
-        })
+          id: this.choose,
+          type: item.node_type
+          // query: [{ column: item, compare: '=', value: '当期个人贷款月累计收息' }]
+        }
+        if (this.searchValues.column && this.searchValues.value) {
+          param.query = [{ column: this.searchValues.column, compare: '=', value: this.searchValues.value }]
+        }
+        const { data } = await getSandboxResultPage(param)
         this.tableHeaders = data.dataColumn.map(e => {
           return {
             label: e.name,
@@ -102,6 +140,10 @@ export default {
         this.loading = false
       }
     },
+    onSearch () {
+      this.tablePageInfo.current = 1
+      this.getList()
+    },
     onPageChange (index) {
       this.tablePageInfo.current = index
       this.getList()

+ 51 - 0
src/views/sandbox/sandboxHistory.vue

@@ -0,0 +1,51 @@
+<template>
+  <m-dialog title="测算历史" ref="dialog">
+    <m-table
+      shadow="never"
+      clearHeader
+      :headers="headers"
+      :items="items"
+      @sort-change="onSortChange"
+      @page-change="onPageChange"
+    >
+      <template #actions="{ row }">
+        <m-button text type="primary" @click="open(row)">查看方案</m-button>
+        <m-button text type="primary" @click="open(row)">查看结果</m-button>
+      </template>
+    </m-table>
+  </m-dialog>
+</template>
+
+<script>
+export default {
+  name: 'sandboxHistory',
+  data () {
+    return {
+      headers: [
+        { label: '测算时间', prop: 'time' },
+        { label: '方案名称', prop: 'name' },
+        { label: '操作', prop: 'actions' }
+      ],
+      items: [
+        { time: '2020-01-01 12:00:00', name: '方案1' },
+        { time: '2020-01-01 12:00:00', name: '方案2' },
+        { time: '2020-01-01 12:00:00', name: '方案3' },
+        { time: '2020-01-01 12:00:00', name: '方案4' },
+        { time: '2020-01-01 12:00:00', name: '方案5' },
+        { time: '2020-01-01 12:00:00', name: '方案6' }
+      ]
+    }
+  },
+  methods: {
+    open (item) {
+      this.$refs.dialog.open()
+    },
+    onSortChange () {},
+    onPageChange () {}
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+
+</style>