商机、商机状态类型

(cherry picked from commit 50430bb9cd)
This commit is contained in:
ljlleo 2023-11-24 14:21:21 +08:00 committed by shizhong
parent 2dc6c8ba93
commit 85bd10a1fc
2 changed files with 36 additions and 28 deletions

View File

@ -10,7 +10,6 @@
<el-form-item label="商机名称" prop="name">
<el-input v-model="formData.name" placeholder="请输入商机名称" />
</el-form-item>
<!-- TODO 芋艿客户列表的组件 -->
<el-form-item label="客户名称" prop="customerName">
<el-popover
placement="bottom"
@ -79,7 +78,12 @@
</el-select>
</el-form-item>
<el-form-item label="商机状态" prop="statusId">
<el-select v-model="formData.statusId" placeholder="请选择商机状态" clearable size="small">
<el-select
v-model="formData.statusId"
placeholder="请选择商机状态"
clearable
size="small"
>
<el-option
v-for="item in businessStatusList"
:key="item.id"
@ -118,9 +122,9 @@
<script setup lang="ts">
import * as BusinessApi from '@/api/crm/business'
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 { ElTable } from 'element-plus'
import {ElTable} from "element-plus";
const { t } = useI18n() //
const message = useMessage() //
@ -229,12 +233,10 @@ const resetForm = () => {
}
formRef.value?.resetFields()
}
/** 加载商机状态列表 */
const changeBusinessStatusType = async (typeId: number) => {
businessStatusList.value = await BusinessStatusTypeApi.getBusinessStatusListByTypeId(typeId)
const changeBusinessStatusType = async (id) => {
//
businessStatusList.value = await BusinessStatusTypeApi.getBusinessStatusListByTypeId(id)
}
const queryParams = reactive({
pageNo: 1,
pageSize: 10,

View File

@ -23,12 +23,22 @@
</el-form-item>
<el-form-item label="状态设置" prop="statusList">
<el-table border style="width: 100%" :data="formData.statusList">
<el-table-column align="center" label="状态" width="120" prop="star">
<el-table-column
align="center"
label="状态"
width="120"
prop="star"
>
<template #default="scope">
<el-text>状态{{ scope.$index + 1 }}</el-text>
<el-text>状态{{scope.$index+1}}</el-text>
</template>
</el-table-column>
<el-table-column align="center" label="状态名称" width="120" prop="name">
<el-table-column
align="center"
label="状态名称"
width="120"
prop="name"
>
<template #default="{ row }">
<el-input v-model="row.name" placeholder="请输入状态名称" />
</template>
@ -40,13 +50,10 @@
</el-table-column>
<el-table-column label="操作" align="center">
<template #default="scope">
<el-button link type="primary" @click="addStatusArea(scope.$index)"> 添加 </el-button>
<el-button
link
type="danger"
@click="deleteStatusArea(scope.$index)"
v-show="scope.$index > 0"
>
<el-button link type="primary" @click="addStatusArea(scope.$index)">
添加
</el-button>
<el-button link type="danger" @click="deleteStatusArea(scope.$index)" v-show="scope.$index>0">
删除
</el-button>
</template>
@ -62,8 +69,8 @@
</template>
<script setup lang="ts">
import * as BusinessStatusTypeApi from '@/api/crm/businessStatusType'
import { defaultProps, handleTree } from '@/utils/tree'
import * as DeptApi from '@/api/system/dept'
import {defaultProps, handleTree} from "@/utils/tree";
import * as DeptApi from "@/api/system/dept";
const { t } = useI18n() //
const message = useMessage() //
@ -79,7 +86,7 @@ const formData = ref({
statusList: []
})
const formRules = reactive({
name: [{ required: true, message: '状态类型名不能为空', trigger: 'blur' }]
name: [{ required: true, message: '状态类型名不能为空', trigger: 'blur' }],
})
const formRef = ref() // Ref
const deptList = ref<Tree[]>([]) //
@ -87,7 +94,7 @@ const treeRef = ref() // 菜单树组件 Ref
const checkStrictly = ref(true) //
/** 打开弹窗 */
const open = async (type: string, id?: number) => {
const open = async (type: string, id?: number) => {
dialogVisible.value = true
dialogTitle.value = t('action.' + type)
formType.value = type
@ -98,7 +105,7 @@ const open = async (type: string, id?: number) => {
try {
formData.value = await BusinessStatusTypeApi.getBusinessStatusType(id)
treeRef.value.setCheckedKeys(formData.value.deptIds)
if (formData.value.statusList.length == 0) {
if(formData.value.statusList.length == 0) {
addStatusArea(0)
}
} finally {
@ -109,6 +116,7 @@ const open = async (type: string, id?: number) => {
}
//
deptList.value = handleTree(await DeptApi.getSimpleDeptList())
}
defineExpose({ open }) // open
@ -149,18 +157,16 @@ const resetForm = () => {
treeRef.value?.setCheckedNodes([])
formRef.value?.resetFields()
}
/** 添加状态 */
const addStatusArea = () => {
const addStatusArea = (index) => {
const data = formData.value
data.statusList.push({
name: '',
percent: ''
})
}
/** 删除状态 */
const deleteStatusArea = (index: number) => {
const deleteStatusArea = (index) => {
const data = formData.value
data.statusList.splice(index, 1)
}