莳松crm管理系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ss-crm-manage-web/src/views/Clue/Pool/Comp/DialogFollow.vue

174 lines
5.2 KiB

1 year ago
<template>
11 months ago
<Dialog :title="dialogTitle" v-model="dialogVisible" width="1000px">
1 year ago
<div class="flex">
10 months ago
<el-form style="flex: 1" :model="form" ref="formRef" :rules="rules" label-width="120px">
<el-row :gutter="20">
<el-col :span="12" :offset="0">
<el-form-item label="本次跟进时间" prop="operateTime">
<el-date-picker
v-model="form.operateTime"
type="datetime"
format="YYYY-MM-DD HH:mm"
valueFormat="YYYY-MM-DD HH:mm"
placeholder="本次跟进时间"
/>
</el-form-item>
</el-col>
<el-col :span="12" :offset="0">
<el-form-item label="下次跟进时间" prop="nextFollowTime">
<el-date-picker
v-model="form.nextFollowTime"
type="date"
format="YYYY-MM-DD"
valueFormat="YYYY-MM-DD"
placeholder="下次跟进时间"
/>
</el-form-item>
</el-col>
10 months ago
<el-col :span="12">
<el-form-item label="意向状态" prop="intentionState">
<el-select v-model="form.intentionState" filterable>
<el-option
v-for="item in intentionOptions"
:key="item.value"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
10 months ago
</el-row>
<el-row :gutter="20">
<el-col :span="24" :offset="0">
<el-form-item label="跟进内容" prop="content">
<el-input
v-model="form.content"
type="textarea"
:autosize="{ minRows: 4 }"
placeholder="请输入跟进内容"
clearable
/>
</el-form-item>
</el-col>
</el-row>
</el-form>
1 year ago
<div class="ml-20px" style="width: 300px">
<el-input
10 months ago
v-model="skillSearch.question"
1 year ago
placeholder="请输入关键字查询关键话术"
clearable
10 months ago
@keyup.enter="getSkillList"
1 year ago
/>
<el-collapse v-model="activeQues" :accordion="false">
<el-collapse-item
10 months ago
v-for="item in skillList"
1 year ago
:key="item.skillId"
:title="item.question"
:name="item.skillId"
>
<div v-dompurify-html="item.content"></div>
</el-collapse-item>
</el-collapse>
10 months ago
<Pagination
v-model:limit="skillSearch.pageSize"
v-model:page="skillSearch.pageNo"
:total="skillCount"
small
layout="total, prev, pager, next, jumper"
@pagination="getSkillList"
/>
1 year ago
</div>
</div>
12 months ago
<template #footer>
<span>
<el-button @click="dialogVisible = false"> </el-button>
10 months ago
<el-button :disabled="formLoading" type="primary" @click="handleSave"> </el-button>
12 months ago
</span>
</template>
11 months ago
</Dialog>
1 year ago
</template>
10 months ago
<script setup name="DialogFollow">
10 months ago
import { getSkillPage } from '@/api/clue/skill'
10 months ago
import { createFollow } from '@/api/clue/followRecord'
10 months ago
import { getDictOptions } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
10 months ago
const { t } = useI18n() // 国际化
const message = useMessage() // 消息弹窗
10 months ago
const intentionOptions = getDictOptions('intention_state')
1 year ago
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
const formRef = ref() // 表单 Ref
10 months ago
const form = ref({})
const rules = {
operateTime: { required: true, message: '本次跟进时间不可为空', trigger: 'change' },
nextFollowTime: { required: true, message: '下次跟进时间不可为空', trigger: 'change' },
content: { required: true, message: '跟进内容不可为空', trigger: 'blur' }
}
10 months ago
const open = async (clueId, status) => {
1 year ago
dialogVisible.value = true
10 months ago
dialogTitle.value = '新增跟进记录'
10 months ago
resetForm(clueId, status)
1 year ago
}
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
10 months ago
function resetForm(clueId, status) {
10 months ago
form.value = {
clueId,
10 months ago
operateTime: formatDate(new Date(), 'YYYY-MM-DD HH:mm'),
10 months ago
nextFollowTime: undefined,
10 months ago
intentionState: status,
10 months ago
content: undefined
}
}
1 year ago
10 months ago
const skillList = ref([])
1 year ago
const activeQues = ref('')
10 months ago
const skillSearch = ref({
pageNo: 1,
pageSize: 10,
question: undefined
})
const skillCount = ref(0)
function getSkillList() {
getSkillPage(skillSearch.value).then((data) => {
skillList.value = data.list
skillCount.value = data.total
})
1 year ago
}
12 months ago
10 months ago
async function handleSave() {
// 校验表单
if (!formRef.value) return
const valid = await formRef.value.validate()
if (!valid) return
// 提交请求
formLoading.value = true
try {
await createFollow(form.value)
message.success(t('common.createSuccess'))
dialogVisible.value = false
// 发送操作成功的事件
emit('success')
} finally {
formLoading.value = false
}
12 months ago
}
10 months ago
onMounted(() => {
getSkillList()
})
1 year ago
</script>
<style lang="scss" scoped></style>