Skip to content

Commit 3c19cb1

Browse files
committed
crm:code review 商机类型
1 parent b3515b2 commit 3c19cb1

File tree

2 files changed

+28
-36
lines changed

2 files changed

+28
-36
lines changed

src/views/crm/business/BusinessForm.vue

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<el-form-item label="商机名称" prop="name">
1111
<el-input v-model="formData.name" placeholder="请输入商机名称" />
1212
</el-form-item>
13+
<!-- TODO 芋艿:客户列表的组件 -->
1314
<el-form-item label="客户名称" prop="customerName">
1415
<el-popover
1516
placement="bottom"
@@ -78,12 +79,7 @@
7879
</el-select>
7980
</el-form-item>
8081
<el-form-item label="商机状态" prop="statusId">
81-
<el-select
82-
v-model="formData.statusId"
83-
placeholder="请选择商机状态"
84-
clearable
85-
size="small"
86-
>
82+
<el-select v-model="formData.statusId" placeholder="请选择商机状态" clearable size="small">
8783
<el-option
8884
v-for="item in businessStatusList"
8985
:key="item.id"
@@ -122,9 +118,9 @@
122118
<script setup lang="ts">
123119
import * as BusinessApi from '@/api/crm/business'
124120
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
125-
import * as CustomerApi from "@/api/crm/customer";
121+
import * as CustomerApi from '@/api/crm/customer'
126122
import { DICT_TYPE } from '@/utils/dict'
127-
import {ElTable} from "element-plus";
123+
import { ElTable } from 'element-plus'
128124
129125
const { t } = useI18n() // 国际化
130126
const message = useMessage() // 消息弹窗
@@ -233,10 +229,12 @@ const resetForm = () => {
233229
}
234230
formRef.value?.resetFields()
235231
}
236-
const changeBusinessStatusType = async (id) => {
237-
// 加载商机状态列表
238-
businessStatusList.value = await BusinessStatusTypeApi.getBusinessStatusListByTypeId(id)
232+
233+
/** 加载商机状态列表 */
234+
const changeBusinessStatusType = async (typeId: number) => {
235+
businessStatusList.value = await BusinessStatusTypeApi.getBusinessStatusListByTypeId(typeId)
239236
}
237+
240238
const queryParams = reactive({
241239
pageNo: 1,
242240
pageSize: 10,

src/views/crm/businessStatusType/BusinessStatusTypeForm.vue

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,12 @@
2323
</el-form-item>
2424
<el-form-item label="状态设置" prop="statusList">
2525
<el-table border style="width: 100%" :data="formData.statusList">
26-
<el-table-column
27-
align="center"
28-
label="状态"
29-
width="120"
30-
prop="star"
31-
>
26+
<el-table-column align="center" label="状态" width="120" prop="star">
3227
<template #default="scope">
33-
<el-text>状态{{scope.$index+1}}</el-text>
28+
<el-text>状态{{ scope.$index + 1 }}</el-text>
3429
</template>
3530
</el-table-column>
36-
<el-table-column
37-
align="center"
38-
label="状态名称"
39-
width="120"
40-
prop="name"
41-
>
31+
<el-table-column align="center" label="状态名称" width="120" prop="name">
4232
<template #default="{ row }">
4333
<el-input v-model="row.name" placeholder="请输入状态名称" />
4434
</template>
@@ -50,10 +40,13 @@
5040
</el-table-column>
5141
<el-table-column label="操作" align="center">
5242
<template #default="scope">
53-
<el-button link type="primary" @click="addStatusArea(scope.$index)">
54-
添加
55-
</el-button>
56-
<el-button link type="danger" @click="deleteStatusArea(scope.$index)" v-show="scope.$index>0">
43+
<el-button link type="primary" @click="addStatusArea(scope.$index)"> 添加 </el-button>
44+
<el-button
45+
link
46+
type="danger"
47+
@click="deleteStatusArea(scope.$index)"
48+
v-show="scope.$index > 0"
49+
>
5750
删除
5851
</el-button>
5952
</template>
@@ -69,8 +62,8 @@
6962
</template>
7063
<script setup lang="ts">
7164
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
72-
import {defaultProps, handleTree} from "@/utils/tree";
73-
import * as DeptApi from "@/api/system/dept";
65+
import { defaultProps, handleTree } from '@/utils/tree'
66+
import * as DeptApi from '@/api/system/dept'
7467
7568
const { t } = useI18n() // 国际化
7669
const message = useMessage() // 消息弹窗
@@ -86,15 +79,15 @@ const formData = ref({
8679
statusList: []
8780
})
8881
const formRules = reactive({
89-
name: [{ required: true, message: '状态类型名不能为空', trigger: 'blur' }],
82+
name: [{ required: true, message: '状态类型名不能为空', trigger: 'blur' }]
9083
})
9184
const formRef = ref() // 表单 Ref
9285
const deptList = ref<Tree[]>([]) // 树形结构
9386
const treeRef = ref() // 菜单树组件 Ref
9487
const checkStrictly = ref(true) // 是否严格模式,即父子不关联
9588
9689
/** 打开弹窗 */
97-
const open = async (type: string, id?: number) => {
90+
const open = async (type: string, id?: number) => {
9891
dialogVisible.value = true
9992
dialogTitle.value = t('action.' + type)
10093
formType.value = type
@@ -105,7 +98,7 @@ const open = async (type: string, id?: number) => {
10598
try {
10699
formData.value = await BusinessStatusTypeApi.getBusinessStatusType(id)
107100
treeRef.value.setCheckedKeys(formData.value.deptIds)
108-
if(formData.value.statusList.length == 0) {
101+
if (formData.value.statusList.length == 0) {
109102
addStatusArea(0)
110103
}
111104
} finally {
@@ -116,7 +109,6 @@ const open = async (type: string, id?: number) => {
116109
}
117110
// 加载部门树
118111
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
119-
120112
}
121113
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
122114
@@ -157,16 +149,18 @@ const resetForm = () => {
157149
treeRef.value?.setCheckedNodes([])
158150
formRef.value?.resetFields()
159151
}
152+
160153
/** 添加状态 */
161-
const addStatusArea = (index) => {
154+
const addStatusArea = () => {
162155
const data = formData.value
163156
data.statusList.push({
164157
name: '',
165158
percent: ''
166159
})
167160
}
161+
168162
/** 删除状态 */
169-
const deleteStatusArea = (index) => {
163+
const deleteStatusArea = (index: number) => {
170164
const data = formData.value
171165
data.statusList.splice(index, 1)
172166
}

0 commit comments

Comments
 (0)