|
@@ -1,50 +1,46 @@
|
|
<template>
|
|
<template>
|
|
<m-card shadow="never">
|
|
<m-card shadow="never">
|
|
- <el-form ref="form" :model="formQuery">
|
|
|
|
|
|
+ <el-form ref="form">
|
|
<el-form-item label="参数配置" class="mb-3">
|
|
<el-form-item label="参数配置" class="mb-3">
|
|
<m-table
|
|
<m-table
|
|
|
|
+ ref="tableRefs"
|
|
shadow="naver"
|
|
shadow="naver"
|
|
clearHeader
|
|
clearHeader
|
|
- :items="formQuery.items"
|
|
|
|
|
|
+ :items="items"
|
|
|
|
+ row-key="index"
|
|
:headers="[
|
|
:headers="[
|
|
|
|
+ { type: 'expand', prop: 'expandProp' },
|
|
{ label: '参数', prop: 'label' },
|
|
{ label: '参数', prop: 'label' },
|
|
- { label: '数值', prop: 'value' },
|
|
|
|
|
|
+ { label: '参数类型', prop: 'valueCategory' },
|
|
{ label: '操作', prop: 'actions' }
|
|
{ label: '操作', prop: 'actions' }
|
|
]"
|
|
]"
|
|
>
|
|
>
|
|
|
|
+ <template #expandProp="{ row }">
|
|
|
|
+ <el-form label-width="100px">
|
|
|
|
+ <el-form-item label="参数">
|
|
|
|
+ <el-input v-model="row.label" size="small"></el-input>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ <el-form-item label="参数类型">
|
|
|
|
+ <el-select v-model="row.valueCategory" size="small">
|
|
|
|
+ <el-option
|
|
|
|
+ v-for="item in DICT_CATEGORY"
|
|
|
|
+ :key="item.value"
|
|
|
|
+ :label="item.label"
|
|
|
|
+ :value="item.value"
|
|
|
|
+ >
|
|
|
|
+ </el-option>
|
|
|
|
+ </el-select>
|
|
|
|
+ </el-form-item>
|
|
|
|
+ </el-form>
|
|
|
|
+ </template>
|
|
<div class="text-center mt-3">
|
|
<div class="text-center mt-3">
|
|
- <m-button icon="el-icon-plus" type="orange" size="small" @click="onAdd">添加一行</m-button>
|
|
|
|
|
|
+ <m-button icon="el-icon-plus" type="orange" size="small" @click="onAdd">添加参数</m-button>
|
|
</div>
|
|
</div>
|
|
- <template #label="scope">
|
|
|
|
- <el-form-item
|
|
|
|
- :prop="`items.${scope.$index}.label`"
|
|
|
|
- :rules="{ required: true, message: '请输入参数名称', trigger: 'blur' }"
|
|
|
|
- >
|
|
|
|
- <el-input
|
|
|
|
- size="small"
|
|
|
|
- v-model="formQuery.items[scope.$index].label"
|
|
|
|
- placeholder="请输入参数"
|
|
|
|
- type="textarea"
|
|
|
|
- :autosize="{ minRows: 1, maxRows: 4}"
|
|
|
|
- ></el-input>
|
|
|
|
- </el-form-item>
|
|
|
|
- </template>
|
|
|
|
- <template #value="scope">
|
|
|
|
- <el-form-item
|
|
|
|
- :prop="`items.${scope.$index}.value`"
|
|
|
|
- :rules="{ required: true, message: '请输入值', trigger: 'blur' }"
|
|
|
|
- >
|
|
|
|
- <el-input-number
|
|
|
|
- size="small"
|
|
|
|
- v-model="formQuery.items[scope.$index].value"
|
|
|
|
- placeholder="参数名称"
|
|
|
|
- :min="0"
|
|
|
|
- :step="0.1"
|
|
|
|
- ></el-input-number>
|
|
|
|
- </el-form-item>
|
|
|
|
|
|
+ <template #valueCategory="{ row }">
|
|
|
|
+ {{ DICT_CATEGORY.find(item => item.value === row.valueCategory)?.label }}
|
|
</template>
|
|
</template>
|
|
<template #actions="scope">
|
|
<template #actions="scope">
|
|
- <m-button size="small" text type="danger" @click="onDelete(scope)">删除</m-button>
|
|
|
|
|
|
+ <m-button size="small" text type="danger" @click="onDelete(scope)">移除</m-button>
|
|
</template>
|
|
</template>
|
|
</m-table>
|
|
</m-table>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
@@ -65,14 +61,18 @@
|
|
/>
|
|
/>
|
|
</m-card>
|
|
</m-card>
|
|
</el-form-item>
|
|
</el-form-item>
|
|
-
|
|
|
|
</el-form>
|
|
</el-form>
|
|
|
|
+ <!-- <SalarySolutionRulesEditParam ref="salarySolutionRulesEditParamRefs" @submit="onAddSubmit"></SalarySolutionRulesEditParam> -->
|
|
</m-card>
|
|
</m-card>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
import { Editor, Toolbar } from '@wangeditor/editor-for-vue'
|
|
import '@wangeditor/editor/dist/css/style.css'
|
|
import '@wangeditor/editor/dist/css/style.css'
|
|
|
|
+// import SalarySolutionRulesEditParam from './salarySolutionRulesEditParam.vue'
|
|
|
|
+import {
|
|
|
|
+ DICT_CATEGORY
|
|
|
|
+} from '../utils/Dict'
|
|
export default {
|
|
export default {
|
|
name: 'salarySolutionRulesEdit',
|
|
name: 'salarySolutionRulesEdit',
|
|
components: { Editor, Toolbar },
|
|
components: { Editor, Toolbar },
|
|
@@ -84,6 +84,7 @@ export default {
|
|
},
|
|
},
|
|
data () {
|
|
data () {
|
|
return {
|
|
return {
|
|
|
|
+ DICT_CATEGORY,
|
|
editor: null,
|
|
editor: null,
|
|
formulaData: '',
|
|
formulaData: '',
|
|
toolbarConfig: {
|
|
toolbarConfig: {
|
|
@@ -91,25 +92,13 @@ export default {
|
|
'headerSelect',
|
|
'headerSelect',
|
|
// 分割线
|
|
// 分割线
|
|
'|',
|
|
'|',
|
|
- // 菜单 key
|
|
|
|
'bold',
|
|
'bold',
|
|
'italic'
|
|
'italic'
|
|
]
|
|
]
|
|
},
|
|
},
|
|
editorConfig: { placeholder: '请输入内容...' },
|
|
editorConfig: { placeholder: '请输入内容...' },
|
|
mode: 'default', // or 'simple'
|
|
mode: 'default', // or 'simple'
|
|
- formQuery: {
|
|
|
|
- items: []
|
|
|
|
- }
|
|
|
|
- // formulaData: [{
|
|
|
|
- // uuid: '1',
|
|
|
|
- // content: null
|
|
|
|
- // }],
|
|
|
|
- // btnList: [
|
|
|
|
- // { label: '同级追加', click: this.onInsertAfter },
|
|
|
|
- // { label: '插入下一级', click: this.onAppend },
|
|
|
|
- // { label: '删除', click: this.onRemove }
|
|
|
|
- // ]
|
|
|
|
|
|
+ items: []
|
|
}
|
|
}
|
|
},
|
|
},
|
|
beforeDestroy () {
|
|
beforeDestroy () {
|
|
@@ -122,53 +111,41 @@ export default {
|
|
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
|
|
this.editor = Object.seal(editor) // 一定要用 Object.seal() ,否则会报错
|
|
},
|
|
},
|
|
onAdd () {
|
|
onAdd () {
|
|
- this.formQuery.items.push({ label: null, value: 0 })
|
|
|
|
|
|
+ const item = {
|
|
|
|
+ index: this.items.length,
|
|
|
|
+ label: '未命名',
|
|
|
|
+ valueCategory: 0
|
|
|
|
+ }
|
|
|
|
+ this.items.push(item)
|
|
|
|
+ const ref = this.$refs.tableRefs.getRefs()
|
|
|
|
+ ref.toggleRowExpansion(item)
|
|
},
|
|
},
|
|
onDelete (scope) {
|
|
onDelete (scope) {
|
|
- this.$confirm('确定要删除吗?', '提示').then(e => {
|
|
|
|
- this.formQuery.items.splice(scope.$index, 1)
|
|
|
|
|
|
+ this.$confirm('确定要移除改组参数吗?', '提示').then(e => {
|
|
|
|
+ this.items.splice(scope.$index, 1)
|
|
}).catch(_ => {})
|
|
}).catch(_ => {})
|
|
},
|
|
},
|
|
- // onRemove (data) {
|
|
|
|
- // this.$confirm('确定要删除吗?', '提示').then(e => {
|
|
|
|
- // this.$refs.formulaTreeRefs.remove(data)
|
|
|
|
- // }).catch(_ => {})
|
|
|
|
- // },
|
|
|
|
- // onInsertAfter (data) {
|
|
|
|
- // this.$refs.formulaTreeRefs.insertAfter({
|
|
|
|
- // uuid: Date.now(),
|
|
|
|
- // content: null
|
|
|
|
- // }, data)
|
|
|
|
- // },
|
|
|
|
- // onAppend (data) {
|
|
|
|
- // this.$refs.formulaTreeRefs.append({
|
|
|
|
- // uuid: Date.now(),
|
|
|
|
- // content: null
|
|
|
|
- // }, data)
|
|
|
|
- // },
|
|
|
|
- // onCommon (index, data) {
|
|
|
|
- // this.btnList[index].click(data)
|
|
|
|
- // },
|
|
|
|
valid () {
|
|
valid () {
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
- this.$refs.form.validate(valid => {
|
|
|
|
- if (valid) {
|
|
|
|
- resolve(this.getValue())
|
|
|
|
- } else {
|
|
|
|
- const obj = {
|
|
|
|
- data: this.item,
|
|
|
|
- $refs: this.$refs.form
|
|
|
|
- }
|
|
|
|
- reject(obj)
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
|
|
+ resolve(this.getValue())
|
|
|
|
+ // this.$refs.form.validate(valid => {
|
|
|
|
+ // if (valid) {
|
|
|
|
+ // resolve(this.getValue())
|
|
|
|
+ // } else {
|
|
|
|
+ // const obj = {
|
|
|
|
+ // data: this.item,
|
|
|
|
+ // $refs: this.$refs.form
|
|
|
|
+ // }
|
|
|
|
+ // reject(obj)
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
})
|
|
})
|
|
},
|
|
},
|
|
setValue (data) {
|
|
setValue (data) {
|
|
- this.formQuery.items = data.calculateConfigurations.map(e => {
|
|
|
|
|
|
+ this.items = data.calculateConfigurations.map(e => {
|
|
return {
|
|
return {
|
|
label: e.name,
|
|
label: e.name,
|
|
- value: e.value
|
|
|
|
|
|
+ valueCategory: e.valueCategory
|
|
}
|
|
}
|
|
})
|
|
})
|
|
this.$nextTick(() => {
|
|
this.$nextTick(() => {
|
|
@@ -176,23 +153,9 @@ export default {
|
|
})
|
|
})
|
|
},
|
|
},
|
|
getValue () {
|
|
getValue () {
|
|
- // const calculateFormulas = removeUuidFromArrayTree(this.formulaData)
|
|
|
|
- // function removeUuidFromArrayTree (treeArray) {
|
|
|
|
- // return treeArray.map(node => {
|
|
|
|
- // // 删除当前节点的uuid
|
|
|
|
- // const { uuid, children, ...rest } = node
|
|
|
|
-
|
|
|
|
- // // 如果有子节点,递归处理
|
|
|
|
- // const cleanedNode = { ...rest }
|
|
|
|
- // if (children && Array.isArray(children) && children.length > 0) {
|
|
|
|
- // cleanedNode.children = removeUuidFromArrayTree(children)
|
|
|
|
- // }
|
|
|
|
- // return cleanedNode
|
|
|
|
- // })
|
|
|
|
- // }
|
|
|
|
return {
|
|
return {
|
|
category: this.item.title,
|
|
category: this.item.title,
|
|
- calculateConfigurations: this.formQuery.items.map(e => {
|
|
|
|
|
|
+ calculateConfigurations: this.items.map(e => {
|
|
return {
|
|
return {
|
|
name: e.label,
|
|
name: e.label,
|
|
value: e.value
|
|
value: e.value
|