Skip to content

Commit 956f19d

Browse files
committed
CRM:合同的 code review
1 parent a5f8c3d commit 956f19d

File tree

16 files changed

+77
-28
lines changed

16 files changed

+77
-28
lines changed

src/api/bpm/model/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ export const getModelPage = async (params) => {
3232
export const getModel = async (id: number) => {
3333
return await request.get({ url: '/bpm/model/get?id=' + id })
3434
}
35+
3536
export const getModelByKey = async (key: string) => {
3637
return await request.get({ url: '/bpm/model/get-by-key?key=' + key })
3738
}
39+
3840
export const updateModel = async (data: ModelVO) => {
3941
return await request.put({ url: '/bpm/model/update', data: data })
4042
}

src/api/crm/bi/ranking.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ export interface BiContractRanKingRespVO {
55
nickname: string
66
deptName: string
77
}
8+
89
export interface BiReceivablesRanKingRespVO {
910
price: number
1011
nickname: string
1112
deptName: string
1213
}
14+
1315
export interface BiRankReqVO {
1416
deptId: number
1517
type: string

src/api/crm/business/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ export const getBusinessListByIds = async (val: number[]) => {
7373
}
7474

7575
// 商机转移
76+
// TODO @puhui999:transferBusiness
7677
export const transfer = async (data: TransferReqVO) => {
7778
return await request.put({ url: '/crm/business/transfer', data })
7879
}

src/api/crm/contract/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export const handleApprove = async (id: number) => {
7171
}
7272

7373
// 合同转移
74+
// TODO @puhui999:transfer 相关方法,这块要补充下;
7475
export const transfer = async (data: TransferReqVO) => {
7576
return await request.put({ url: '/crm/contract/transfer', data })
7677
}

src/components/Table/src/TableSelectForm.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- TODO @puhui999:这个最好加个注释哈 -->
12
<template>
23
<Dialog v-model="dialogVisible" :appendToBody="true" :scroll="true" :title="title" width="60%">
34
<el-table

src/views/crm/backlog/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ const leftSides = ref([
9696
const sideClick = (item) => {
9797
leftType.value = item.infoType
9898
}
99+
// TODO @dhb52: 侧边栏样式,在黑暗模式下,颜色会不对。是不是可以读取主题色哈;
99100
</script>
100-
101101
<style lang="scss" scoped>
102102
.side-item-list {
103103
top: 0;

src/views/crm/bi/ranking/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
</ContentWrap>
3737
<el-col>
3838
<el-tabs v-model="activeTab">
39+
<!-- 合同金额排行 -->
3940
<el-tab-pane label="合同金额排行" name="contractAmountRanking">
40-
<!-- 合同金额排行 -->
4141
<RankingContractStatistics :queryParams="queryParams" ref="rankingContractStatisticsRef" />
4242
</el-tab-pane>
43+
<!-- 回款金额排行 -->
4344
<el-tab-pane label="回款金额排行" name="receivablesRanKing" lazy>
44-
<!-- 回款金额排行 -->
4545
<RankingReceivablesStatistics
4646
:queryParams="queryParams"
4747
ref="rankingReceivablesStatisticsRef"
@@ -83,6 +83,7 @@ const resetQuery = () => {
8383
queryFormRef.value.resetFields()
8484
handleQuery()
8585
}
86+
8687
// 加载部门树
8788
onMounted(async () => {
8889
deptList.value = handleTree(await DeptApi.getSimpleDeptList())

src/views/crm/contact/detail/index.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ const message = useMessage()
5757
const id = Number(route.params.id) // 联系人编号
5858
const loading = ref(true) // 加载中
5959
const contact = ref<ContactApi.ContactVO>({} as ContactApi.ContactVO) // 联系人详情
60+
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // 团队成员列表 Ref
6061
6162
/** 获取详情 */
6263
const getContactData = async (id: number) => {
@@ -68,22 +69,20 @@ const getContactData = async (id: number) => {
6869
loading.value = false
6970
}
7071
}
72+
7173
/** 编辑 */
7274
const formRef = ref()
7375
const openForm = (type: string, id?: number) => {
7476
formRef.value.open(type, id)
7577
}
78+
7679
/** 联系人转移 */
7780
const crmTransferFormRef = ref<InstanceType<typeof CrmTransferForm>>() // 联系人转移表单 ref
7881
const transfer = () => {
7982
crmTransferFormRef.value?.open('联系人转移', contact.value.id, ContactApi.transfer)
8083
}
8184
82-
const permissionListRef = ref<InstanceType<typeof PermissionList>>() // 团队成员列表 Ref
83-
84-
/**
85-
* 获取操作日志
86-
*/
85+
/** 获取操作日志 */
8786
const logList = ref<OperateLogV2VO[]>([]) // 操作日志列表
8887
const getOperateLog = async (contactId: number) => {
8988
if (!contactId) {
@@ -95,9 +94,12 @@ const getOperateLog = async (contactId: number) => {
9594
})
9695
logList.value = data.list
9796
}
97+
98+
/** 关闭窗口 */
9899
const close = () => {
99100
delView(unref(currentRoute))
100101
}
102+
101103
/** 初始化 */
102104
const { delView } = useTagsViewStore() // 视图操作
103105
const { currentRoute } = useRouter() // 路由

src/views/crm/contract/ContractForm.vue

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@
144144
<el-col :span="24">
145145
<CardTitle class="mb-10px" title="审批信息" />
146146
</el-col>
147+
<!-- TODO 芋艿:需要后面在 review 下,目前看不到信息 -->
147148
<el-col :span="12">
148149
<el-button
149150
class="m-20px"
@@ -188,15 +189,17 @@ const formRules = reactive({
188189
no: [{ required: true, message: '合同编号不能为空', trigger: 'blur' }]
189190
})
190191
const formRef = ref() // 表单 Ref
191-
const BPMLModelRef = ref<InstanceType<typeof BPMLModel>>()
192+
const BPMLModelRef = ref<InstanceType<typeof BPMLModel>>() // TODO @puhui999:这个变量不太对;另外,可以不做 bpm model 窗口,而是可以点击跳转到工作流详情里;
193+
194+
// TODO @puhui999:加个注释哈
192195
watch(
193196
() => formData.value.productItems,
194197
(val) => {
195198
if (!val || val.length === 0) {
196199
formData.value.productPrice = 0
197200
return
198201
}
199-
// 使用reduce函数进行累加
202+
// 使用 reduce 函数进行累加
200203
formData.value.productPrice = val.reduce(
201204
(accumulator, currentValue) =>
202205
isNaN(accumulator + currentValue.totalPrice) ? 0 : accumulator + currentValue.totalPrice,
@@ -205,13 +208,13 @@ watch(
205208
},
206209
{ deep: true }
207210
)
211+
208212
/** 打开弹窗 */
209213
const open = async (type: string, id?: number) => {
210214
dialogVisible.value = true
211215
dialogTitle.value = t('action.' + type)
212216
formType.value = type
213217
resetForm()
214-
await getAllApi()
215218
// 修改时,设置数据
216219
if (id) {
217220
formLoading.value = true
@@ -221,10 +224,9 @@ const open = async (type: string, id?: number) => {
221224
formLoading.value = false
222225
}
223226
}
227+
await getAllApi()
224228
}
225-
const getAllApi = async () => {
226-
await Promise.all([getCustomerList(), getUserList(), getContactListList(), getBusinessList()])
227-
}
229+
228230
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
229231
230232
/** 提交表单 */
@@ -252,32 +254,42 @@ const submitForm = async () => {
252254
formLoading.value = false
253255
}
254256
}
255-
const customerList = ref<CustomerApi.CustomerVO[]>([])
257+
258+
/** 重置表单 */
259+
const resetForm = () => {
260+
formData.value = {} as ContractApi.ContractVO
261+
formRef.value?.resetFields()
262+
}
263+
264+
/** 获取其它相关数据 */
265+
const getAllApi = async () => {
266+
await Promise.all([getCustomerList(), getUserList(), getContactListList(), getBusinessList()])
267+
}
268+
256269
/** 获取客户 */
270+
const customerList = ref<CustomerApi.CustomerVO[]>([])
257271
const getCustomerList = async () => {
258272
customerList.value = await CustomerApi.getSimpleCustomerList()
259273
}
260-
const contactList = ref<ContactApi.ContactVO[]>([])
274+
261275
/** 动态获取客户联系人 */
276+
const contactList = ref<ContactApi.ContactVO[]>([])
262277
const getContactOptions = computed(() =>
263278
contactList.value.filter((item) => item.customerId === formData.value.customerId)
264279
)
265280
const getContactListList = async () => {
266281
contactList.value = await ContactApi.getSimpleContactList()
267282
}
268-
const userList = ref<UserApi.UserVO[]>([])
283+
269284
/** 获取用户列表 */
285+
const userList = ref<UserApi.UserVO[]>([])
270286
const getUserList = async () => {
271287
userList.value = await UserApi.getSimpleUserList()
272288
}
273-
const businessList = ref<BusinessApi.BusinessVO[]>([])
289+
274290
/** 获取商机 */
291+
const businessList = ref<BusinessApi.BusinessVO[]>([])
275292
const getBusinessList = async () => {
276293
businessList.value = await BusinessApi.getSimpleBusinessList()
277294
}
278-
/** 重置表单 */
279-
const resetForm = () => {
280-
formData.value = {} as ContractApi.ContractVO
281-
formRef.value?.resetFields()
282-
}
283295
</script>

src/views/crm/contract/components/ProductList.vue

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<!-- 合同 Form 表单下的 Product 列表 -->
12
<template>
23
<el-row justify="end">
34
<el-button plain type="primary" @click="openForm">添加产品</el-button>
@@ -71,23 +72,32 @@ withDefaults(defineProps<{ modelValue: any[] }>(), { modelValue: () => [] })
7172
const emits = defineEmits<{
7273
(e: 'update:modelValue', v: any[]): void
7374
}>()
74-
const list = ref<ProductApi.ProductExpandVO[]>([])
75+
76+
const list = ref<ProductApi.ProductExpandVO[]>([]) // TODO @puhui999
77+
const multipleSelection = ref<ProductApi.ProductExpandVO[]>([]) // 多选
78+
79+
/** 处理删除 */
7580
const handleDelete = (id: number) => {
7681
const index = list.value.findIndex((item) => item.id === id)
7782
if (index !== -1) {
7883
list.value.splice(index, 1)
7984
}
8085
}
86+
87+
/** 打开 Product 弹窗 */
8188
const tableSelectFormRef = ref<InstanceType<typeof TableSelectForm>>()
82-
const multipleSelection = ref<ProductApi.ProductExpandVO[]>([])
8389
const openForm = () => {
8490
tableSelectFormRef.value?.open(ProductApi.getProductPage)
8591
}
92+
93+
/** 计算 totalPrice */
8694
const getTotalPrice = computed(() => (row: ProductApi.ProductExpandVO) => {
8795
const totalPrice = (row.price * row.count * row.discountPercent) / 100
8896
row.totalPrice = isNaN(totalPrice) ? 0 : totalPrice
8997
return isNaN(totalPrice) ? 0 : totalPrice
9098
})
99+
100+
// TODO @puhui999:注释下
91101
watch(
92102
list,
93103
(val) => {
@@ -98,6 +108,8 @@ watch(
98108
},
99109
{ deep: true }
100110
)
111+
112+
// TODO @puhui999:注释下
101113
watch(
102114
multipleSelection,
103115
(val) => {

0 commit comments

Comments
 (0)