|
|
@@ -5,14 +5,18 @@
|
|
|
<el-tag color="primary">{{ itemData.title }}</el-tag>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="类型">
|
|
|
- <el-tabs v-model="editableTabsValue" type="card" editable @edit="onTabsEdit">
|
|
|
+ <el-tabs v-model="editableTabsValue" addable type="card" @edit="onTabsEdit">
|
|
|
<el-tab-pane
|
|
|
v-for="tab in editableTabs"
|
|
|
:key="tab.name"
|
|
|
:label="tab.label"
|
|
|
:name="tab.name"
|
|
|
+ :closable="editableTabs.length > 1"
|
|
|
>
|
|
|
- <SalarySolutionRulesEdit :formula="formula"></SalarySolutionRulesEdit>
|
|
|
+ <div class="text-right mb-3">
|
|
|
+ <m-button size="small" type="orange" >编辑分类名称</m-button>
|
|
|
+ </div>
|
|
|
+ <SalarySolutionRulesEdit></SalarySolutionRulesEdit>
|
|
|
</el-tab-pane>
|
|
|
</el-tabs>
|
|
|
</el-form-item>
|
|
|
@@ -36,23 +40,12 @@ export default {
|
|
|
},
|
|
|
data () {
|
|
|
return {
|
|
|
- editableTabsValue: 1,
|
|
|
+ editableTabsValue: '1',
|
|
|
+ ids: 1,
|
|
|
editableTabs: [
|
|
|
- { label: '分类1', name: 1, content: null }
|
|
|
+ { label: '分类1', name: '1', content: null }
|
|
|
],
|
|
|
- formula: [
|
|
|
- {
|
|
|
- uuid: '1',
|
|
|
- content: null
|
|
|
- }
|
|
|
- ],
|
|
|
- // headers: [
|
|
|
- // { label: '启用', prop: 'status', width: 80 },
|
|
|
- // { label: '参数名称', prop: 'name', align: 'left' },
|
|
|
- // { label: '数值', prop: 'value' }
|
|
|
- // ],
|
|
|
itemData: {},
|
|
|
- // options: [],
|
|
|
loading: false,
|
|
|
categories: [], // 所有分类
|
|
|
allParams: [], // 所有参数
|
|
|
@@ -61,22 +54,6 @@ export default {
|
|
|
paramsSelection: [] // 已选参数
|
|
|
}
|
|
|
},
|
|
|
- computed: {
|
|
|
- gridData () {
|
|
|
- const _allParams = Object.values(this.paramsCategoryItems).flat()
|
|
|
- if (_allParams.length === 0) {
|
|
|
- return []
|
|
|
- }
|
|
|
- return this.paramsSelection.map(e => {
|
|
|
- const item = _allParams.find(item => item.name === e)
|
|
|
- return {
|
|
|
- name: item.name,
|
|
|
- value: item.value ?? 0,
|
|
|
- category: item.category
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- },
|
|
|
methods: {
|
|
|
open (item) {
|
|
|
this.itemData = item
|
|
|
@@ -97,13 +74,13 @@ export default {
|
|
|
const { data: detail } = await getSolutionDetails({
|
|
|
performanceSolutionId: item.performanceSolutionId
|
|
|
})
|
|
|
- if (!detail.calculateFormulas.length) {
|
|
|
- this.formula = [
|
|
|
- { uuid: '1', content: null, sort: null }
|
|
|
- ]
|
|
|
- } else {
|
|
|
- this.formula = detail.calculateFormulas
|
|
|
- }
|
|
|
+ // if (!detail.calculateFormulas.length) {
|
|
|
+ // this.formula = [
|
|
|
+ // { uuid: '1', content: null, sort: null }
|
|
|
+ // ]
|
|
|
+ // } else {
|
|
|
+ // this.formula = detail.calculateFormulas
|
|
|
+ // }
|
|
|
this.paramsSelection = detail.calculateConfigurations.map(e => e.name)
|
|
|
|
|
|
// 根据分类获取参数列表
|
|
|
@@ -126,6 +103,29 @@ export default {
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ onTabsEdit (targetName, action) {
|
|
|
+ if (action === 'add') {
|
|
|
+ this.ids++
|
|
|
+ this.editableTabs.push(
|
|
|
+ { label: '分类' + this.ids, name: String(this.ids), content: null }
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if (action === 'remove') {
|
|
|
+ if (this.editableTabs.length === 1) {
|
|
|
+ this.$message.error('至少保留一个分类')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ const index = this.editableTabs.findIndex(tab => tab.name === targetName)
|
|
|
+ this.editableTabs.splice(index, 1)
|
|
|
+ if (index === 0) {
|
|
|
+ this.editableTabsValue = this.editableTabs[0].name
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (targetName === this.editableTabsValue) {
|
|
|
+ this.editableTabsValue = this.editableTabs[index - 1].name
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
async onSure () {
|
|
|
if (this.paramsSelection.length === 0) {
|
|
|
this.$message.error('请选择参数')
|
|
|
@@ -151,7 +151,7 @@ export default {
|
|
|
entity: {
|
|
|
performanceSolutionId: this.itemData.performanceSolutionId
|
|
|
},
|
|
|
- calculateConfigurations: this.gridData,
|
|
|
+ calculateConfigurations: [],
|
|
|
calculateFormulas
|
|
|
})
|
|
|
this.$refs.dialog.close()
|
|
|
@@ -160,23 +160,11 @@ export default {
|
|
|
} catch (error) {
|
|
|
this.$message.error(error)
|
|
|
}
|
|
|
- },
|
|
|
- onTabsEdit (targetName, action) {
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
-::v-deep .el-tree-node__content {
|
|
|
- height: 40px;
|
|
|
-}
|
|
|
-.text-gray {
|
|
|
- color: grey;
|
|
|
-}
|
|
|
-.tools {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-end;
|
|
|
-}
|
|
|
+
|
|
|
</style>
|