7
7
label-width =" 100px"
8
8
v-loading =" formLoading"
9
9
>
10
- <el-form-item label =" 状态类型名 " prop =" name" >
11
- <el-input v-model =" formData.name" placeholder =" 请输入状态类型名 " />
10
+ <el-form-item label =" 状态组名 " prop =" name" >
11
+ <el-input v-model =" formData.name" placeholder =" 请输入状态组名 " />
12
12
</el-form-item >
13
13
<el-form-item label =" 应用部门" prop =" deptIds" >
14
+ <template #label >
15
+ <Tooltip message =" 不选择部门时,默认全公司生效" title =" 应用部门" />
16
+ </template >
14
17
<el-tree
15
18
ref =" treeRef"
16
19
:data =" deptList"
21
24
show-checkbox
22
25
/>
23
26
</el-form-item >
24
- <el-form-item label =" 状态设置 " prop =" statusList " >
25
- <el-table border style =" width : 100% " :data =" formData.statusList " >
26
- <el-table-column align =" center" label =" 状态 " width =" 120 " prop = " star " >
27
+ <el-form-item label =" 阶段设置 " prop =" statuses " >
28
+ <el-table border style =" width : 100% " :data =" formData.statuses " >
29
+ <el-table-column align =" center" label =" 阶段 " width =" 70 " >
27
30
<template #default =" scope " >
28
- <el-text >状态 {{ scope.$index + 1 }}</el-text >
31
+ <el-text >阶段 {{ scope.$index + 1 }}</el-text >
29
32
</template >
30
33
</el-table-column >
31
- <el-table-column align =" center" label =" 状态名称 " width =" 120 " prop =" name" >
34
+ <el-table-column align =" center" label =" 阶段名称 " width =" 160 " prop =" name" >
32
35
<template #default =" { row } " >
33
36
<el-input v-model =" row.name" placeholder =" 请输入状态名称" />
34
37
</template >
35
38
</el-table-column >
36
- <el-table-column width =" 120 " align =" center" label =" 赢单率" prop =" percent" >
39
+ <el-table-column width =" 140 " align =" center" label =" 赢单率" prop =" percent" >
37
40
<template #default =" { row } " >
38
- <el-input v-model =" row.percent" placeholder =" 请输入赢单率" />
41
+ <el-input-number
42
+ v-model =" row.percent"
43
+ placeholder =" 请输入赢单率"
44
+ controls-position =" right"
45
+ :min =" 0"
46
+ :max =" 100"
47
+ :precision =" 2"
48
+ class =" !w-1/1"
49
+ />
39
50
</template >
40
51
</el-table-column >
41
- <el-table-column label =" 操作" align =" center" >
52
+ <el-table-column label =" 操作" width = " 110 " align =" center" >
42
53
<template #default =" scope " >
43
54
<el-button link type =" primary" @click =" addStatusArea(scope.$index)" > 添加 </el-button >
44
55
<el-button
45
56
link
46
57
type =" danger"
47
58
@click =" deleteStatusArea(scope.$index)"
48
- v-show = " scope.$index > 0 "
59
+ :disabled = " formData.statuses.length <= 1 "
49
60
>
50
61
删除
51
62
</el-button >
61
72
</Dialog >
62
73
</template >
63
74
<script setup lang="ts">
64
- import * as BusinessStatusTypeApi from ' @/api/crm/businessStatusType '
75
+ import * as BusinessStatusApi from ' @/api/crm/business/status '
65
76
import { defaultProps , handleTree } from ' @/utils/tree'
66
77
import * as DeptApi from ' @/api/system/dept'
67
78
@@ -71,15 +82,15 @@ const message = useMessage() // 消息弹窗
71
82
const dialogVisible = ref (false ) // 弹窗的是否展示
72
83
const dialogTitle = ref (' ' ) // 弹窗的标题
73
84
const formLoading = ref (false ) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
74
- const formType = ref (' ' ) // 表单的类型 :create - 新增;update - 修改
85
+ const formType = ref (' ' ) // 表单的组 :create - 新增;update - 修改
75
86
const formData = ref ({
76
87
id: 0 ,
77
88
name: ' ' ,
78
89
deptIds: [],
79
- statusList : []
90
+ statuses : []
80
91
})
81
92
const formRules = reactive ({
82
- name: [{ required: true , message: ' 状态类型名不能为空 ' , trigger: ' blur' }]
93
+ name: [{ required: true , message: ' 状态组名不能为空 ' , trigger: ' blur' }]
83
94
})
84
95
const formRef = ref () // 表单 Ref
85
96
const deptList = ref <Tree []>([]) // 树形结构
@@ -96,9 +107,9 @@ const open = async (type: string, id?: number) => {
96
107
if (id ) {
97
108
formLoading .value = true
98
109
try {
99
- formData .value = await BusinessStatusTypeApi . getBusinessStatusType (id )
110
+ formData .value = await BusinessStatusApi . getBusinessStatus (id )
100
111
treeRef .value .setCheckedKeys (formData .value .deptIds )
101
- if (formData .value .statusList .length == 0 ) {
112
+ if (formData .value .statuses .length == 0 ) {
102
113
addStatusArea (0 )
103
114
}
104
115
} finally {
@@ -120,13 +131,13 @@ const submitForm = async () => {
120
131
// 提交请求
121
132
formLoading .value = true
122
133
try {
123
- const data = formData .value as unknown as BusinessStatusTypeApi .BusinessStatusTypeVO
134
+ const data = formData .value as unknown as BusinessStatusApi .BusinessStatusTypeVO
124
135
data .deptIds = treeRef .value .getCheckedKeys (false )
125
136
if (formType .value === ' create' ) {
126
- await BusinessStatusTypeApi . createBusinessStatusType (data )
137
+ await BusinessStatusApi . createBusinessStatus (data )
127
138
message .success (t (' common.createSuccess' ))
128
139
} else {
129
- await BusinessStatusTypeApi . updateBusinessStatusType (data )
140
+ await BusinessStatusApi . updateBusinessStatus (data )
130
141
message .success (t (' common.updateSuccess' ))
131
142
}
132
143
dialogVisible .value = false
@@ -144,7 +155,7 @@ const resetForm = () => {
144
155
id: 0 ,
145
156
name: ' ' ,
146
157
deptIds: [],
147
- statusList : []
158
+ statuses : []
148
159
}
149
160
treeRef .value ?.setCheckedNodes ([])
150
161
formRef .value ?.resetFields ()
@@ -153,15 +164,15 @@ const resetForm = () => {
153
164
/** 添加状态 */
154
165
const addStatusArea = () => {
155
166
const data = formData .value
156
- data .statusList .push ({
167
+ data .statuses .push ({
157
168
name: ' ' ,
158
- percent: ' '
169
+ percent: undefined
159
170
})
160
171
}
161
172
162
173
/** 删除状态 */
163
174
const deleteStatusArea = (index : number ) => {
164
175
const data = formData .value
165
- data .statusList .splice (index , 1 )
176
+ data .statuses .splice (index , 1 )
166
177
}
167
178
</script >
0 commit comments