完成投诉管理
This commit is contained in:
206
src/views/system/Complaint/complainMain.vue
Normal file
206
src/views/system/Complaint/complainMain.vue
Normal file
@@ -0,0 +1,206 @@
|
||||
<template>
|
||||
<div class="ResidentMainBox p-2 w-full">
|
||||
<PageHeader title="投诉详情"></PageHeader>
|
||||
<div class="ResidentMainBody">
|
||||
<!-- 投诉信息 -->
|
||||
<div class="mb-10">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>投诉信息</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="w-full h-full CarinfoBox">
|
||||
<div class="carinfo_item">
|
||||
<div class="label">投诉类型</div>
|
||||
<div class="main">{{ form.type }}</div>
|
||||
</div>
|
||||
|
||||
<div class="carinfo_item">
|
||||
<div class="label">问题描述</div>
|
||||
<div class="main">{{ form.problemDes }}</div>
|
||||
</div>
|
||||
|
||||
<div class="carinfo_item">
|
||||
<div class="label">投诉人姓名</div>
|
||||
<div class="main">{{ form.complaintName }}</div>
|
||||
</div>
|
||||
|
||||
<div class="carinfo_item">
|
||||
<div class="label">手机号码</div>
|
||||
<div class="main">{{ form.phone }}</div>
|
||||
</div>
|
||||
|
||||
<div class="carinfo_item">
|
||||
<div class="label">投诉时间</div>
|
||||
<div class="main">{{ form.orderDate }}</div>
|
||||
</div>
|
||||
|
||||
<div class="carinfo_item">
|
||||
<div class="label">处理状态</div>
|
||||
<div class="main">
|
||||
<DictTag :options="com_complaint_status" :value="form.status"></DictTag>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
<!-- 处理情况 -->
|
||||
<div class="mb-10">
|
||||
<el-card>
|
||||
<template #header>
|
||||
<div class="card-header">
|
||||
<span>处理情况</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="formbox">
|
||||
<el-form ref="formRef" :rules="rules" class="m-auto" :inline="false" label-width="100px" :model="form">
|
||||
<el-form-item label="处理状态" prop="status">
|
||||
<el-radio-group v-model="form.status">
|
||||
<el-radio v-for="(item, index) in com_complaint_status" :key="index" :value="item.value">{{ item.label }}</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理人员" prop="handleId">
|
||||
<repairUser :userid="form.handleId" returnvalue="value" @change="handleChange"></repairUser>
|
||||
</el-form-item>
|
||||
<el-form-item label="处理描述" prop="handleContent">
|
||||
<el-input type="textarea" :rows="5" v-model="form.handleContent"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="submitForm">提交</el-button>
|
||||
<el-button @click="handleBack">返回</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</div>
|
||||
</el-card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import repairUser from '@/components/Holder/repairUser.vue';
|
||||
import PageHeader from '@/components/Pageheader/index.vue';
|
||||
import { getComplaint, updateComplaint } from '@/api/system/Complaint';
|
||||
import { listComplaintType } from '@/api/system/ComplainType';
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_complaint_status } = toRefs<any>(proxy?.useDict('com_complaint_status'));
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
|
||||
const form = ref({
|
||||
'id': null,
|
||||
'type': '',
|
||||
'typeId': null,
|
||||
'problemDes': '',
|
||||
'complaintName': '',
|
||||
'phone': '',
|
||||
'problemIamgeUrl': '',
|
||||
'status': '1', // 投诉状态 0待处理 1已处理
|
||||
'handleId': '',
|
||||
'handleName': '',
|
||||
'handleContent': ''
|
||||
});
|
||||
const rules = {
|
||||
status: [{ required: true, message: '选择投诉处理状态', trigger: 'blur' }]
|
||||
};
|
||||
const userid = ref();
|
||||
const complaintyTyplist = ref([]);
|
||||
// ! 投诉 ====================================================================================================
|
||||
async function init() {
|
||||
const res2 = await listComplaintType();
|
||||
getComplaint(userid.value).then((res) => {
|
||||
form.value = {
|
||||
...form.value,
|
||||
...res.data
|
||||
};
|
||||
console.log(form.value);
|
||||
const find = res2.rows.find((item) => item.id === form.value.typeId);
|
||||
if (find) {
|
||||
form.value.type = find.name;
|
||||
}
|
||||
console.log(form.value);
|
||||
});
|
||||
}
|
||||
|
||||
if (route.query.id) {
|
||||
userid.value = route.query.id;
|
||||
init();
|
||||
}
|
||||
|
||||
function handleChange(pop) {
|
||||
form.value.handleId = pop.userId;
|
||||
form.value.handleName = pop.nickName;
|
||||
}
|
||||
|
||||
// 提交
|
||||
|
||||
const formRef = ref();
|
||||
const submitForm = () => {
|
||||
formRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
if (userid.value) {
|
||||
updateComplaint(form.value).then(() => {
|
||||
ElMessage.success('编辑成功');
|
||||
handleBack();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// 返回
|
||||
function handleBack() {
|
||||
router.push({
|
||||
path: '/repair/complaint'
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.ResidentMainBox {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
.ResidentMainBody {
|
||||
margin-top: 20px;
|
||||
flex: 1;
|
||||
|
||||
.CarinfoBox {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-rows: repeat(2, 1fr);
|
||||
gap: 20px;
|
||||
.carinfo_item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.label {
|
||||
margin-right: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.formbox {
|
||||
width: 500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
&:deep(div.el-step__head.is-process) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px dashed gray;
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
&:deep(.el-step.is-vertical .el-step__line) {
|
||||
top: 20px;
|
||||
}
|
||||
&:deep(div.el-step__head.is-finish) {
|
||||
& > div.el-step__line {
|
||||
width: 0;
|
||||
border: 1px solid var(--el-color-primary);
|
||||
background: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
196
src/views/system/Complaint/index.vue
Normal file
196
src/views/system/Complaint/index.vue
Normal file
@@ -0,0 +1,196 @@
|
||||
<template>
|
||||
<div class="h-full p-2 flex flex-col">
|
||||
<transition :enter-active-class="proxy?.animate.searchAnimate.enter" :leave-active-class="proxy?.animate.searchAnimate.leave">
|
||||
<div v-show="showSearch" class="mb-[10px]">
|
||||
<el-card shadow="hover">
|
||||
<el-form ref="queryFormRef" label-width="120px" :model="queryParams" :inline="true">
|
||||
<el-form-item label="投诉类型" prop="typeId">
|
||||
<el-select v-model="queryParams.typeId" placeholder="请选择投诉类型" style="width: 240px">
|
||||
<el-option :disabled="item.status === '1'" v-for="item in complaintyTyplist" :key="item.id" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="投诉人姓名" prop="complaintName">
|
||||
<el-input v-model="queryParams.complaintName" placeholder="请输入投诉人姓名" clearable @keyup.enter="handleQuery" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="Refresh" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</el-card>
|
||||
</div>
|
||||
</transition>
|
||||
|
||||
<el-card class="flex-1" shadow="never">
|
||||
<el-table v-loading="loading" border :data="complaintList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="投诉类型" align="center" prop="typeId" />
|
||||
<el-table-column label="投诉状态" align="center" prop="status">
|
||||
<template #default="scope">
|
||||
<dict-tag :options="com_complaint_status" :value="scope.row.status"></dict-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="问题描述" align="center" prop="problemDes" />
|
||||
<el-table-column label="投诉人姓名" align="center" prop="complaintName" />
|
||||
<el-table-column label="手机号" align="center" prop="phone" />
|
||||
<el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width">
|
||||
<template #default="scope">
|
||||
<el-button link type="primary" @click="handleUpdate(scope.row)" v-hasPermi="['complaint:complaint:edit']">查看详情</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination v-show="total > 0" :total="total" v-model:page="queryParams.pageNum" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
||||
</el-card>
|
||||
</div>
|
||||
</template>
|
||||
<!-- complaint -->
|
||||
<script setup name="Complaint" lang="ts">
|
||||
import { listComplaint, getComplaint, delComplaint, addComplaint, updateComplaint } from '@/api/system/Complaint/index';
|
||||
import { ComplaintVO, ComplaintQuery, ComplaintForm } from '@/api/system/Complaint/type';
|
||||
import { listComplaintType } from '@/api/system/ComplainType';
|
||||
|
||||
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
||||
const { com_complaint_status } = toRefs<any>(proxy?.useDict('com_complaint_status'));
|
||||
|
||||
const complaintList = ref<ComplaintVO[]>([]);
|
||||
const buttonLoading = ref(false);
|
||||
const loading = ref(true);
|
||||
const showSearch = ref(true);
|
||||
const ids = ref<Array<string | number>>([]);
|
||||
const single = ref(true);
|
||||
const multiple = ref(true);
|
||||
const total = ref(0);
|
||||
|
||||
const queryFormRef = ref<ElFormInstance>();
|
||||
const complaintFormRef = ref<ElFormInstance>();
|
||||
|
||||
const dialog = reactive<DialogOption>({
|
||||
visible: false,
|
||||
title: ''
|
||||
});
|
||||
|
||||
const initFormData: ComplaintForm = {
|
||||
id: undefined,
|
||||
typeId: undefined,
|
||||
problemDes: undefined,
|
||||
complaintName: undefined,
|
||||
phone: undefined,
|
||||
problemIamgeUrl: undefined,
|
||||
status: undefined,
|
||||
handleId: undefined,
|
||||
handleName: undefined,
|
||||
handleContent: undefined
|
||||
};
|
||||
const data = reactive<PageData<ComplaintForm, ComplaintQuery>>({
|
||||
form: { ...initFormData },
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
typeId: undefined,
|
||||
problemDes: undefined,
|
||||
complaintName: undefined,
|
||||
phone: undefined,
|
||||
problemIamgeUrl: undefined,
|
||||
status: undefined,
|
||||
handleId: undefined,
|
||||
handleName: undefined,
|
||||
handleContent: undefined,
|
||||
params: {}
|
||||
},
|
||||
rules: {
|
||||
id: [{ required: true, message: '投诉管理表id不能为空', trigger: 'blur' }]
|
||||
}
|
||||
});
|
||||
|
||||
const { queryParams, form, rules } = toRefs(data);
|
||||
|
||||
const complaintyTyplist = ref([]);
|
||||
/** 查询投诉管理列表 */
|
||||
const getList = async () => {
|
||||
loading.value = true;
|
||||
const res2 = await listComplaintType();
|
||||
complaintyTyplist.value = res2.rows;
|
||||
const res = await listComplaint(queryParams.value);
|
||||
complaintList.value = res.rows;
|
||||
total.value = res.total;
|
||||
loading.value = false;
|
||||
};
|
||||
|
||||
/** 搜索按钮操作 */
|
||||
const handleQuery = () => {
|
||||
queryParams.value.pageNum = 1;
|
||||
getList();
|
||||
};
|
||||
|
||||
/** 重置按钮操作 */
|
||||
const resetQuery = () => {
|
||||
queryFormRef.value?.resetFields();
|
||||
handleQuery();
|
||||
};
|
||||
|
||||
/** 多选框选中数据 */
|
||||
const handleSelectionChange = (selection: ComplaintVO[]) => {
|
||||
ids.value = selection.map((item) => item.id);
|
||||
single.value = selection.length != 1;
|
||||
multiple.value = !selection.length;
|
||||
};
|
||||
|
||||
const router = useRouter();
|
||||
/** 详情按钮操作 */
|
||||
const handleUpdate = async (row?: ComplaintVO) => {
|
||||
router.push({
|
||||
path: '/repair/complainMain',
|
||||
query: {
|
||||
id: row.id
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 提交按钮 */
|
||||
const submitForm = () => {
|
||||
complaintFormRef.value?.validate(async (valid: boolean) => {
|
||||
if (valid) {
|
||||
buttonLoading.value = true;
|
||||
if (form.value.id) {
|
||||
await updateComplaint(form.value).finally(() => (buttonLoading.value = false));
|
||||
} else {
|
||||
await addComplaint(form.value).finally(() => (buttonLoading.value = false));
|
||||
}
|
||||
proxy?.$modal.msgSuccess('操作成功');
|
||||
dialog.visible = false;
|
||||
await getList();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/** 删除按钮操作 */
|
||||
const handleDelete = async (row?: ComplaintVO) => {
|
||||
const _ids = row?.id || ids.value;
|
||||
await proxy?.$modal.confirm('是否确认删除投诉管理编号为"' + _ids + '"的数据项?').finally(() => (loading.value = false));
|
||||
await delComplaint(_ids);
|
||||
proxy?.$modal.msgSuccess('删除成功');
|
||||
await getList();
|
||||
};
|
||||
|
||||
/** 导出按钮操作 */
|
||||
const handleExport = () => {
|
||||
proxy?.download(
|
||||
'complaint/complaint/export',
|
||||
{
|
||||
...queryParams.value
|
||||
},
|
||||
`complaint_${new Date().getTime()}.xlsx`
|
||||
);
|
||||
};
|
||||
|
||||
onMounted(() => {
|
||||
getList();
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.el-table {
|
||||
height: calc(100% - 80px);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user