crm:code review 商机类型
This commit is contained in:
parent
937fc17150
commit
36702f5f90
@ -10,6 +10,7 @@
|
|||||||
<el-form-item label="商机名称" prop="name">
|
<el-form-item label="商机名称" prop="name">
|
||||||
<el-input v-model="formData.name" placeholder="请输入商机名称" />
|
<el-input v-model="formData.name" placeholder="请输入商机名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<!-- TODO 芋艿:客户列表的组件 -->
|
||||||
<el-form-item label="客户名称" prop="customerName">
|
<el-form-item label="客户名称" prop="customerName">
|
||||||
<el-popover
|
<el-popover
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
@ -78,12 +79,7 @@
|
|||||||
</el-select>
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商机状态" prop="statusId">
|
<el-form-item label="商机状态" prop="statusId">
|
||||||
<el-select
|
<el-select v-model="formData.statusId" placeholder="请选择商机状态" clearable size="small">
|
||||||
v-model="formData.statusId"
|
|
||||||
placeholder="请选择商机状态"
|
|
||||||
clearable
|
|
||||||
size="small"
|
|
||||||
>
|
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in businessStatusList"
|
v-for="item in businessStatusList"
|
||||||
:key="item.id"
|
:key="item.id"
|
||||||
@ -122,9 +118,9 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import * as BusinessApi from '@/api/crm/business'
|
import * as BusinessApi from '@/api/crm/business'
|
||||||
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
|
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
|
||||||
import * as CustomerApi from "@/api/crm/customer";
|
import * as CustomerApi from '@/api/crm/customer'
|
||||||
import { DICT_TYPE } from '@/utils/dict'
|
import { DICT_TYPE } from '@/utils/dict'
|
||||||
import {ElTable} from "element-plus";
|
import { ElTable } from 'element-plus'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -233,10 +229,12 @@ const resetForm = () => {
|
|||||||
}
|
}
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
const changeBusinessStatusType = async (id) => {
|
|
||||||
// 加载商机状态列表
|
/** 加载商机状态列表 */
|
||||||
businessStatusList.value = await BusinessStatusTypeApi.getBusinessStatusListByTypeId(id)
|
const changeBusinessStatusType = async (typeId: number) => {
|
||||||
|
businessStatusList.value = await BusinessStatusTypeApi.getBusinessStatusListByTypeId(typeId)
|
||||||
}
|
}
|
||||||
|
|
||||||
const queryParams = reactive({
|
const queryParams = reactive({
|
||||||
pageNo: 1,
|
pageNo: 1,
|
||||||
pageSize: 10,
|
pageSize: 10,
|
||||||
|
@ -23,22 +23,12 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="状态设置" prop="statusList">
|
<el-form-item label="状态设置" prop="statusList">
|
||||||
<el-table border style="width: 100%" :data="formData.statusList">
|
<el-table border style="width: 100%" :data="formData.statusList">
|
||||||
<el-table-column
|
<el-table-column align="center" label="状态" width="120" prop="star">
|
||||||
align="center"
|
|
||||||
label="状态"
|
|
||||||
width="120"
|
|
||||||
prop="star"
|
|
||||||
>
|
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-text>状态{{scope.$index+1}}</el-text>
|
<el-text>状态{{ scope.$index + 1 }}</el-text>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column
|
<el-table-column align="center" label="状态名称" width="120" prop="name">
|
||||||
align="center"
|
|
||||||
label="状态名称"
|
|
||||||
width="120"
|
|
||||||
prop="name"
|
|
||||||
>
|
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<el-input v-model="row.name" placeholder="请输入状态名称" />
|
<el-input v-model="row.name" placeholder="请输入状态名称" />
|
||||||
</template>
|
</template>
|
||||||
@ -50,10 +40,13 @@
|
|||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column label="操作" align="center">
|
<el-table-column label="操作" align="center">
|
||||||
<template #default="scope">
|
<template #default="scope">
|
||||||
<el-button link type="primary" @click="addStatusArea(scope.$index)">
|
<el-button link type="primary" @click="addStatusArea(scope.$index)"> 添加 </el-button>
|
||||||
添加
|
<el-button
|
||||||
</el-button>
|
link
|
||||||
<el-button link type="danger" @click="deleteStatusArea(scope.$index)" v-show="scope.$index>0">
|
type="danger"
|
||||||
|
@click="deleteStatusArea(scope.$index)"
|
||||||
|
v-show="scope.$index > 0"
|
||||||
|
>
|
||||||
删除
|
删除
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
@ -69,8 +62,8 @@
|
|||||||
</template>
|
</template>
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
|
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
|
||||||
import {defaultProps, handleTree} from "@/utils/tree";
|
import { defaultProps, handleTree } from '@/utils/tree'
|
||||||
import * as DeptApi from "@/api/system/dept";
|
import * as DeptApi from '@/api/system/dept'
|
||||||
|
|
||||||
const { t } = useI18n() // 国际化
|
const { t } = useI18n() // 国际化
|
||||||
const message = useMessage() // 消息弹窗
|
const message = useMessage() // 消息弹窗
|
||||||
@ -86,7 +79,7 @@ const formData = ref({
|
|||||||
statusList: []
|
statusList: []
|
||||||
})
|
})
|
||||||
const formRules = reactive({
|
const formRules = reactive({
|
||||||
name: [{ required: true, message: '状态类型名不能为空', trigger: 'blur' }],
|
name: [{ required: true, message: '状态类型名不能为空', trigger: 'blur' }]
|
||||||
})
|
})
|
||||||
const formRef = ref() // 表单 Ref
|
const formRef = ref() // 表单 Ref
|
||||||
const deptList = ref<Tree[]>([]) // 树形结构
|
const deptList = ref<Tree[]>([]) // 树形结构
|
||||||
@ -105,7 +98,7 @@ const open = async (type: string, id?: number) => {
|
|||||||
try {
|
try {
|
||||||
formData.value = await BusinessStatusTypeApi.getBusinessStatusType(id)
|
formData.value = await BusinessStatusTypeApi.getBusinessStatusType(id)
|
||||||
treeRef.value.setCheckedKeys(formData.value.deptIds)
|
treeRef.value.setCheckedKeys(formData.value.deptIds)
|
||||||
if(formData.value.statusList.length == 0) {
|
if (formData.value.statusList.length == 0) {
|
||||||
addStatusArea(0)
|
addStatusArea(0)
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -116,7 +109,6 @@ const open = async (type: string, id?: number) => {
|
|||||||
}
|
}
|
||||||
// 加载部门树
|
// 加载部门树
|
||||||
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
|
||||||
|
|
||||||
}
|
}
|
||||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
||||||
|
|
||||||
@ -157,16 +149,18 @@ const resetForm = () => {
|
|||||||
treeRef.value?.setCheckedNodes([])
|
treeRef.value?.setCheckedNodes([])
|
||||||
formRef.value?.resetFields()
|
formRef.value?.resetFields()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 添加状态 */
|
/** 添加状态 */
|
||||||
const addStatusArea = (index) => {
|
const addStatusArea = () => {
|
||||||
const data = formData.value
|
const data = formData.value
|
||||||
data.statusList.push({
|
data.statusList.push({
|
||||||
name: '',
|
name: '',
|
||||||
percent: ''
|
percent: ''
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 删除状态 */
|
/** 删除状态 */
|
||||||
const deleteStatusArea = (index) => {
|
const deleteStatusArea = (index: number) => {
|
||||||
const data = formData.value
|
const data = formData.value
|
||||||
data.statusList.splice(index, 1)
|
data.statusList.splice(index, 1)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user