| | |
| | | <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-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'"> |
| | |
| | | </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'> |
| | |
| | | <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" |
| | |
| | | pageAnalyseFile, |
| | | delClientSatisfaction, |
| | | delAnalyseFile, |
| | | exportAnnualSummary, |
| | | } from '@/api/cnas/systemManagement/customerSatisfaction.js' |
| | | |
| | | export default { |
| | |
| | | tabIndex: '0', |
| | | tableColumn: [ |
| | | { |
| | | label: '单位名称', |
| | | label: '客户名称', |
| | | prop: 'unitName', |
| | | minWidth: '140' |
| | | }, |
| | | { |
| | | label: '地址', |
| | | prop: 'address', |
| | | minWidth: '150' |
| | | }, |
| | | { |
| | | label: '联系人', |
| | | prop: 'contactPerson', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | label: '日期', |
| | | label: '填表日期', |
| | | prop: 'fillDate', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | label: '客户', |
| | | prop: 'userName', |
| | | 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: '100' |
| | | minWidth: '110' |
| | | }, |
| | | { |
| | | label: '样品名称', |
| | | prop: 'sampleName', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | label: '部门', |
| | | prop: 'department', |
| | | minWidth: '100' |
| | | }, |
| | | { |
| | | label: '联系电话', |
| | | prop: 'contactNumber', |
| | | minWidth: '100' |
| | | minWidth: '120' |
| | | }, |
| | | { |
| | | label: '创建日期', |
| | | prop: 'createTime', |
| | | minWidth: '100', |
| | | minWidth: '160', |
| | | }, |
| | | { |
| | | dataType: 'action', |
| | | minWidth: '80', |
| | | label: '操作', |
| | | operation: [ |
| | | { |
| | |
| | | }, |
| | | { |
| | | dataType: 'action', |
| | | minWidth: '50', |
| | | label: '操作', |
| | | operation: [ |
| | | { |
| | |
| | | upLoading: false, |
| | | currentInfo: {}, |
| | | lookDialogVisible: false, |
| | | exportDialogVisible: false, |
| | | exportYear: String(new Date().getFullYear()), |
| | | exportLoading: false, |
| | | }; |
| | | }, |
| | | mounted() { |
| | |
| | | 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 = ''; |