|
|
@@ -0,0 +1,80 @@
|
|
|
+<template>
|
|
|
+ <m-dialog title="测算" ref="dialog" v-loading="loading">
|
|
|
+ <div v-if="!isCalculate && !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">
|
|
|
+ <el-radio
|
|
|
+ v-for="item in radioItems"
|
|
|
+ :key="item.id"
|
|
|
+ :label="item.name"
|
|
|
+ >
|
|
|
+ {{ item.name }}
|
|
|
+ </el-radio>
|
|
|
+ </el-radio-group>
|
|
|
+ <m-table
|
|
|
+ class="mt-3"
|
|
|
+ shadow="never"
|
|
|
+ clearHeader
|
|
|
+ :items="tableItems"
|
|
|
+ :headers="tableHeaders"
|
|
|
+ ></m-table>
|
|
|
+ </template>
|
|
|
+ </m-dialog>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script>
|
|
|
+import {
|
|
|
+ getSandboxResultList
|
|
|
+} from '@/api/salary'
|
|
|
+export default {
|
|
|
+ name: 'sandboxCalculate',
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ choose: null,
|
|
|
+ loading: false,
|
|
|
+ isCalculate: false,
|
|
|
+ isSuccess: false,
|
|
|
+ radioItems: [],
|
|
|
+ tableItems: [],
|
|
|
+ tableHeaders: [
|
|
|
+ { label: '姓名', prop: 'name' },
|
|
|
+ { label: '部门', prop: 'department' },
|
|
|
+ { label: '岗位', prop: 'position' }
|
|
|
+ ]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ methods: {
|
|
|
+ async open (item) {
|
|
|
+ this.isCalculate = false
|
|
|
+ this.isSuccess = false
|
|
|
+ this.$refs.dialog.open()
|
|
|
+ this.loading = true
|
|
|
+ try {
|
|
|
+ const { data } = await getSandboxResultList({
|
|
|
+ modelName: item.modelName
|
|
|
+ })
|
|
|
+ this.radioItems = data || []
|
|
|
+ if (this.radioItems.length) {
|
|
|
+ this.choose = this.radioItems[0].name
|
|
|
+ }
|
|
|
+ this.isCalculate = true
|
|
|
+ setTimeout(() => {
|
|
|
+ this.isCalculate = false
|
|
|
+ this.isSuccess = true
|
|
|
+ }, 1000)
|
|
|
+ } catch (error) {
|
|
|
+ this.$message.error(error)
|
|
|
+ } finally {
|
|
|
+ this.loading = false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+
|
|
|
+</style>
|