zhengnaiwen_citu 5 mēneši atpakaļ
vecāks
revīzija
cae40d0364

+ 0 - 126
src/views/salary/solution/salarySolutionParameter/configEdit.vue

@@ -1,126 +0,0 @@
-<template>
-  <m-dialog ref="editDialog" :title="query.calculateConfigurationId ? '编辑参数' : '新增参数'" v-bind="$attrs" @sure="handleSaveEdit">
-    <m-form ref="formRefs" :items="items" v-model="query"></m-form>
-  </m-dialog>
-</template>
-
-<script>
-import {
-  getConfigCateGories,
-  addConfig,
-  updateConfig
-} from '@/api/salary'
-export default {
-  name: 'config-edit',
-  data () {
-    return {
-      query: {},
-      items: [
-        {
-          label: '配置名称',
-          prop: 'name',
-          type: 'input',
-          options: {
-            placeholder: '请输入配置名称'
-          },
-          rules: [
-            { required: true, message: '请输入配置名称', trigger: 'blur' }
-          ]
-        },
-        {
-          label: '数值',
-          prop: 'value',
-          type: 'input',
-          options: {
-            placeholder: '请输入数值'
-          },
-          rules: [
-            { required: true, message: '请输入数值', trigger: 'blur' }
-          ]
-        },
-        {
-          label: '分类',
-          prop: 'category',
-          type: 'autocomplete',
-          options: {
-            clearable: true,
-            placeholder: '请选择分类',
-            fetchSuggestions: this.fetchSuggestions,
-            handles: {
-              focus () {
-                console.log('focus')
-              }
-            }
-          },
-          rules: [
-            { required: true, message: '请选择分类', trigger: 'change' }
-          ]
-        },
-        {
-          label: '描述',
-          prop: 'tag',
-          type: 'input',
-          options: {
-            type: 'textarea',
-            placeholder: '请输入描述'
-          }
-        }
-      ]
-    }
-  },
-  methods: {
-    open (item) {
-      if (!item) {
-        this.initQuery()
-      } else {
-        this.query = { ...item }
-      }
-      this.$refs.editDialog.open()
-      this.$nextTick(() => {
-        this.$refs.formRefs.clearValidate()
-      })
-    },
-    initQuery () {
-      this.query = this.items.reduce((res, item) => {
-        res[item.prop] = null
-        return res
-      }, {})
-    },
-    async fetchSuggestions (category, cb) {
-      try {
-        const { data } = await getConfigCateGories({ category })
-        cb(data.map(e => {
-          return {
-            value: e
-          }
-        }))
-      } catch (error) {
-        const empty = []
-        cb(empty)
-        this.$message.error(error)
-      }
-    },
-    handleSaveEdit () {
-      this.$refs.formRefs.validate(async valid => {
-        if (!valid) {
-          return
-        }
-        console.log(this.query)
-        const subApi = this.query.calculateConfigurationId ? updateConfig : addConfig
-        try {
-          await subApi(this.query)
-          this.$message.success('保存成功')
-          this.$refs.editDialog.close()
-          this.$emit('refresh')
-        } catch (error) {
-          this.$message.error(error)
-        }
-      })
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-
-</style>

+ 0 - 142
src/views/salary/solution/salarySolutionParameter/index.vue

@@ -1,142 +0,0 @@
-<template>
-  <div>
-    <m-search class="mb-3" :items="searchItems" v-model="searchValues" @search="onSearch"></m-search>
-    <m-table
-      :card-title="$attrs.label"
-      v-loading="loading"
-      row-key="calculateConfigurationId"
-      :items="items"
-      :headers="headers"
-      :page-size="pageInfo.size"
-      :page-current="pageInfo.current"
-      :total="total"
-      @page-change="onPageChange"
-    >
-      <template #card-tools>
-        <m-button type="orange" size="small" icon="el-icon-plus" @click="onAdd">新增</m-button>
-      </template>
-      <template #actions="{ row }">
-        <m-button text type="primary" @click="onEdit(row)" size="small">编辑</m-button>
-        <m-button text type="danger" @click="onDelete(row)" size="small">删除</m-button>
-      </template>
-    </m-table>
-    <config-edit ref="editRefs" @refresh="onInit"></config-edit>
-  </div>
-</template>
-
-<script>
-import ConfigEdit from './configEdit'
-import {
-  getConfigPage,
-  getConfigCateGories,
-  deleteConfig,
-  getConfig
-} from '@/api/salary'
-export default {
-  name: 'salary-config',
-  components: { ConfigEdit },
-  data () {
-    return {
-      searchItems: [
-        { label: '关键词', prop: 'keyword', type: 'input', options: { placeholder: '请输入关键词' } },
-        {
-          label: '分类',
-          prop: 'category',
-          type: 'autocomplete',
-          options: {
-            clearable: true,
-            placeholder: '请输入分类',
-            fetchSuggestions: this.fetchSuggestions
-          }
-        }
-      ],
-      searchValues: {},
-      headers: [
-        { label: '配置名称', prop: 'name' },
-        { label: '数值', prop: 'value' },
-        { label: '分类', prop: 'category' },
-        { label: '描述', prop: 'tag' },
-        { label: '创建时间', prop: 'createDate' },
-        { label: '操作', prop: 'actions' }
-      ],
-      items: [],
-      loading: false,
-      pageInfo: {
-        size: 10,
-        current: 1
-      },
-      total: 0
-    }
-  },
-  mounted () {
-    this.$emit('mounted')
-  },
-  methods: {
-    async onInit () {
-      this.loading = true
-      try {
-        const { data } = await getConfigPage({
-          ...this.searchValues,
-          ...this.pageInfo,
-          history: 0
-        })
-        this.items = data.records
-        this.total = data.total
-      } catch (error) {
-        this.$message.error(error)
-      } finally {
-        this.loading = false
-      }
-    },
-    async fetchSuggestions (category, cb) {
-      try {
-        const { data } = await getConfigCateGories({ category })
-        cb(data.map(e => {
-          return {
-            value: e
-          }
-        }))
-      } catch (error) {
-        this.$message.error(error)
-      }
-    },
-    onSearch () {
-      this.pageInfo.current = 1
-      this.onInit()
-    },
-    onAdd () {
-      this.$refs.editRefs.open()
-    },
-    async onEdit (item) {
-      try {
-        const { data } = await getConfig(item.calculateConfigurationId)
-        this.$refs.editRefs.open(data)
-      } catch (error) {
-        this.$message.error(error)
-      }
-    },
-    onDelete (item) {
-      this.$confirm('确定删除该配置吗?', '提示').then(async () => {
-        try {
-          await deleteConfig(item.calculateConfigurationId)
-          this.$message.success('删除成功')
-          this.onInit()
-        } catch (error) {
-          this.$message.error(error)
-        }
-      }).catch(() => {})
-    },
-    onPageChange (index) {
-      this.pageInfo.current = index
-      this.onInit()
-    },
-    onHistory (row) {
-      this.$refs.configHistoryRefs.open(row)
-    }
-  }
-}
-</script>
-
-<style lang="scss" scoped>
-
-</style>