更新投诉

This commit is contained in:
weipengfei 2023-09-23 17:49:07 +08:00
parent 24393cc887
commit 7a782102aa

View File

@ -1,130 +1,161 @@
<template> <template>
<div> <div>
<el-card class="!border-none mb-4" shadow="never"> <el-card class="!border-none mb-4" shadow="never">
<el-form <el-form class="mb-[-16px]" :model="queryParams" inline>
class="mb-[-16px]" <el-form-item label="公司" prop="company_id">
:model="queryParams" <el-input
inline class="w-[280px]"
> v-model="queryParams.company_id"
<el-form-item label="公司" prop="company_id"> clearable
<el-input class="w-[280px]" v-model="queryParams.company_id" clearable placeholder="请输入公司" /> placeholder="请输入公司"
</el-form-item> />
<el-form-item label="内容" prop="content"> </el-form-item>
<el-input class="w-[280px]" v-model="queryParams.content" clearable placeholder="请输入内容" /> <el-form-item label="内容" prop="content">
</el-form-item> <el-input
<el-form-item> class="w-[280px]"
<el-button type="primary" @click="resetPage">查询</el-button> v-model="queryParams.content"
<el-button @click="resetParams">重置</el-button> clearable
</el-form-item> placeholder="请输入内容"
</el-form> />
</el-card> </el-form-item>
<el-card class="!border-none" v-loading="pager.loading" shadow="never">
<el-button v-perms="['company_complaint_feedback/add']" type="primary" @click="handleAdd"> <el-form-item>
<template #icon> <el-button type="primary" @click="resetPage">查询</el-button>
<icon name="el-icon-Plus" /> <el-button @click="resetParams">重置</el-button>
</template> </el-form-item>
新增 </el-form>
</el-button> </el-card>
<el-button <el-card class="!border-none" v-loading="pager.loading" shadow="never">
v-perms="['company_complaint_feedback/delete']" <el-button
:disabled="!selectData.length" v-perms="['company_complaint_feedback/add']"
@click="handleDelete(selectData)" type="primary"
> @click="handleAdd"
删除 >
</el-button> <template #icon>
<div class="mt-4"> <icon name="el-icon-Plus" />
<el-table :data="pager.lists" @selection-change="handleSelectionChange"> </template>
<el-table-column type="selection" width="55" /> 新增
<el-table-column label="公司" prop="company_id" show-overflow-tooltip /> </el-button>
<el-table-column label="内容" prop="content" show-overflow-tooltip /> <el-button
<el-table-column label="操作" width="120" fixed="right"> v-perms="['company_complaint_feedback/delete']"
<template #default="{ row }"> :disabled="!selectData.length"
<el-button @click="handleDelete(selectData)"
v-perms="['company_complaint_feedback/edit']" >
type="primary" 删除
link </el-button>
@click="handleEdit(row)" <div class="mt-4">
> <el-table :data="pager.lists" @selection-change="handleSelectionChange">
编辑 <el-table-column type="selection" width="55" />
</el-button> <el-table-column
<el-button label="id"
v-perms="['company_complaint_feedback/delete']" prop="id"
type="danger" width="120"
link show-overflow-tooltip
@click="handleDelete(row.id)" />
> <el-table-column
删除 label="公司"
</el-button> prop="company_id"
</template> width="220"
</el-table-column> show-overflow-tooltip
</el-table> />
</div> <el-table-column label="内容" prop="content" show-overflow-tooltip />
<div class="flex mt-4 justify-end">
<pagination v-model="pager" @change="getLists" /> <el-table-column label="操作" width="120" fixed="right">
</div> <template #default="{ row }">
</el-card> <el-button
<edit-popup v-if="showEdit" ref="editRef" :dict-data="dictData" @success="getLists" @close="showEdit = false" /> v-perms="['company_complaint_feedback/edit']"
</div> type="primary"
</template> link
@click="handleEdit(row)"
<script lang="ts" setup name="companyComplaintFeedbackLists"> >
import { usePaging } from '@/hooks/usePaging' 编辑
import { useDictData } from '@/hooks/useDictOptions' </el-button>
import { apiCompanyComplaintFeedbackLists, apiCompanyComplaintFeedbackDelete } from '@/api/company_complaint_feedback' <el-button
import { timeFormat } from '@/utils/util' v-perms="['company_complaint_feedback/delete']"
import feedback from '@/utils/feedback' type="danger"
import EditPopup from './edit.vue' link
@click="handleDelete(row.id)"
const editRef = shallowRef<InstanceType<typeof EditPopup>>() >
// 删除
const showEdit = ref(false) </el-button>
</template>
</el-table-column>
// </el-table>
const queryParams = reactive({ </div>
company_id: '', <div class="flex mt-4 justify-end">
content: '', <pagination v-model="pager" @change="getLists" />
}) </div>
</el-card>
// <edit-popup
const selectData = ref<any[]>([]) v-if="showEdit"
ref="editRef"
// :dict-data="dictData"
const handleSelectionChange = (val: any[]) => { @success="getLists"
selectData.value = val.map(({ id }) => id) @close="showEdit = false"
} />
</div>
// </template>
const { dictData } = useDictData('')
<script lang="ts" setup name="companyComplaintFeedbackLists">
// import { usePaging } from "@/hooks/usePaging";
const { pager, getLists, resetParams, resetPage } = usePaging({ import { useDictData } from "@/hooks/useDictOptions";
fetchFun: apiCompanyComplaintFeedbackLists, import {
params: queryParams apiCompanyComplaintFeedbackLists,
}) apiCompanyComplaintFeedbackDelete,
} from "@/api/company_complaint_feedback";
// import { timeFormat } from "@/utils/util";
const handleAdd = async () => { import feedback from "@/utils/feedback";
showEdit.value = true import EditPopup from "./edit.vue";
await nextTick()
editRef.value?.open('add') const editRef = shallowRef<InstanceType<typeof EditPopup>>();
} //
const showEdit = ref(false);
//
const handleEdit = async (data: any) => { //
showEdit.value = true const queryParams = reactive({
await nextTick() company_id: "",
editRef.value?.open('edit') content: "",
editRef.value?.setFormData(data) });
}
//
// const selectData = ref<any[]>([]);
const handleDelete = async (id: number | any[]) => {
await feedback.confirm('确定要删除?') //
await apiCompanyComplaintFeedbackDelete({ id }) const handleSelectionChange = (val: any[]) => {
getLists() selectData.value = val.map(({ id }) => id);
} };
getLists() //
</script> const { dictData } = useDictData("");
//
const { pager, getLists, resetParams, resetPage } = usePaging({
fetchFun: apiCompanyComplaintFeedbackLists,
params: queryParams,
});
//
const handleAdd = async () => {
showEdit.value = true;
await nextTick();
editRef.value?.open("add");
};
//
const handleEdit = async (data: any) => {
showEdit.value = true;
await nextTick();
editRef.value?.open("edit");
editRef.value?.setFormData(data);
};
//
const handleDelete = async (id: number | any[]) => {
await feedback.confirm("确定要删除?");
await apiCompanyComplaintFeedbackDelete({ id });
getLists();
};
getLists();
</script>