Commit 701c3a88 by lichengming

添加数据审核页面

parent 25606830
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header">数据审核</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目审核" name="waitReceive">
<WaitReceive ref="waitReceiveModal"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="按样品审核" name="waitScan">
<WaitScan ref="waitScanModal"></WaitScan>
</el-tab-pane>
<!-- <el-tab-pane label="查看原始记录" name="viewRecord">-->
<!-- <OriginalRecordView ref="recordModal"></OriginalRecordView>-->
<!-- </el-tab-pane>-->
</el-tabs>
<!-- <keep-alive>-->
<!-- &lt;!&ndash; eslint-disable-next-line vue/require-component-is &ndash;&gt;-->
<!-- <component ref="refModal" :is="currentComponent"></component>-->
<!-- </keep-alive>-->
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './item-tabs/ItemTabs'
import WaitScan from './sample-tabs/SampleTabs'
// import OriginalRecordView from './OriginalRecordView'
export default {
components: {
WaitReceive,
WaitScan
// OriginalRecordView
},
data() {
return {
type: '',
contractId: '', // 合同id
entrustId: '',
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: '',
currentComponent: ''
}
},
mounted() {
// this.currentComponent = 'waitScan'
},
methods: {
_open(contractId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = contractId // 合同id
this.activeName = 'waitReceive'
// this.currentComponent = 'waitScan'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.entrustId)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.entrustId)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.contractId, this.type)
},
_changeTabs(tab, event) {
if (tab.name === 'viewRecord') {
// this._issuedPage()
this.$refs.recordModal._open(this.entrustId)
} else if (tab.name === 'waitReceive') {
// this._waitPage()
this.$refs.waitScanModal._clearTable()
this.$refs.waitReceiveModal._open(this.entrustId)
} else if (tab.name === 'waitScan') {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._open(this.entrustId)
// this._waitSend()
}
},
_search() {
this.$refs.waitReceiveModal._clearTable()
this.$refs.waitScanModal._clearTable()
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</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">
<SampleBackupsManage ref="checkTabs"></SampleBackupsManage>
</el-tab-pane>
<el-tab-pane label="历史任务" name="checkHis">
<SampleBackupsQuery ref="checkHisTabs"></SampleBackupsQuery>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import SampleBackupsManage from './DataAudit'
import SampleBackupsQuery from './DataAuditHis'
export default {
components: {
SampleBackupsManage,
SampleBackupsQuery
},
data() {
return {
activeName: 'check'
}
},
mounted() {
this.activeName = 'check'
this.$refs.checkTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'check') {
this.$refs.checkTabs._page()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.checkHisTabs._page()
}
}
}
}
</script>
<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>
<AuditDataModal ref="sampleManageModal" @on-result-change="_page"></AuditDataModal>
<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'
import AuditDataModal from './AuditDataModal'
export default {
components: {
UserInfo,
Operation,
// eslint-disable-next-line vue/no-unused-components
AuditDataModal
},
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: '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, '数据录入')
},
_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">
<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>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<div slot="header">{{modalTitle}}</div>
<div>
<Form id="index-right-form" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="指标名称:">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入类别" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 10px;"/>
<PTVXETable ref="pageTable" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :iconMsg="iconMsg">
<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">
<template slot-scope="scope">
<span v-if="item.key==='defaulted'">{{scope.row[item.key]?'是':'否'}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
</PTVXETable>
</div>
</Modal>
<IndexManageEdit ref="indexEdit" @on-result-change="_page"></IndexManageEdit>
</div>
</template>
<script>
import { soilAptitude, soilTest } from '../../../api'
import IndexManageEdit from './IndexManageEdit'
export default {
components: { IndexManageEdit },
data() {
return {
id: '',
modalTitle: '',
showModal: false,
btn: [
{ type: 'success', id: '', name: '添加指标' },
{ type: 'error', id: '', name: '删除' }
],
tableHeight: document.documentElement.clientHeight - 180,
pageColumns: [
{ title: '试验指标名称', key: 'name' },
{ title: '试验指标大类', key: 'mainType', width: 120 },
{ title: '试验指标小类', key: 'smallType', width: 120 },
{ title: '状态', key: 'status', width: 120 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 }
],
getPage: {},
iconMsg: [{ type: 'md-create', id: '', name: '编辑' }],
selectIds: [],
formObj: {
name: ''
},
// 资质信息
aptitudeItemInfo: {}
}
},
methods: {
_open(data) {
console.log(data)
this.aptitudeItemInfo = data
this.formObj = this.$resetFields(this.formObj)
this.id = data.id
this.modalTitle = data.name + ' 指标管理'
this.showModal = true
this._page()
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.experimentId = this.id
const result = await soilTest.itemPage(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_iconClick(res, data) {
switch (res) {
case '编辑':
this._editModal(true, data)
break
}
},
_editModal(edit, data) {
if (edit) {
this._getById(data)
} else {
this.$refs.indexEdit._open(this.id, '')
}
},
_getById: async function(data) {
const result = await soilTest.itemGetById(data.id)
console.log(result)
if (result) {
this.$refs.indexEdit._open('', result)
}
},
_btnClick(msg) {
switch (msg) {
case '添加指标':
this._editModal(false)
break
case '删除':
this._deleteByIds()
break
}
},
_deleteByIds() {
if (this.selectIds.length === 0) {
// this.$msgTip('warning')
this.$message.warning('请至少选择一条记录')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定删除 ' + this.selectIds.length + ' 条记录?',
onOk: () => {
this._delOk(this.selectIds)
}
})
}
},
_delOk: async function(ids) {
const result = await soilAptitude.expItemDeleteByIds(ids)
if (result) {
this.$message.success('删除成功')
this._page()
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" @on-visible-change="_visibleChange" width="900">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" :id="formId" :model="formObj" :rules="ruleValidate" :label-width="100" inline>
<div>
<Form-item label="试验指标名称" prop="name" class="width-48">
<Input v-model="formObj.name" name="name" placeholder="请输入试验名称"/>
</Form-item>
<Form-item label="试验指标大类" prop="mainType" class="width-48">
<Input v-model="formObj.mainType" name="mainType"
placeholder="请输入试验指标大类"/>
</Form-item>
<Form-item label="试验指标小类" prop="smallType" class="width-48">
<Input v-model="formObj.smallType" name="smallType" placeholder="请输入试验指标小类"/>
</Form-item>
<Form-item label="状态" prop="status" class="width-48">
<Input v-model="formObj.status" name="status"
placeholder="请输入状态"/>
</Form-item>
<Form-item label="检测值" prop="testValue" class="width-48">
<Input v-model="formObj.testValue" name="testValue"
placeholder="请输入检测值"/>
</Form-item>
<Form-item label="单位" prop="unit" class="width-48">
<Input v-model="formObj.unit"
name="unit" placeholder="请输入单位"/>
</Form-item>
</div>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
/**
* 添加编辑环境资质项目表
*/
import { soilTest } from '../../../api'
export default {
components: {},
data() {
return {
activeName: '',
hideUserSel: true,
id: '',
modalTitle: '',
expId: '',
formObj: {
name: '',
unit: '',
status: '',
mainType: '',
smallType: '',
testValue: ''
},
ruleValidate: {
name: [{ required: true, message: '指标名称不能为空', trigger: 'blur' }]
},
showModal: false,
footerList: [
{ name: '取消', type: '' },
{ name: '保存', type: 'primary' }
],
microbedList: [{ value: 0, name: '否' }, { value: 1, name: '是' }],
// 检测依据
testBasisData: [],
// 类别下拉数组
typeData: [],
// 检测科室
groupData: [],
groupName: '',
// 主检人
userData: [],
// 单位
unitData: [],
aptitudeData: [],
aptitude: '',
// testBasisName: '',
computeTypeList: [],
tester: '',
marksList: [],
detectionTypeList: [],
testItemData: [],
formId: ''
}
},
mounted() {
// 检测科室
// this._getUserGroup()
// 检测依据
// this._getTestBasisList()
// 资质
// this._getAptitudeList()
// this._getType()
},
methods: {
// 字典
_dicSearch() {
this.$store.dispatch('LmsBaseDict/getItem', '食品检出类别').then(() => {
const result = this.$store.state.LmsBaseDict.item
this.detectionTypeList = result
if (this.$string(this.id).isEmpty()) {
// 添加界面默认第一个
this.formObj.detectionType = result.length > 0 ? result[0].name : ''
}
})
},
_testBasisChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.stdId = data.id
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = data.name
this.formObj.testMethod = data.stdNum
this.$refs.formObj.validateField('testBasis')
break
case 'query':
this.formObj.stdId = ''
this.formObj.testMethod = ''
this.formObj.testBasis = data.stdNum
this.formObj.testBasisName = ''
this._getTestBasisList(data)
break
case 'blur':
if (this.formObj.stdId === '') {
this.formObj.testBasis = ''
this.formObj.testMethod = ''
this._getTestBasisList()
}
this.$refs.formObj.validateField('testBasis')
}
},
_selectJudgeType(data) {
this.formObj.microbed = data
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
case '填写说明':
this.$refs.introduction._open()
this._hideLoading()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(id, formObj) {
this.formId = 'edit-form'
this._hideLoading()
this.$refs.formObj.resetFields()
if (this.$string(formObj).isEmpty()) {
this.id = ''
this.expId = id
this.modalTitle = '添加试验指标'
} else {
this.hideUserSel = true
this.id = formObj.id
this.formObj = formObj
this.modalTitle = '编辑试验指标'
}
this.showModal = true
},
// 获取检测项目
_getItemList(value) {
const data = {}
if (value) {
Object.assign(data, { name: value })
}
this.$store.dispatch('FoodAptitudeItem/getTestItem', data).then(() => {
this.testItemData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测项目结果
_testItemChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.name = data
this.$refs.formObj.validateField('name')
this._changeMicrobed()
break
case 'query':
this.formObj.name = data
this._getItemList(data)
break
case 'blur':
this._changeMicrobed()
break
}
},
_changeMicrobed() {
// 新增或者导入新增资质时 如果检测项目名称带‘菌’字,则是否微生物默认为‘是’
if (this.id === '') {
if (this.formObj.name.indexOf('菌') > -1) {
this.$set(this.formObj, 'microbed', 1)
} else {
this.$set(this.formObj, 'microbed', 0)
}
}
},
_clearMarks() {
this.marksList = []
},
_getMarks() {
if (this.formObj.computeMark) {
this.$store
.dispatch('AptitudeFood/getMarks', {
computeMark: this.formObj.computeMark
})
.then(() => {
if (this.$store.state.AptitudeFood.model) {
this.marksList = this.$store.state.AptitudeFood.model
}
})
}
},
_getType() {
this.$store
.dispatch('LmsEnum/getByType', 'ItemCalculateType')
.then(() => {
this.computeTypeList = this.$store.state.LmsEnum.model
})
},
// 资质
_getAptitudeList() {
this.$store.dispatch('LmsBaseDict/getItem', '所需资质').then(() => {
this.aptitudeData = this.$store.state.LmsBaseDict.item
})
},
// 主检人&检测科室
_groupChange(data) {
if (data) {
this.groupName = data.label
this.formObj.groupId = data.value
this.formObj.tester = ''
this.formObj.testerId = ''
this._getUserList(data.value)
}
},
_userChange(data) {
if (data) {
this.formObj.testerId = data.value
this.formObj.tester = data.label
}
},
_getUserList(groupId) {
const data = { rows: 500 }
if (groupId) {
Object.assign(data, { groupId: groupId })
}
this.$store.dispatch('LmsUserGroup/getUserByGroupId', data).then(() => {
this.userData = this.$store.state.LmsUserGroup.userPage.records
})
},
_getUserGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 单位
_unitChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.unit = data
break
case 'query':
this._getUnitList(data)
break
}
},
_getUnitList(data) {
this.unitData = []
if (data) {
this.$store
.dispatch('AptitudeFood/historyUnit', { unit: data })
.then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
} else {
this.$store.dispatch('AptitudeFood/historyUnit').then(() => {
this.unitData = this.$store.state.AptitudeFood.list
})
}
},
// 检测依据
_getTestBasisList(data) {
const obj = { classify: 1 }
if (data) {
obj.stdNum = data.stdNum
}
this.$store.dispatch('StandardInfo/page', obj).then(() => {
this.testBasisData = this.$store.state.StandardInfo.page.records
})
},
// 获取表数据
_resultChange(msg) {
this.showModal = false
this.$refs.footerModal._hideLoading()
this.$Message.success(msg)
this.$emit('on-result-change')
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.$serialize('edit-form')
if (this.$string(this.id).isEmpty()) {
data.experimentId = this.expId
// 添加
this._save(data)
} else {
// 编辑
this._edit({ id: this.formObj.id, obj: data })
}
} else {
this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!')
}
})
},
_save: async function(data) {
console.log(data)
const result = await soilTest.itemSave(data)
console.log(result)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilTest.itemEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
},
_cancel() {
this.showModal = false
this._hideLoading()
},
// 切换tab
_changeTabs(tab, event) {
if (tab.name === 'testStep') {
this.$refs.testStepByAptitude._open(
this.formObj.stepId,
this.formObj.id
)
}
},
_visibleChange(data) {
if (!data && this.$showBtn('food-aptitude-item-step-edit')) {
this.$emit('on-result-change')
this.$refs.testStepByAptitude._clear()
}
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-left" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input v-model="formObj.name" @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 @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :isRadio="true" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :hide-checkbox="true" :rows="100" select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
name: undefined
},
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
id: '',
pageColumns: [
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测方法', key: 'testMethod', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.id = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.id
const result = await soilTest.pageTestByExp(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
this.$emit('on-result-change', data)
break
case 'singleSelect':
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this._autoAssign()
break
}
},
_autoAssign() {
console.log('自动分配')
// this.$refs.autoAssignModal._open()
// this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
// const num = this.$store.state.FoodItem.count
// if (num !== undefined) {
// this.$refs.refModal._open(num)
// }
// })
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-item-right" :label-width="70" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="检测项目:">
<Input @on-enter="_formSearch" name="name" 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" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :icon-msg="iconMsg" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<div v-if="item.key === 'name'" :style="{color:colorComputed(scope.row.planEndDate)}">
{{scope.row[item.key]}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='num'" @click.stop="_sampleDetail(scope.row)">{{scope.row[item.key]}}</a>
<span
v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.datetime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
<!-- <SelectOriTempRecord ref="recordModal" @on-result-change="_page"></SelectOriTempRecord>-->
<!-- <OriginalRecordEdit ref="editModal"></OriginalRecordEdit>-->
<IndexManage ref="indexModal" @on-result-change="_page"></IndexManage>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
// import SelectOriTempRecord from '../SelectOriTempRecord'
// import OriginalRecordEdit from '../OriginalRecordEdit'
import IndexManage from '../IndexManage'
export default {
components: {
AssignPerson,
// SelectOriTempRecord,
// OriginalRecordEdit,
IndexManage
},
data() {
return {
// 定义表格名称----英文
tableName: 'food-task-assign-item-right',
formObj: {
entrustId: '',
name: '',
testMethod: '',
testBasis: ''
},
entrustId: '',
// 用户自己选中的列
userColumns: [],
currentComponent: '',
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
},
{
key: 'receiveDate',
name: '接样日期',
placeholder: '请选择接样日期',
date: true
},
{ key: 'tester', name: '主检人', placeholder: '请输入主检人' },
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
],
btn: [
{ type: 'success', id: '', name: '提交' },
{ type: 'waring', id: '', name: '退回' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{
type: '',
id: 'food-task-assign-plan-date',
name: '设置计划完成时间'
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
iconMsg: [
{ type: 'ios-book', id: '', name: '查看原始记录' },
{ type: 'md-apps', id: '', name: '查看指标' }
],
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' },
{ title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '试样包装类型', key: 'samplePack', width: 180 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '原始记录是否填写', key: 'recorded', width: 140 },
{ title: '检测方法', key: 'testMethod', width: 260 },
{ title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测科室', key: 'groupName', width: 150 }
],
leftSelectData: {},
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
result: [],
sampleNames: '', // 没有计划完成时间的样品名
defaultPlanDate: null, // 是否有字典
warningValue: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.warningValue * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
_iconClick(res, data, currentComponent) {
this.$nextTick(() => {
switch (res) {
case '查看原始记录':
console.log(data)
this._viewRecord('1309434759937146882')
break
case '查看指标':
this._indexManage(data)
break
}
})
},
_indexManage(data) {
this.$refs.indexModal._open(data)
},
_viewRecord(originalRecordId) {
// layx.iframe('labRecordWriteOriView', '原始记录预览', Global.recordURL + '/print/v1/form/' + originalRecordId, {
// eslint-disable-next-line no-undef
layx.iframe(
'labRecordWriteOriView',
'原始记录预览',
Global.recordURL +
'/print/v1/form/' +
originalRecordId +
'?type=ENVTESTMAKE',
{
event: {
onload: {
after: function(layxWindow, winform) {
// eslint-disable-next-line no-undef
layx.max(winform.id)
}
}
}
}
)
},
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
},
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 从字典查预警期
_dicSearch() {
const data = ['食品检测预警天数', '食品默认计划完成时间']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// eslint-disable-next-line camelcase
const result_1 = result[0]
// eslint-disable-next-line camelcase
const result_2 = result[1]
// 1食品检测预警天数
if (result_1.length !== 0) {
this.warningValue = result_1[0].name
}
// 2食品默认计划完成时间
this.defaultPlanDate =
result_2.length !== 0
? result_2[0].name === '是'
? (this.defaultPlanDate = true)
: (this.defaultPlanDate = false)
: (this.defaultPlanDate = false)
})
},
_selInputResult1(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput2._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_selInputResult2(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput1._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'AssignPerson':
if (this.defaultPlanDate) {
this._trueDefault(data)
} else {
this._userResult(data)
}
break
case 'EndDateModal':
// if(this.defaultPlanDate){
// this._endDate()
// } else {
this._page()
// }
break
case 'UserGroup':
this._userGroupResult(data)
break
default:
this._page()
}
},
// 为 true时,有字典按人分配
_trueDefault(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/personAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.sampleNames = ''
this._page()
this._resultChange('分配成功!')
}
})
},
// 设置时间
_endDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.currentComponent = 'AssignPerson'
this.$nextTick(function() {
this.$refs.refModal._openGoupByUserId('分配人员', user.id, 'itemTree')
})
}
},
// 调整分组
_userGroupResult(data) {
const tempData = {
groupId: data.id,
groupName: data.name,
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/adjustTestGroup', tempData).then(() => {
this._resultChange('调整成功')
})
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
this.$emit('on-result-change')
},
async _btnClick(msg) {
switch (msg) {
case '按人分配':
this._allotByPerson()
// await this._reportDueDate()
// await this._userAssign()
break
case '试验项目分配':
this._userAssign()
break
case '填写原始记录':
this._addRecord()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
break
case '调整分组':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择=一条数据')
} else {
this.currentComponent = 'UserGroup'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
break
case '设置计划完成时间':
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this._changeDate()
})
break
case '信息维护':
this._maintainInfo()
break
}
},
_addRecord() {
if (this.selectIds.length === 0) {
this.$message.warning('请至少选择一条数据')
} else {
console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds, this.entrustId)
}
},
_allotByPerson() {
const user = Global.getUserInfo('userInfo')
this.$refs.personModal._openGoupByUserId('分配人员', user.id, 'itemTree')
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_changeDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$refs.refModal._open(tempData, 'planDate')
}
},
_open(id, data) {
this.leftSelectData = data
this.entrustId = id
if (data.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectSampleIds = []
this.selectIds = []
this.selectData = []
this.result = []
} else {
this._formSearch()
}
},
_refresh() {
this.$emit('on-result-change')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { foodItemList: this.leftSelectData }
Object.assign(obj, obj1, obj2, obj3)
return obj
},
_page: async function() {
// const saveName = []
// const saveMethod = []
// for (let i = 0; i < this.leftSelectData.length; i++) {
// saveName.push(this.leftSelectData[i].name)
// saveMethod.push(this.leftSelectData[i].testMethod)
// }
// const data = this.$serialize('task-assign-item-right')
// console.log(data)
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
this.formObj.name = this.leftSelectData.name
this.formObj.testMethod = this.leftSelectData.testMethod
const result = await soilTest.pageExperimentTest(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll()
this.getPage = result
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
// this.result = this.getPage.records;
// this.$nextTick(() => {
// this.$refs.pageTable._checkAll()
// })
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
this._page()
// this.$refs.pageTable._checkAll()
break
}
},
// 按人分配 选人选时间
_assignBackData(data) {
console.log(data)
const tempData = {}
tempData.ids = this.selectIds.join(',')
tempData.user = data.realname
tempData.userId = data.userId
this._allotItems(tempData)
},
_allotItems: async function(data) {
const result = await soilTest.allotExp(data)
if (result) {
this._resultChange('分配成功')
}
},
_userAssign() {
const user = Global.getUserInfo('userInfo')
console.log(user)
this.$refs.personModal._openGoup('分配人员', 'itemTree')
// if (this.defaultPlanDate) {
// // 有字典
// if (this.sampleNames === '') {
// // 有计划完成时间
// const user = Global.getUserInfo('userInfo')
// this.currentComponent = 'AssignPerson'
// this.$nextTick(function() {
// this.$refs.refModal._openGoupByUserId(
// '分配人员',
// user.id,
// 'itemTree'
// )
// })
// } else {
// // 有字典,无计划完成时间的
// this.$Modal.confirm({
// title: '提示',
// content:
// '所选项目中含有未设置计划完成时间的' +
// `${this._reportDueDate()}` +
// '请确认!',
// onOk: () => {}
// })
// }
// } else {
// // 无字典
// this.currentComponent = 'EndDateModal'
// this.$nextTick(() => {
// this._endDate()
// })
// }
},
// 遍历出计划时间为空的样品名
_reportDueDate() {
const sampleNames = []
for (let i = 0; i < this.result.length; i++) {
if (!this.result[i].planEndDate) {
sampleNames.push(this.result[i].name)
}
}
this.sampleNames = [...new Set(sampleNames)].join(',')
return this.sampleNames
},
_userResult(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'user')
})
},
// 按组分配 选时间
_groupAssign() {
if (this.defaultPlanDate) {
// 有字典
if (this.sampleNames === '') {
// 有计划完成时间
const tempData = {
ids: this.selectIds.join(',')
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/groupAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('分配成功!')
this._page()
}
})
} else {
// 有字典,无计划完成时间
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典的
// eslint-disable-next-line no-lonely-if
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'group')
})
}
}
},
// 委托详情
_detailModal(data) {
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 1) {
this.currentComponent = 'FoodContractGovernDetail'
} else {
this.currentComponent = 'FoodContractCompanyDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 样品详情
_sampleDetail(data) {
this.$nextTick(function() {
if (data.type === 1) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="leftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="rightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './ItemLeftList'
import ItemRightList from './ItemRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
console.log('ItemTabs', data)
this.$refs.rightModal._open(this.id, data)
},
_rightResult() {
this.$refs.leftModal._page()
},
_open(id) {
this.id = id
console.log(id)
this.$refs.leftModal._open(this.id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.rightModal._clearAll()
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-left" :label-width="70" 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-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :rows="100">
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<a v-if="item.detail" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
formObj: {
entrustId: undefined
},
entrustId: '',
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
selectIds: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 120 },
{ title: '委托编号', key: 'entrustCode', width: 140 },
{ title: '委托商', key: 'client', width: 200 }
]
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
methods: {
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
_modalResult() {
if (this.currentComponent === 'AutoAssignModal') {
this._formSearch()
}
},
_selInputResult1(msg, data) {
switch (msg) {
case 'search':
this._formSearch()
break
}
},
_open(id) {
this.entrustId = id
this._page()
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
const result = await soilTest.pageExpTestSample(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
// case 'selectData':
// this.$emit('on-result-change', data)
// break
case 'selectIds':
this.selectIds = data
this.$emit('on-result-change', this.selectIds.join(','))
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this.currentComponent = 'AutoAssignModal'
this.$nextTick(function() {
this._autoAssign()
})
break
}
},
_autoAssign() {
this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
const num = this.$store.state.FoodItem.count
if (num !== undefined) {
this.$refs.refModal._open(num)
}
})
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-right" :label-width="70" 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-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :table-name="tableName" :rows="100" is-task select-data>
<vxe-table-column
v-for="item in userColumns.length > 0 ?userColumns:pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width"
:fixed="item.fixed?item.fixed:undefined"
sortable>
<template slot-scope="scope">
<div v-if="item.key === 'name'" :style="{color:colorComputed(scope.row.planEndDate)}">
{{scope.row[item.key]}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='num'" @click.stop="_sampleDetail(scope.row)">{{scope.row[item.key]}}</a>
<span v-else-if="item.key==='status'">{{scope.row[item.key].display}}</span>
<span
v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.datetime">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM'):''}}</span>
<span v-else>{{scope.row[item.key]}}</span>
</template>
</vxe-table-column>
<VXESettingCol slot="setting" :pageColumns="pageColumns" :userColumns="userColumns"
@on-result-change="_resetColumn" :table-name="tableName"></VXESettingCol>
</PTVXETable>
</Col>
</Row>
<AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
</div>
</template>
<script>
import Global from '../../../../api/config'
import { soilTest } from '../../../../api'
import AssignPerson from '../../../../components/user-info-single/AssignPerson'
export default {
components: { AssignPerson },
data() {
return {
// 定义表格名称----英文
tableName: 'food-task-assign-item-right',
formObj: {},
// 用户自己选中的列
userColumns: [],
currentComponent: '',
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'sampleName', name: '样品名称', placeholder: '请输入样品名称' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
},
{
key: 'receiveDate',
name: '接样日期',
placeholder: '请选择接样日期',
date: true
},
{ key: 'tester', name: '主检人', placeholder: '请输入主检人' },
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
],
btn: [
{ type: 'success', id: '', name: '试验项目分配' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{
type: '',
id: 'food-task-assign-plan-date',
name: '设置计划完成时间'
},
{ type: '', id: 'food-task-assign-maintain-info', name: '信息维护' }
],
getPage: {},
pageColumns: [
{ title: '试验名称', key: 'name', width: 160 },
{ title: '试验项目英文简写', key: 'shortName', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 }
],
leftSelectData: [],
sampleIds: [],
selectIds: [], // 检测项目id
selectData: [], // 检测项目data
selectSampleIds: [], // 样品ids
result: [],
sampleNames: '', // 没有计划完成时间的样品名
defaultPlanDate: null, // 是否有字典
warningValue: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
},
colorComputed() {
return function(val) {
return val - new Date().getTime() > this.warningValue * 86400000
? '#606266'
: val - new Date().getTime() <= 0
? '#eb6877'
: '#f90'
}
}
},
mounted() {
// this._dicSearch()
},
methods: {
// 获取column
_getColumn() {
this.$refs.pageTable._getColByTableName()
},
// 重置column
_resetColumn(colList) {
this.userColumns = colList
this.$refs.pageTable._loadColumn(colList)
},
// 从字典查预警期
_dicSearch() {
const data = ['食品检测预警天数', '食品默认计划完成时间']
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// eslint-disable-next-line camelcase
const result_1 = result[0]
// eslint-disable-next-line camelcase
const result_2 = result[1]
// 1食品检测预警天数
if (result_1.length !== 0) {
this.warningValue = result_1[0].name
}
// 2食品默认计划完成时间
this.defaultPlanDate =
result_2.length !== 0
? result_2[0].name === '是'
? (this.defaultPlanDate = true)
: (this.defaultPlanDate = false)
: (this.defaultPlanDate = false)
})
},
_selInputResult1(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput2._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_selInputResult2(msg, data) {
switch (msg) {
case 'keyword':
this.$refs.selInput1._setCompareKeyword(data)
break
case 'search':
this._formSearch()
break
}
},
_modalResult(data) {
switch (this.currentComponent) {
case 'AssignPerson':
if (this.defaultPlanDate) {
this._trueDefault(data)
} else {
this._userResult(data)
}
break
case 'EndDateModal':
// if(this.defaultPlanDate){
// this._endDate()
// } else {
this._page()
// }
break
case 'UserGroup':
this._userGroupResult(data)
break
default:
this._page()
}
},
// 为 true时,有字典按人分配
_trueDefault(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/personAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.sampleNames = ''
this._page()
this._resultChange('分配成功!')
}
})
},
// 设置时间
_endDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const user = Global.getUserInfo('userInfo')
this.currentComponent = 'AssignPerson'
this.$nextTick(function() {
this.$refs.refModal._openGoupByUserId('分配人员', user.id, 'itemTree')
})
}
},
// 调整分组
_userGroupResult(data) {
const tempData = {
groupId: data.id,
groupName: data.name,
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/adjustTestGroup', tempData).then(() => {
this._resultChange('调整成功')
})
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
this.$emit('on-result-change')
this.selectIds = []
},
async _btnClick(msg) {
switch (msg) {
case '试验项目分配':
this._userAssign()
break
case '按组分配':
await this._reportDueDate()
await this._groupAssign()
break
case '调整分组':
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择=一条数据')
} else {
this.currentComponent = 'UserGroup'
this.$nextTick(() => {
this.$refs.refModal._open()
})
}
break
case '设置计划完成时间':
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this._changeDate()
})
break
case '信息维护':
this._maintainInfo()
break
}
},
// 信息维护
_maintainInfo() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectSampleIds, 2)
})
}
},
_changeDate() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$refs.refModal._open(tempData, 'planDate')
}
},
_open(id, data) {
this.getPage.records = []
console.log(id)
this.sampleIds = data
if (data.length === 0) {
this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0)
this.$set(this.getPage, 'current', 1)
this.selectSampleIds = []
this.selectIds = []
this.selectData = []
this.result = []
} else {
this._page()
}
},
_refresh() {
this.$emit('on-result-change')
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
const obj2 = this.$refs.selInput2._getFormObj()
const obj3 = { foodItemList: this.leftSelectData }
Object.assign(obj, obj1, obj2, obj3)
return obj
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.sampleIds = this.sampleIds
const result = await soilTest.pageTest(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.$refs.pageTable._checkAll()
this.getPage = result
}
},
_tableResultChange(msg, data) {
const selectIds = []
switch (msg) {
case 'page':
this._page()
// this.result = this.getPage.records;
// this.$nextTick(() => {
// this.$refs.pageTable._checkAll()
// })
// if (this.getPage.records.length === 0) {
// this.$emit('on-result-change')
// }
break
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
case 'changeSize':
this._page()
// this.$refs.pageTable._checkAll()
break
}
},
// 按人分配 选人选时间
_userAssign() {
const user = Global.getUserInfo('userInfo')
console.log(user)
this.$refs.personModal._openGoup('分配人员', 'itemTree')
// if (this.defaultPlanDate) {
// // 有字典
// if (this.sampleNames === '') {
// // 有计划完成时间
// const user = Global.getUserInfo('userInfo')
// this.currentComponent = 'AssignPerson'
// this.$nextTick(function() {
// this.$refs.refModal._openGoupByUserId(
// '分配人员',
// user.id,
// 'itemTree'
// )
// })
// } else {
// // 有字典,无计划完成时间的
// this.$Modal.confirm({
// title: '提示',
// content:
// '所选项目中含有未设置计划完成时间的' +
// `${this._reportDueDate()}` +
// '请确认!',
// onOk: () => {}
// })
// }
// } else {
// // 无字典
// this.currentComponent = 'EndDateModal'
// this.$nextTick(() => {
// this._endDate()
// })
// }
},
// 遍历出计划时间为空的样品名
_reportDueDate() {
const sampleNames = []
for (let i = 0; i < this.result.length; i++) {
if (!this.result[i].planEndDate) {
sampleNames.push(this.result[i].name)
}
}
this.sampleNames = [...new Set(sampleNames)].join(',')
return this.sampleNames
},
_userResult(data) {
const tempData = {
ids: this.selectIds.join(','),
personId: data.userId,
personName: data.realname,
groupId: data.groupId,
groupName: data.groupName
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'user')
})
},
// 按组分配 选时间
_groupAssign() {
if (this.defaultPlanDate) {
// 有字典
if (this.sampleNames === '') {
// 有计划完成时间
const tempData = {
ids: this.selectIds.join(',')
}
Object.assign(tempData, { planDate: null })
this.$store.dispatch('FoodItem/groupAllot', tempData).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('分配成功!')
this._page()
}
})
} else {
// 有字典,无计划完成时间
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典的
// eslint-disable-next-line no-lonely-if
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.currentComponent = 'EndDateModal'
this.$nextTick(function() {
this.$refs.refModal._open(tempData, 'group')
})
}
}
},
// 委托详情
_detailModal(data) {
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 1) {
this.currentComponent = 'FoodContractGovernDetail'
} else {
this.currentComponent = 'FoodContractCompanyDetail'
}
this.$nextTick(function() {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_assignBackData(data) {
console.log(data)
const tempData = {}
tempData.ids = this.selectIds.join(',')
tempData.user = data.realname
tempData.userId = data.userId
this._allotItems(tempData)
},
_allotItems: async function(data) {
const result = await soilTest.allotExp(data)
if (result) {
this._resultChange('分配成功')
}
},
// 样品详情
_sampleDetail(data) {
this.$nextTick(function() {
if (data.type === 1) {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
this.$refs.refModal._open(data.sampleId)
})
},
_clearAll() {
this.getPage.records = []
this.selectIds = []
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template slot="left">
<ItemLeftList ref="SampleleftModal" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template slot="right">
<ItemRightList ref="SamplerightModal" @on-result-change="_rightResult"></ItemRightList>
</template>
</TwoColumnPage>
</div>
</template>
<script>
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './SampleLeftList'
import ItemRightList from './SampleRightList'
export default {
components: {
TwoColumnPage,
ItemLeftList,
ItemRightList
},
data() {
return {
id: ''
}
},
methods: {
_leftResult(data) {
this.$refs.SamplerightModal._open(this.id, data)
},
_rightResult() {
this.$refs.SampleleftModal._page()
},
_open(id) {
this.id = id
this.$refs.SampleleftModal._open(id)
// this.$refs.rightModal._getColumn()
},
_clearTable() {
this.$refs.SamplerightModal._clearAll()
}
}
}
</script>
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<div> <div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200" <Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none"> class="zIndex-900 modal-footer-none">
<p slot="header"> {{name}}--管理样品</p> <p slot="header">数据复核</p>
<div> <div>
<el-tabs v-model="activeName" @tab-click="_changeTabs"> <el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目复核" name="waitReceive"> <el-tab-pane label="按项目复核" name="waitReceive">
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
import UserInfo from '../../../components/user-info-single/AssignPerson' import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api' import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation' import Operation from '../../../components/operation/Operation'
import AuditDataModal from './AuditDataModal' import AuditDataModal from './CheckDataModal'
export default { export default {
components: { components: {
UserInfo, UserInfo,
......
...@@ -16,6 +16,7 @@ import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurp ...@@ -16,6 +16,7 @@ import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurp
import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex' import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex'
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 Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -93,6 +94,11 @@ export default [ ...@@ -93,6 +94,11 @@ export default [
path: 'check', path: 'check',
component: CheckIndex, component: CheckIndex,
meta: { title: '数据复核' } meta: { title: '数据复核' }
},
{
path: 'audit',
component: AuditIndex,
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