<template>
|
<div class="flex_column">
|
<div>
|
<TableCard :showTitle="false">
|
<template v-slot:form>
|
<div class="items_center">
|
<!-- <span>关键字</span>
|
<el-input size="small" class="search" v-model="superviseForm.searchVal" placeholder="请输入"></el-input>
|
<el-button type="primary" size="small">查询</el-button> -->
|
<el-button v-if="multipleSelection.length > 0" slot="reference" size="small" type="danger"
|
@click="delRecords">删除</el-button>
|
</div>
|
<div>
|
<el-button size="small" type="primary" @click="addRecord"
|
v-show="departId && departId != 1">新增</el-button>
|
</div>
|
</template>
|
<template v-slot:table>
|
<limsTable :column="superviseColumnData" :handleSelectionChange="handleSelectionChange"
|
:height="'calc(100vh - 20em)'" :isSelection="true" :table-data="superviseTableData"
|
:table-loading="superviseLoading" rowKey="id" style="margin-top: 18px; padding: 0 15px;"
|
:page="page" @pagination="pagination">
|
<div slot="action" slot-scope="scope">
|
<el-button type="text" @click="openDownloadDia(scope.row)">
|
<span>导出</span>
|
</el-button>
|
<el-button type="text" @click="openRecord(scope.row)">
|
<span>监督记录</span>
|
</el-button>
|
<el-button type="text" @click="openControl(scope.row.id)"
|
:disabled="scope.row.evaluationSupervisionSituation != '不符合'">
|
<span :style="renderBtn(scope.row.currentStateControl)">控制单</span>
|
</el-button>
|
<el-button type="text" @click="openDispose(scope.row.id)"
|
:disabled="scope.row.correctiveMeasure != '1'">
|
<span :style="renderBtn(scope.row.currentStateProcessing)">处理单</span>
|
</el-button>
|
</div>
|
</limsTable>
|
</template>
|
</TableCard>
|
</div>
|
<RecordAdd ref="recordModal" @submit="getTableData" :departId="departId"></RecordAdd>
|
<ControlModal ref="controlModal" @getTableData="getTableData" :departId="departId"></ControlModal>
|
<DisposeModal ref="disposeModal" @getTableData='getTableData' :departId="departId"></DisposeModal>
|
<el-dialog :visible.sync="downloadDialog" title="导出" width="600px">
|
<span>
|
<el-button :disabled="!download.currentStateControl" plain type="primary"
|
@click="controlDown">控制单导出</el-button>
|
<el-button :disabled="!download.currentStateProcessing" plain type="primary"
|
@click="processingDown">处理单导出</el-button>
|
<el-button plain type="primary" @click="supervisoryDown">监督记录导出</el-button>
|
</span>
|
<span slot="footer" class="dialog-footer">
|
<el-button @click="downloadDialog = false">取 消</el-button>
|
</span>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import TableCard from '@/components/TableCard/index.vue';
|
import RecordAdd from "./Add.vue"
|
import limsTable from "@/components/Table/lims-table.vue";
|
import ControlModal from "./control/index.vue"
|
import DisposeModal from "./dispose/index.vue"
|
import {
|
personSupervisionRecordPage,
|
deletePersonSupervisionRecord,
|
exportSupervisionControlSheet,
|
exportSupervisionProcessingSheet,
|
exportPersonSupervisionRecord
|
} from '@/api/cnas/personnel/personnelInfo.js'
|
export default {
|
props: {
|
isDepartment: {
|
type: Boolean,
|
default: false
|
},
|
departId: {
|
type: Number,
|
default: () => {
|
return null;
|
}
|
},
|
},
|
components: {
|
TableCard,
|
RecordAdd,
|
limsTable,
|
ControlModal,
|
DisposeModal
|
},
|
data() {
|
return {
|
loading: false,
|
page: {
|
current: 1,
|
size: 20,
|
total: 0
|
},
|
// 监督记录
|
superviseForm: {
|
searchVal: undefined
|
},
|
superviseColumnData: [
|
// {
|
// label: 'id',
|
// prop: 'id'
|
// },
|
{
|
label: '检测人员',
|
prop: 'testerName',
|
width: 120
|
}, {
|
label: '监督人员',
|
prop: 'supervisorName',
|
width: 120
|
}, {
|
label: '检验项目',
|
prop: 'testItem',
|
width: 120
|
}, {
|
label: '样品编号',
|
prop: 'sampleNumber',
|
width: 120
|
}, {
|
label: '检验日期',
|
prop: 'detectionDate',
|
width: 160
|
}, {
|
label: '控制单状态',
|
prop: 'currentStateControl',
|
formatData: (item) => {
|
let result = undefined
|
switch (item) {
|
case '0':
|
result = '工作情况'
|
break;
|
case '1':
|
result = '被监督人确认'
|
break;
|
case '2':
|
result = '处理措施'
|
break;
|
case '3':
|
result = '纠正措施'
|
break;
|
case '4':
|
result = '通知客户'
|
break;
|
}
|
return result
|
},
|
width: 140,
|
}, {
|
label: '流程单状态',
|
prop: 'currentStateProcessing',
|
formatData: (item) => {
|
let result = undefined
|
switch (item) {
|
case '0':
|
result = '问题描述'
|
break;
|
case '1':
|
result = '原因分析'
|
break;
|
case '2':
|
result = '纠正措施'
|
break;
|
case '3':
|
result = '验证结果'
|
break;
|
}
|
return result
|
},
|
width: 140,
|
}, {
|
label: '人员',
|
prop: 'personnel',
|
width: 150
|
}, {
|
label: '设备仪器',
|
prop: 'instrumentEquipment',
|
width: 140
|
}, {
|
label: '工作环境',
|
prop: 'workingEnvironment',
|
width: 140
|
}, {
|
label: '样品采集',
|
prop: 'sampleCollection',
|
width: 140
|
}, {
|
label: '样品的准备',
|
prop: 'samplePreparation',
|
width: 140
|
}, {
|
label: '检验方法',
|
prop: 'testMethod',
|
width: 120
|
}, {
|
label: '检测记录',
|
prop: 'testingRecords',
|
width: 120
|
}, {
|
label: '检验报告',
|
prop: 'testReport',
|
width: 120
|
}, {
|
label: '监督情况评价',
|
prop: 'evaluationSupervisionSituation',
|
width: 140
|
}, {
|
label: '不符合处理意见',
|
prop: 'doNotMeetTheHandlingOpinions',
|
width: 140
|
}, {
|
fixed: 'right',
|
dataType: "slot",
|
width: 280,
|
label: '操作',
|
slot: 'action',
|
}
|
],
|
superviseTableData: [],
|
superviseLoading: false,
|
multipleSelection: [],
|
downloadDialog: false,
|
download: {
|
currentStateControl: '',
|
currentStateProcessing: '',
|
},
|
downloadId: '',
|
}
|
},
|
mounted() {
|
this.getTableData()
|
},
|
methods: {
|
/**
|
* @desc 获取树的人员id
|
*/
|
getDepart() {
|
this.getTableData()
|
},
|
pagination({ page, limit }) {
|
this.page.current = page;
|
this.page.size = limit;
|
this.getTableData();
|
},
|
// 获取监督记录
|
async getTableData() {
|
this.loading = true
|
const { code, data } = await personSupervisionRecordPage({
|
departLimsId: this.isDepartment ? this.departId : null,
|
userId: this.isDepartment ? null : this.departId,
|
current: this.page.current,
|
size: this.page.size
|
})
|
if (code == 200) {
|
this.superviseTableData = data.records
|
this.page.total = data.total
|
}
|
this.loading = false
|
},
|
// 新增监督记录
|
addRecord(row, type = false) {
|
this.$refs.recordModal.openDialog({ departId: this.departId, ...row }, type)
|
},
|
openRecord(row) {
|
this.$refs.recordModal.openDialog(row, true)
|
},
|
// 打开导出弹框
|
openDownloadDia(row) {
|
this.downloadDialog = true
|
this.download = row
|
console.log('this.download', this.download.currentStateProcessing, this.download.currentStateControl);
|
this.downloadId = row.id
|
},
|
// 控制单导出
|
controlDown() {
|
exportSupervisionControlSheet({ supervisionRecordId: this.downloadId }).then(res => {
|
this.outLoading = false
|
const blob = new Blob([res], { type: 'application/msword' });
|
this.$download.saveAs(blob, '控制单导出' + '.docx')
|
})
|
},
|
// 处理单导出
|
processingDown() {
|
exportSupervisionProcessingSheet({ supervisionRecordId: this.downloadId }).then(res => {
|
this.outLoading = false
|
const blob = new Blob([res], { type: 'application/msword' });
|
this.$download.saveAs(blob, '处理单导出' + '.docx')
|
})
|
},
|
// 监督记录导出
|
supervisoryDown() {
|
exportPersonSupervisionRecord({ id: this.downloadId }).then(res => {
|
this.outLoading = false
|
const blob = new Blob([res], { type: 'application/msword' });
|
this.$download.saveAs(blob, '监督记录导出' + '.docx')
|
})
|
},
|
// 显示控制单
|
openControl(id) {
|
this.$refs.controlModal.openDialog(id)
|
},
|
// 显示处理单
|
openDispose(id) {
|
this.$refs.disposeModal.openDialog(id)
|
},
|
// 表格多选激活后做什么
|
handleSelectionChange(val) {
|
this.multipleSelection = val
|
},
|
/**
|
* @desc 批量删除监督记录
|
*/
|
delRecords() {
|
this.$confirm(
|
'此操作将删除选中数据, 是否继续?',
|
'提示',
|
{
|
confirmButtonText: '确定',
|
cancelButtonText: '取消',
|
type: 'warning'
|
})
|
.then(async () => {
|
console.log(this.multipleSelection)
|
let ids = this.multipleSelection.map((item) => item.id).join(',')
|
const code = await this.delTableData(ids)
|
this.$message({
|
type: code == 200 ? 'success' : 'error',
|
message: code == 200 ? '删除成功!' : '删除失败!'
|
});
|
this.getTableData()
|
})
|
},
|
// 删除api
|
async delTableData(ids) {
|
const { code } = await deletePersonSupervisionRecord({ ids })
|
return code
|
},
|
// 行背景色
|
renderBtn(currentState) {
|
let status = Number(currentState)
|
let res = {}
|
switch (status) {
|
case 0:
|
break;
|
case 1:
|
res = { color: '#337ecc' }
|
break;
|
case 2:
|
res = { color: '#409EFF' }
|
break;
|
case 3:
|
res = { color: '#79bbff' }
|
break;
|
case 4:
|
res = { color: '#a0cfff' }
|
break;
|
}
|
return res;
|
}
|
},
|
watch: {
|
// 监听点击el-tree的数据,进行数据刷新
|
departId: {
|
handler(newId, oldId) {
|
if (this.isDepartment) {
|
this.getTableData();
|
} else {
|
this.getTableData()
|
}
|
}
|
}
|
}
|
}
|
</script>
|
<style scoped>
|
.flex_column {
|
display: flex;
|
flex-direction: column;
|
justify-content: space-between;
|
}
|
|
|
.items_center {
|
display: flex;
|
align-items: center;
|
}
|
|
.date_box {
|
margin: 0 5px;
|
}
|
|
.search {
|
width: 150px;
|
padding: 0 16px;
|
}
|
</style>
|