<template>
|
<div class="capacity-scope">
|
<div>
|
<div class="search">
|
<div>
|
<el-form :model="searchForm" ref="searchForm" size="small" :inline="true">
|
<el-form-item label="客户名称" prop="unitName" v-if="tabIndex === '0'">
|
<el-input v-model="searchForm.unitName" clearable size="small"></el-input>
|
</el-form-item>
|
<el-form-item label="文件名称" prop="fileName" v-if="tabIndex === '1'">
|
<el-input v-model="searchForm1.fileName" clearable size="small"></el-input>
|
</el-form-item>
|
<el-form-item>
|
<el-button type="primary" size="small" @click="searchList">查询</el-button>
|
<el-button size="small" @click="resetSearchForm">重置</el-button>
|
</el-form-item>
|
</el-form>
|
</div>
|
<div>
|
<el-button v-if="tabIndex === '0'" size="small" type="primary" @click="openFormDia('add')">新 增</el-button>
|
<el-button v-if="tabIndex === '0'" size="small" type="primary" @click="openExportDialog">导 出</el-button>
|
<el-upload v-if="tabIndex === '1'" ref='upload' :action="action" :before-upload="beforeUpload"
|
:headers="uploadHeader" :on-error="onError" :on-success="handleSuccessUp" :show-file-list="false"
|
accept='.jpg,.jpeg,.png,.gif,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,.zip,.rar'>
|
<el-button :loading="upLoading" size="small" type="primary">导入</el-button>
|
</el-upload>
|
</div>
|
</div>
|
<div class="table">
|
<div class="table-tab">
|
<el-radio-group v-model="tabIndex" @change="searchList" size="small">
|
<el-radio-button value="0">客户满意度</el-radio-button>
|
<el-radio-button value="1">综合分析</el-radio-button>
|
</el-radio-group>
|
</div>
|
<div v-if="tabIndex === '0'">
|
<limsTable :column="tableColumn" :height="'calc(100vh - 22em)'" :table-data="tableData"
|
:table-loading="tableLoading" @pagination="pagination"
|
:page="page">
|
</limsTable>
|
</div>
|
<div v-if="tabIndex === '1'">
|
<limsTable :column="tableColumn1" :height="'calc(100vh - 22em)'" :table-data="tableData1"
|
:table-loading="tableLoading1" @pagination="pagination0">
|
</limsTable>
|
</div>
|
</div>
|
</div>
|
<el-dialog v-model="lookDialogVisible" fullscreen title="查看附件" top="5vh" width="800px">
|
<filePreview v-if="lookDialogVisible" :currentFile="{}" :fileUrl="javaApi + '/word/' + currentInfo.fileUrl"
|
style="height: 90vh;overflow-y: auto;" />
|
</el-dialog>
|
<el-dialog v-model="exportDialogVisible" title="导出年度汇总" width="360px" :close-on-click-modal="false">
|
<el-form label-width="80px">
|
<el-form-item label="汇总年度">
|
<el-date-picker v-model="exportYear" type="year" format="YYYY年" value-format="YYYY" placeholder="选择年度"
|
style="width: 100%"></el-date-picker>
|
</el-form-item>
|
</el-form>
|
<template #footer>
|
<el-button @click="exportDialogVisible = false">取 消</el-button>
|
<el-button type="primary" :loading="exportLoading" @click="handleExport">导 出</el-button>
|
</template>
|
</el-dialog>
|
<FormDialog v-if="formDialog" ref="formDialog" @closeFormDia="closeFormDia"></FormDialog>
|
<lims-attachment ref="attachmentDialog" title="满意度附件" name-field="unitName" id-param="clientSatisfactionId"
|
upload-url="/clientSatisfaction/uploadAttachment" select-url="/clientSatisfaction/selectAttachments"
|
delete-url="/clientSatisfaction/deleteAttachment" />
|
</div>
|
</template>
|
|
<script>
|
import limsTable from "@/components/Table/lims-table.vue";
|
import FormDialog from './components/formDialog.vue';
|
import filePreview from '@/components/Preview/filePreview.vue'
|
import limsAttachment from '@/components/Attachment/lims-attachment.vue'
|
import {
|
pageClientSatisfaction,
|
pageAnalyseFile,
|
delClientSatisfaction,
|
delAnalyseFile,
|
exportAnnualSummary,
|
} from '@/api/cnas/systemManagement/customerSatisfaction.js'
|
|
export default {
|
name: 'CustomerSatisfaction',
|
// import 引入的组件需要注入到对象中才能使用
|
components: { filePreview, FormDialog, limsTable, limsAttachment },
|
data() {
|
// 这里存放数据
|
return {
|
searchForm: {
|
unitName: '',
|
},
|
searchForm1: {
|
fileName: '',
|
},
|
tabIndex: '0',
|
tableColumn: [
|
{
|
label: '客户名称',
|
prop: 'unitName',
|
minWidth: '140'
|
},
|
{
|
label: '地址',
|
prop: 'address',
|
minWidth: '150'
|
},
|
{
|
label: '联系人',
|
prop: 'contactPerson',
|
minWidth: '100'
|
},
|
{
|
label: '填表日期',
|
prop: 'fillDate',
|
minWidth: '100'
|
},
|
{
|
label: '总分',
|
prop: 'totalScore',
|
minWidth: '80',
|
formatData: (val) => (val === null || val === undefined || val === '') ? '--' : val
|
},
|
{
|
label: '满意度评定',
|
prop: 'satisfactionResult',
|
minWidth: '110',
|
dataType: 'tag',
|
formatData: (val) => {
|
if (val === null || val === undefined || val === '') {
|
return '--'
|
}
|
return Number(val) === 0 ? '满意' : '不满意'
|
},
|
formatType: (val) => {
|
if (val === null || val === undefined || val === '') {
|
return 'info'
|
}
|
return Number(val) === 0 ? 'success' : 'danger'
|
}
|
},
|
{
|
label: '委托单编号',
|
prop: 'entrustCode',
|
minWidth: '110'
|
},
|
{
|
label: '样品名称',
|
prop: 'sampleName',
|
minWidth: '120'
|
},
|
{
|
label: '创建日期',
|
prop: 'createTime',
|
minWidth: '160',
|
},
|
{
|
dataType: 'action',
|
label: '操作',
|
operation: [
|
{
|
name: '编辑',
|
type: 'text',
|
clickFun: (row) => {
|
this.openFormDia('edit', row);
|
},
|
},
|
{
|
name: '附件',
|
type: 'text',
|
clickFun: (row) => {
|
this.$refs.attachmentDialog.open(row);
|
},
|
},
|
{
|
name: '删除',
|
type: 'text',
|
color: 'var(--el-color-danger)',
|
clickFun: (row) => {
|
this.delPlan(row)
|
}
|
}
|
]
|
}
|
],
|
tableData: [],
|
tableLoading: false,
|
page: {
|
size: 20,
|
current: 1,
|
total: 0,
|
},
|
tableColumn1: [
|
{
|
label: '附件名称',
|
prop: 'fileName',
|
minWidth: '100'
|
},
|
{
|
label: '创建人',
|
prop: 'userName',
|
minWidth: '100'
|
},
|
{
|
label: '创建时间',
|
prop: 'createTime',
|
minWidth: '100'
|
},
|
{
|
dataType: 'action',
|
label: '操作',
|
operation: [
|
{
|
name: '预览',
|
type: 'text',
|
clickFun: (row) => {
|
this.handleLook(row)
|
}
|
},
|
{
|
name: '下载',
|
type: 'text',
|
clickFun: (row) => {
|
this.upload(row);
|
},
|
},
|
{
|
name: '删除',
|
type: 'text',
|
color: 'var(--el-color-danger)',
|
clickFun: (row) => {
|
this.delFile(row)
|
}
|
}
|
]
|
}
|
],
|
tableData1: [],
|
tableLoading1: false,
|
page1: {
|
size: 20,
|
current: 1,
|
total: 0,
|
},
|
formDialog: false,
|
upLoading: false,
|
currentInfo: {},
|
lookDialogVisible: false,
|
exportDialogVisible: false,
|
exportYear: String(new Date().getFullYear()),
|
exportLoading: false,
|
};
|
},
|
mounted() {
|
this.searchList()
|
},
|
// 方法集合
|
methods: {
|
// 查询列表
|
searchList() {
|
const entity = this.tabIndex === '0' ? this.searchForm : this.searchForm1
|
const page = this.tabIndex === '0' ? this.page : this.page1
|
if (this.tabIndex === '0') {
|
this.tableLoading = true
|
pageClientSatisfaction({ ...entity, ...page }).then(res => {
|
this.tableLoading = false
|
this.tableData = res.data.records
|
this.page.total = res.data.total
|
}).catch(err => {
|
console.log('err---', err);
|
this.tableLoading = false
|
})
|
} else {
|
this.tableLoading1 = true
|
pageAnalyseFile({ ...entity, ...page }).then(res => {
|
this.tableLoading1 = false
|
this.tableData1 = res.data.records
|
this.page1.total = res.data.total
|
}).catch(err => {
|
console.log('err---', err);
|
this.tableLoading1 = false
|
})
|
}
|
},
|
openFormDia(type, row) {
|
this.formDialog = true
|
this.$nextTick(() => {
|
this.$refs.formDialog.openDia(type, row);
|
})
|
},
|
closeFormDia() {
|
this.formDialog = false
|
this.searchList()
|
},
|
// 打开年度汇总导出弹窗
|
openExportDialog() {
|
this.exportYear = String(new Date().getFullYear())
|
this.exportDialogVisible = true
|
},
|
// 导出年度汇总 Word
|
handleExport() {
|
if (!this.exportYear) {
|
this.$message.warning('请选择汇总年度')
|
return
|
}
|
this.exportLoading = true
|
exportAnnualSummary({ year: this.exportYear }).then(async data => {
|
// 后端无数据时返回的是 JSON,需转成文本提示,避免存成坏文件
|
if (data && data.type && data.type.indexOf('json') !== -1) {
|
let msg = '导出失败'
|
try {
|
const resText = await data.text()
|
const rspObj = JSON.parse(resText)
|
msg = rspObj.msg || msg
|
} catch (e) {
|
console.log('err---', e)
|
}
|
this.exportLoading = false
|
this.$message.error(msg)
|
return
|
}
|
const blob = new Blob([data], { type: 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' })
|
this.$download.saveAs(blob, '客户满意度年度汇总表_' + this.exportYear + '年.docx')
|
this.exportLoading = false
|
this.exportDialogVisible = false
|
}).catch(err => {
|
console.log('err---', err)
|
this.exportLoading = false
|
})
|
},
|
// 重置查询条件
|
resetSearchForm() {
|
this.searchForm.unitName = '';
|
this.searchForm1.fileName = '';
|
this.searchList()
|
},
|
// 导入流程
|
beforeUpload(file) {
|
if (file.size > 1024 * 1024 * 10) {
|
this.$message.error('上传文件不超过10M');
|
this.$refs.upload.clearFiles()
|
return false;
|
} else {
|
this.upLoading = true;
|
return true;
|
}
|
},
|
onError(err, file, fileList) {
|
this.$message.error('上传失败')
|
this.$refs.upload.clearFiles()
|
},
|
handleSuccessUp(response) {
|
this.upLoading = false;
|
if (response.code == 200) {
|
this.$message.success('上传成功');
|
this.searchList()
|
}
|
},
|
// 删除客户满意度
|
delPlan(row) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.tableLoading = true
|
delClientSatisfaction({ clientSatisfactionId: row.clientSatisfactionId }).then(res => {
|
this.tableLoading = false
|
this.$message.success('删除成功')
|
this.searchList()
|
}).catch(err => {
|
this.tableLoading = false
|
console.log('err---', err);
|
})
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
// 查看文件
|
handleLook(row) {
|
this.currentInfo = row
|
this.lookDialogVisible = true
|
},
|
// 下载客户福建
|
upload(row) {
|
this.$download.saveAs(row.fileUrl, row.fileName);
|
},
|
// 删除客户分析附件
|
delFile(row) {
|
this.$confirm('此操作将永久删除该数据, 是否继续?', '提示', {
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
}).then(() => {
|
this.tableLoading = true
|
delAnalyseFile({ analyseFileId: row.analyseFileId }).then(res => {
|
this.tableLoading = false
|
this.$message.success('删除成功')
|
this.searchList()
|
}).catch(err => {
|
this.tableLoading = false
|
console.log('err---', err);
|
})
|
}).catch(() => {
|
this.$message({
|
type: 'info',
|
message: '已取消删除'
|
});
|
});
|
},
|
// 分页
|
pagination({ page, limit }) {
|
this.page.current = page;
|
this.page.size = limit;
|
this.searchList();
|
},
|
// 分页
|
pagination0({ page, limit }) {
|
this.page.current = page;
|
this.page.size = limit;
|
this.searchList();
|
},
|
},
|
// 用于上传文件的信息
|
computed: {
|
action() {
|
return this.javaApi + '/clientSatisfaction/uploadAnalyseFile'
|
}
|
},
|
};
|
</script>
|
|
<style scoped>
|
.search {
|
height: 46px;
|
display: flex;
|
justify-content: space-between;
|
}
|
|
.table-tab {
|
margin: 0 0 20px 0;
|
}
|
</style>
|