|
@@ -1,25 +1,28 @@
|
|
|
<template>
|
|
|
- <div class="ivrContent">
|
|
|
- <el-card shadow="never">
|
|
|
+ <div class="deviceManagement-ivrCategroy-container layout-padding">
|
|
|
+ <div class="layout-padding-auto layout-padding-view pd20">
|
|
|
<div class="flex-center-between mb20">
|
|
|
- <p class="table-title">信息列表</p>
|
|
|
+ <p class="table-title">信息列表</p>
|
|
|
<div v-auth="'300302'">
|
|
|
- <el-button type="primary" @click="onAddCategory" v-waves>
|
|
|
- <SvgIcon name="ele-Plus" class="mr5"/>新增分类
|
|
|
+ <el-button type="primary" @click="onAddCategory" v-waves>
|
|
|
+ <SvgIcon name="ele-Plus" class="mr5" />新增分类
|
|
|
</el-button>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
<template v-if="authShow">
|
|
|
<!-- 表格 -->
|
|
|
<el-table :data="list" v-loading="loading">
|
|
|
<el-table-column prop="name" label="分类名称" show-overflow-tooltip></el-table-column>
|
|
|
<el-table-column prop="remark" label="备注" show-overflow-tooltip></el-table-column>
|
|
|
- <el-table-column prop="creationTime" label="创建时间" show-overflow-tooltip width="170"></el-table-column>
|
|
|
+ <el-table-column prop="creationTime" label="创建时间" show-overflow-tooltip width="170">
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" width="150" fixed="right" align="center">
|
|
|
<template #default="scope">
|
|
|
- <el-button text type="primary" @click="onEditCategroy(scope.row)" v-auth="'300303'">修改</el-button>
|
|
|
+ <el-button text type="primary" @click="onEditCategroy(scope.row)" v-auth="'300303'">修改
|
|
|
+ </el-button>
|
|
|
<!-- <el-button text type="success" @click="configIvr(scope.row)">配置ivr</el-button> -->
|
|
|
- <el-button text type="danger" @click="onDelCategroy(scope.row)" v-auth="'300304'">删除</el-button>
|
|
|
+ <el-button text type="danger" @click="onDelCategroy(scope.row)" v-auth="'300304'">删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<template #empty>
|
|
@@ -28,40 +31,43 @@
|
|
|
</el-table>
|
|
|
</template>
|
|
|
<template v-else>
|
|
|
- <el-alert title="您暂无权限查看" type="warning" show-icon :closable="false"/>
|
|
|
+ <el-alert title="您暂无权限查看" type="warning" show-icon :closable="false" />
|
|
|
</template>
|
|
|
- </el-card>
|
|
|
-
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
<el-dialog v-model="isShowDialog" width="600px" draggable :title="dialogTitle">
|
|
|
- <el-form :model="ruleForm" label-width="100px" ref="ruleFormRef">
|
|
|
- <el-row :gutter="35">
|
|
|
- <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
- <el-form-item label="ivr分类名称" prop="name" :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]">
|
|
|
- <el-input v-model="ruleForm.name" placeholder="请输入分类名称" clearable></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- <el-col :xs="24" :sm="12" :md="24" :lg="24" :xl="24">
|
|
|
- <el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="ruleForm.remark" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }" placeholder="请输入备注" clearable></el-input>
|
|
|
- </el-form-item>
|
|
|
- </el-col>
|
|
|
- </el-row>
|
|
|
- </el-form>
|
|
|
- <template #footer>
|
|
|
- <span class="dialog-footer">
|
|
|
- <el-button @click="isShowDialog = false">取 消</el-button>
|
|
|
- <el-button type="primary" @click="onSubmit">保 存</el-button>
|
|
|
- </span>
|
|
|
- </template>
|
|
|
- </el-dialog>
|
|
|
+ <el-form :model="ruleForm" label-width="100px" ref="ruleFormRef">
|
|
|
+ <el-row :gutter="35">
|
|
|
+ <el-col :xs="24" :sm="24" :md="24" :lg="24" :xl="24">
|
|
|
+ <el-form-item label="ivr分类名称" prop="name"
|
|
|
+ :rules="[{ required: true, message: '请输入分类名称', trigger: 'blur' }]">
|
|
|
+ <el-input v-model="ruleForm.name" placeholder="请输入分类名称" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :xs="24" :sm="12" :md="24" :lg="24" :xl="24">
|
|
|
+ <el-form-item label="备注" prop="remark">
|
|
|
+ <el-input v-model="ruleForm.remark" type="textarea" :autosize="{ minRows: 4, maxRows: 6 }"
|
|
|
+ placeholder="请输入备注" clearable></el-input>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ </el-row>
|
|
|
+ </el-form>
|
|
|
+ <template #footer>
|
|
|
+ <span class="dialog-footer">
|
|
|
+ <el-button @click="isShowDialog = false">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="onSubmit">保 存</el-button>
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script lang="ts" setup name="ivrCategroy">
|
|
|
-import { onMounted, reactive, ref, toRefs ,computed} from "vue";
|
|
|
-import {ElMessage, ElMessageBox} from 'element-plus'
|
|
|
-import {getIvrCategories,addIvrCategroies, updateIvrCategroies, deleteIvrCategroies} from "/@/api/deviceManagement/ivr";
|
|
|
+import { onMounted, reactive, ref, toRefs, computed } from "vue";
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
+import { getIvrCategories, addIvrCategroies, updateIvrCategroies, deleteIvrCategroies } from "/@/api/deviceManagement/ivr";
|
|
|
import { formatDate } from '/@/utils/formatTime';
|
|
|
-import {storeToRefs} from 'pinia';
|
|
|
+import { storeToRefs } from 'pinia';
|
|
|
import { useUserInfo } from '/@/stores/userInfo';
|
|
|
// import { useRouter } from "vue-router";
|
|
|
const loading = ref(false);
|
|
@@ -71,73 +77,73 @@ const isShowDialog = ref(false);
|
|
|
let dialogTitle = ref('新增ivr分类');
|
|
|
|
|
|
interface stateIvrCategroy {
|
|
|
- ruleForm:{
|
|
|
- name:string,
|
|
|
- remark:string
|
|
|
+ ruleForm: {
|
|
|
+ name: string,
|
|
|
+ remark: string
|
|
|
}
|
|
|
}
|
|
|
const state = reactive<stateIvrCategroy>({
|
|
|
- ruleForm:{
|
|
|
- name:"",
|
|
|
- remark:""
|
|
|
+ ruleForm: {
|
|
|
+ name: "",
|
|
|
+ remark: ""
|
|
|
}
|
|
|
})
|
|
|
const ruleFormRef = ref();
|
|
|
-const onAddCategory = ()=>{// 新增分类
|
|
|
+const onAddCategory = () => {// 新增分类
|
|
|
dialogTitle.value = "新增分类";
|
|
|
- if(ruleFormRef.value){
|
|
|
+ if (ruleFormRef.value) {
|
|
|
ruleFormRef.value.resetFields();
|
|
|
}
|
|
|
state.ruleForm = {
|
|
|
- name:"",
|
|
|
- remark:""
|
|
|
+ name: "",
|
|
|
+ remark: ""
|
|
|
}
|
|
|
isShowDialog.value = true;
|
|
|
}
|
|
|
-const onEditCategroy = (row:any)=>{// 编辑分类
|
|
|
+const onEditCategroy = (row: any) => {// 编辑分类
|
|
|
dialogTitle.value = "编辑分类";
|
|
|
- if(ruleFormRef.value){
|
|
|
+ if (ruleFormRef.value) {
|
|
|
ruleFormRef.value.resetFields();
|
|
|
}
|
|
|
state.ruleForm = JSON.parse(JSON.stringify(row));
|
|
|
isShowDialog.value = true;
|
|
|
}
|
|
|
-const onDelCategroy = (row:any)=>{ //删除分类
|
|
|
+const onDelCategroy = (row: any) => { //删除分类
|
|
|
ElMessageBox.confirm(`此操作将永久删除分类:【${row.name}】,是否继续?`, '提示', {
|
|
|
- confirmButtonText: '确认',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning',
|
|
|
- }).then(() => {
|
|
|
- deleteIvrCategroies(row.id).then(() => {
|
|
|
- ElMessage.success('删除成功');
|
|
|
- handleQuery();
|
|
|
- });
|
|
|
- }).catch(() => {});
|
|
|
+ confirmButtonText: '确认',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning',
|
|
|
+ }).then(() => {
|
|
|
+ deleteIvrCategroies(row.id).then(() => {
|
|
|
+ ElMessage.success('删除成功');
|
|
|
+ handleQuery();
|
|
|
+ });
|
|
|
+ }).catch(() => { });
|
|
|
}
|
|
|
-const handleQuery = ()=>{ //查询列表
|
|
|
+const handleQuery = () => { //查询列表
|
|
|
loading.value = true;
|
|
|
- getIvrCategories().then((res:any)=>{
|
|
|
+ getIvrCategories().then((res: any) => {
|
|
|
list.value = res?.result ?? [];
|
|
|
for (let i of list.value) {
|
|
|
i.creationTime = formatDate(new Date(i.creationTime), 'YYYY-mm-dd HH:MM:SS');
|
|
|
}
|
|
|
setTimeout(() => {
|
|
|
- loading.value = false;
|
|
|
- }, 300);
|
|
|
+ loading.value = false;
|
|
|
+ }, 300);
|
|
|
})
|
|
|
}
|
|
|
-const onSubmit = ()=>{// 保存
|
|
|
+const onSubmit = () => {// 保存
|
|
|
ruleFormRef.value.validate((valid: boolean) => {
|
|
|
if (valid) {
|
|
|
loading.value = true;
|
|
|
- if(dialogTitle.value === '新增分类'){
|
|
|
- addIvrCategroies(state.ruleForm).then(()=>{
|
|
|
+ if (dialogTitle.value === '新增分类') {
|
|
|
+ addIvrCategroies(state.ruleForm).then(() => {
|
|
|
ElMessage.success("新增成功")
|
|
|
handleQuery();
|
|
|
isShowDialog.value = false;
|
|
|
})
|
|
|
- }else if(dialogTitle.value === '编辑分类'){
|
|
|
- updateIvrCategroies(state.ruleForm).then(()=>{
|
|
|
+ } else if (dialogTitle.value === '编辑分类') {
|
|
|
+ updateIvrCategroies(state.ruleForm).then(() => {
|
|
|
ElMessage.success("更新成功")
|
|
|
handleQuery();
|
|
|
isShowDialog.value = false;
|
|
@@ -149,8 +155,8 @@ const onSubmit = ()=>{// 保存
|
|
|
});
|
|
|
}
|
|
|
const storesUserInfo = useUserInfo();
|
|
|
-const {userInfos} = storeToRefs(storesUserInfo);
|
|
|
-const authShow = computed(()=>{ // 校验是否有查看权限
|
|
|
+const { userInfos } = storeToRefs(storesUserInfo);
|
|
|
+const authShow = computed(() => { // 校验是否有查看权限
|
|
|
return userInfos.value.authBtnList.includes('300301')
|
|
|
})
|
|
|
// const configIvr = (row:any)=>{ // 配置ivr
|
|
@@ -163,14 +169,18 @@ const authShow = computed(()=>{ // 校验是否有查看权限
|
|
|
// }
|
|
|
// })
|
|
|
// }
|
|
|
-const {ruleForm} = toRefs(state);
|
|
|
-onMounted(()=>{
|
|
|
- if(userInfos.value.authBtnList.includes('300301')){
|
|
|
+const { ruleForm } = toRefs(state);
|
|
|
+onMounted(() => {
|
|
|
+ if (userInfos.value.authBtnList.includes('300301')) {
|
|
|
handleQuery();
|
|
|
}
|
|
|
})
|
|
|
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
-
|
|
|
+.deviceManagement-ivrCategroy-container{
|
|
|
+ .el-table {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+}
|
|
|
</style>
|