Commit 3441b0ae by lichengming

添加报告编制页面

parent 701c3a88
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @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 :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.type">{{scope.row[item.key] === 0 ? '企业':scope.row[item.key] ===
1?'政府':scope.row[item.key] === 2?'食品类抽样单': ''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation>
<FileManage ref="FileManage"></FileManage>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
export default {
components: {
UserInfo,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
],
searchOpen: false,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
this._page()
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, name)
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.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())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按委托编制" name="check">
<ReportMakeByEntrust ref="checkTabs"></ReportMakeByEntrust>
</el-tab-pane>
<el-tab-pane label="历史报告" name="checkHis">
<ReportMakeHis ref="checkHisTabs"></ReportMakeHis>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import ReportMakeByEntrust from './tabs/ReportMakeByEntrust'
import ReportMakeHis from './ReportMakeHis'
export default {
components: {
ReportMakeByEntrust,
ReportMakeHis
},
data() {
return {
activeName: 'check'
}
},
mounted() {
this.activeName = 'check'
this.$refs.checkTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'check') {
this.$refs.checkTabs._open()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.checkHisTabs._page()
}
}
}
}
</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" @on-result-change="_sampleTabResult"></ReportMakeBySample>
</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 './tabs/ReportInfoMake'
import ReportMakeBySample from './tabs/ReportMakeBySample'
export default {
components: {
ReportMakeBySample,
ReportInfoMake
},
data() {
return {
showModal: false,
modalTitle: '',
activeName: '',
contractId: '',
type: '',
personal: ''
}
},
computed: {
tableHeight: function() {
return document.documentElement.clientHeight - 135
}
},
methods: {
_open(contractId, title, type, personal) {
this.modalTitle = '管理样品和报告'
this.showModal = true
this.activeName = 'sample'
this.contractId = contractId
this.type = type
this.personal = personal
// 先初始化样品台账的数据
// 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.contractId, this.personal)
},
_sample() {
this.$refs.sampleTabs._open(this.contractId, this.type, this.personal)
},
_changeTabs(tab, event) {
switch (tab.name) {
case 'sample':
this._sample()
break
case 'report':
this._report()
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">
<Form :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.reportSn" placeholder="请输入报告编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" v-model="formObj.sampleNum" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.sampleName" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-item" label="任务来源:">
<Input @on-enter="_formSearch" v-model="formObj.taskSource" placeholder="请输入任务来源" clearable/>
</Form-item>
<Form-item label="细类:" class="search-item" style="margin-left: 8px">
<Input @on-enter="_formSearch" v-model="formObj.detectType"
placeholder="请输入细类" clearable/>
</Form-item>
<Form-item label="已推国抽:" class="search-item">
<Select v-model="formObj.dataPushed" clearable placeholder="请选择是否已推国抽">
<Option v-for="item in dataPushedList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item label="应出报告日期:" class="search-item">
<Date-picker :editable="false" @on-change="_reportDateChange" v-model="dateList"
type="daterange" placeholder="应出报告日期" format="yyyy-MM-dd"
style="width:100%" placement="bottom-start"></Date-picker>
<input v-model="formObj.reportDueDateBegin" type="hidden">
<input v-model="formObj.reportDueDateEnd" type="hidden">
</Form-item>
<Form-item class="search-item" label="结果判定:">
<Select v-model="formObj.notOkCount" clearable placeholder="请选择结果判定">
<Option v-for="item in notOkCountList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<BtnList :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide">
<!--切换待认领任务-->
<template slot="processTask">
<div class="fr process-task">
<el-checkbox v-model="formObj.personal" @change="_page" :true-label="1" :false-label="0"
size="medium">
个人任务
</el-checkbox>
</div>
</template>
</BtnList>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg" :tableName="tableName" :rows="100"
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 { soilTest } from '../../../../api'
/**
* 报告编制的-待办-报告台账
*/
export default {
components: {},
data() {
return {
notOkCountList: [
{ value: 0, name: '合格' },
{ value: 1, name: '不合格' }
],
currentComponent: '',
searchOpen: false,
btn: [
{
type: 'primary',
id: 'food-report-make-submit-to-gc-platform-by-contract',
name: '推送至国抽平台'
},
{ type: 'primary', id: 'food-report-make-submit', name: '提交' },
{
type: 'primary',
id: 'food-report-make-to-pdf',
name: '盖章',
componentName: 'SignatureToPDF'
},
{
type: 'primary',
id: 'food-report-make-to-auditor',
name: '选择审核人',
componentName: 'AssignPerson'
},
{
type: 'primary',
id: 'food-report-make-submit-to-issue',
name: '提交至报告签发'
},
{
type: 'success',
id: 'food-report-make-batch-create-report',
name: '重新生成',
componentName: 'ReportTemplateModal'
},
{
type: 'error',
id: 'food-report-make-batch-del-report',
name: '删除'
},
{ id: 'food-report-make-batch-down', name: '下载' },
{ id: 'food-report-make-batch-achieve-by-contract', name: '完成' },
{
id: 'food-report-make-batch-overdue-reason',
name: '记录报告超期原因',
componentName: 'Reason'
},
{
id: 'food-report-make-edit-report-aptitude',
name: '修改报告资质要求',
componentName: 'EditReportAptitude'
}
],
getPage: {},
pageColumns: [
{ title: '报告编号', key: 'reportSn', width: 180, fixed: 'left' },
{ title: '样品编号', key: 'sampleNum', width: 180 },
{ title: '样品名称', key: 'sampleName', width: 160 },
{ title: '是否合格', key: 'notOkCount', width: 120, notOkCount: true },
{ title: '信息维护状态', key: 'infoMaintain', width: 130 },
{ title: '应出报告日期', key: 'reportDate', width: 120, date: true },
{ title: '是否判定', key: 'judge', width: 100, judge: true },
{ title: '已盖章', key: 'signStatus', width: 100 },
{ title: '盖章类型', key: 'signType', width: 180 },
{ title: '所需资质', key: 'aptitudeType', width: 180 },
{ title: '报告类别', key: 'reportClass', width: 120 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 120 },
{ title: '任务来源', key: 'taskSource', width: 120 },
{ title: '已推国抽', key: 'dataPushed', width: 150, judge: true },
{ title: '报告语言', key: 'reportType', width: 120 },
{ title: '报告要求', key: 'reportRequire', width: 120 },
{ title: '是否带照片', key: 'havePhoto', width: 120, judge: true },
{ title: '编制人', key: 'maker', width: 100 },
{ title: '编制时间', key: 'makDate', width: 140, dateTime: true },
{ title: '样品备注', key: 'sampleRemark' },
{ title: '委托备注', key: 'contractRemark' }
],
selectIds: [],
selectData: [],
formObj: {
contractId: '',
reportSn: '',
sampleNum: '',
sampleName: '',
taskSource: '',
detectType: '',
reportDateBegin: '',
reportDateEnd: '',
notOkCount: '',
personal: 0,
dataPushed: ''
},
dateList: [],
iconMsg: [
{ type: 'ios-book', id: '', name: '预览/编辑报告' },
// {
// type: 'loop',
// id: '',
// name: '重新生成',
// componentName: 'ReportTemplateModal'
// },
{
type: 'ios-document',
id: '',
name: '项目台账',
componentName: 'ItemModalByReportMake'
},
{
type: 'ios-cloud-upload',
id: '',
name: '上传',
componentName: 'UploadByReport'
},
// {
// type: 'information-circled',
// id: '',
// name: '历史版本',
// componentName: 'HisRevision'
// },
{
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._viewReport(data.id)
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)
},
_viewReport(id) {
this.$store.dispatch('FoodSampleReport/viewReport', id).then(() => {
const data = this.$store.state.FoodSampleReport.page
if (data !== undefined) {
// 查询token,后台使用pageoffice调接口查询数据,需要token,否则提示未登录
this.$store.dispatch('Redirect/getAccessToken').then(() => {
const token = this.$store.state.Redirect.str
if (token) {
if (localStorage.getItem('reportReadOnly')) {
// 只读
this.$openWindowModeless({ objectKey: data.objectKey, id: id })
} else {
// 编辑
this.$openWindowModeless({
objectKey: data.objectKey,
id: id,
isReport: 1,
token: token,
reportStatus: this.reportStatus
})
}
}
})
}
})
},
_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':
this.userColumns = data
break
case 'changeSize':
this._page()
break
}
},
_open(contractId, personal) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.contractId = contractId
this.dateList = []
this.formObj.personal = personal
this.showIssueModal = false
this.reportId = ''
this.tempId = ''
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.pageExpTest(
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" name="cname" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input @on-enter="_formSearch" name="code" placeholder="请输入委托编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" name="num" 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" :rows="100">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
: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">
{{scope.row[item.key].display}}
</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>
<SampleByMakeModal ref="sampleByMakeModal"></SampleByMakeModal>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
import SampleByMakeModal from '../SampleByMakeModal'
export default {
components: { SampleByMakeModal },
data() {
return {
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
currentComponent: '',
getPage: {},
formObj: {},
pageColumns: [
{
title: '委托单位',
key: 'cname',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '委托名称', key: 'name', width: 160 },
{ title: '委托编号', key: 'code', width: 180 },
{ title: '类型', key: 'type', width: 80, type: true },
{ title: '状态', key: 'progress', width: 110, status: true },
{ title: '应出报告日期', key: 'reportDueDate', width: 130, date: true },
{ title: '是否判定', key: 'judge', width: 100, judge: true },
{
title: '报告剩余天数',
key: 'reportRemainDay',
width: 130,
day: true
},
{ title: '报告进度统计', key: 'reportProgress', width: 450 },
{ title: '主联系人', key: 'linkman', width: 100 },
{ title: '联系手机', key: 'tel', width: 120 },
{ title: '检测类型', key: 'detectType', width: 130 },
{ title: '服务类型', key: 'serviceType', width: 120 },
{ title: '是否带照片', key: 'havePhoto', width: 120 },
{ title: '报告语言', key: 'reportType', width: 100 },
{ title: '报告类别', key: 'reportClass', width: 120 },
{ title: '备注', key: 'remark' }
],
iconMsg: [
{
type: 'ios-flask-outline',
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: 'food-report-make-maintain-info',
name: '信息维护'
}
],
selectIds: [],
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 'search':
this.searchOpen = !this.searchOpen
break
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '管理样品和报告':
this.$refs.sampleByMakeModal._open(
data.id,
data.cname + '【' + data.code + '】',
data.type,
this.personal
)
break
case '检测项目':
this.$refs.refModal._open(data)
break
case '操作记录':
this.$refs.refModal._open(data.id)
break
case '附件':
this._upload(data.id)
break
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
this.selectIds = []
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilTest.pageExpTest(
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.$refs.refModal._open(id, 'contractId')
}
}
}
</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.num" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-item" label="任务来源:">
<Input @on-enter="_formSearch" v-model="formObj.taskSource" placeholder="请输入任务来源" clearable></Input>
</Form-item>
<Form-item label="细类:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.detectType"
placeholder="请输入细类" clearable/>
</Form-item>
<Form-item label="已推国抽:" class="search-item margin-left-6">
<Select v-model="formObj.dataPushed" clearable placeholder="请选择是否已推国抽">
<Option v-for="item in dataPushedList" :value="item.value" :key="item.value">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item label="应出报告日期:" class="search-item">
<Date-picker :editable="false" @on-change="_reportDateChange" v-model="dateList"
type="daterange" placeholder="应出报告日期" format="yyyy-MM-dd"
style="width:100%" placement="bottom-start"></Date-picker>
<input v-model="formObj.reportDateBegin" type="hidden">
<input v-model="formObj.reportDateEnd" type="hidden">
</Form-item>
<Form-item label="已生成报告:" class="search-item">
<Select v-model="formObj.reported" clearable>
<Option :value="0"></Option>
<Option :value="1"></Option>
</Select>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<BtnList :msg="btn" :open="searchOpen" :showSearchBtn="true" @on-result-change="_btnClick"
class="contHide">
<!--切换待认领任务-->
<template slot="processTask">
<div class="fr process-task">
<el-checkbox v-model="formObj.personal" @change="_page" :true-label="1" :false-label="0"
size="medium">
个人任务
</el-checkbox>
<el-checkbox v-model="formObj.onlyReportMake" @change="_page" :true-label="1"
:false-label="0" size="medium">只显示待编样品
</el-checkbox>
</div>
</template>
</BtnList>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :tableHeight="tableHeight" @on-result-change="_tableResultChange"
:getPage="getPage" :rows="100" 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 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.key==='reportDueDate'"
:style="{color:$reportDueDateColor(scope.row.reportDueDate)}">
{{ scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</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>
</div>
</template>
<script>
/**
* 按委托编制----管理样品
*/
export default {
components: {},
data() {
return {
currentComponent: '',
searchOpen: false,
btn: [
{
type: 'primary',
id: 'food-report-make-push-to-gc',
name: '推送至国抽平台'
},
{ type: 'success', id: '', 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: 'num', width: 180, fixed: 'left' },
{ title: '样品名称', key: 'name', width: 160 },
{ title: '报告已生成', key: 'reported', width: 120, reported: true },
{ title: '是否合格', key: 'isEligible', width: 120 },
{ title: '状态', key: 'progress', width: 100 },
{ title: '信息维护状态', key: 'infoMaintain', width: 130 },
{ title: '应出报告日期', key: 'reportDueDate', width: 120, date: true },
{ title: '是否判定', key: 'judge', width: 100, judge: true },
{ title: '报告类别', key: 'reportClass', width: 120 },
{ title: '所需资质', key: 'aptitudeType', width: 120 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '任务来源', key: 'taskSource', width: 150 },
{ title: '已推国抽', key: 'dataPushed', width: 150, judge: true },
{
title: '抽样单状态',
key: 'samplingStatus',
width: 120,
display: true
},
{ title: '报告语言', key: 'reportType', width: 100 },
{ title: '报告要求', key: 'reportRequire', width: 150 },
{ title: '是否带照片', key: 'havePhoto', width: 120, judge: true },
{ title: '备注', key: 'remark' }
],
selectIds: [],
selectData: [],
formObj: {
contractId: '',
num: '',
name: '',
detectType: '',
taskSource: '',
onlyReportMake: 1,
reportDateBegin: '',
reportDateEnd: '',
reported: 0,
personal: 0,
dataPushed: ''
},
dateList: [],
type: '',
iconMsg: [
{ type: 'cloud', id: '', name: '样品附件', disabled: true },
{ 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'
}
],
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: {
// 初始化值
_resetData(contractId, type, personal) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.contractId = contractId
this.formObj.reported = 0
this.formObj.onlyReportMake = 1
this.formObj.personal = personal
this.type = type
this.dateList = []
},
// 当前列表有值,则不会重新调page接口
_getPage(contractId, type, personal) {
this._resetData(contractId, type, personal)
this.getPage = this.$store.state.FoodSample.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.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
}
})
},
_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(contractId, type, personal) {
// 初始化数据
this._resetData(contractId, type, personal)
// this._page()
},
_page() {
const data = this.$serializeFormSearch(this.formObj)
this.$refs.pageTable._page('', this.postUrl, data)
},
_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>
...@@ -17,6 +17,7 @@ import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIn ...@@ -17,6 +17,7 @@ import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIn
import TestInputIndex from '../pages/soil-test-manage/test-input/TestInputIndex' import TestInputIndex from '../pages/soil-test-manage/test-input/TestInputIndex'
import CheckIndex from '../pages/soil-test-manage/test-data-check/CheckIndex' import CheckIndex from '../pages/soil-test-manage/test-data-check/CheckIndex'
import AuditIndex from '../pages/soil-test-manage/test-data-audit/AuditIndex' import AuditIndex from '../pages/soil-test-manage/test-data-audit/AuditIndex'
import ReportMakeIndex from '../pages/soil-report-manage/report-make/ReportMakeIndex'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -103,6 +104,17 @@ export default [ ...@@ -103,6 +104,17 @@ export default [
] ]
}, },
{ {
path: 'report',
component: Blank,
children: [
{
path: 'make_report',
component: ReportMakeIndex,
meta: { title: '报告编制' }
}
]
},
{
path: 'aptitude', path: 'aptitude',
component: Blank, component: Blank,
children: [ children: [
......
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