feat : 话务配置管理
This commit is contained in:
36
src/api/phone-traffic-config/index.js
Normal file
36
src/api/phone-traffic-config/index.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import request from '@/utils/request.js'
|
||||||
|
|
||||||
|
// 获取参数配置表详情
|
||||||
|
export const getConfigDetails = (configId,extraConfigType) => {
|
||||||
|
return request({
|
||||||
|
url: `/extra/config/${configId}/${extraConfigType}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增参数配置表
|
||||||
|
export const addConfig = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/extra/config',
|
||||||
|
method: 'post',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改参数配置表
|
||||||
|
export const editConfig = (data) => {
|
||||||
|
return request({
|
||||||
|
url: '/extra/config',
|
||||||
|
method: 'put',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除参数配置表
|
||||||
|
export const delConfig =(configIdList,extraConfigType) => {
|
||||||
|
return request({
|
||||||
|
url: `/extra/config/${configIdList}/${extraConfigType}`,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,72 +1,142 @@
|
|||||||
<template>
|
<template>
|
||||||
<fvSearchForm :searchConfig="searchConfig" @search="search">
|
<fvSearchForm :searchConfig="searchConfig" @search="searchPhoneTraffic"></fvSearchForm>
|
||||||
</fvSearchForm>
|
<fvTable ref="tableIns" :tableConfig="phoneTrafficTableConfig" @headBtnClick="headBtnClick" @selectionChange="selectionChange"></fvTable>
|
||||||
<fvTable ref="tableIns" :tableConfig="tableConfig" :data="mockData" @headBtnClick="headBtnClick"></fvTable>
|
<fvFormDialog ref="formDialogRef" :title="dialogTitle" :dialogType="dialogType"
|
||||||
|
:form-schema="formSchema" :form-rules="formRules"
|
||||||
|
@dialogSubmit="handleSubmitAddressBook"></fvFormDialog>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="jsx">
|
<script setup lang="jsx">
|
||||||
import { shallowRef } from 'vue';
|
import { shallowRef } from 'vue';
|
||||||
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
import fvSelect from '@/fvcomponents/fvSelect/index.vue'
|
||||||
|
import {ElMessage, ElMessageBox} from "element-plus";
|
||||||
|
import {addConfig, delConfig, editConfig, getConfigDetails} from "@/api/phone-traffic-config";
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const tableIns = ref()
|
const tableIns = ref()
|
||||||
const mockData = ref([
|
const formDialogRef = ref()
|
||||||
{
|
const extraConfigType = ref(0)
|
||||||
workOrderNumber: 1211,
|
const contactIds = ref("");
|
||||||
workOrderTime: '2022-02-09 00 : 12',
|
const dialogTitle = ref("");
|
||||||
state: 0,
|
const dialogType = ref("");
|
||||||
callState: 0
|
const formRules = reactive({
|
||||||
},
|
configName: [
|
||||||
{
|
{required: true, message: "参数名称不能为空", trigger: "blur"},
|
||||||
workOrderNumber: 232,
|
],
|
||||||
state: 1,
|
configKey: [
|
||||||
callState: 1
|
{required: true, message: "参数键名不能为空", trigger: "blur"},
|
||||||
}
|
],
|
||||||
])
|
configValue: [
|
||||||
|
{required: true, message: "参数键值不能为空", trigger: "blur"},
|
||||||
|
],
|
||||||
|
configType: [
|
||||||
|
{required: true, message: "系统内置不能为空", trigger: "change"},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
const formSchema = computed(() => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
label: '参数名称',
|
||||||
|
prop: 'configName',
|
||||||
|
component: 'el-input',
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
placeholder: '请输入参数名称',
|
||||||
|
clearable: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '参数键名',
|
||||||
|
prop: 'configKey',
|
||||||
|
component: 'el-input',
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
placeholder: '请输入参数键名',
|
||||||
|
clearable: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '参数键值',
|
||||||
|
prop: 'configValue',
|
||||||
|
component: 'el-input',
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
placeholder: '请输入参数键值',
|
||||||
|
clearable: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '系统内置',
|
||||||
|
prop: 'configType',
|
||||||
|
component: shallowRef(fvSelect),
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
placeholder: '请选择系统内置',
|
||||||
|
cacheKey: 'yes_no',
|
||||||
|
clearable: true,
|
||||||
|
filterable: true,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '备注',
|
||||||
|
prop: 'remark',
|
||||||
|
component: 'el-input',
|
||||||
|
colProps: {
|
||||||
|
span: 24
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
placeholder: '请输入备注',
|
||||||
|
clearable: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
]
|
||||||
|
})
|
||||||
const searchConfig = reactive([
|
const searchConfig = reactive([
|
||||||
{
|
{
|
||||||
label: '配置ID',
|
label: '参数名称',
|
||||||
prop: 'requirementName',
|
prop: 'configName',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入配置ID查询',
|
placeholder: '请输入参数名称查询',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
checkStrictly: true
|
checkStrictly: true
|
||||||
},
|
},
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '名称',
|
label: '参数键名',
|
||||||
prop: 'requirementName',
|
prop: 'configKey',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请输入名称查询',
|
placeholder: '请输入参数键名查询',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
checkStrictly: true
|
checkStrictly: true
|
||||||
},
|
},
|
||||||
component: 'el-input',
|
component: 'el-input',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: '状态',
|
label: '系统内置',
|
||||||
prop: 'requirementName',
|
prop: 'configType',
|
||||||
props: {
|
props: {
|
||||||
placeholder: '请选择状态查询',
|
placeholder: '请选择系统内置查询',
|
||||||
cacheKey: 'work_order_status',
|
cacheKey: 'yes_no',
|
||||||
clearable: true,
|
clearable: true,
|
||||||
filterable: true,
|
filterable: true,
|
||||||
},
|
},
|
||||||
component: shallowRef(fvSelect),
|
component: shallowRef(fvSelect),
|
||||||
},
|
|
||||||
{
|
|
||||||
label: '创建日期',
|
|
||||||
prop: 'requirementName',
|
|
||||||
props: {
|
|
||||||
placeholder: '请选择',
|
|
||||||
clearable: true,
|
|
||||||
checkStrictly: true
|
|
||||||
},
|
|
||||||
component: 'el-date-picker',
|
|
||||||
}
|
}
|
||||||
])
|
])
|
||||||
const tableConfig = reactive({
|
const phoneTrafficTableConfig = reactive({
|
||||||
columns: [
|
columns: [
|
||||||
|
{
|
||||||
|
type: 'selection',
|
||||||
|
prop: 'selection'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
prop: 'index',
|
prop: 'index',
|
||||||
type: 'index',
|
type: 'index',
|
||||||
@@ -75,62 +145,205 @@ const tableConfig = reactive({
|
|||||||
width: 80,
|
width: 80,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'workOrderNumber',
|
prop: 'configName',
|
||||||
label: '配置ID',
|
label: '参数名称',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'workOrderNumber',
|
prop: 'configKey',
|
||||||
label: '名称',
|
label: '参数键名',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'workOrderNumber',
|
prop: 'configValue',
|
||||||
label: '类型',
|
label: '参数键值',
|
||||||
align: 'center'
|
align: 'center'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
prop: 'workOrderNumber',
|
prop: 'configType',
|
||||||
label: '内容',
|
label: '系统内置',
|
||||||
align: 'center'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
prop: 'state',
|
|
||||||
label: '状态',
|
|
||||||
align: 'center',
|
align: 'center',
|
||||||
showOverflowTooltip: false,
|
|
||||||
currentRender: ({ row, index }) => {
|
currentRender: ({ row, index }) => {
|
||||||
if (row.state !== null) {
|
if (row.configType !== null) {
|
||||||
return (<Tag dictType={'work_order_status'} value={row.state} />)
|
return (<Tag dictType={'yes_no'} value={row.configType} />)
|
||||||
} else {
|
} else {
|
||||||
return '--'
|
return '--'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
prop: 'workOrderTime',
|
// prop: 'workOrderTime',
|
||||||
label: '创建时间',
|
// label: '创建时间',
|
||||||
align: 'center',
|
// align: 'center',
|
||||||
width: 200
|
// width: 200
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
prop: 'remark',
|
prop: 'remark',
|
||||||
label: '备注',
|
label: '备注',
|
||||||
align: 'center',
|
align: 'center',
|
||||||
width: 200
|
},
|
||||||
|
{
|
||||||
|
prop: 'oper',
|
||||||
|
label: '操作',
|
||||||
|
align: 'center',
|
||||||
|
fixed: 'right',
|
||||||
|
width: 150,
|
||||||
|
showOverflowTooltip: false,
|
||||||
|
currentRender: ({row, index}) => {
|
||||||
|
let btn = []
|
||||||
|
btn.push({label: '编辑', func: () => handleEdit(row), type: 'primary'})
|
||||||
|
btn.push({label: '删除', func: () => handleSingleDelete(row), type: 'danger'})
|
||||||
|
return (
|
||||||
|
<div style={{width: '100%'}}>
|
||||||
|
{
|
||||||
|
btn.map(item => (
|
||||||
|
<el-button
|
||||||
|
type={item.type}
|
||||||
|
// v-perm={item.prem}
|
||||||
|
onClick={() => item.func()}
|
||||||
|
link
|
||||||
|
>
|
||||||
|
{item.label}
|
||||||
|
</el-button>
|
||||||
|
))
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
api: '',
|
api: '/extra/config',
|
||||||
params: {},
|
params: {
|
||||||
|
extraConfigType:extraConfigType.value
|
||||||
|
},
|
||||||
btns: [
|
btns: [
|
||||||
{name: '新增', key: 'add',type:'primary',icon:'Plus'},
|
{name: '新增', key: 'add',type:'primary'},
|
||||||
|
{name: '删除', key: 'delete', type: 'danger'},
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
const searchPhoneTraffic = (val) => {
|
||||||
|
let obj = {...val}
|
||||||
|
if (obj.dateValue) {
|
||||||
|
obj.startTime = obj.dateValue[0]
|
||||||
|
obj.endTime = obj.dateValue[1]
|
||||||
|
delete obj.dateValue
|
||||||
|
}
|
||||||
|
phoneTrafficTableConfig.params = obj
|
||||||
|
tableIns.value.refresh()
|
||||||
|
}
|
||||||
|
|
||||||
const headBtnClick = (key) => {
|
const headBtnClick = (key) => {
|
||||||
switch (key) {
|
switch (key) {
|
||||||
case 'add':
|
case 'add':
|
||||||
handleAdd()
|
handleAdd()
|
||||||
break;
|
break;
|
||||||
|
case 'delete':
|
||||||
|
handleMoreDelete()
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const handleAdd = () => {
|
||||||
|
formDialogRef.value.openOrCloseDialog(true)
|
||||||
|
dialogTitle.value = "新增话务配置";
|
||||||
|
dialogType.value = "add";
|
||||||
|
nextTick(() => {
|
||||||
|
formDialogRef.value.getFormInstance().setValues({})
|
||||||
|
// 清空校验
|
||||||
|
formDialogRef.value.getFormInstance().clearValidate()
|
||||||
|
formDialogRef.value.getFormInstance().resetFields()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const handleEdit = (row) => {
|
||||||
|
formDialogRef.value.openOrCloseDialog(true)
|
||||||
|
getDetail(row)
|
||||||
|
dialogTitle.value = "编辑话务配置";
|
||||||
|
dialogType.value = "edit";
|
||||||
|
}
|
||||||
|
const getDetail = (row) => {
|
||||||
|
getConfigDetails(row.configId,extraConfigType.value).then(res => {
|
||||||
|
if (res.code === 1000) {
|
||||||
|
ElMessage.success(res.msg)
|
||||||
|
nextTick(() => {
|
||||||
|
formDialogRef.value.getFormInstance().setValues(res.data)
|
||||||
|
// 清空校验
|
||||||
|
formDialogRef.value.getFormInstance().clearValidate()
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const selectionChange = (selection) => {
|
||||||
|
if (selection.length !== 0) {
|
||||||
|
contactIds.value = selection.map(item => item.configId).join()
|
||||||
|
} else {
|
||||||
|
contactIds.value=''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const deleteContactMethod = (configId) => {
|
||||||
|
delConfig(configId,extraConfigType.value).then(res => {
|
||||||
|
if (res.code === 1000) {
|
||||||
|
ElMessage.success(res.msg)
|
||||||
|
tableIns.value.refresh()
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
const handleMoreDelete = () => {
|
||||||
|
if(contactIds.value){
|
||||||
|
ElMessageBox.confirm(`确认删除选择的话务配置吗?`, '系统提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
deleteContactMethod(contactIds.value)
|
||||||
|
})
|
||||||
|
}else{
|
||||||
|
ElMessage.warning("请选择要删除的话务配置")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const handleSingleDelete = (row) => {
|
||||||
|
ElMessageBox.confirm(`确认删除参数名称为${row.configName}的话务配置吗?`, '系统提示', {
|
||||||
|
confirmButtonText: '确定',
|
||||||
|
cancelButtonText: '取消',
|
||||||
|
type: 'warning'
|
||||||
|
}).then(() => {
|
||||||
|
deleteContactMethod(row.configId)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
//提交
|
||||||
|
const handleSubmitAddressBook = async (formInstance) => {
|
||||||
|
if (!formInstance) return;
|
||||||
|
let validate = await formInstance.validate()
|
||||||
|
if (!validate.isValidate) return;
|
||||||
|
let params={
|
||||||
|
...formInstance.getValues(),
|
||||||
|
configType:parseInt(formInstance.getValues().configType),
|
||||||
|
extraConfigType:extraConfigType.value
|
||||||
|
}
|
||||||
|
if (dialogType.value === "add") {
|
||||||
|
addConfig(params).then(res => {
|
||||||
|
if (res.code === 1000) {
|
||||||
|
ElMessage.success(res.msg);
|
||||||
|
tableIns.value.refresh()
|
||||||
|
formDialogRef.value.openOrCloseDialog(false)
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
editConfig(params).then(res => {
|
||||||
|
if (res.code === 1000) {
|
||||||
|
ElMessage.success(res.msg);
|
||||||
|
tableIns.value.refresh()
|
||||||
|
formDialogRef.value.openOrCloseDialog(false)
|
||||||
|
} else {
|
||||||
|
ElMessage.error(res.msg);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user