Commit a801b521 by wangweidong

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	pages/soil-report-manage/report-make/OriginalRecordView.vue
parents 51ebb430 8a900743
......@@ -51,5 +51,7 @@ export default {
listExperimentProgress: data =>
http
.post('soil/v1/experiment/list_experiment_progress', data)
.then(res => res)
.then(res => res),
listSampleProgress: data =>
http.post('soil/v1/sample/list_sample_progress', data).then(res => res)
}
......@@ -9,10 +9,7 @@
<Form :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="模板名称:">
<Input v-model="formObj.templateTitle" @on-enter="_formSearch" placeholder="请输入模板名称" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托单位:">
<Input v-model="formObj.cusNames" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
<Input v-model="formObj.title" @on-enter="_formSearch" placeholder="请输入模板名称" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
......@@ -104,7 +101,11 @@ export default {
templateTitle: '',
fillInTimeBegin: '',
fillInTimeEnd: '',
cusNames: ''
cusNames: '',
codes: '',
itemNames: '',
testAccordings: '',
title: undefined
},
searchOpen: false
}
......
<template>
<div>
<Modal v-model="showModal" @on-visible-change="_visibleChange"
width="1200" class="zIndex-900 modal-footer-none">
<div slot="header"><p>查看原始记录</p></div>
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="模板名称:">
<Input v-model="formObj.title" @on-enter="_formSearch" placeholder="请输入模板名称" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :open="searchOpen" :msg="btn" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :icon-msg="iconMsg" :getPage="getPage">
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.dateTime">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<!-- <template slot="col">-->
<!-- <vxe-table-column-->
<!-- :width="190"-->
<!-- title="操作"-->
<!-- align="center"-->
<!-- fixed="right">-->
<!-- <template slot-scope="scope">-->
<!-- <VXEIconList :msg="(scope.row.hasInputItem===1) ? iconMsg : iconMsgDisable"-->
<!-- @on-result-change="_iconClick" :rowData="scope.row"></VXEIconList>-->
<!-- </template>-->
<!-- </vxe-table-column>-->
<!-- </template>-->
</PTVXETable>
</Col>
</Row>
</Modal>
<ItemView ref="itemViewModal"></ItemView>
</div>
</template>
<script>
/**
* 原始记录查看
*/
import Global from '../../../api/config'
import { soilSample, soilTest } from '../../../api'
import ItemView from '../report-make/ItemView'
export default {
components: {
ItemView
},
data() {
return {
currentComponent: '',
getPage: {},
showModal: false,
selectIds: [],
iconMsg: [
{
type: 'ios-book',
id: '',
name: '查看原始记录'
},
{
type: 'ios-list',
id: '',
name: '查看试验项目'
}
// {
// type: 'erlenmeyer-flask',
// id: '',
// name: '查看样品',
// componentName: 'SampleView'
// },
// {
// type: 'document-text',
// id: '',
// name: '查看检测项目',
// componentName: 'ItemView'
// },
// { type: 'cloud', id: '', name: '附件', componentName: 'FileManage' },
// { type: 'trash-a', id: '', name: '删除' },
// {
// type: 'ios-clock',
// id: '',
// name: '操作记录',
// componentName: 'ElnFormRecord'
// }
],
iconMsgDisable: [
{ type: 'md-create', id: '', name: '编辑', disabled: true },
{
type: '',
id: '',
name: '查看原始记录',
componentName: 'OriginalItemView'
},
{
type: 'ios-list',
id: '',
name: '查看试验项目'
}
// {
// type: 'document-text',
// id: '',
// name: '查看检测项目',
// componentName: 'ItemView'
// },
// { type: 'cloud', id: '', name: '附件', componentName: 'FileManage' },
// { type: 'trash-a', id: '', name: '删除', disabled: true },
// {
// type: 'ios-clock',
// id: '',
// name: '操作记录',
// componentName: 'ElnFormRecord'
// }
],
pageColumns: [
{ title: '模板名称', key: 'title' },
{ title: '委托编号', key: 'entrustCode' },
{ title: '填写人', key: 'uname' },
{ title: '创建时间', key: 'ctime', dateTime: true }
],
formObj: {
entrustId: '',
batchNos: '',
sampleNums: '',
templateTitle: '',
fillInTimeBegin: '',
fillInTimeEnd: '',
cusNames: '',
codes: '',
itemNames: '',
testAccordings: '',
title: undefined
},
searchOpen: false
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
methods: {
_componentResult(data) {
switch (this.currentComponent) {
case 'EditDateModal':
this._updateDate(data)
break
default:
this._page()
}
},
_updateDate(date) {
this.$store
.dispatch('PrintForm/updateTimeBatch', {
ids: this.selectIds.join(','),
fillInTime: date
})
.then(() => {
if (this.$store.state.PrintForm.success) {
this._page()
this.$Message.success('更新成功!')
}
})
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '纠正填写时间':
this._editWriteTime()
break
case '设置填写人乙':
this._setAnotherTester()
break
case '生成报告':
this._reportMake()
break
case '删除':
this._batchDelete()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_visibleChange(data) {
if (data === false) {
this.$emit('on-result-change')
}
},
_reportMake(data) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定这' + this.selectIds.length + '条数据生成报告',
onOk: () => {
this.openTooltip()
this.$refs.pageTable._showLoading()
this._reportMakeOk()
}
})
}
},
_reportMakeOk: async function() {
const result = await soilSample.reportMake({
entrustId: this.formObj.entrustId,
originalList: this.selectIds
})
if (result) {
this.$Message.success('报告成功生成')
this._page()
this.$emit('on-result-change')
}
this.$refs.pageTable._hideLoading()
},
openTooltip() {
this.$notify.info({
title: '提示',
message: '正在生成,请稍后',
duration: 3000
})
},
// 设置填写人乙
_setAnotherTester() {
if (this.selectIds.length === 0) {
this.$msgTip('warning')
} else {
this.$refs.testerModal._open(this.selectIds)
}
},
_editWriteTime() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('填写时间')
}
},
_dateChange(data) {
this.formObj.fillInTimeBegin = data[0]
this.formObj.fillInTimeEnd = data[1]
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
// this.$refs.recordEditModal._openWithType(
// data.originalRecordId,
// 'ENVTESTMAKEEDIT'
// )
this._recordEdit(data)
break
case '查看原始记录':
this._recordLook(data)
// this._recordView(data.originalRecordId)
break
case '查看试验项目':
this._itemView(data.id)
break
case '查看检测项目':
this.$refs.refModal._open(data)
break
case '查看样品':
this.$refs.refModal._open(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'originalId')
break
case '删除':
this._deleteByIds([data.id])
break
case '操作记录':
this.$refs.refModal._open(data.id)
break
}
})
},
_recordLook(data) {
if (data.objectKey) {
this._reportMakeLook(data)
} else {
this._recordView(data.originalRecordId)
}
},
_recordEdit(data) {
if (data.objectKey) {
this._reportMakeLook(data)
} else {
this.$refs.recordEditModal._openWithType(
data.originalRecordId,
'ENVTESTMAKEEDIT'
)
}
},
_reportMakeLook(data) {
console.log(data)
this._viewReport(data)
// const result = await soilReport.getExcelOriginalRecord(data.id)
// if (result) {
// this._viewReport(result)
// }
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 10,
id: data.id,
isReport: 4
})
}
},
// 查看试验项目
_itemView(id) {
this.$refs.itemViewModal._open(id)
},
// 查看原始记录
_recordView(originalRecordId) {
// layx.iframe('labRecordWriteOriView', '原始记录预览', Global.recordURL + '/print/v1/form/' + originalRecordId, {
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
recordUrl + '/print/v1/form/' + originalRecordId + '?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
_open(entrustId) {
this.showModal = true
this.formObj.entrustId = entrustId
this._page()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.EnvItem.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.recordPage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// 批量删除原始记录
_batchDelete() {
if (this.selectIds.length > 0) {
const content = '确定删除这' + this.selectIds.length + '条数据?'
this._deleteByIds(this.selectIds, content)
} else {
this.$msgTip('warning')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('EnvItem/deleteOriRecord', ids).then(() => {
if (this.$store.state.EnvItem.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
}
}
}
</script>
<template>
<div>
<!--内容-->
<Modal v-model="showModal" :width="100" class="modal-footer-none modal-top-0">
<p slot="header">{{modalTitle}}</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="样品台账" name="sample">
<ReportMakeBySample ref="sampleTabs"></ReportMakeBySample>
</el-tab-pane>
<el-tab-pane label="汇总报告台账" name="summary">
<SummaryInfo ref="summaryTabs"></SummaryInfo>
</el-tab-pane>
<el-tab-pane label="试验项目报告台账" name="report">
<ReportInfoMake ref="reportTabs"></ReportInfoMake>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
</div>
</template>
<script>
import ReportInfoMake from './sample-report-manage/ReportInfoMake'
import ReportMakeBySample from './sample-report-manage/ReportMakeBySample'
import SummaryInfo from './sample-report-manage/SummaryInfo'
export default {
components: {
ReportMakeBySample,
ReportInfoMake,
SummaryInfo
},
data() {
return {
showModal: false,
modalTitle: '',
activeName: '',
contractId: '',
entrustId: '',
type: '',
personal: ''
}
},
computed: {
tableHeight: function() {
return document.documentElement.clientHeight - 135
}
},
methods: {
_open(entrustId) {
this.modalTitle = '管理样品和报告'
this.showModal = true
this.activeName = 'sample'
this.entrustId = entrustId
this.$refs.sampleTabs._open(this.entrustId)
console.log(this.entrustId)
// 先初始化样品台账的数据
// this.$nextTick(() =>
// this.$refs.sampleTabs._getPage(
// this.contractId,
// this.type,
// this.personal
// )
// )
// this._sampleData(contractId)
},
// 判断待编样品是否为0
_sampleData(contractId) {
const data = {
contractId: contractId,
onlyReportMake: 1,
reported: 0,
page: 1,
rows: 50,
personal: this.personal
}
this.$store.dispatch('FoodSample/pageSampleReportMake', data).then(() => {
const records = this.$store.state.FoodSample.page.records
if (records.length === 0) {
this.activeName = 'report'
this.$nextTick(() => this._report())
} else {
this.activeName = 'sample'
this.$nextTick(() =>
this.$refs.sampleTabs._getPage(
this.contractId,
this.type,
this.personal
)
)
}
})
},
_report() {
this.$refs.reportTabs._open(this.entrustId)
},
_sample() {
console.log(this.entrustId)
this.$refs.sampleTabs._open(this.entrustId)
},
_summary() {
this.$refs.summaryTabs._open(this.entrustId)
},
_changeTabs(tab, event) {
switch (tab.name) {
case 'sample':
this._sample()
break
case 'report':
this._report()
break
case 'summary':
this._summary()
break
}
}
// _sampleTabResult(msg) {
// if (msg === 'changeTab') {
// this.activeName = 'report'
// this.$refs.reportTabs._open(this.contractId, this.personal)
// }
// }
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg" :tableName="tableName"
select-data is-report>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in (userColumns.length>0?userColumns: pageColumns)"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'): ''}}
</div>
<div v-else-if="item.dateTime">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'): ''}}
</div>
<div v-else-if="item.judge">{{Number(scope.row[item.key])===1?'是':'否'}}
</div>
<div v-else-if="item.notOkCount">
<span v-if="scope.row[item.key] === 0" class="blue-color">合格</span>
<span v-else class="red-color">不合格</span>
</div>
<div v-else-if="item.key==='progress'">
{{scope.row[item.key].display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<template slot="setting">
<VXESettingCol :pageColumns="pageColumns" :userColumns="userColumns" @on-result-change="_resetColumn"
:table-name="tableName"></VXESettingCol>
</template>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<Modal v-model="showIssueModal" @on-cancel="_issueCancel"
@on-ok="_issueOk"
class="zIndex-1100">
<p slot="header">请选择签发日期</p>签发日期:
<DatePicker :editable="false"
v-model="issueDateTemp"
@on-change='_issueChange'
placeholder="请选择签发日期"
style="width:400px">
</DatePicker>
</Modal>
</div>
</template>
<script>
import global from '../../../../api/config'
import http from '../../../../api/http'
import { soilReport, soilTest } from '../../../../api'
import Global from '../../../../api/config'
/**
* 报告编制的-待办-报告台账
*/
export default {
components: {},
data() {
return {
notOkCountList: [
{ value: 0, name: '合格' },
{ value: 1, name: '不合格' }
],
currentComponent: '',
searchOpen: false,
btn: [{ id: 'food-report-make-batch-down', name: '下载' }],
getPage: {},
pageColumns: [
{ title: '试验项目', key: 'expName', width: 180, fixed: 'left' },
{ title: '创建人', key: 'uname', width: 180, fixed: 'left' },
{ title: '创建时间', key: 'ctime', width: 180, dateTime: true }
],
selectIds: [],
selectData: [],
formObj: {
entrustId: ''
},
dateList: [],
iconMsg: [
{ type: 'ios-book', id: '', name: '预览/编辑报告' }
// {
// type: 'ios-document',
// id: '',
// name: '项目台账',
// componentName: 'ItemModalByReportMake'
// },
// {
// type: 'ios-cloud-upload',
// id: '',
// name: '上传',
// componentName: 'UploadByReport'
// },
// {
// type: 'cloud',
// id: '',
// name: '附件',
// componentName: 'ReportFileManage'
// },
// {
// type: 'ios-clock',
// id: '',
// name: '操作记录',
// componentName: 'FoodReportRecord'
// }
],
// 签发日期
issueDateTemp: '',
issueDate: '',
showIssueModal: false,
reportId: '',
tempId: '',
reportType: 'FOOD_REPORT_MAKE',
// 批量还是单个生成报告
reportBatch: false,
reportBatchData: {},
dataPushedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
userColumns: [],
tableName: 'food-report-make-report-info-by-contract',
reportStatus: 'FLOW_REPORT_MAKE'
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearchTwo')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 盖章
_toPDF() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_reportDateChange(data) {
this.formObj.reportDueDateBegin = data[0]
this.formObj.reportDueDateEnd = data[1]
},
// 签发日期
_issueChange(data) {
if (data) {
this.issueDate = data
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'Reason':
this._overdueReason(data)
break
case 'ReportTemplateModal':
this._regenerate(data)
break
case 'AssignPerson':
this._auditorResult(data)
break
default:
this._page()
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '上传':
this._upload(data.id)
break
case '重新生成':
this.$refs.refModal._open(data)
break
case '预览/编辑报告':
this._reportView(data)
// this._viewReport(data)
break
case '操作记录':
this._record(data.id)
break
case '项目台账':
this.$refs.refModal._open(data.id)
break
case '历史版本':
this.$refs.refModal._open(data.id, this.reportType)
break
case '附件':
this.$refs.refModal._open(data.id, 'reportId')
break
case '档案查看':
this.reportViewFiles(data, {
location: 'report',
archivesType: 'reportManage'
})
break
}
})
},
_upload(id) {
this.$refs.refModal._open(id)
},
_reportView(data) {
if (data.objectKey) {
this._reportMakeLook(data)
} else {
this._recordView(data.originalRecordId)
}
},
_reportMakeLook: async function(data) {
console.log(data)
const result = await soilReport.expReportGetById(data.id)
// this._viewReport(data)
// const result = await soilReport.getExcelOriginalRecord(data.id)
if (result) {
console.log('result')
this._viewReport(result)
}
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 11,
id: data.id,
isReport: 4
})
}
},
_recordView(originalRecordId) {
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
recordUrl + '/print/v1/form/' + originalRecordId + '?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.reportBatch = false
this.reportBatchData = {}
this.getPage = this.$store.state.FoodSampleReport.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'table-col':
console.log('table-col', data)
this.userColumns = data
break
case 'changeSize':
this._page()
break
}
},
_open(entrustId) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.entrustId = entrustId
this.showIssueModal = false
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.pageExperimentReport(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_record(id) {
// 操作记录
this.$refs.refModal._open(id)
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '提交':
this._submit('submit')
break
case '提交至报告签发':
this._submit('submit-to-issue')
break
case '下载':
this._downloadBatch()
break
case '删除':
this._deleteSelected()
break
case '记录报告超期原因':
this._batchOverdueReason()
break
case '修改报告资质要求':
this._editReportAptitude()
break
case '选择审核人':
this._selectAuditor()
break
case '重新生成':
if (this.selectData.length > 0) {
this.$refs.refModal._open({
reportBatch: true,
id: '',
tempId: this.selectData[0].tempId
})
} else {
this.$msgTip('warning')
}
break
case '推送至国抽平台':
this._selectToGc()
break
case '完成':
this._achieveReport()
break
case '盖章':
this._toPDF()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 完成报告
_achieveReport() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定完成这' + this.selectIds.length + '个报告?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/submitMakeToEnd', {
reportIds: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$msgTip('success', '提交成功')
this._page()
}
this.$Modal.remove()
})
}
})
}
},
// 推送至国抽
_selectToGc() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确认提交这' + this.selectIds.length + '条数据至国抽平台?',
loading: true,
onOk: () => {
this._submitToGc()
}
})
}
},
_submitToGc() {
// 提交之前进行验证
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch('FoodSample/pushDataToGcReport', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSample.success) {
this.$msgTip('success', '提交成功')
this._page()
}
this.$Modal.remove()
})
}
})
},
// 选择审核人
_selectAuditor() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('auditor', '选择审核人')
}
},
_auditorResult(data) {
const tempData = {
auditorId: data.userId,
auditor: data.realname,
ids: this.selectIds.join(',')
}
this.$layxLoading()
// 提交之前进行验证
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch('FoodSampleReport/submitMakeToAuditor', tempData)
.then(() => {
this._resultChange('提交成功')
})
} else {
this.$layxLoading(false)
}
})
},
_editReportAptitude() {
this.$refs.refModal._open(this.formObj.contractId)
},
_batchOverdueReason() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('超期原因')
}
},
_overdueReason(reason) {
this.$layxLoading()
this.$store
.dispatch('FoodReportSummary/addReason', {
ids: this.selectIds.join(','),
reason: reason
})
.then(() => {
if (this.$store.state.FoodReportSummary.success) {
this.$Message.success('操作成功!')
this._page()
}
this.$layxLoading(false)
})
},
_resultChange(msg) {
if (this.$store.state.FoodSampleReport.success) {
this.$Message.success(msg)
this._page()
}
this.$Modal.remove()
this.$layxLoading(false)
},
// 重新生成报告ok(多个)
_regenerateBatch() {
const validateObj = {
ids: this.selectIds.join(','),
issueDate: this.issueDate,
reportModelId: this.reportBatchData.tempId
}
// 先进行验证
this.$store
.dispatch('FoodSampleReport/generateAgainBatchCheck', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
// true --- 建立连接
this.currentComponent = 'ProgressByRegenerateReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds.length, currentTime)
})
validateObj.seriesNo = currentTime
this.$store
.dispatch('FoodSampleReport/generateAgainBatch', validateObj)
.then(() => {})
}
})
},
// 重新生成报告(单个、批量)
_regenerate(data) {
this.reportBatch = data.reportBatch
this.reportBatchData = data
if (!data.reportBatch) {
// 单个生成
this.reportId = data.id
this.tempId = data.tempId
}
// 判断字典中是否配置报告编制日期
this.$store
.dispatch('LmsBaseDict/getItem', '编制时选择签发日期')
.then(() => {
const result = this.$store.state.LmsBaseDict.item
if (result.length !== 0 && result[0].code === 'yes') {
// 配置为yes弹出
this.showIssueModal = true
this.issueDateTemp = ''
this.issueDate = ''
} else {
// 配置为no不弹出
this.showIssueModal = false
this.issueDate = ''
this._createOk()
}
})
},
_issueCancel() {
this.showIssueModal = false
},
// 选择时间ok
_issueOk() {
this.showIssueModal = false
this._createOk()
},
// 生成报告
_createOk() {
if (!this.reportBatch) {
// 单个生成报告
const obj = {
id: this.reportId,
issueDate: this.issueDate,
reportModelId: this.tempId
}
this.$store.dispatch('FoodSampleReport/generateAgain', obj).then(() => {
this._resultChange('报告重新生成成功')
})
} else {
// 批量改生成报告
this._regenerateBatch()
}
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids.join(','), '确定删除 ' + ids.length + ' 条记录?')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/sampleReportDeletes', { ids: ids })
.then(() => {
this._resultChange('删除成功!')
})
}
})
},
_downloadBatch() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要下载这 ' + ids.length + ' 个报告?',
onOk: () => {
const obj = {
ids: ids.join(','),
contractId: this.formObj.contractId,
flag: 0
}
http.open(
global.baseURL +
'/food/v1/sample_report/download_batch_by_sampleIds',
obj,
'_blank'
)
}
})
}
},
_submit(msg) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
let url = ''
let successMsg = ''
let content = ''
switch (msg) {
case 'submit':
// 提交
url = 'FoodSampleReport/submitMake'
successMsg = '提交成功'
content = '确定要提交这 ' + ids.length + ' 条数据?'
break
case 'submit-to-issue':
// 提交至报告签发
url = 'FoodSampleReport/submitToIssue'
successMsg = '成功提交至报告签发'
content = '确定要将这 ' + ids.length + ' 条数据提交至报告签发?'
break
}
this.$Modal.confirm({
title: '提示',
content: content,
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch(url, { ids: this.selectIds.join(',') })
.then(() => {
this._resultChange(successMsg)
})
}
})
}
})
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-make-contract" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托单位:">
<Input @on-enter="_formSearch" v-model="formObj.client" name="client" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input @on-enter="_formSearch" v-model="formObj.entrustCode" name="entrustCode" placeholder="请输入委托编号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
:msg="btn" class="contHide">
<!-- <template slot="processTask">-->
<!-- <div class="fr process-task">-->
<!-- <el-checkbox v-model="personal" @change="_page" :true-label="1" :false-label="0" size="medium">-->
<!-- 个人任务-->
<!-- </el-checkbox>-->
<!-- <el-checkbox v-model="onlyReportMake" @change="_page" :true-label="1"-->
<!-- :false-label="0" size="medium">只显示待编报告-->
<!-- </el-checkbox>-->
<!-- </div>-->
<!-- </template>-->
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="100"
:width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<a @click.stop="_detailModal(scope.row.id,scope.row.type)"
v-if="item.detail">{{scope.row[item.key]}}</a>
<div v-else-if="item.type">{{scope.row[item.key]?'政府':'企业'}}</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'): ''}}
</div>
<div v-else-if="item.key==='havePhoto'">{{scope.row[item.key]===1?'是':
scope.row[item.key]===0?'否':''}}
</div>
<div v-else-if="item.status">
<span v-if="scope.row[item.key].display === '报告审核退回'||'报告签发退回' ===scope.row[item.key].display " style="color: red;">{{ scope.row[item.key] === undefined ? '': scope.row[item.key].display }}</span>
<span v-else>{{ scope.row[item.key] === undefined ? '': scope.row[item.key].display }}</span>
</div>
<div v-else-if="item.judge">
{{Number(scope.row[item.key]) === 0? '否':'是'}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_componentResult"></component>
</keep-alive>
</div>
</template>
<script>
import { soilSample, soilStatistics } from '../../../../api'
import SampleByMakeModal from '../SampleByMakeModal'
import Operation from '../../../../components/operation/Operation'
import OriginalRecordView from '../OriginalRecordView'
import UploadByReport from '../UploadByReport'
import ItemReportView from '../ItemReportView'
export default {
components: {
// eslint-disable-next-line vue/no-unused-components
SampleByMakeModal,
// eslint-disable-next-line vue/no-unused-components
Operation,
// eslint-disable-next-line vue/no-unused-components
OriginalRecordView,
// eslint-disable-next-line vue/no-unused-components
UploadByReport,
// eslint-disable-next-line vue/no-unused-components
ItemReportView
},
data() {
return {
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
currentComponent: '',
getPage: {},
formObj: {},
pageColumns: [
{
title: '委托商',
key: 'client',
width: 100,
fixed: 'left'
},
{ title: '委托编号', key: 'entrustCode', width: 100 },
{ title: '报告编号', key: 'reportCode', width: 100 },
{ title: '进度', key: 'progress', width: 110, status: true },
{ title: '状态', key: 'status', width: 100, status: true },
{ title: '委托日期', key: 'entrustDate', width: 100, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 100 },
{ title: '钻孔名称', key: 'boreholeName', width: 100 },
{ title: '水深', key: 'waterDepth', width: 100 },
{ title: '制表人', key: 'tabulater', width: 110 },
{ title: '制表日期', key: 'tabulateDate', width: 110, date: true }
],
iconMsg: [
{
type: 'ios-flask-outline',
id: '',
name: '管理样品和报告',
currentComponent: SampleByMakeModal
},
{
type: 'ios-beaker',
id: '',
name: '查看原始记录',
currentComponent: OriginalRecordView
},
{
type: 'ios-list-box',
id: '',
name: '查看试验项目报告'
},
{
type: 'ios-cloud-upload',
id: '',
name: '上传报告'
},
{
type: 'md-image',
id: '',
name: '预览报告'
},
{
type: 'ios-book',
id: '',
name: '编辑报告'
},
// {
// type: 'ios-document-outline',
// id: '',
// name: '检测项目'
// },
{ type: 'ios-cloud-outline', id: '', name: '附件' },
{
type: 'ios-clock-outline',
id: '',
name: '操作记录',
componentName: 'FoodContractRecord'
}
],
onlyReportMake: 1,
searchOpen: false,
btn: [
{
type: 'primary',
id: '',
name: '提交'
}
],
selectIds: [],
selectData: [],
personal: 0
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearchTwo')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
_open() {
// this._dicSearch()
},
_reportDateChange(data) {
$('input[name="reportDueDateBegin"]').val(data[0])
$('input[name="reportDueDateEnd"]').val(data[1])
},
// 从字典查预警期
_dicSearch() {
// 食品报告编制个人任务是否勾选
const data = ['食品报告编制个人任务是否勾选']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
const personalList = result[0]
// 食品报告编制个人任务是否勾选
if (personalList.length && personalList[0].name === '是') {
this.personal = 1
} else {
this.personal = 0
}
this._page()
})
},
_btnClick(msg) {
switch (msg) {
case '信息维护':
this._maintainInfo()
break
case '提交':
this._submitToCheck()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_submitToCheck() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
console.log(this.selectData)
for (let i = 0; i < this.selectIds.length; i++) {
if (this.selectData[i].reported !== '是') {
this.$Message.warning('报告未编制')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定提交这' + this.selectIds.length + '条数据?',
onOk: () => {
this._submitReportOk()
}
})
}
}
}
},
_submitReportOk: async function() {
const result = await soilSample.reportMakeSubmit(this.selectIds.join(','))
if (result) {
this.$Message.success('提交成功')
this._page()
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理样品和报告':
this._sampleManage(data.id)
break
case '查看原始记录':
this._viewRecord(data.id)
break
case '查看试验项目报告':
this._viewItemRecord(data.id)
break
case '上传报告':
this._uploadReport(data.id)
break
case '预览报告':
this._viewReport(data.id)
break
case '编辑报告':
this._viewReport(data.id)
break
case '检测项目':
this.$refs.refModal._open(data)
break
case '操作记录':
this._operationRecord(data.id)
break
case '附件':
this._upload(data.id)
break
}
})
},
_viewRecord(id) {
this.currentComponent = 'OriginalRecordView'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
},
_viewItemRecord(id) {
this.currentComponent = 'ItemReportView'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
},
_sampleManage(id) {
this.currentComponent = 'SampleByMakeModal'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
},
_uploadReport(id) {
this.currentComponent = 'UploadByReport'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
// this.$refs.uploadReport._open(id)
},
_viewReport: async function(id) {
const result = await soilSample.getReport(id)
if (result) {
this._reportEdit(result, id)
}
},
_reportEdit(data, id) {
this.$openWindowModeless({
objectKey: data.objectKey,
id: id,
idType: 11,
isReport: 4
})
},
_operationRecord(id) {
this.currentComponent = 'Operation'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
// 操作日志
// this.$refs.operation._open(id)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
this.selectIds = []
break
case 'selectIds':
this.selectIds = data
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < this.selectData.length; i++) {
this.selectIds.push(this.selectData[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.currentComponent)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilStatistics.pageReportMake(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_upload(id) {
this.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'entrustId')
})
// 上传文件
// this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-make-sample" :label-width="90" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="试样编号:">
<Input @on-enter="_formSearch" v-model="formObj.sampleCode" placeholder="请输入试样编号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide">
<!--切换待认领任务-->
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight" @on-result-change="_tableResultChange"
:getPage="getPage" select-data>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.display">{{scope.row[item.key]? scope.row[item.key].display: ''}}</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'): ''}}
</div>
<div v-else-if="item.judge">{{Number(scope.row[item.key])===1?'是':'否'}}
</div>
<div v-else-if="item.reported">
<div v-if="scope.row[item.key]>0" class="green-color"></div>
<div v-else></div>
</div>
<div v-else-if="item.key === 'infoMaintain'">
<label v-if="scope.row.infoMaintain === 'no'" class="green-color">信息已维护</label>
<label v-else-if="scope.row.infoMaintain === 'yes'" class="red-color">信息待维护</label>
<label v-else-if="scope.row.infoMaintain === 'none'"></label>
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<vxe-table-column
:width="140"
title="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="type === 0?iconMsg1:iconMsg" @on-result-change="_iconClick" :rowData="scope.row"
:rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
import SoilSampleItemManage from '../../../meter-entrust/SoilSampleItemManage'
/**
* 按委托编制----管理样品
*/
export default {
components: { SoilSampleItemManage },
data() {
return {
currentComponent: '',
searchOpen: false,
btn: [
{
type: 'primary',
id: 'food-report-make-push-to-gc',
name: '推送至国抽平台'
},
{ type: 'success', id: 'ZBC', name: '生成' },
{
type: 'success',
id: 'food-report-make-select-template-create',
name: '选择模板生成',
componentName: 'CreateReport'
},
{
type: 'primary',
id: 'food-report-make-create-samples',
name: '多样品生成',
componentName: 'CreateReportBySamples'
},
{
type: 'primary',
id: 'food-report-make-edit-items',
name: '批量维护检测项目',
componentName: 'FoodItemBatchEditModal'
},
{
type: '',
id: 'food-report-make-sample-maintain-info',
name: '信息维护',
componentName: 'MaintainInfoModal'
}
],
getPage: {},
detectionDate: '',
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 },
{ title: '试验项目', key: 'experimentNames', width: 330 }
],
selectIds: [],
selectData: [],
formObj: {
entrustId: undefined,
contractId: undefined,
sampleCode: undefined
},
dateList: [],
type: '',
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理检测项目'
},
{ type: 'md-trash', id: '', name: '删除' }
],
iconMsg1: [
{
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
{ type: 'compose', id: '', name: '编辑' }, // food-report-make-sample-edit
{
type: 'ios-upload',
id: '',
name: '上传',
componentName: 'UploadReport'
},
{
type: 'document-text',
id: '',
name: '项目台账',
componentName: 'FoodItemEditModal'
},
{
type: 'ios-clock',
id: '',
name: '操作记录',
componentName: 'FoodSampleRecord'
}
],
dataPushedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
postUrl: 'FoodSample/pageSampleReportMake',
currentId: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {},
methods: {
// 初始化值
// 当前列表有值,则不会重新调page接口
_reportDateChange(data) {
this.formObj.reportDateBegin = data[0]
this.formObj.reportDateEnd = data[1]
},
_modalResult(data, msg) {
switch (this.currentComponent) {
case 'CreateReport':
this.$emit('on-result-change', 'changeTab')
break
case 'ProgressByReport':
// 进度条
this.$emit('on-result-change', 'changeTab')
break
case 'FoodSampleCompanyEdit':
case 'FoodSampleGovernLYEdit':
case 'FoodSampleGovernEdit':
case 'UploadReport':
// 单个编辑
this._updateRows()
break
default:
this._page()
}
},
// 更新ids数据
_updateRows() {
const obj = {
url: this.postUrl,
params: this.$serializeFormSearch(this.formObj)
}
obj.params.ids = this.currentId
this.$refs.pageTable._updateRows(obj)
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理检测项目':
this._itemManage(data.id)
break
case '上传':
this.currentId = data.id
this.$refs.refModal._open(data.id)
break
case '项目台账':
this.$refs.refModal._open(data)
break
case '操作记录':
this._record(data.id)
break
case '编辑':
this.currentId = data.id
this._edit(data)
break
case '样品附件':
this._upload(data.id)
break
}
})
},
_itemManage(data) {
// 管理检测项目
this.$refs.sampleItemManage._open(data)
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'sampleId')
},
_edit(data) {
if (data.type === 0) {
this.currentComponent = 'FoodSampleCompanyEdit'
this.$store.dispatch('FoodSample/getByCompanyId', data.id).then(() => {
this.$nextTick(function() {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.formObj.contractId
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(function() {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.formObj.contractId
)
})
})
} else {
this.currentComponent = 'FoodSampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(function() {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.formObj.contractId
)
})
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.getPage = this.$store.state.FoodSample.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_open(entrustId) {
// 初始化数据
// this._resetData(contractId, type, personal)
this.formObj.entrustId = entrustId
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.samplePage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_record(id) {
// 操作记录
this.$refs.refModal._open(id)
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '生成':
this._createReport()
break
case '选择模板生成':
this._judgeReport('create')
break
case '推送至国抽平台':
this._pushToGC()
break
case '多样品生成':
this._judgeReport('create-samples')
break
case '批量维护检测项目':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(this.selectIds)
}
break
case '信息维护':
this._maintainInfo()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds, 2)
}
},
// 推送至国抽平台
_pushToGC() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要推送这' + ids.length + '条数据至国抽平台?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSample/pushDataToGC', { ids: ids.join(',') })
.then(() => {
this._resultChange('信息推送成功')
})
}
})
}
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this.$Message.success(msg)
this._page()
this.selectIds = []
}
this.$Modal.remove()
},
// 生成报告
_judgeReport(name) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
switch (name) {
case 'create':
this.$refs.refModal._open(this.selectData)
break
case 'create-samples':
this.$refs.refModal._open(this.selectIds)
break
}
}
},
_createReport() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const validateObj = { sampleIds: this.selectIds }
// 先进行验证
this.$store
.dispatch('FoodSampleReport/generateAutomaticValidate', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
// true --- 建立连接
this.currentComponent = 'ProgressByReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds.length, currentTime)
})
validateObj.seriesNo = currentTime
this.$store
.dispatch('FoodSampleReport/generateAutomatic', validateObj)
.then(() => {})
} else {
// false --- 弹出选择模板框
this.currentComponent = 'CreateReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectData)
})
}
})
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg" :tableName="tableName"
select-data is-report>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in (userColumns.length>0?userColumns: pageColumns)"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'): ''}}
</div>
<div v-else-if="item.dateTime">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'): ''}}
</div>
<div v-else-if="item.judge">{{Number(scope.row[item.key])===1?'是':'否'}}
</div>
<div v-else-if="item.notOkCount">
<span v-if="scope.row[item.key] === 0" class="blue-color">合格</span>
<span v-else class="red-color">不合格</span>
</div>
<div v-else-if="item.key==='progress'">
{{scope.row[item.key].display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
<template slot="setting">
<VXESettingCol :pageColumns="pageColumns" :userColumns="userColumns" @on-result-change="_resetColumn"
:table-name="tableName"></VXESettingCol>
</template>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<Modal v-model="showIssueModal" @on-cancel="_issueCancel"
@on-ok="_issueOk"
class="zIndex-1100">
<p slot="header">请选择签发日期</p>签发日期:
<DatePicker :editable="false"
v-model="issueDateTemp"
@on-change='_issueChange'
placeholder="请选择签发日期"
style="width:400px">
</DatePicker>
</Modal>
</div>
</template>
<script>
import global from '../../../../api/config'
import http from '../../../../api/http'
import { soilReport, soilTest } from '../../../../api'
import Global from '../../../../api/config'
/**
* 报告编制的-待办-报告台账
*/
export default {
components: {},
data() {
return {
notOkCountList: [
{ value: 0, name: '合格' },
{ value: 1, name: '不合格' }
],
currentComponent: '',
searchOpen: false,
getPage: {},
pageColumns: [
{ title: '创建人', key: 'uname', width: 180, fixed: 'left' },
{ title: '创建时间', key: 'ctime', width: 180, dateTime: true }
],
selectIds: [],
selectData: [],
formObj: {
entrustId: ''
},
dateList: [],
iconMsg: [
{ type: 'ios-book', id: '', name: '预览报告' }
// {
// type: 'ios-document',
// id: '',
// name: '项目台账',
// componentName: 'ItemModalByReportMake'
// },
// {
// type: 'ios-cloud-upload',
// id: '',
// name: '上传',
// componentName: 'UploadByReport'
// },
// {
// type: 'cloud',
// id: '',
// name: '附件',
// componentName: 'ReportFileManage'
// },
// {
// type: 'ios-clock',
// id: '',
// name: '操作记录',
// componentName: 'FoodReportRecord'
// }
],
// 签发日期
issueDateTemp: '',
issueDate: '',
showIssueModal: false,
reportId: '',
tempId: '',
reportType: 'FOOD_REPORT_MAKE',
// 批量还是单个生成报告
reportBatch: false,
reportBatchData: {},
dataPushedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
userColumns: [],
tableName: 'food-report-make-report-info-by-contract',
reportStatus: 'FLOW_REPORT_MAKE'
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearchTwo')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 盖章
_toPDF() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_reportDateChange(data) {
this.formObj.reportDueDateBegin = data[0]
this.formObj.reportDueDateEnd = data[1]
},
// 签发日期
_issueChange(data) {
if (data) {
this.issueDate = data
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'Reason':
this._overdueReason(data)
break
case 'ReportTemplateModal':
this._regenerate(data)
break
case 'AssignPerson':
this._auditorResult(data)
break
default:
this._page()
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '上传':
this._upload(data.id)
break
case '重新生成':
this.$refs.refModal._open(data)
break
case '预览报告':
this._reportView(data)
// this._viewReport(data)
break
case '操作记录':
this._record(data.id)
break
case '项目台账':
this.$refs.refModal._open(data.id)
break
case '历史版本':
this.$refs.refModal._open(data.id, this.reportType)
break
case '附件':
this.$refs.refModal._open(data.id, 'reportId')
break
case '档案查看':
this.reportViewFiles(data, {
location: 'report',
archivesType: 'reportManage'
})
break
}
})
},
_upload(id) {
this.$refs.refModal._open(id)
},
_reportView(data) {
if (data.objectKey) {
this._reportMakeLook(data)
} else {
this._recordView(data.originalRecordId)
}
},
_reportMakeLook: async function(data) {
console.log(data)
const result = await soilReport.reportGetById(data.id)
// this._viewReport(data)
// const result = await soilReport.getExcelOriginalRecord(data.id)
if (result) {
console.log('result')
this._viewReport(result)
}
},
_viewReport(data) {
if (data) {
this.$openWindowModeless({
objectKey: data.objectKey,
idType: 11,
id: data.id,
isReport: 4
})
}
},
_recordView(originalRecordId) {
let recordUrl = ''
if (process.env.NODE_ENV === 'production') {
recordUrl = 'http://record.patzn.com'
} else {
recordUrl = Global.recordURL
}
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
recordUrl + '/print/v1/form/' + originalRecordId + '?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.reportBatch = false
this.reportBatchData = {}
this.getPage = this.$store.state.FoodSampleReport.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'table-col':
console.log('table-col', data)
this.userColumns = data
break
case 'changeSize':
this._page()
break
}
},
_open(entrustId) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.entrustId = entrustId
this.showIssueModal = false
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.reportPage(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_record(id) {
// 操作记录
this.$refs.refModal._open(id)
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '提交':
this._submit('submit')
break
case '提交至报告签发':
this._submit('submit-to-issue')
break
case '下载':
this._downloadBatch()
break
case '删除':
this._deleteSelected()
break
case '记录报告超期原因':
this._batchOverdueReason()
break
case '修改报告资质要求':
this._editReportAptitude()
break
case '选择审核人':
this._selectAuditor()
break
case '重新生成':
if (this.selectData.length > 0) {
this.$refs.refModal._open({
reportBatch: true,
id: '',
tempId: this.selectData[0].tempId
})
} else {
this.$msgTip('warning')
}
break
case '推送至国抽平台':
this._selectToGc()
break
case '完成':
this._achieveReport()
break
case '盖章':
this._toPDF()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 完成报告
_achieveReport() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定完成这' + this.selectIds.length + '个报告?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/submitMakeToEnd', {
reportIds: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$msgTip('success', '提交成功')
this._page()
}
this.$Modal.remove()
})
}
})
}
},
// 推送至国抽
_selectToGc() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content: '确认提交这' + this.selectIds.length + '条数据至国抽平台?',
loading: true,
onOk: () => {
this._submitToGc()
}
})
}
},
_submitToGc() {
// 提交之前进行验证
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch('FoodSample/pushDataToGcReport', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSample.success) {
this.$msgTip('success', '提交成功')
this._page()
}
this.$Modal.remove()
})
}
})
},
// 选择审核人
_selectAuditor() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('auditor', '选择审核人')
}
},
_auditorResult(data) {
const tempData = {
auditorId: data.userId,
auditor: data.realname,
ids: this.selectIds.join(',')
}
this.$layxLoading()
// 提交之前进行验证
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch('FoodSampleReport/submitMakeToAuditor', tempData)
.then(() => {
this._resultChange('提交成功')
})
} else {
this.$layxLoading(false)
}
})
},
_editReportAptitude() {
this.$refs.refModal._open(this.formObj.contractId)
},
_batchOverdueReason() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open('超期原因')
}
},
_overdueReason(reason) {
this.$layxLoading()
this.$store
.dispatch('FoodReportSummary/addReason', {
ids: this.selectIds.join(','),
reason: reason
})
.then(() => {
if (this.$store.state.FoodReportSummary.success) {
this.$Message.success('操作成功!')
this._page()
}
this.$layxLoading(false)
})
},
_resultChange(msg) {
if (this.$store.state.FoodSampleReport.success) {
this.$Message.success(msg)
this._page()
}
this.$Modal.remove()
this.$layxLoading(false)
},
// 重新生成报告ok(多个)
_regenerateBatch() {
const validateObj = {
ids: this.selectIds.join(','),
issueDate: this.issueDate,
reportModelId: this.reportBatchData.tempId
}
// 先进行验证
this.$store
.dispatch('FoodSampleReport/generateAgainBatchCheck', validateObj)
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
// 验证成功之后再建立连接,然后进行生成报告操作
// 建立websocket连接
const currentTime = new Date().getTime()
// true --- 建立连接
this.currentComponent = 'ProgressByRegenerateReport'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds.length, currentTime)
})
validateObj.seriesNo = currentTime
this.$store
.dispatch('FoodSampleReport/generateAgainBatch', validateObj)
.then(() => {})
}
})
},
// 重新生成报告(单个、批量)
_regenerate(data) {
this.reportBatch = data.reportBatch
this.reportBatchData = data
if (!data.reportBatch) {
// 单个生成
this.reportId = data.id
this.tempId = data.tempId
}
// 判断字典中是否配置报告编制日期
this.$store
.dispatch('LmsBaseDict/getItem', '编制时选择签发日期')
.then(() => {
const result = this.$store.state.LmsBaseDict.item
if (result.length !== 0 && result[0].code === 'yes') {
// 配置为yes弹出
this.showIssueModal = true
this.issueDateTemp = ''
this.issueDate = ''
} else {
// 配置为no不弹出
this.showIssueModal = false
this.issueDate = ''
this._createOk()
}
})
},
_issueCancel() {
this.showIssueModal = false
},
// 选择时间ok
_issueOk() {
this.showIssueModal = false
this._createOk()
},
// 生成报告
_createOk() {
if (!this.reportBatch) {
// 单个生成报告
const obj = {
id: this.reportId,
issueDate: this.issueDate,
reportModelId: this.tempId
}
this.$store.dispatch('FoodSampleReport/generateAgain', obj).then(() => {
this._resultChange('报告重新生成成功')
})
} else {
// 批量改生成报告
this._regenerateBatch()
}
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids.join(','), '确定删除 ' + ids.length + ' 条记录?')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/sampleReportDeletes', { ids: ids })
.then(() => {
this._resultChange('删除成功!')
})
}
})
},
_downloadBatch() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定要下载这 ' + ids.length + ' 个报告?',
onOk: () => {
const obj = {
ids: ids.join(','),
contractId: this.formObj.contractId,
flag: 0
}
http.open(
global.baseURL +
'/food/v1/sample_report/download_batch_by_sampleIds',
obj,
'_blank'
)
}
})
}
},
_submit(msg) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
let url = ''
let successMsg = ''
let content = ''
switch (msg) {
case 'submit':
// 提交
url = 'FoodSampleReport/submitMake'
successMsg = '提交成功'
content = '确定要提交这 ' + ids.length + ' 条数据?'
break
case 'submit-to-issue':
// 提交至报告签发
url = 'FoodSampleReport/submitToIssue'
successMsg = '成功提交至报告签发'
content = '确定要将这 ' + ids.length + ' 条数据提交至报告签发?'
break
}
this.$Modal.confirm({
title: '提示',
content: content,
loading: true,
onOk: () => {
this.$store
.dispatch('FoodSampleReport/submitMakeCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodSampleReport.success) {
this.$store
.dispatch(url, { ids: this.selectIds.join(',') })
.then(() => {
this._resultChange(successMsg)
})
}
})
}
})
}
}
}
}
</script>
......@@ -8,10 +8,6 @@
<Col span="24">
<Form id="search-form-report-tab" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="报告编号:">
<Input @on-enter="_formSearch" name="reportCode" placeholder="请输入报告编号"
clearable/>
</Form-item>
<Form-item class="search-item" label="委托单位:">
<Input @on-enter="_formSearch" name="client" placeholder="请输入委托单位" clearable/>
</Form-item>
......@@ -85,8 +81,11 @@
<script>
import { soilReport } from '../../../../api'
import Operation from '../../../../components/operation/Operation'
import SampleByMakeModal from '../../report-manage/SampleByMakeModal'
import OriginalRecordView from '../OriginalRecordView'
export default {
components: { Operation },
// eslint-disable-next-line vue/no-unused-components
components: { Operation, SampleByMakeModal, OriginalRecordView },
props: {
reportStatus: null
},
......@@ -121,6 +120,17 @@ export default {
// componentName: 'ErecordIndex'
// },
{
type: 'ios-flask-outline',
id: '',
name: '管理样品和报告'
},
{
type: 'ios-beaker',
id: '',
name: '查看原始记录'
},
{ type: 'ios-cloud', id: '', name: '附件' },
{
type: 'ios-clock',
id: '',
name: '操作记录'
......@@ -184,23 +194,6 @@ export default {
break
}
},
_reportDateChange(data) {
$('input[name="reportDueDateBegin"]').val(data[0])
$('input[name="reportDueDateEnd"]').val(data[1])
},
// 制单日期
_ctimeChange(data) {
$('input[name="ctimeBegin"]').val(data[0])
$('input[name="ctimeEnd"]').val(data[1])
},
_dateChange(data) {
$('input[name=auditDateBegin]').val(data[0])
$('input[name=auditDateEnd]').val(data[1])
},
_issueDateChange(data) {
$('input[name=issueDateBegin]').val(data[0])
$('input[name=issueDateEnd]').val(data[1])
},
_btnClick(msg) {
switch (msg) {
case '导出发放记录':
......@@ -291,8 +284,14 @@ export default {
this.currentComponent = componentName
this.$nextTick(() => {
switch (res) {
case '资料管理':
this._resManage(data)
case '管理样品和报告':
this._sampleManage(data.id)
break
case '查看原始记录':
this._viewRecord(data.id)
break
case '附件':
this._upload(data.id)
break
case '操作记录':
this._record(data.id)
......@@ -300,6 +299,26 @@ export default {
}
})
},
_upload(id) {
this.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'entrustId')
})
// 上传文件
// this.$refs.FileManage._open(id, 'entrustId')
},
_viewRecord(id) {
this.currentComponent = 'OriginalRecordView'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
},
_sampleManage(id) {
this.currentComponent = 'SampleByMakeModal'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
},
_record(id) {
this.$refs.recordModal._open(id)
},
......
<template>
<div>
<Row>
<!--查询条件-->
<Col span="24">
<div>
<Form :label-width="100" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="委托编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.entrustCode" placeholder="请输入委托编号" clearable/>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.sampleCode" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</div>
</Col>
<Col span="24">
<BtnList :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide">
</BtnList>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
:key="item.key"
sortable>
<template slot-scope="scope">
<div v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</div>
<div v-else-if="item.key==='testProgress'" style="position: relative">
<Progress :percent="scope.row.testProgressPer" :stroke-width="30" status="active" hide-info>
</Progress>
<div style="position: absolute;top: 0;bottom: 0;text-align: center;width: 100%;line-height: 30px">
{{scope.row[item.key]}}
</div>
</div>
<div v-else-if="item.status">
{{scope.row[item.key]?scope.row[item.key].display:''}}
</div>
<div v-else-if="item.type">{{$sampleType(scope.row[item.key])}}</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilStatistics } from '../../../api'
export default {
components: {},
data() {
return {
tableName: 'food-test-progress-table',
// 用户自己选中的列
userColumns: [],
searchOpen: true,
formObj: {
cname: '',
num: '',
contractName: '',
code: '',
finished: '',
reportDateBegin: '',
reportDateEnd: '',
myGroupData: 0,
name: '',
groupIds: '',
salesmans: '',
type: ''
},
btn: [
{ type: 'primary', id: '', name: '导出' },
{ type: 'primary', id: '', name: '催单' }
],
getPage: {},
pageColumns: [
{ title: '委托编号', key: 'entrustCode', width: 140 },
{ title: '钻孔名称', key: 'boreholeName', width: 140 },
{ title: '样品编号', key: 'sampleCode', width: 140 },
{ title: '状态', key: 'status', width: 80, status: true },
{ title: '检测进度', key: 'testProgress', width: 160 }
],
selectIds: [],
selectData: [],
groupData: [],
salesmanData: [],
selectGroupIds: [],
selectSalesmans: [],
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }]
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 300)
} else {
return this.$tableHeight('noSearch')
}
}
},
mounted() {
this._page()
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 获取业务员数据
_getSalesManList() {
this.$store.dispatch('LmsEquipInfo/userList').then(() => {
const list = this.$store.state.LmsEquipInfo.userList
const tempList = []
list.forEach(item => {
if (item.status.display !== '待激活' && item.realname !== undefined) {
tempList.push({ id: item.id, realname: item.realname })
}
})
this.salesmanData = JSON.parse(JSON.stringify(tempList))
})
},
_salesmanDataChange(data) {
this.formObj.salesmans = data.join(',')
},
// 所选检测科室的ids
_groupDataChange(data) {
this.formObj.groupIds = data.join(',')
},
// 获取当前的检测科室下拉
_getGroupList() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 应出报告日期
_reportDueDateChange(data) {
this.formObj.reportDateBegin = data[0]
this.formObj.reportDateEnd = data[1]
},
_btnClick(msg) {
switch (msg) {
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出')
} else {
this._export()
}
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilStatistics.listSampleProgress(
this.$serializeForm(this.formObj)
)
if (result) {
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.getPage = this.$store.state.FoodSample.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
}
}
}
</script>
......@@ -32,6 +32,7 @@ import yearDeclara from '../pages/soil-statistics/yearDeclara'
import MeterCustomerEntrust from '../pages/soil-statistics/customer-entrust/MeterCustomerEntrust'
import MeterPersonalTask from '../pages/soil-statistics/personal-task/MeterPersonalTask'
import MeterAnnualEntrust from '../pages/soil-statistics/annual-entrust/MeterAnnualEntrust'
import SampleProgressDetail from '../pages/soil-statistics/sample-progress/SampleProgressDetail'
import ReportAuditIndex from '../pages/soil-report-manage/report-audit/ReportAuditIndex'
import ReportIssueIndex from '../pages/soil-report-manage/report-issue/ReportIssueIndex'
import SampleDisposeIndex from '../pages/soil-sample-manage/sample-dispose/SampleDisposeIndex'
......@@ -267,6 +268,11 @@ export default [
meta: { title: '不合格项目查询' }
},
{
path: 'sample_progress',
component: SampleProgressDetail,
meta: { title: '样品进度查询' }
},
{
path: 'year_declara_count',
component: yearDeclara,
meta: { title: '年度报检量统计' }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment