<template>
|
<div class="capacity-scope">
|
<div style="display: flex;justify-content: space-between">
|
<div style="display: flex;">
|
<div style="margin-bottom: 18px;margin-right: 10px;display: flex;align-items: center;line-height: 32px;">
|
<span style="width: 128px;font-size: 14px;font-weight: 700;color: var(--lims-text-2);">检验报告编号</span>
|
<el-input size="small" placeholder="请输入" clearable v-model="queryParams.insReportCode"
|
@keyup.enter="refreshTable()"></el-input>
|
</div>
|
<div style="line-height: 30px;">
|
<el-button type="primary" size="small" @click="refreshTable">查询</el-button>
|
<el-button size="small" @click="refresh">重置</el-button>
|
</div>
|
</div>
|
<div style="line-height: 30px;">
|
<el-button size="small" type="primary" @click="handleDown" :loading="outLoading" v-if="outPower">导出</el-button>
|
<el-button size="small" type="primary" @click="openAdd" v-if="addPower">新增</el-button>
|
</div>
|
</div>
|
<div class="table">
|
<lims-table :tableData="tableData" :column="column" :tableLoading="tableLoading" :height="'calc(100vh - 270px)'"
|
:page="page" @pagination="pagination"></lims-table>
|
</div>
|
<el-dialog :title="title" v-model="addDialogVisible" width="520px" top="6vh" :close-on-click-modal="false">
|
<el-row>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">检验报告编号:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="addInfo.insReportCode"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">发往何处:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="addInfo.send"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">发送方式:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="addInfo.method" :disabled="!!addInfo.inspectionOrderId"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">发送日期:</div>
|
<div class="search_input">
|
<el-date-picker v-model="addInfo.sendTime" type="date" size="small" placeholder="选择日期" format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD" style="width: 100%;">
|
</el-date-picker>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">领报告日期:</div>
|
<div class="search_input">
|
<el-date-picker v-model="addInfo.receiveDate" type="date" size="small" placeholder="选择日期"
|
format="YYYY-MM-DD" value-format="YYYY-MM-DD" style="width: 100%;">
|
</el-date-picker>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">领报告人:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="addInfo.receiveUser"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">发送人:</div>
|
<div class="search_input">
|
<el-select v-model="addInfo.sendUser" placeholder="请选择" size="small" style="width: 100%;">
|
<el-option v-for="item in personList" :key="item.value" :label="item.label" :value="item.value">
|
</el-option>
|
</el-select>
|
</div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">签收人:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable
|
v-model="addInfo.signatory"></el-input></div>
|
</div>
|
</el-col>
|
<el-col :span="24" style="margin-bottom: 16px;">
|
<div class="search_thing">
|
<div class="search_label">备注:</div>
|
<div class="search_input"><el-input size="small" placeholder="请输入" clearable v-model="addInfo.remark"
|
type="textarea" :rows="2"></el-input></div>
|
</div>
|
</el-col>
|
</el-row>
|
<template #footer><span class="dialog-footer">
|
<el-button @click="addDialogVisible = false">取 消</el-button>
|
<el-button type="primary" @click="handleAdd" :loading="addLoading">确 定</el-button>
|
</span></template>
|
</el-dialog>
|
<el-dialog title="下载有章报告" v-model="downloadDialogVisible" width="420px"
|
:close-on-click-modal="false" @closed="closeDownloadDialog">
|
<el-form label-width="90px">
|
<el-form-item label="文件格式:">
|
<el-radio-group v-model="selectedDownloadFormat">
|
<el-radio value="pdf">PDF(含骑缝章)</el-radio>
|
<el-radio value="word">Word</el-radio>
|
</el-radio-group>
|
</el-form-item>
|
</el-form>
|
<template #footer><span class="dialog-footer">
|
<el-button @click="downloadDialogVisible = false">取 消</el-button>
|
<el-button type="primary" :loading="downloadingReportId !== null"
|
@click="downloadSelectedReport">下 载</el-button>
|
</span></template>
|
</el-dialog>
|
</div>
|
</template>
|
|
<script>
|
import limsTable from "@/components/Table/lims-table.vue";
|
import {
|
exportProcessReport,
|
doProcessReport,
|
addProcessReport,
|
pageProcessReport,
|
delProcessReport,
|
downloadStampedReport
|
} from '@/api/cnas/process/reportResults.js'
|
import {
|
selectUserCondition,
|
} from "@/api/business/inspectionTask.js";
|
export default {
|
name: 'ReportResults',
|
components: {
|
limsTable
|
},
|
data() {
|
return {
|
outLoading: false,
|
addPower: true,
|
outPower: true,
|
personList: [],
|
title: '新增',
|
addDialogVisible: false,
|
addInfo: {},
|
addLoading: false,
|
downloadingReportId: null,
|
downloadDialogVisible: false,
|
downloadRow: null,
|
selectedDownloadFormat: 'pdf',
|
queryParams: {
|
insReportCode: ''
|
},
|
tableData: [],
|
column: [
|
{ label: "检验报告编号", prop: "insReportCode" },
|
{ label: "发往何处", prop: "send" },
|
{ label: "发送方式", prop: "method" },
|
{ label: "发送日期", prop: "sendTime" },
|
{ label: "领报告日期", prop: "receiveDate", width: "120px" },
|
{ label: "领报告人", prop: "receiveUser", width: "110px" },
|
{ label: "发送人", prop: "sendUserName" },
|
{ label: "签收人", prop: "signatory" },
|
{ label: "备注", prop: "remark" },
|
{
|
dataType: "action",
|
fixed: "right",
|
label: "操作",
|
width: "180px",
|
operation: [
|
{
|
name: "下载",
|
type: "text",
|
disabled: (row) => this.downloadingReportId === row.id,
|
clickFun: (row) => {
|
this.handleDownload(row);
|
},
|
},
|
{
|
name: "编辑",
|
type: "text",
|
clickFun: (row) => {
|
this.handleWork(row);
|
},
|
},
|
{
|
name: "删除",
|
type: "text",
|
clickFun: (row) => {
|
this.handleDelete(row);
|
},
|
},
|
],
|
},
|
],
|
page: {
|
total: 0,
|
size: 20,
|
current: 1,
|
},
|
tableLoading: false,
|
}
|
},
|
mounted() {
|
// this.entityCopy = this.HaveJson(this.componentData.entity);
|
this.getList()
|
this.getAuthorizedPerson()
|
},
|
methods: {
|
handleDown() {
|
this.outLoading = true
|
exportProcessReport(this.queryParams).then(res => {
|
this.outLoading = false
|
const blob = new Blob([res], { type: 'application/msword' });
|
this.$download.saveAs(blob, '报告结果' + '.docx');
|
})
|
},
|
openAdd() {
|
this.title = '新增'
|
this.addInfo = {}
|
this.addDialogVisible = true;
|
},
|
getList() {
|
this.tableLoading = true;
|
let param = { ...this.queryParams, ...this.page };
|
delete param.total;
|
pageProcessReport({ ...param })
|
.then((res) => {
|
this.tableLoading = false;
|
if (res.code === 200) {
|
this.tableData = res.data.records;
|
this.page.total = res.data.total;
|
}
|
})
|
.catch((err) => {
|
this.tableLoading = false;
|
});
|
},
|
pagination({ page, limit }) {
|
this.page.current = page;
|
this.page.size = limit;
|
this.getList();
|
},
|
refresh() {
|
this.queryParams = {};
|
this.page.current = 1;
|
this.getList();
|
},
|
refreshTable() {
|
this.page.current = 1;
|
this.getList();
|
},
|
getAuthorizedPerson() {
|
selectUserCondition().then(res => {
|
let data = []
|
res.data.forEach(a => {
|
data.push({
|
label: a.name,
|
value: a.id
|
})
|
})
|
this.personList = data
|
})
|
},
|
handleAdd() {
|
this.addLoading = true
|
delete this.addInfo.createTime
|
delete this.addInfo.createUser
|
delete this.addInfo.updateTime
|
delete this.addInfo.updateUser
|
delete this.addInfo.sendUserName
|
if (this.title == '新增') {
|
addProcessReport(this.addInfo).then(res => {
|
this.addLoading = false
|
this.addDialogVisible = false
|
this.$message({
|
type: 'success',
|
message: '操作成功!'
|
});
|
this.refreshTable()
|
}).catch(() => {
|
this.addLoading = false
|
})
|
} else {
|
doProcessReport(this.addInfo).then(res => {
|
this.addLoading = false
|
this.addDialogVisible = false
|
this.$message({
|
type: 'success',
|
message: '操作成功!'
|
});
|
this.refreshTable()
|
}).catch(() => {
|
this.addLoading = false
|
})
|
}
|
},
|
handleWork(row) {
|
this.title = '修改'
|
this.addInfo = { ...row }
|
this.addDialogVisible = true;
|
},
|
handleDownload(row) {
|
this.downloadRow = row
|
this.selectedDownloadFormat = 'pdf'
|
this.downloadDialogVisible = true
|
},
|
closeDownloadDialog() {
|
if (this.downloadingReportId === null) {
|
this.downloadRow = null
|
this.selectedDownloadFormat = 'pdf'
|
}
|
},
|
downloadSelectedReport() {
|
if (!this.downloadRow) {
|
return
|
}
|
const row = this.downloadRow
|
const format = this.selectedDownloadFormat
|
this.downloadingReportId = row.id
|
downloadStampedReport(row.id, format).then(res => {
|
if (res.type && res.type.includes('application/json')) {
|
const reader = new FileReader()
|
reader.onload = () => {
|
try {
|
this.$message.error(JSON.parse(reader.result).msg || '有章报告下载失败')
|
} catch (e) {
|
this.$message.error('有章报告下载失败')
|
}
|
}
|
reader.readAsText(res)
|
return
|
}
|
const extension = format === 'word' ? 'docx' : 'pdf'
|
this.$download.saveAs(res, `${row.insReportCode || '有章报告'}.${extension}`)
|
this.downloadDialogVisible = false
|
}).catch(() => {
|
this.$message.error('有章报告下载失败')
|
}).finally(() => {
|
this.downloadingReportId = null
|
if (!this.downloadDialogVisible) {
|
this.downloadRow = null
|
}
|
})
|
},
|
handleDelete(row) {
|
this.$confirm("是否删除该条数据?", "提示", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning",
|
})
|
.then(() => {
|
delProcessReport({ id: row.id }).then((res) => {
|
this.$message.success("删除成功");
|
this.refresh();
|
});
|
})
|
.catch(() => { });
|
},
|
}
|
}
|
</script>
|
|
<style scoped>
|
.search {
|
height: 46px;
|
display: flex;
|
justify-content: space-between;
|
}
|
|
.search_thing {
|
width: 350px;
|
display: flex;
|
align-items: center;
|
}
|
|
.search_label {
|
width: 110px;
|
font-size: 14px;
|
text-align: right;
|
}
|
|
.search_input {
|
width: calc(100% - 110px);
|
}
|
</style>
|