Commit e1f58483 by lichengming

修改了试样检测页面

parent b7ea0817
...@@ -23,5 +23,13 @@ export default { ...@@ -23,5 +23,13 @@ export default {
samplePage: data => http.post('soil/v1/sample/page', data).then(res => res), samplePage: data => http.post('soil/v1/sample/page', data).then(res => res),
pageExpTestSample: data => pageExpTestSample: data =>
http.post('soil/v1/sample/page_exp_test_sample', data).then(res => res), http.post('soil/v1/sample/page_exp_test_sample', data).then(res => res),
pageItem: data => http.post('soil/v1/experiment/page', data).then(res => res) pageItem: data => http.post('soil/v1/experiment/page', data).then(res => res),
pageAllotByExp: data =>
http.post('soil/v1/experiment/page_allot_by_exp', data).then(res => res),
pageExperimentAllot: data =>
http.post('soil/v1/experiment/page_exp_allot', data).then(res => res),
pageTestByExp: data =>
http.post('soil/v1/experiment/page_test_by_exp', data).then(res => res),
pageExperimentTest: data =>
http.post('soil/v1/experiment/page_exp_test', data).then(res => res)
} }
<template>
<div>
<Modal v-model="showModal" @on-visible-change="_visibleChange" width="1000">
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane v-if="sampleShow" label="按样品录入" name="sample"/>
<el-tab-pane v-if="itemShow" label="按项目录入" name="item"/>
</el-tabs>
<!--组件加载,缓存-->
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :id="id" :is="currentComponent"></component>
</keep-alive>
</div>
</div>
</Modal>
</div>
</template>
<script>
import ItemTabs from './item-tabs/ItemTabs'
import SampleTabs from './sample-tabs/SampleTabs'
/**
* 任务分配
*/
export default {
components: {
// eslint-disable-next-line vue/no-unused-components
ItemTabs,
// eslint-disable-next-line vue/no-unused-components
SampleTabs
},
data() {
return {
activeName: '',
currentComponent: '',
showModal: false,
id: '',
sampleShow: true,
itemShow: true
}
},
mounted() {
// 初始化tab,按钮权限
this._initTab()
},
methods: {
_open(id) {
this.showModal = true
this.id = id
this.activeName = 'sample'
},
_initTab() {
if (this.sampleShow) {
// eslint-disable-next-line no-unused-expressions
this.activeName === 'sample'
this.currentComponent = 'SampleTabs'
} else if (this.itemShow) {
// eslint-disable-next-line no-unused-expressions
this.activeName === 'item'
this.currentComponent = 'ItemTabs'
}
},
_changeTabs(tab, event) {
if (tab.name === 'item') {
this.currentComponent = 'ItemTabs'
} else if (tab.name === 'sample') {
this.currentComponent = 'SampleTabs'
}
},
_search() {
this.$emit('on-result-change')
},
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</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"></WaitReceive>
</el-tab-pane>
<el-tab-pane label="按样品录入" name="waitScan">
<WaitScan ref="waitScanModal"></WaitScan>
</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'
export default {
components: {
WaitReceive,
WaitScan
},
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 === 'alreadyIssued') {
// this._issuedPage()
} else if (tab.name === 'waitReceive') {
// this._waitPage()
this.$refs.waitReceiveModal._open(this.entrustId)
} else if (tab.name === 'waitScan') {
this.$refs.waitScanModal._open(this.entrustId)
// this._waitSend()
}
},
_search() {
this.$emit('on-result-change')
},
// 关闭弹框的时候刷新上个界面
_visibleChange(data) {
if (data === false) {
this._search()
}
}
}
}
</script>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
<!--选择领样人--> <!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo> <UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<Operation ref="operation"></Operation> <Operation ref="operation"></Operation>
<dataEntry ref="sampleManageModal" @on-result-change="_page"></dataEntry> <SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>
</div> </div>
</template> </template>
<script> <script>
...@@ -71,11 +71,14 @@ import UserInfo from '../../../components/user-info-single/AssignPerson' ...@@ -71,11 +71,14 @@ 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 dataEntry from './dataEntry' import dataEntry from './dataEntry'
import SampleManage from './SampleManage'
export default { export default {
components: { components: {
UserInfo, UserInfo,
Operation, Operation,
dataEntry // eslint-disable-next-line vue/no-unused-components
dataEntry,
SampleManage
}, },
data() { data() {
return { return {
......
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-left" inline onsubmit="return false">
<label class="label-sign"></label>
<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" select-data :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.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>{{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>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_modalResult"></component>
</keep-alive>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
props: {
id: null
},
components: {},
data() {
return {
currentComponent: '',
tableName: 'food-task-assign-sample-left',
// 用户自己选中的列
userColumns: [],
switchStatusData: this.id,
formObj: {
entrustId: ''
},
optionList: [
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'cname', name: '委托单位', placeholder: '请输入委托单位' },
{ key: 'testedName', name: '受检单位', placeholder: '请输入受检单位' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'name', name: '样品名称', placeholder: '请输入样品名称' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
}
],
btn: [{ id: 'food-task-assign-auto', name: '自动分配' }],
getPage: {},
pageColumns: [{ title: '检测项目', key: 'name', width: 180 }],
resultDateBegin: '',
resultDateEnd: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
mounted() {
this._page()
},
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._page(id)
},
_searchParams() {
const obj = {}
const obj1 = this.$refs.selInput1._getFormObj()
Object.assign(obj, obj1)
return obj
},
_page: async function() {
console.log('项目')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.switchStatusData
const result = await soilTest.pageTestByExp(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
case 'selectIds':
console.log(data)
this.$emit('on-result-change', data)
break
case 'selectData':
console.log(data)
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this._autoAssign()
break
}
},
_autoAssign() {
this.currentComponent = 'AutoAssignModal'
this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
const num = this.$store.state.FoodItem.count
if (num !== undefined) {
this.$nextTick(function() {
this.$refs.refModal._open(num)
})
}
})
},
// 委托详情
_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.id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
})
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template #left>
<ItemLeftList ref="itemleftModal" :id="id" @on-result-change="_leftResult"></ItemLeftList>
</template>
<template #right>
<!-- <NoData v-if="!currentComponent" msg="请选中左侧数据后,查看此界面信息"/>-->
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_rightResult"></component>
</template>
</TwoColumnPage>
</div>
</template>
<script>
// import NoData from '@/components/base/NoData'
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import ItemLeftList from './ItemLeftList'
import ItemRightList from './ItemRightList'
export default {
components: {
ItemLeftList,
TwoColumnPage,
// eslint-disable-next-line vue/no-unused-components
ItemRightList
// NoData
},
props: {
id: null
},
data() {
return {
currentComponent: 'ItemRightList',
switchStatusData: this.id
}
},
computed: {
switchStatus: function() {
return this.status // 直接监听props里的status状态
}
},
methods: {
_leftResult(data) {
this.currentComponent = 'ItemRightList'
this.$refs.refModal._open(data.join(','))
},
_rightResult() {
this.$refs.itemleftModal._page()
}
}
}
</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 @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" 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: '请输入检测依据' }
],
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) {
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() {
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>
<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) {
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()
}
}
}
</script>
<template>
<div>
<Row>
<!--查询-->
<Col span="24">
<Form id="task-assign-sample-left" inline onsubmit="return false">
<label class="label-sign"></label>
<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">
<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.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>{{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>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_modalResult"></component>
</keep-alive>
</div>
</template>
<script>
import { soilTest } from '../../../../api'
export default {
components: {},
props: {
id: null
},
data() {
return {
currentComponent: '',
tableName: 'food-task-assign-sample-left',
// 用户自己选中的列
userColumns: [],
switchStatusData: this.id,
formObj: {
entrustId: ''
},
optionList: [
{ key: 'code', name: '委托编号', placeholder: '请输入委托编号' },
{ key: 'cname', name: '委托单位', placeholder: '请输入委托单位' },
{ key: 'testedName', name: '受检单位', placeholder: '请输入受检单位' },
{ key: 'num', name: '样品编号', placeholder: '请输入样品编号' },
{ key: 'name', name: '样品名称', placeholder: '请输入样品名称' },
{
key: 'resultDate',
name: '数据出具日期',
placeholder: '请选择数据出具日期',
date: true
}
],
btn: [{ id: 'food-task-assign-auto', name: '自动分配' }],
getPage: {},
pageColumns: [
{ title: '委托编号', key: 'code', width: 180 },
{ title: '受检单位', key: 'testedName', width: 180 },
{ title: '样品编号', key: 'num', width: 180 },
{ title: '样品名称', key: 'name', width: 140 },
{ title: '委托单位', key: 'cname', width: 180 },
{ title: '数据出具日期', key: 'resultDate', width: 120, date: true }
],
resultDateBegin: '',
resultDateEnd: ''
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tabSearch')
}
},
mounted() {
this._page()
},
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() {
console.log('样品')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.switchStatusData
const result = await soilTest.pageExpTestSample(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
case 'selectIds':
this.$emit('on-result-change', data)
break
case 'changeSize':
this._page()
break
case 'table-col':
// 用户选中的表格列
this.userColumns = data
break
}
},
_btnClick(msg) {
switch (msg) {
case '自动分配':
this._autoAssign()
break
}
},
_autoAssign() {
this.currentComponent = 'AutoAssignModal'
this.$store.dispatch('FoodItem/autoAllotNum').then(() => {
const num = this.$store.state.FoodItem.count
if (num !== undefined) {
this.$nextTick(function() {
this.$refs.refModal._open(num)
})
}
})
},
// 委托详情
_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.id).then(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
}
})
}
}
}
</script>
<template>
<div>
<TwoColumnPage>
<template #left>
<SampleLeftList ref="leftModal" :id="id" @on-result-change="_leftResult"></SampleLeftList>
</template>
<template #right>
<!-- <NoData v-if="!currentComponent" msg="请选中左侧数据后,查看此界面信息"/>-->
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_rightResult"></component>
</template>
</TwoColumnPage>
</div>
</template>
<script>
// import NoData from '@/components/base/NoData'
import TwoColumnPage from '../../../../components/base/TwoColumnPage'
import SampleLeftList from './SampleLeftList'
import SampleRightList from './SampleRightList'
export default {
components: {
SampleLeftList,
TwoColumnPage,
// eslint-disable-next-line vue/no-unused-components
SampleRightList
// NoData
},
props: {
id: null
},
data() {
return {
currentComponent: 'SampleRightList',
switchStatusData: this.id
}
},
computed: {
switchStatus: function() {
return this.status // 直接监听props里的status状态
}
},
methods: {
_open() {
console.log('y123123123123123123')
this.this.$refs.leftModal._open()
},
_sendData(id) {
this.$refs.leftModal._open(this.id)
},
_leftResult(data) {
this.currentComponent = 'SampleRightList'
this.$refs.refModal._open(data.join(','))
},
_rightResult() {
this.$refs.leftModal._page()
}
}
}
</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>
<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(id) {
this.$refs.SampleleftModal._open(id)
// this.$refs.rightModal._getColumn()
}
}
}
</script>
...@@ -58,7 +58,7 @@ export default { ...@@ -58,7 +58,7 @@ export default {
}, },
// 待接收 // 待接收
_waitPage() { _waitPage() {
this.$refs.waitReceiveModal._open() this.$refs.waitReceiveModal._open(this.entrustId)
}, },
// 待发放 // 待发放
_waitSend() { _waitSend() {
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
// this._issuedPage() // this._issuedPage()
} else if (tab.name === 'waitReceive') { } else if (tab.name === 'waitReceive') {
// this._waitPage() // this._waitPage()
this.$refs.waitReceiveModal._open() this.$refs.waitReceiveModal._open(this.entrustId)
} else if (tab.name === 'waitScan') { } else if (tab.name === 'waitScan') {
this.$refs.waitScanModal._open(this.entrustId) this.$refs.waitScanModal._open(this.entrustId)
// this._waitSend() // this._waitSend()
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</Form> </Form>
</Col> </Col>
<Col span="24"> <Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list> <btn-list @on-result-change="_btnClick" class="contHide" style="margin-bottom: 6px;"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
...@@ -60,9 +60,10 @@ export default { ...@@ -60,9 +60,10 @@ export default {
{ key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' } { key: 'testBasis', name: '检测依据', placeholder: '请输入检测依据' }
], ],
getPage: {}, getPage: {},
id: '',
pageColumns: [ pageColumns: [
{ title: '检测项目', key: 'name', width: 120 }, { title: '检测项目', key: 'name', width: 120 },
{ title: '检测依据', key: 'testBasis', width: 140 }, { title: '检测方法', key: 'testMethod', width: 140 },
{ title: '检测依据名称', key: 'testBasisName', width: 200 } { title: '检测依据名称', key: 'testBasisName', width: 200 }
] ]
} }
...@@ -90,7 +91,8 @@ export default { ...@@ -90,7 +91,8 @@ export default {
break break
} }
}, },
_open() { _open(id) {
this.id = id
this._page() this._page()
}, },
_searchParams() { _searchParams() {
...@@ -101,8 +103,8 @@ export default { ...@@ -101,8 +103,8 @@ export default {
}, },
_page: async function() { _page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj) this.formObj.entrustId = this.id
const result = await soilTest.pageExpAllot( const result = await soilTest.pageAllotByExp(
this.$serializeForm(this.formObj) this.$serializeForm(this.formObj)
) )
if (result) { if (result) {
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
</PTVXETable> </PTVXETable>
</Col> </Col>
</Row> </Row>
<AssignPerson ref="personModal" @on-result-change="_page"></AssignPerson> <AssignPerson ref="personModal" @on-result-change="_assignBackData"></AssignPerson>
</div> </div>
</template> </template>
<script> <script>
...@@ -59,7 +59,13 @@ export default { ...@@ -59,7 +59,13 @@ export default {
return { return {
// 定义表格名称----英文 // 定义表格名称----英文
tableName: 'food-task-assign-item-right', tableName: 'food-task-assign-item-right',
formObj: {}, formObj: {
entrustId: '',
name: '',
testMethod: '',
testBasis: ''
},
entrustId: '',
// 用户自己选中的列 // 用户自己选中的列
userColumns: [], userColumns: [],
currentComponent: '', currentComponent: '',
...@@ -85,8 +91,7 @@ export default { ...@@ -85,8 +91,7 @@ export default {
{ key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' } { key: 'detectType', name: '样品类别', placeholder: '请输入样品类别' }
], ],
btn: [ btn: [
{ type: 'success', id: '', name: '按人分配' }, { type: 'success', id: '', name: '试验项目分配' },
{ type: 'warning', id: '', name: '按组分配' },
{ type: '', id: 'food-task-assign-adjust-group', name: '调整分组' }, { type: '', id: 'food-task-assign-adjust-group', name: '调整分组' },
{ {
type: '', type: '',
...@@ -98,24 +103,14 @@ export default { ...@@ -98,24 +103,14 @@ export default {
getPage: {}, getPage: {},
pageColumns: [ pageColumns: [
{ title: '检测项目', key: 'name', width: 120, fixed: 'left' }, { title: '检测项目', key: 'name', width: 120, fixed: 'left' },
{ title: '样品编号', key: 'num', width: 180 }, { title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '样品名称', key: 'sampleName', width: 140 }, { title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '服务类型', key: 'serviceType', width: 160 }, { title: '试样包装类型', key: 'samplePack', width: 180 },
{ title: '产品', key: 'subClass', width: 160 }, { title: '大类', key: 'mainType', width: 140 },
{ title: '计划完成时间', key: 'planEndDate', width: 120, date: true }, { title: '小类', key: 'smallType', width: 140 },
{ 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: 'testMethod', width: 260 },
{ title: '主检人', key: 'tester', width: 100 }, { title: '检测依据', key: 'testBasis', width: 140 },
{ title: '检测科室', key: 'groupName', width: 150 }, { 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: [], leftSelectData: [],
selectIds: [], // 检测项目id selectIds: [], // 检测项目id
...@@ -261,10 +256,9 @@ export default { ...@@ -261,10 +256,9 @@ export default {
}) })
}, },
_resultChange(msg) { _resultChange(msg) {
if (this.$store.state.FoodItem.success) { this.$Message.success(msg)
this.$Message.success(msg) this._page()
this._page() this.$emit('on-result-change')
}
}, },
async _btnClick(msg) { async _btnClick(msg) {
switch (msg) { switch (msg) {
...@@ -273,6 +267,9 @@ export default { ...@@ -273,6 +267,9 @@ export default {
// await this._reportDueDate() // await this._reportDueDate()
// await this._userAssign() // await this._userAssign()
break break
case '试验项目分配':
this._userAssign()
break
case '按组分配': case '按组分配':
await this._reportDueDate() await this._reportDueDate()
await this._groupAssign() await this._groupAssign()
...@@ -323,8 +320,9 @@ export default { ...@@ -323,8 +320,9 @@ export default {
this.$refs.refModal._open(tempData, 'planDate') this.$refs.refModal._open(tempData, 'planDate')
} }
}, },
_open(data) { _open(id, data) {
this.leftSelectData = data this.leftSelectData = data
this.entrustId = id
if (data.length === 0) { if (data.length === 0) {
this.$set(this.getPage, 'records', []) this.$set(this.getPage, 'records', [])
this.$set(this.getPage, 'total', 0) this.$set(this.getPage, 'total', 0)
...@@ -352,9 +350,17 @@ export default { ...@@ -352,9 +350,17 @@ export default {
return obj return obj
}, },
_page: async function() { _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)
}
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj) this.formObj.entrustId = this.entrustId
const result = await soilTest.pageExpAllot( this.formObj.name = saveName.join(',')
this.formObj.testMethod = saveMethod.join(',')
const result = await soilTest.pageExperimentAllot(
this.$serializeForm(this.formObj) this.$serializeForm(this.formObj)
) )
if (result) { if (result) {
...@@ -394,39 +400,56 @@ export default { ...@@ -394,39 +400,56 @@ export default {
} }
}, },
// 按人分配 选人选时间 // 按人分配 选人选时间
_userAssign() { _assignBackData(data) {
if (this.defaultPlanDate) { console.log(data)
// 有字典 const tempData = {}
if (this.sampleNames === '') { tempData.ids = this.selectIds.join(',')
// 有计划完成时间 tempData.user = data.realname
const user = Global.getUserInfo('userInfo') tempData.userId = data.userId
this.currentComponent = 'AssignPerson' this._allotItems(tempData)
this.$nextTick(function() { },
this.$refs.refModal._openGoupByUserId( _allotItems: async function(data) {
'分配人员', const result = await soilTest.allotExp(data)
user.id, if (result) {
'itemTree' this._resultChange('分配成功')
)
})
} else {
// 有字典,无计划完成时间的
this.$Modal.confirm({
title: '提示',
content:
'所选项目中含有未设置计划完成时间的' +
`${this._reportDueDate()}` +
'请确认!',
onOk: () => {}
})
}
} else {
// 无字典
this.currentComponent = 'EndDateModal'
this.$nextTick(() => {
this._endDate()
})
} }
}, },
_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() { _reportDueDate() {
const sampleNames = [] const sampleNames = []
......
...@@ -23,17 +23,21 @@ export default { ...@@ -23,17 +23,21 @@ export default {
ItemRightList ItemRightList
}, },
data() { data() {
return {} return {
id: ''
}
}, },
methods: { methods: {
_leftResult(data) { _leftResult(data) {
this.$refs.rightModal._open(data) this.$refs.rightModal._open(this.id, data)
}, },
_rightResult() { _rightResult() {
this.$refs.leftModal._page() this.$refs.leftModal._page()
}, },
_open() { _open(id) {
this.$refs.leftModal._open() this.id = id
console.log(id)
this.$refs.leftModal._open(this.id)
// this.$refs.rightModal._getColumn() // this.$refs.rightModal._getColumn()
} }
} }
......
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