Commit 9241ce6a by lichengming

修改了试验任务分配

parent 5dd168e4
...@@ -29,3 +29,4 @@ export { default as meterSample } from './meter/meter-sample' ...@@ -29,3 +29,4 @@ export { default as meterSample } from './meter/meter-sample'
export { default as soilAptitude } from './soil/soil-aptitude' export { default as soilAptitude } from './soil/soil-aptitude'
export { default as soilEntrust } from './soil/soil-entrust' export { default as soilEntrust } from './soil/soil-entrust'
export { default as soilSample } from './soil/soil-sample' export { default as soilSample } from './soil/soil-sample'
export { default as soilTest } from './soil/soil-test'
/**
* 工作台
*/
import http from '../http'
// import { https } from '../https'
export default {
// page
pageExpAllot: data =>
http.post('soil/v1/entrust/page_exp_allot', data).then(res => res)
}
...@@ -261,6 +261,7 @@ export default { ...@@ -261,6 +261,7 @@ export default {
if (this.hideCheckbox === undefined || this.hideCheckbox === false) { if (this.hideCheckbox === undefined || this.hideCheckbox === false) {
const selData = data.selection const selData = data.selection
this.checkData = selData this.checkData = selData
console.log('checkData', this.checkData)
// 默认返回的是id数组 // 默认返回的是id数组
if (this.selectData === undefined) { if (this.selectData === undefined) {
const idList = [] const idList = []
......
<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>
<SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>
<ItemManage ref="itemManageModal" @on-result-change="_page"></ItemManage>
<Operation ref="operation"></Operation>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilTest } from '../../../api'
import Operation from '../../../components/operation/Operation'
import SampleManage from './entrust-sample-manage/SampleManage'
import ItemManage from './ItemManage'
export default {
components: {
UserInfo,
SampleManage,
ItemManage,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{
type: 'ios-list',
id: '',
name: '项目管理'
},
{
type: 'md-create',
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.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.pageExpAllot(
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.refModal._open(id, 'contractId')
}
}
}
</script>
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<p slot="header">{{modalTitle}}</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="110" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.num" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item label="样品名称:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.sampleName" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" :show-search-btn="true" class="contHide">
<template slot="processTask">
<div class="fr process-task">
<el-checkbox v-model="formObj.onlyAbort" @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" @on-result-change="_tableResultChange"
:getPage="getPage"
is-edit
is-group
select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
:edit-render="item.editCell?{autofocus: 'input'}:null"
sortable
>
<!--可编辑模板-->
<template v-slot:edit="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.sampleId)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.status">{{scope.row[item.key] === undefined ?'':scope.row[item.key].display}}
</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='epibolyItem'">{{scope.row.epibolyItem?'是':'否'}}</div>
<div v-else-if="item.key==='qualified'">{{scope.row.qualified?scope.row.qualified.display:''}}</div>
<!--科室 start-->
<div v-else-if="item.key==='groupName'">
<el-select v-model="scope.row.groupName" @change="_groupChange" @click.native.stop="_handleRow(scope)"
transfer
size="small">
<el-option :label="item.name" :value="item.name" v-for="item in groupData"
:key="item.name"></el-option>
</el-select>
</div>
<!--科室 end-->
<!--检测依据简称 start-->
<div v-else-if="item.key==='testBasisSm'">
<el-select v-model="scope.row.testBasisSm"
@change="_saveTestBasisSm(scope)"
placeholder="请选择检测依据简称"
size="small"
style="width:100%">
<el-option
v-for="item in testBasisSmList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</div>
<!--检测依据简称 end-->
<!--检测依据名+号 start-->
<div v-else-if="item.key==='testBasisAndName'">
<AutoCompletesTestBasis :value="scope.row.testBasisAndName" :downData="testBasisData"
@on-result-change="_testBasisChange" :handleObj="scope"
placeholder="请选择检测依据" focus blur
></AutoCompletesTestBasis>
</div>
<!--检测依据名+号 end-->
<!--检测方法 start-->
<div v-else-if="item.key==='testMethod'">
<AutoCompletes :value="scope.row.testMethod" :downData="testMethodData"
@on-result-change="_testMethodChange" :handleObj="scope"
placeholder="请选择检测方法" focus blur show-key="testMethod"
></AutoCompletes>
</div>
<!--检测方法 end-->
<div v-else>{{scope.row[item.key]}}</div>
</template>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.sampleId)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.status">{{scope.row[item.key] === undefined ?'':scope.row[item.key].display}}
</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='epibolyItem'">{{scope.row.epibolyItem?'是':'否'}}</div>
<div v-else-if="item.key==='qualified'">{{scope.row.qualified?scope.row.qualified.display:''}}</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
/* 查看样品(企业和政府) */
import { soilEntrust } from '../../../api'
export default {
components: {},
data() {
return {
showModal: false,
selectData: [],
selectIds: [],
modalTitle: '检测项目',
type: '', // 判断是企业或政府委托
getPage: {},
pageColumns: [
{ title: '产品', key: 'subClass', width: 200, fixed: 'left' },
{ title: '样品编号', key: 'num', width: 180, detail: true },
{ title: '样品名称', key: 'sampleName', width: 120 },
{ title: '样品大类', key: 'firstClass', width: 130 },
{ title: '样品细类', key: 'detectType', width: 120 },
{ title: '抽样单编号', key: 'samplingNum', width: 140 },
{ title: '检测项目', key: 'name', width: 200 },
{ title: '状态', key: 'progress', width: 120, status: true },
{ title: '检测科室', key: 'groupName', width: 130, editCell: true },
{ title: '省局项目ID', key: 'provinceItemId', width: 120 },
{
title: '检测依据简称',
key: 'testBasisSm',
width: 200,
editCell: true
},
{
title: '检测依据',
key: 'testBasisAndName',
width: 300,
editCell: true
},
{ title: '检测方法', key: 'testMethod', width: 200, editCell: true },
{ title: '判定依据', key: 'judgeBasisAndName', width: 300 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 },
{ title: '结果判定', key: 'qualified', width: 120 },
{ title: '检出限', key: 'detection', width: 120 },
{ title: '限量', key: 'limitDefault', width: 120 },
{ title: '是否分包', key: 'epibolyItem', width: 120 },
{ title: '接收日期', key: 'receiveDate', width: 120, date: true },
{ title: '抽样日期', key: 'samplingDate', width: 120, date: true },
{ title: '签发人', key: 'issuer', width: 120 },
{ title: '签发日期', key: 'issueDate', width: 120, date: true },
{ title: '下单日期', key: 'ctime', width: 120, date: true },
{ title: '说明', key: 'labRemark', width: 200 },
{ title: '备注', key: 'remark' }
],
btn: [
// {type: 'primary', id: 'food-sampling-list-item-match', name: '匹配省抽项目'},
{
type: 'error',
id: 'ZBC',
name: '删除'
}
// {type: '', id: 'food-sampling-list-reset-sc-id', name: '重置省局ID',},
],
formObj: {
contractId: '',
samplingNum: '',
name: '',
num: '',
samplingDateBegin: '',
samplingDateEnd: '',
receiveDateBegin: '',
receiveDateEnd: '',
ctimeBegin: '',
ctimeEnd: '',
testBasis: '',
detectType: '',
mateTestBasisSm: 0,
hasProvinceId: 0,
groupIds: '',
sampleName: '',
firstClass: '',
onlyAbort: 0,
qced: 0
},
receiveDateList: [],
ctimeList: [],
samplingDateList: [],
searchOpen: false,
groupData: [],
testBasisSmList: [],
testBasisData: [],
testMethodData: [],
currentRow: {},
judgeList: [{ name: '是', value: 1 }, { name: '否', value: 0 }],
// 检测科室
selectGroupData: []
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 320)
} else {
return this.$tableHeight('', 175)
}
}
},
mounted() {
// this._getGroup()
},
methods: {
// 搜索项检测科室变化
_groupDataChange(data) {
this.formObj.groupIds = data.join(',')
},
_handleRow(data) {
this.currentRow = data.row
},
// 科室
_getGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 选择科室
_groupChange(e) {
const obj = this.groupData.find(item => item.name === e)
if (obj) {
this.$set(this.currentRow, 'groupId', obj.id)
this.$set(this.currentRow, 'groupName', obj.name)
}
this._save()
},
// 获取方法简称
_getTestBasisSm(data) {
this.$store
.dispatch('FoodItem/listAbbreviationByItem', { ids: data.row.id })
.then(() => {
const result = this.$store.state.FoodItem.list
if (result) {
this.testBasisSmList = result
} else {
this.testBasisSmList = []
}
})
},
// 方法简称(只是这个界面同批量的方法一样)
_saveTestBasisSm(data) {
this.currentRow = data.row
this.$store
.dispatch('FoodItem/assignmentAbbreviation', {
ids: this.currentRow.id,
abbreviation: this.currentRow.testBasisSm
})
.then(() => {
const result = this.$store.state.FoodItem.success
if (result) {
// 不要刷新表格,只刷新当前行数据
this.$store
.dispatch('FoodItem/getItemByContract', {
id: this.currentRow.id,
contractId: this.formObj.contractId,
page: 1,
rows: 1,
qced: 0
})
.then(() => {
const newObj = this.$store.state.FoodItem.page.records
if (newObj && newObj.length > 0) {
this.$set(
this.currentRow,
'testBasisAndName',
newObj[0].testBasisAndName ? newObj[0].testBasisAndName : ''
)
this.$set(
this.currentRow,
'testBasisId',
newObj[0].testBasisId ? newObj[0].testBasisId : ''
)
this.$set(
this.currentRow,
'testBasisName',
newObj[0].testBasisName ? newObj[0].testBasisName : ''
)
this.$set(
this.currentRow,
'testBasis',
newObj[0].testBasis ? newObj[0].testBasis : ''
)
this.$set(
this.currentRow,
'testMethod',
newObj[0].testMethod ? newObj[0].testMethod : ''
)
this.$set(
this.currentRow,
'groupName',
newObj[0].groupName ? newObj[0].groupName : ''
)
this.$set(
this.currentRow,
'groupId',
newObj[0].groupId ? newObj[0].groupId : ''
)
}
})
}
})
},
// 获取检测依据
_testBasisList(data) {
const obj = {}
if (this.currentRow.name) {
obj.name = this.currentRow.name
} else {
// 没有填检测项目检测依据的下拉就为空
this.testBasisData = []
return
}
if (data) {
obj.testBasis = data
}
this.$store.dispatch('FoodAptitudeItem/getTestBasis', obj).then(() => {
this.testBasisData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测依据结果
_testBasisChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.testBasisAndName =
data.testBasis + ' ' + data.testBasisName
this.currentRow.testBasis = data.testBasis
this.currentRow.testBasisId = data.stdId
this.currentRow.testBasisName = data.testBasisName
this.currentRow.groupId = data.groupId
? data.groupId
: this.groupData[0].id
this.currentRow.groupName = data.groupName
? data.groupName
: this.groupData[0].name
this._save()
break
case 'query':
this.currentRow.testBasisAndName = data
// 只要搜索就清空已填的值
this.currentRow.testBasisName = ''
this.currentRow.testBasisId = ''
this.currentRow.testBasis = ''
this._testBasisList(data)
break
case 'focus':
this._testBasisList()
break
case 'blur':
// 如果没有依据,则清空
if (this.currentRow.testBasisId === '') {
this.currentRow.testBasisAndName = ''
}
this._save()
break
}
},
// 获取检测方法
_testMethodList(testMethod) {
const obj = {}
if (this.currentRow.name && this.currentRow.testBasisId) {
obj.name = this.currentRow.name
obj.stdId = this.currentRow.testBasisId
} else {
this.testMethodData = []
return
}
if (testMethod) {
obj.testMethod = testMethod
}
this.$store.dispatch('FoodAptitudeItem/getTestMethod', obj).then(() => {
this.testMethodData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测方法结果
_testMethodChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.$set(this.currentRow, 'testMethod', data.testMethod)
// testMethodTemp 临时存在
this.$set(this.currentRow, 'testMethodTemp', data.testMethod)
// 查询科室
this.$store
.dispatch('FoodAptitudeItem/getGroupInfo', {
name: this.currentRow.name,
stdId: this.currentRow.testBasisId,
testMethod: this.currentRow.testMethod
})
.then(() => {
const groupObj = this.$store.state.FoodAptitudeItem.model
this.$set(this.currentRow, 'groupId', groupObj.groupId)
this.$set(this.currentRow, 'groupName', groupObj.groupName)
this._save()
})
break
case 'query':
this.$set(this.currentRow, 'testMethod', data.testMethod)
this.$set(this.currentRow, 'testMethodTemp', '')
this._testMethodList(data.testMethod)
break
case 'focus':
this._testMethodList()
break
case 'blur':
// 只能选择检测方法
if (
this.currentRow.testMethodTemp === '' ||
this.currentRow.testMethodTemp === undefined
) {
this.$set(this.currentRow, 'testMethod', '')
}
this._save()
break
}
},
// 抽样日期
_samplingDateChange(data) {
this.formObj.samplingDateBegin = data[0]
this.formObj.samplingDateEnd = data[1]
},
// 接收日期
_receiveChange(data) {
this.formObj.receiveDateBegin = data[0]
this.formObj.receiveDateEnd = data[1]
},
// 下单日期
_ctimeChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
this.selectIds = []
break
case 'selectData':
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'changeSize':
this._page()
break
}
},
_btnClick(msg) {
switch (msg) {
case '匹配省抽项目':
this._matchItem()
break
case '删除':
this._deleteSelected()
break
case '选择依据简称':
this._selTestBasisSm()
break
case '重置省局ID':
this._resetScId()
break
case '终止':
this._operateItem(msg)
break
case '恢复终止项目':
this._operateItem(msg)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
// 恢复、终止
_operateItem(name) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else if (name === '终止') {
this.$Modal.confirm({
title: '提示',
content: '确定要' + name + '这 ' + ids.length + ' 条项目?',
onOk: () => {
this.$refs.reasonModal._open('终止原因')
}
})
} else if (name === '恢复终止项目') {
this.$store
.dispatch('FoodItem/restoreVerification', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodItem.success
this._restore(result)
})
}
},
// 终止项目恢复
_restore(result) {
if (result !== '') {
this.$Modal.confirm({
title: '提示',
content: result,
onOk: () => {
this.$store
.dispatch('FoodItem/projectRestore', {
ids: this.selectIds.join(','),
contractId: this.formObj.contractId,
deleteReport: 1
})
.then(() => {
this._resultChange('恢复成功!')
})
}
})
} else {
this.$store
.dispatch('FoodItem/projectRestore', {
ids: this.selectIds.join(','),
contractId: this.formObj.contractId,
deleteReport: 0
})
.then(() => {
this._resultChange('恢复成功!')
})
}
},
// 原因返回的结果
_reasonResult(data, msg) {
const temp = {
reason: data,
ids: this.selectIds.join(','),
contractId: this.formObj.contractId
}
if (msg === '终止原因') {
this.$store.dispatch('FoodItem/archivesStop', temp).then(() => {
this._resultChange('终止成功!')
})
}
},
_resetScId() {
if (this.selectIds.length === 0) {
this.$Modal.confirm({
title: '提示',
content: '请确认是否重置整个任务下所有检测项目的省局ID?',
onOk: () => {
this._resetScIdOk()
}
})
} else {
this._resetScIdOk()
}
},
_resetScIdOk() {
const obj = { contractId: this.formObj.contractId }
if (this.selectIds.length) {
obj.ids = this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/resetProvinceItemId', obj).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
}
})
},
// 选择检测依据简称
_selTestBasisSm() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条检测项目!')
} else {
this.$store
.dispatch('FoodItem/listAbbreviationByItem', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodItem.list
// 弹出选择框
this.$refs.basisSmModal._open(this.selectIds, result)
})
}
},
_matchItem() {
const list = this.selectData
for (let i = 0; i < list.length; i++) {
const obj = this.selectData.find(item => item.name !== list[i].name)
if (obj) {
this.$Modal.confirm({
title: '提示',
content:
'一次只能手动匹配同一分类下的同一项目,您选中的检测项目名称不同,是否继续?',
onOk: () => {
this.$refs.matchModal._open(
this.selectIds,
this.formObj.contractId
)
}
})
return
}
}
this.$refs.matchModal._open(this.selectIds, this.formObj.contractId)
},
_matchChange(msg) {
switch (msg) {
case 'page':
this._page()
break
case 'manual':
this.$refs.tabModal._open(
this.formObj.contractId,
this.selectIds,
this.selectData[0].samplingNum,
this.selectData[0].provinceClassifyId
)
break
}
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
this.$store
.dispatch('FoodItem/deleteItemByIds', { ids: ids.join(',') })
.then(() => {
this._resultChange('删除成功!')
})
}
})
},
_resultChange(msg) {
if (this.$store.state.FoodItem.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
this.$emit('on-result-change')
}
},
_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 soilEntrust.page(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_open(id, type) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.hasProvinceId = 0
this.formObj.mateTestBasisSm = 0
this.formObj.onlyAbort = 0
this.formObj.contractId = id
this.receiveDateList = []
this.ctimeList = []
this.samplingDateList = []
this.type = type
this.showModal = true
this.currentRow = {}
this.selectGroupData = []
this._page()
},
_detailModal(id) {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.governSampleDetail._open(
this.$store.state.FoodSample.governModel
)
})
},
// 保存 除结果判定(除手工判定)
_save() {
let tempBool = true
setTimeout(() => {
if (tempBool) {
this.$refs.pageTable._showLoading()
}
}, 1500)
const item = this.currentRow
const obj = {
unit: item.unit,
testMethod: item.testMethod,
limitDefault: item.limitDefault,
limitValue: item.limitValue,
compareSymbol: item.compareSymbol,
limitType: item.limitType,
judged: item.judged,
detection: item.detection,
labRemark: item.labRemark,
microbeN: item.microbeN ? item.microbeN : 0,
microbeC: item.microbeC ? item.microbeC : 0,
microbeM: item.microbeM ? item.microbeM : 0,
microbeBm: item.microbeBm ? item.microbeBm : 0,
qualified: item.qualified.value,
subClass: item.subClass,
testBasisSm: item.testBasisSm,
testBasisName: item.testBasisName,
testBasis: item.testBasis,
singleConclusion: item.singleConclusion,
groupId: item.groupId,
groupName: item.groupName
}
if (item.testBasisId) {
obj.testBasisId = item.testBasisId
}
if (item.judgeBasisId) {
obj.judgeBasisId = item.judgeBasisId
obj.judgeBasis = item.judgeBasis
obj.judgeBasisName = item.judgeBasisName
} else {
obj.judgeBasis = item.judgeBasis
obj.judgeBasisName = item.judgeBasisName
}
const data = {
id: item.id,
obj: obj
}
this.$store.dispatch('FoodItem/itemEdit', data).then(() => {
if (this.$store.state.FoodItem.success) {
tempBool = false
this.$refs.pageTable._hideLoading()
} else {
this.$Message.error('保存失败')
tempBool = false
this.$refs.pageTable._hideLoading()
}
})
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-rel-sample" :label-width="80" 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" name="num" placeholder="请输入样品编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" 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" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:icon-msg="iconMsg"
select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.contractId,scope.row.type)">{{scope.row[item.key]}}</a>
</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.sampleDetail"><a @click.stop="_sampleDetailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</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>
</div>
</template>
<script>
import http from '../../../api/http'
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api'
export default {
components: {
UserInfo
},
data() {
return {
formObj: { num: undefined, name: undefined },
iconMsgDis: [],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
// 操作列
sampleFile: {
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
sampleFileDis: {
type: 'cloud',
id: '',
name: '样品附件',
disabled: true
},
edit: {
type: 'compose',
id: 'rel-sample-receive-edit-sample',
name: '编辑'
},
del: {
type: 'trash-a',
id: 'rel-sample-receive-del-sample',
name: '删除'
},
copy: {
type: 'ios-copy',
id: 'rel-sample-receive-copy-sample',
name: '复制'
},
record: {
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodSampleRecord'
},
sampleDownloadContract: {
type: 'share',
id: 'food-sample-receive-sample-download-contract',
name: '导出委托协议'
},
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 160, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 160 },
{ title: '土质描述', key: 'sampleDescribe', width: 160 },
{ title: '样品包装类型', key: 'samplePack', width: 160 },
{ title: '现场编号', key: 'siteNo', width: 130 }
],
searchOpen: false,
btn: [
{ type: 'primary', id: 'ZBC', name: '接收并发放', componentName: '' }
],
selectIds: [],
selectData: [],
currentComponent: '',
printerVal: '', // 选择的打印机
standard: '',
stdList: [],
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// // 获取当前的执行标准下拉项
// this._getStdList()
},
methods: {
// 接收的返回保存
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'relReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData)
.then(() => {
this._resultSampleChange('接收并发放成功')
})
break
case 'relReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 抽样日期
_makeDateChange(data) {
$('input[name=samplingDateBegin]').val(data[0])
$('input[name=samplingDateEnd]').val(data[1])
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
default:
this._page()
}
},
_btnClick(msg, currentComponent, formTypeObj) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg, formTypeObj)
}
})
},
// btn操作
_btnOption(msg, formTypeObj) {
switch (msg) {
case '扫码接收并发放':
// 根据字典判断是否选择人员
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('relReceiveSendScanMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '接收并发放':
this._submitSend()
break
case '添加':
if (formTypeObj.uri === 'DLTB-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByDLTB'
} else if (formTypeObj.uri === 'HES-company-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByHES'
} else {
this.currentComponent = 'FoodContractCompanyEdit'
}
this.$nextTick(() => {
this.$refs.refModal._openReceive()
})
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
break
}
},
// 1.自定义打印,除检样、备样、留样 增加制备标签,需要单独的查询制备标签的数据,
// 2.样品接收位置的制备用制备的的接口,将当前的保存方式置空,打印出来手动填写
_cusTomePrint() {
this.$store
.dispatch('FoodSample/preparationButton', {
sampleIds: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
for (let i = 0; i < result.length; i++) {
// 样品制备保存方式
result[i].saveWay = ''
}
// 样品的数据和制备样品的数据
this.$refs.refModal._open(this.selectData, result)
})
},
// 接收并发放
_submitSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
const data = {
ids: this.selectIds.join(',')
}
if (this.acceptSelectUserValue === '是') {
// 根据字典接收并发放
this.$store
.dispatch('FoodSample/submitReceiveSendCheck', data)
.then(() => {
const result = this.$store.state.FoodSample.success
if (result) {
// 验证成功
this.$refs.userModal._open('relReceiveSendMan', '请选择领样人')
}
})
} else {
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultSampleChange('接收并发放成功')
})
}
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
/* this.$Modal.confirm({
title: '提示',
content: '确定导出所有记录?',
onOk: () => {
http.open('/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids);
}
}); */
} else {
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
// 单个删除
_deleteById(id) {
this._deleteByIds([id], '确定删除该条记录?')
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultSampleChange('删除成功!')
})
}
})
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_iconClick(res, data, currentComponent, rowIndex, obj) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
if (data.type === 0) {
// 企业--编辑的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
this.$store
.dispatch('FoodSample/companyPage', {
contractId: data.contractId
})
.then(() => {
const num = this.$store.state.FoodSample.companyPage
.total
if (num <= 1) {
// 无配置表单 委托的编辑界面
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
} else {
// 样品的编辑界面
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
data.contractId,
'receive-his-wait'
)
})
})
}
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
}
})
} else if (data.type === 1) {
// 政府--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
} else {
// 粮油--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
}
break
case '删除':
this._deleteById(data.id)
break
case '复制':
if (data.type === 0) {
// 企业--复制的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
// 无配置表单
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
}
})
} else if (data.type === 1) {
// 政府--只是复制样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else {
// 粮油--只是复制样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
}
break
case '操作日志':
this._operationRecord(data.id)
break
case '导出委托协议':
// this.$Modal.confirm({
// title: '提示',
// content: '确认要下载委托单?',
// onOk: () => {
// http.open('/food/v1/sample/export_sample_form?id=' + data.id);
// }
// });
this._downContractForm(data.id)
break
case '样品附件':
this._upload(data.id)
break
}
})
},
_downContractForm(id) {
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-receive-sample-download-contract'
)
.then(() => {
if (this.$store.state.ReportExport.model) {
if (this.$store.state.ReportExport.model.indexOf('?') !== -1) {
window.open(
this.$store.state.ReportExport.model + '&sampleId=' + id,
'_blank'
)
} else {
window.open(
this.$store.state.ReportExport.model + '?sampleId=' + id,
'_blank'
)
}
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log(this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageReceive(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// 查看委托
_detailModal(contractId, type) {
this.$store.dispatch('FoodContract/getById', contractId).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 查看样品
_sampleDetailModal(id, type) {
if (type === 0) {
// 政府
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store.dispatch('FoodSample/getByCompanyId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.companyModel)
})
})
} else {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
}
},
_editModal(id, type) {
this.$refs.refModal._open(id, type)
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.refModal._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_resultSampleChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'sampleId')
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
break
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.standard = data
break
case 'query':
this.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-form-rel-sample'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
}
}
}
</script>
<template>
<div>
<Modal v-model="showEditModal" :mask-closable="false" :width="500" class="zIndex-1200">
<p slot="header">{{modalTitle}}</p>
<div>
<Form id="edit-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="100" inline>
<Form-item label="收样位置" prop="name" style="width: 100%">
<el-select v-model="formObj.locationId" @change="selectLocation($event)" name="locationId">
<el-option v-for="(item) in options" :label="item.name" :key="item.id" :value="item.id">
{{ item.name }}
</el-option>
</el-select>
</Form-item>
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</div>
</template>
<script>
/**
* 添加编辑
*/
import ModalFooter from '../../../components/base/modalFooter'
import { soilAptitude, soilEntrust, soilSample } from '../../../api'
export default {
components: {
ModalFooter
},
data() {
return {
formId: '',
lengthLimitList: [
{ key: 'stdNum', title: '标准号' },
{ key: 'enName', title: '英文名称' },
{ key: 'belongUnit', title: '归口单位' },
{ key: 'publishUnit', title: '发布单位' }
],
modalTitle: '添加食品标准表',
formObj: {
receiveLocation: '',
locationId: ''
},
ruleValidate: {},
showEditModal: false,
ids: '',
options: [],
classifyList: [
{ value: 0, name: '判定依据' },
{ value: 1, name: '检测依据' },
{ value: 2, name: '其他' }
],
typeList: [
{ value: 0, name: '国家标准' },
{ value: 1, name: '地方标准' },
{ value: 2, name: '行业标准' },
{ value: 3, name: '企业标准' }
],
statusList: [
{ value: 0, name: '现行' },
{ value: 1, name: '即将实施' },
{ value: 2, name: '部分被代替' },
{ value: 3, name: '被代替' },
{ value: 4, name: '作废' }
],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
]
}
},
methods: {
/** *modal-footer */
selectLocation(data) {
this._getLocationById(data)
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
this.showEditModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
this.formObj.ids = this.ids
this._receive(this.formObj)
} else {
this.$Message.error('表单验证失败!')
this._hideLoading()
}
})
},
_receive: async function(data) {
const result = await soilEntrust.receiveSample(data)
if (result) {
this._resultChange('收样成功!')
}
},
_save: async function(data) {
const result = await soilAptitude.standardSave(data)
if (result) {
this._resultChange('添加成功!')
}
},
_edit: async function(data) {
const result = await soilAptitude.standardEdit(data)
if (result) {
this._resultChange('编辑成功!')
}
},
_cancel() {
this._hideLoading()
this.showEditModal = false
},
_open(ids) {
this.formObj.receiveLocation = ''
this.formObj.locationId = ''
this._getLocation()
this.ids = ids
this.showEditModal = true
},
_getLocation: async function() {
const result = await soilSample.locationList()
if (result) {
console.log(result)
this.options = result
console.log(this.options)
}
},
_getLocationById: async function(id) {
console.log(id)
const result = await soilSample.locationGetById(id)
if (result) {
this.formObj.receiveLocation = result.name
}
console.log(this.formObj.receiveLocation)
},
_registerAdd() {
this.formId = this.$randomCode()
this._hideLoading()
this.$refs.formObj.resetFields()
this.modalTitle = '添加'
this.formObj.id = ''
this.formObj.type = 3
this.showEditModal = true
}
}
}
</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="entrust">
<ReceiveByEntrust ref="entrustTabs"></ReceiveByEntrust>
</el-tab-pane>
<el-tab-pane label="按样品分配" name="sample">
<ReceiveBySample ref="sampleTabs"></ReceiveBySample>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import ReceiveByEntrust from './AllotByEntrust'
import ReceiveBySample from './ReceiveBySample'
export default {
name: 'MeterSummaryEntrustIndex',
components: {
ReceiveByEntrust,
ReceiveBySample
},
data() {
return {
activeName: 'entrust'
}
},
mounted() {
this.activeName = 'entrust'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'entrust') {
this._page()
} else {
this.$refs.sampleTabs._page()
}
},
_page() {
this.$refs.entrustTabs._page()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<!--自动分配-->
<Modal v-model="showTimeModal">
<p slot="header">计划完成时间</p>
<div>
<Alert type="success" show-icon>{{ total }}</Alert>
<Form ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="150" inline>
<Form-item label="计划完成时间" prop="planDate" style="width:100%">
<Date-picker v-model="formObj.planDate" :editable="false" @on-change="_endDateChange"
type="date" placeholder="计划完成时间" format="yyyy-MM-dd"
style="width: 100%;"></Date-picker>
</Form-item>
</Form>
</div>
<div slot="footer">
<Button @click="_timeCancel" style="margin-left: 8px">取消</Button>
<Button @click="_timeOk" type="primary">提交</Button>
</div>
</Modal>
</div>
</template>
<script>
/**
*自动分配
*/
export default {
components: {},
data() {
return {
showTimeModal: false,
formObj: {
planDate: ''
},
planDate: '',
ruleValidate: {
planDate: [
{
required: true,
message: '请选择计划完成时间',
trigger: 'change',
type: 'date'
}
]
},
total: ''
}
},
methods: {
_open(num) {
this.showTimeModal = true
this.total = '可自动分配项目有 ' + num + ' 条'
},
_endDateChange(data) {
this.planDate = data
console.log(this.planDate, 123)
},
_timeCancel() {
this.showTimeModal = false
},
_timeOk() {
this.$refs.formObj.validate(valid => {
if (valid) {
this.$store.dispatch('FoodItem/autoAllot', this.planDate).then(() => {
this._resultChange('自动分配成功!')
})
} else {
this.$Message.error('表单验证失败!')
}
})
},
_resultChange(msg) {
if (this.$store.state.FoodItem.success) {
this.$Message.success(msg)
this.$emit('on-result-change')
this.showTimeModal = false
}
}
}
}
</script>
<template>
<div>
<Modal v-model="showSampleModal" @on-visible-change="_visibleChange" width="1200"
class="zIndex-900 modal-footer-none">
<p slot="header"> {{name}}--管理样品</p>
<div>
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按项目分配" name="waitReceive">
<WaitReceive ref="waitReceiveModal" @on-result-change="_search"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="按样品分配" name="waitScan">
<WaitScan ref="waitScanModal" @-result-change="_search"></WaitScan>
</el-tab-pane>
</el-tabs>
</div>
</Modal>
</div>
</template>
<script>
import WaitReceive from './item-tabs/ItemTabs'
import WaitScan from './sample-tabs/SampleTabs'
export default {
components: {
WaitReceive,
WaitScan
},
data() {
return {
type: '',
contractId: '', // 合同id
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: ''
}
},
methods: {
_initTab() {
if (this.$showBtn('food-wait-Issue-sample')) {
this.activeName = 'waitScan'
this._waitSend()
}
},
_open(contractId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = contractId // 合同id
this.activeName = 'waitReceive'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open()
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open()
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.contractId, this.type)
},
_changeTabs(tab, event) {
if (tab.name === 'alreadyIssued') {
this._issuedPage()
} else if (tab.name === 'waitReceive') {
// this._waitPage()
} else if (tab.name === 'waitScan') {
this._waitSend()
}
},
_search() {
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</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.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" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :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>
<AutoAssignModal ref="autoAssignModal" @on-result-change="_page"></AutoAssignModal>
</div>
</template>
<script>
import { soilTest } from '../../../../../api'
import AutoAssignModal from '../AutoAssignModal'
export default {
components: { AutoAssignModal },
data() {
return {
currentComponent: '',
formObj: {},
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
btn: [{ id: '', name: '自动分配' }],
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测依据', key: 'testBasis', 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() {
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())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpAllot(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
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() {
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 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.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>
</div>
</template>
<script>
import Global from '../../../../../api/config'
import { soilTest } from '../../../../../api'
export default {
components: {},
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: 'warning', 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: 120, fixed: 'left' },
{ title: '样品编号', key: 'num', width: 180 },
{ title: '样品名称', key: 'sampleName', width: 140 },
{ title: '服务类型', key: 'serviceType', width: 160 },
{ title: '产品', key: 'subClass', width: 160 },
{ title: '计划完成时间', key: 'planEndDate', width: 120, date: true },
{ title: '应出报告日期', key: 'reportDueDate', width: 120, date: true },
{ title: '数据出具日期', key: 'resultDate', width: 120, date: true },
{ title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 },
{ title: '检测方法', key: 'testMethod', width: 260 },
{ title: '主检人', key: 'tester', width: 100 },
{ title: '检测科室', key: 'groupName', width: 150 },
{ title: '判定依据', key: 'judgeBasis', width: 140 },
{ title: '判定依据名称', key: 'judgeBasisName', width: 200 },
{ title: '接样日期', key: 'receiveDate', width: 100, date: true },
{ title: '项目备注', key: 'remark', width: 200 },
{ title: '样品备注', key: 'sampleRemark', width: 200 },
{ title: '委托备注', key: 'contractRemark', width: 200 }
],
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: {
// 获取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) {
if (this.$store.state.FoodItem.success) {
this.$Message.success(msg)
this._page()
}
},
async _btnClick(msg) {
switch (msg) {
case '按人分配':
await this._reportDueDate()
await 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(data) {
this.leftSelectData = 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._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() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpAllot(
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() {
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)
})
}
}
}
</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 {}
},
methods: {
_leftResult(data) {
this.$refs.rightModal._open(data)
},
_rightResult() {
this.$refs.leftModal._page()
},
_open() {
this.$refs.leftModal._open()
// this.$refs.rightModal._getColumn()
}
}
}
</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 :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :pageColumns="pageColumns" :table-name="tableName"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange" :getPage="getPage" :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: {},
tableName: 'food-task-assign-item-left',
// 用户自己选中的列
userColumns: [],
optionList: [
{ key: 'name', name: '检测项目', placeholder: '请输入检测项目' },
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
],
btn: [{ id: '', name: '自动分配' }],
getPage: {},
pageColumns: [
{ title: '检测项目', key: 'name', width: 120 },
{ title: '检测依据', key: 'testBasis', 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() {
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())
const result = await soilTest.pageExpAllot(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
break
case 'selectData':
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.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.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>
</div>
</template>
<script>
import Global from '../../../../../api/config'
import { soilTest } from '../../../../../api'
export default {
components: {},
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: 'warning', 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: 120, fixed: 'left' },
{ title: '样品编号', key: 'num', width: 180 },
{ title: '样品名称', key: 'sampleName', width: 140 },
{ title: '服务类型', key: 'serviceType', width: 160 },
{ title: '产品', key: 'subClass', width: 160 },
{ title: '计划完成时间', key: 'planEndDate', width: 120, date: true },
{ title: '应出报告日期', key: 'reportDueDate', width: 120, date: true },
{ title: '数据出具日期', key: 'resultDate', width: 120, date: true },
{ title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 },
{ title: '检测方法', key: 'testMethod', width: 260 },
{ title: '主检人', key: 'tester', width: 100 },
{ title: '检测科室', key: 'groupName', width: 150 },
{ title: '判定依据', key: 'judgeBasis', width: 140 },
{ title: '判定依据名称', key: 'judgeBasisName', width: 200 },
{ title: '接样日期', key: 'receiveDate', width: 100, date: true },
{ title: '项目备注', key: 'remark', width: 200 },
{ title: '样品备注', key: 'sampleRemark', width: 200 },
{ title: '委托备注', key: 'contractRemark', width: 200 }
],
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: {
// 获取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) {
if (this.$store.state.FoodItem.success) {
this.$Message.success(msg)
this._page()
}
},
async _btnClick(msg) {
switch (msg) {
case '按人分配':
await this._reportDueDate()
await 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(data) {
this.leftSelectData = 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._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() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilTest.pageExpAllot(
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() {
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)
})
}
}
}
</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 {}
},
methods: {
_leftResult(data) {
this.$refs.SamplerightModal._open(data)
},
_rightResult() {
this.$refs.SampleleftModal._page()
},
_open() {
console.log('按样品分配')
this.$refs.SampleleftModal._open()
// this.$refs.rightModal._getColumn()
}
}
}
</script>
...@@ -13,6 +13,7 @@ import AddressManage from '../pages/soil-sample-manage/sample-address/AddressMan ...@@ -13,6 +13,7 @@ import AddressManage from '../pages/soil-sample-manage/sample-address/AddressMan
import BackupsManage from '../pages/soil-sample-manage/backups-manage/SampleBackupsIndex' import BackupsManage from '../pages/soil-sample-manage/backups-manage/SampleBackupsIndex'
import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeIndex' import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeIndex'
import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex' import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex'
import TestTaskIndex from '../pages/soil-test-manage/test-task-manage/TestTaskIndex'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -73,6 +74,22 @@ export default [ ...@@ -73,6 +74,22 @@ export default [
] ]
}, },
{ {
path: 'test',
component: Blank,
children: [
{
path: 'allot_task',
component: TestTaskIndex,
meta: { title: '试验任务分配' }
},
{
path: 'do_test',
component: ExperimentItemManage,
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