Commit f4a52992 by lichengming

修改了发放高级试验,添加独立留存菜单

parent 18d104bf
......@@ -21,6 +21,8 @@ export default {
http.post('soil/v1/entrust/page_review', data).then(res => res),
pageSampleReceive: data =>
http.post('soil/v1/entrust/page_sample_receive', data).then(res => res),
pageAloneKeep: data =>
http.post('soil/v1/entrust/page_alone_keep', data).then(res => res),
pageLocationEntrust: data =>
http
.post('soil/v1/entrust/page_receive_location_entrust', data)
......@@ -89,6 +91,8 @@ export default {
http.post('soil/v1/sample/sample_retain', data).then(res => res),
sendSample: data =>
http.post('soil/v1/sample/send_sample', data).then(res => res),
aloneKeepSample: data =>
http.post('soil/v1/sample/alone_keep_sample', data).then(res => res),
pagePrepare: data =>
http.post('soil/v1/sample/page_prepare', data).then(res => res),
pagePrepareCheck: data =>
......
......@@ -76,6 +76,11 @@ export default {
name: '查看'
},
{
type: 'ios-cloud',
id: '',
name: '附件'
},
{
type: 'ios-clock',
id: '',
name: '操作日志'
......@@ -242,7 +247,10 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'aloneSampleId')
})
},
_getById: async function(id) {
const result = await soilAptitude.getById(id)
......
......@@ -76,6 +76,11 @@ export default {
name: '查看'
},
{
type: 'ios-cloud',
id: '',
name: '附件'
},
{
type: 'ios-clock',
id: '',
name: '操作日志'
......@@ -240,7 +245,10 @@ export default {
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'subcontractorId')
this.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'aloneSampleId')
})
},
_getById: async function(id) {
const result = await soilAptitude.getById(id)
......
......@@ -249,7 +249,7 @@ export default {
// 上传文件
this.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'sampleId')
this.$refs.refModal._open(id, 'aloneSampleId')
})
},
_getById: async function(id) {
......
<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">
</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" :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-item" label="钻孔名称:">
<Input v-model="formObj.boreholeName" @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>
<!--组件加载-->
<!--选择领样人-->
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_componentResult"></component>
</keep-alive>
</div>
</template>
<script>
import { soilEntrust } from '../../../api'
import Operation from '../../../components/operation/Operation'
import SampleManage from './entrust-sample-manage/SampleManage'
export default {
// eslint-disable-next-line vue/no-unused-components
components: { SampleManage, Operation },
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{
type: '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: 'boreholeName', width: 120 },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', 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() {},
methods: {
// 组件返回值
_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
}
})
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.entrustCode)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.currentComponent = 'SampleManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, type, name)
})
},
_tableResultChange(msg, data) {
switch (msg) {
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 soilEntrust.pageAloneKeep(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_search() {
this._page()
},
_operationRecord(id) {
this.currentComponent = 'Operation'
this.$nextTick(() => {
this.$refs.refModal._open(id)
})
// 操作日志
// this.$refs.operation._open(id)
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.selectIds = []
},
_upload(id) {
// 上传文件
this.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'entrustId')
})
// this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" v-show="searchOpen" :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-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" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
:icon-msg="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>
<!--组件加载-->
<!--选择领样人-->
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent" @on-result-change="_componentResult"></component>
</keep-alive>
<!-- <SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>-->
<!-- <Operation ref="operation"></Operation>-->
<!-- <FileManage ref="FileManage"></FileManage>-->
</div>
</template>
<script>
import { soilEntrust } from '../../../api'
import Operation from '../../../components/operation/Operation'
import SampleManage from './entrust-sample-manage/SampleManageHis'
export default {
// eslint-disable-next-line vue/no-unused-components
components: { SampleManage, Operation },
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{ type: 'md-cloud', id: '', name: '附件' },
{
type: '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: {
// 一键接收并发放
// 组件返回值
_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
}
})
},
// 扫码接收并发放
// 一键接收并发放
// 一键发放
// 一键接收
// 信息维护
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.entrustCode)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.currentComponent = 'SampleManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, type, name)
})
// this.$refs.sampleManageModal._open(id, type, name)
},
_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 soilEntrust.pageSampleReceiveHis(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.currentComponent = 'Operation'
this.$nextTick(() => {
this.$refs.refModal._open(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.currentComponent = 'FileManage'
this.$nextTick(() => {
this.$refs.refModal._open(id, 'entrustId')
})
// this.$refs.FileManage._open(id, 'entrustId')
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="待完成" name="entrust"></el-tab-pane>
<el-tab-pane label="历史记录" name="sample"></el-tab-pane>
</el-tabs>
<keep-alive>
<!-- eslint-disable-next-line vue/require-component-is -->
<component ref="refModal" :is="currentComponent"></component>
</keep-alive>
</div>
</div>
</div>
</template>
<script>
import ReceiveByEntrust from './ReceiveByEntrust'
import ReceiveBySample from './ReceiveBySample'
export default {
name: 'MeterSummaryEntrustIndex',
components: {
// eslint-disable-next-line vue/no-unused-components
ReceiveByEntrust,
// eslint-disable-next-line vue/no-unused-components
ReceiveBySample
},
data() {
return {
activeName: 'entrust',
currentComponent: ''
}
},
mounted() {
this.activeName = 'entrust'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'entrust') {
this._page()
} else {
this.currentComponent = 'ReceiveBySample'
this.$nextTick(() => {
this.$refs.refModal._page()
})
// this.$refs.sampleTabs._page()
}
},
_page() {
this.currentComponent = 'ReceiveByEntrust'
this.$nextTick(() => {
this.$refs.refModal._page()
})
// this.$refs.entrustTabs._page()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<Modal v-model="showEditModal" v-drag :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('收样成功!')
}
this._hideLoading()
},
_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>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="margin-bottom: 10px">
<Form id="search-send" :label-width="80" 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.name" name="name" placeholder="请输入样品名称" clearable></Input>
</Form-item>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input>
<input name="contractId" type="hidden">
</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">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
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>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<!--组件加载-->
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
export default {
components: {},
data() {
return {
btn: [
{
id: 'ZBC',
type: 'primary',
name: '出库',
componentName: 'OutStorage'
}
],
selectIds: [],
getPage: {},
pageColumns: [
{
title: '样品编号',
key: 'num',
width: 180,
detail: true,
fixed: 'left'
},
{ title: '样品名称', key: 'name', width: 160, fixed: 'left' },
{ title: '执行标准', key: 'standard', width: 160 },
{ title: '大类', key: 'firstClass', width: 130 },
{ title: '细类', key: 'detectType', width: 200 },
{ title: '抽样单编号', key: 'samplingNum', width: 200 },
{ title: '状态', key: 'status', width: 120, status: true },
{ title: '检测项目', key: 'itemName', width: 160 },
{ title: '规格型号', key: 'specification', width: 160 },
{ title: '质量等级', key: 'qualityGrade', width: 160 },
{ title: '样品数量', key: 'quantity', width: 100 },
{ title: '单位', key: 'unit', width: 90 },
{ title: '抽样环节', key: 'samplingLink', width: 160 },
{ title: '备样数量', key: 'backupQuanity', width: 100 },
{ title: '保存条件', key: 'keepCondition', width: 160 },
{ title: '抽样地点', key: 'samplingPlace', width: 160 },
{ title: '抽样地点(其他)', key: 'samplingPlaceRemark', width: 200 },
{ title: '抽样日期', key: 'samplingDate', width: 200, date: true },
{ title: '日期类型', key: 'dateType', width: 160 },
{ title: '日期', key: 'dateTime', width: 120, date: true },
{ title: '样品形态', key: 'shape', width: 100 },
{ title: '接收日期', key: 'receiveDate', width: 120, date: true },
{ title: '备注', key: 'remark' }
],
iconMsg: [
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'SampleRecord'
},
{ type: 'md-cloud', id: '', name: '附件', componentName: 'FileManage' }
],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
samplingNum: '',
name: '',
num: '',
receiveStartDate: '',
receiveEndDate: '',
detectType: ''
},
dateList: [],
searchOpen: false
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
// 接收日期
_receiveChange(data) {
this.formObj.receiveStartDate = data[0]
this.formObj.receiveEndDate = data[1]
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
default:
this._search()
}
},
_detailModal(id) {
// 查看
if (this.type === 1) {
// 政府
this.currentComponent = 'FoodSampleGovernDetail'
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store.dispatch('FoodSample/getByCompanyId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.companyModel)
})
})
}
},
_open(contractId, type) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
$('input[name=contractId]').val(contractId)
this.contractId = contractId
this.type = type
this.selectIds = []
this.$nextTick(() => {
this._page()
})
},
_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
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '导出任务单':
this._exportTaskForm()
break
case '导出检测任务单':
this._exportTestTaskForm()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
break
case '出库':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息!')
} else {
this.$refs.refModal._open(this.selectIds, 'alreadyOutStorage')
}
break
case '扫码出库':
this.$refs.refModal._open('alreadyScanOutStorage')
break
case '追加检测项目':
this._importItem()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '追加检测项目包':
this._importItemPackage()
break
case 'search':
this.searchOpen = !this.searchOpen
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)
})
},
_exportTestTaskForm() {
this.formObj.contractId = this.contractId
const objcity = {
param: 'ids',
ids: this.selectIds,
url: '',
queryObj: this.$serializeFormSearch(this.formObj),
msgContent: '数据量如果超过两万条,请分批次导出'
}
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-manage-export-test-table'
)
.then(() => {
const result = this.$store.state.ReportExport.model
objcity.url = result
this.$exportByQuery(objcity)
})
},
_search() {
this._page()
},
_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 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
// 追加检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this._judge('package')
}
},
// 追加检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this._judge('item')
}
},
// 复制历史项目
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this._judge('copyHisItem')
}
},
_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 {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_judge(msg) {
this.$store
.dispatch('FoodSample/getSampleStatus', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
if (result) {
// 选中的是同一个 状态的样品
// FLOW_RECEIVE--待接收
this.sampleStatus = result.status.value
if (this.sampleStatus === 'FLOW_RECEIVE') {
// 选择检测项目后--直接保存
this.$refs.refModal._open(this.selectIds, this.selectData[0])
} else {
// 弹出询问框
this.$refs.typeModal._open(
msg,
this.selectIds,
this.selectData[0]
)
}
}
})
},
/** ********************************导出任务单 -start********************************************/
_exportTaskForm() {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-manage-export-task-form1'
)
.then(() => {
const result = this.$store.state.ReportExport.model
window.open(
this.$judgeUrlChar(result) + 'ids=' + this.selectIds,
'_blank'
)
})
}
},
/** ********************************导出任务单 -end********************************************/
// 选择完打印机之后
_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)
}
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form v-show="searchOpen" id="search-wait-scan" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item">
<Input v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入试样编号" clearable @on-enter="_formSearch"></Input>
<input name="entrustId" type="hidden">
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide" @on-result-change="_btnClick">
</btn-list>
</Col>
<Col span="24">
<PTVXETableHeight
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
select-data
@on-result-change="_tableResultChange">
<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.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
<!--选择领样人-->
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
export default {
components: {},
data() {
return {
btn: [],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 95 },
{ title: '现场编号', key: 'siteNo', width: 100 },
{ title: '接收人', key: 'receiver', width: 120 },
{ title: '接收时间', key: 'receiveTime', width: 145, date: true },
{ title: '收样存储位置', key: 'receiveLocation', width: 140 },
{ title: '发放人', key: 'sender', width: 120 },
{ title: '发放时间', key: 'sendTime', width: 144, date: true },
{ title: '土质描述', key: 'sampleDescribe', width: 185 },
{ title: '样品包装类型', key: 'samplePack', width: 120 }
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' },
{ type: 'ios-copy', id: '', name: '复制' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'SampleRecord'
},
{ type: 'cloud', id: '', name: '附件', componentName: 'FileManage' }
],
type: '',
entrustId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
sampleCode: undefined,
entrustId: undefined
},
searchOpen: true
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// this._getStdList()
// 样品接收是否选择人员
// 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 'sampleSendMan':
// 发放
this.$store.dispatch('FoodSample/submitSend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'sampleScanSend':
// 扫码接收并发放
this.$refs.refModal._open('扫码发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_open(entrustId, type) {
this.formObj = this.$resetFields(this.formObj)
$('input[name=entrustId]').val(entrustId)
this.formObj.entrustId = entrustId
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.pageSendHis(this.formObj)
console.log(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '打印标签':
this._selectPrinter('print-label')
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.selectIds = []
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
}
}
}
</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="warehouse" style="width: 100%">
<Input v-model="formObj.warehouse" name="warehouse" placeholder="请选择库房号" style="width: 95%;"/>
<span @click="_storageModel()" style="font-size: 20px;color: #00b5ec">+</span>
</Form-item>
<Form-item label="架位号" prop="receiveLocation" style="width: 100%">
<Input v-model="formObj.receiveLocation" name="receiveLocation" placeholder="请选择架位号"/>
</Form-item>
<Form-item label="留存有效期:" prop="keepLimitTime" style="width: 100%">
<Date-picker v-model="formObj.keepLimitTime" @on-change="_ctimeChange" type="date" split-panels
placeholder="请选择留存有效期" name="keepLimitTime"></Date-picker>
</Form-item>
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
<sampleKeep ref="storageModal" @on-result-change="_storageData"></sampleKeep>
</div>
</template>
<script>
/**
* 添加编辑
*/
import ModalFooter from '../../../../components/base/modalFooter'
import { soilAptitude, soilEntrust, soilSample } from '../../../../api'
import sampleKeep from '../sampleKeep'
export default {
components: {
ModalFooter,
sampleKeep
},
data() {
return {
formId: '',
modalTitle: '留存位置选择',
formObj: {
receiveLocation: undefined,
keepLimitTime: undefined,
locationId: undefined
},
ruleValidate: {},
showEditModal: false,
ids: '',
options: [],
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
}
},
_storageModel() {
this.$refs.storageModal._open()
},
_storageData(data) {
this.$forceUpdate()
this.formObj.locationId = data.id
this.formObj.warehouse = data.warehouse
this.formObj.receiveLocation = data.name
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_resultChange(msg) {
this.showEditModal = false
this.$Message.success(msg)
this.$emit('on-result-change')
this._hideLoading()
},
_ctimeChange(data) {
this.formObj.keepLimitTime = data
},
_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.sampleRetain(data)
if (result) {
this._resultChange('留存成功!')
}
this.$refs.footerModal._hideLoading()
},
_save: async function(data) {
const result = await soilAptitude.standardSave(data)
if (result) {
this._resultChange('添加成功!')
}
},
_cancel() {
this._hideLoading()
this.showEditModal = false
},
_open(ids) {
this.formObj.receiveLocation = ''
this.formObj.warehouse = ''
this.formObj.keepLimitTime = undefined
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)
}
}
}
</script>
<!--检测项目编辑列表(添加、导入检测项目)-->
<template>
<div>
<Modal
v-model="showModal"
:mask-closable="false"
:width="690"
title="检测项目管理"
>
<Row>
<Col span="24">
<Form v-model="formObj" :label-width="90" inline onsubmit="return false">
<Form-item class="search-item" label="试验名称:" style="margin-left: -25px">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入试验名称" clearable />
</Form-item>
<!-- <Form-item class="search-item" label="检测依据:">-->
<!-- <Input v-model="formObj.code" placeholder="请输入检测依据名称" clearable @on-enter="_formSearch" />-->
<!-- </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" />
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilAptitude } from '../../../../api'
export default {
components: {},
data() {
return {
formObj: {
catalogueId: '',
name: '',
code: '',
standardCode: '',
standardName: ''
},
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 140 },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType', width: 140 },
{ title: '方法', key: 'testMethod', width: 180 }
// { title: '设备', key: 'device', width: 180 },
// { title: '检测依据', key: 'code', width: 180 },
// { title: '检测科室', key: 'groupName', width: 110 },
// { title: '比较符', key: 'compareSymbol', width: 120 },
// { title: '限值', key: 'limitValue' },
// { title: '单位', key: 'unit' },
// { title: '是否系统判定', key: 'judged', width: 120, judged: true },
// { title: '备注', key: 'remark' }
],
catalogueId: '',
getPage: {},
selectData: []
}
},
methods: {
_open(catalogueId, label) {
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.catalogueId = catalogueId
this.formObj.catalogueId = catalogueId
this.getPage.records = []
this.$refs.pageTable._hideLoading()
this._page()
// if (catalogueId) {
// this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_backData(data) {
console.log(typeof this.index)
this.getPage.records[this.index].code = data.code
this.$set(
this.getPage.records,
this.index,
this.getPage.records[this.index]
)
console.log(this.getPage.records)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_page: async function() {
// this.$refs.pageTable._page('search-form-package', 'FoodJudgeBasis/page')
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilAptitude.page(this.$serializeForm(this.formObj))
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this._deleteById(data.relPackageId)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
// _deleteOk: async function(id) {
// // const result = await drugCatalogueItem.deleteById(id)
// if (result) {
// this.$Message.success('删除成功')
// this._page()
// }
// },
// table结果 返回整行
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_ok() {
const data = this.selectData
if (data.length === 0) {
this._hideLoading()
this.$Message.warning('请选择至少一条数据!')
}
const ids = []
data.forEach(item => {
ids.push(item.id)
})
this._saveCatalogueItem(data)
},
_saveCatalogueItem(data) {
this.showModal = false
this._hideLoading()
this.$emit('on-result-change', data)
console.log('data------', data)
this._hideLoading()
},
_cancel() {
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<template>
<div>
<Modal v-model="showSampleModal" v-drag @on-visible-change="_visibleChange" width="1100"
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 './WaitReceive'
import WaitScan from './WaitScan'
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(this.entrustId, this.type)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.contractId, this.type)
},
// 已接收
_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>
<Modal v-model="showSampleModal" v-drag @on-visible-change="_visibleChange" width="1100"
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 './WaitReceiveHis'
import WaitScan from './AlreadyIssuedHis'
export default {
components: {
WaitReceive,
WaitScan
},
data() {
return {
type: '',
entrustId: '', // 合同id
showSampleModal: false,
modalTitle: '',
selectIds: [],
activeName: 'waitReceive',
name: ''
}
},
methods: {
_initTab() {
if (this.$showBtn('food-wait-Issue-sample')) {
this.activeName = 'waitScan'
this._waitSend()
}
},
_open(entrustId, type, name) {
this.type = type // 类型(采样或送样)
this.name = name
this.showSampleModal = true
this.entrustId = entrustId // 合同id
this.activeName = 'waitReceive'
this.selectIds = []
this._waitPage()
},
// 待接收
_waitPage() {
this.$refs.waitReceiveModal._open(this.entrustId, this.type)
},
// 待发放
_waitSend() {
this.$refs.waitScanModal._open(this.entrustId, this.type)
},
// 已接收
_issuedPage() {
this.$refs.alreadyIssuedModal._open(this.entrustId, 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>
<Modal v-model="showModal" v-drag width="1200">
<p slot="header">
{{ modalTitle }}
</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form id="search-sample-company" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试验名称:" class="search-item">
<Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入试验名称" clearable />
</Form-item>
<Form-item label="大类:" class="search-item">
<Input v-model="formObj.mainType" @on-enter="_formSearch" placeholder="请输入大类" clearable />
</Form-item>
<Form-item label="小类:" class="search-item">
<Input v-model="formObj.smallType" @on-enter="_formSearch" placeholder="请输入小类" clearable />
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">
搜索
</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" @on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:edit-render="item.editCell?{autofocus: 'input'}:null"
:fixed="item.fixed?item.fixed:undefined" sortable>
<template slot-scope="scope">
<div v-if="item.detail">
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div>
<div v-else-if="item.key==='epibolyItem'" @click.stop="_handleRow(scope)">
<el-select v-if="showOption" v-model="scope.row.epibolyItem" @change="_optionChange(scope.row)" placeholder="请选择">
<el-option
v-for="(item,index) in subOptions"
:key="index"
:label="item.label"
:value="index"
/>
</el-select>
<span v-if="!showOption">{{ scope.row[item.key]===0? '否':'是' }}</span>
</div>
<div v-else-if="item.key==='groupName'" @click="_handleRow(scope)">
<AutoCompletes v-model="scope.row.groupName" :handle-obj="scope.row" :down-data="groupoptions" @on-result-change="_selGroup"
style="editable:false" clearable
placeholder="请选择试验室" show-key="name"></AutoCompletes>
</div>
<div v-else-if="item.key==='status'">
{{ scope.row[item.key].display }}
</div>
<div v-else-if="item.judged">
{{ scope.row[item.key]===0? '否':'是' }}
</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==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
@blur="_codeEdit({id:scope.row.id, obj :{code:scope.row.code}})"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.row.id,scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
@blur="_compareSymbolEdit({id:scope.row.id, obj :{compareSymbol:scope.row.compareSymbol}})"
blur
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
@blur="_limitValueEdit({id:scope.row.id, obj :{limitValue:scope.row.limitValue}})"
blur
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
@blur="_unitEdit({id:scope.row.id, obj :{unit:scope.row.unit}})"
blur
placeholder="请输入单位"
/>
</div>
<div v-else>
{{ scope.row[item.key] }}
</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import http from '../../../../api/http'
import AutoCompletes from '../../../../components/base/AutoCompletes'
import { soilAptitude, soilEntrust } from '../../../../api'
export default {
components: { AutoCompletes },
data() {
return {
formId: 'SampleItemManage',
currentComponent: '',
btn: [],
iconMsg: [{ type: 'pt-a-end', id: '', name: '删除' }],
sampleId: '', // 样品id
showModal: false,
modalTitle: '管理检测项目',
selectIds: [],
groupoptions: [],
itemId: '',
index: '',
showOption: true,
searchOpen: true,
selectData: {},
getPage: {},
currentRow: '',
currentIndex: '',
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '关闭', type: 'primary' }
],
pageColumns: [
{ title: '试验名称', key: 'name', width: 160 },
{ title: '试验项目英文简写', key: 'shortName', width: 140 },
{ title: '试验科室', key: 'groupName', width: 140, editCell: true },
{ title: '大类', key: 'mainType', width: 140 },
{ title: '小类', key: 'smallType' },
{ title: '检测依据', key: 'testBasis', width: 180 },
{ title: '试验方法', key: 'testMethod', width: 180 },
{ title: '状态', key: 'status', width: 180 }
],
subOptions: [
{
value: '0',
label: '否'
},
{
value: '1',
label: '是'
}
],
dateList: [],
formObj: {
name: undefined,
sampleId: undefined,
code: undefined,
mainType: undefined,
smallType: undefined
}
}
},
computed: {
tableHeight: function() {
return this.$tableHeight('tableModal')
}
},
methods: {
_getGroupList: async function() {
const result = await soilAptitude.getGroupList()
if (result) {
this.groupoptions = result
}
},
_selGroup(msg, data, handleObj) {
console.log(handleObj)
if (msg === 'select') {
this.getPage.records[this.currentIndex].groupName = data.name
this.getPage.records[this.currentIndex].groupId = data.id
const tempData = {}
tempData.groupName = data.name
tempData.groupId = data.id
this._editItem(handleObj.id, tempData)
}
},
_editItem: async function(id, obj) {
const result = await soilEntrust.editItem({ id: id, obj: obj })
if (result) {
this.$Message.success('修改成功')
} else {
this.$Message.warning('修改失败')
}
},
_selectjudgeBasis(id, index) {
console.log(id)
this.itemId = id
this.index = index
this.$refs.EditModal._open()
},
_optionChange(data) {
console.log(data)
if (data.epibolyItem === 1) {
this._submit(data.id)
} else {
this._cancelSub(data.id)
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '关闭':
this._cancel()
break
}
},
_cancel() {
this.$emit('on-result-change')
this.$refs.pageTable._hideLoading()
this.$refs.footerModal._hideLoading()
this.showModal = false
},
_ok() {
console.log(this.getPage.records)
},
_modalResult(data1, data2) {
switch (this.currentComponent) {
case 'CopyModal':
if (data1 === 0) {
this._copySample(data2)
} else {
this._copyAll(data2)
}
break
default:
this._search()
}
},
_handleRow(data) {
this.currentRow = data.row
this.currentIndex = data.rowIndex
},
_dateChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '提交分包':
this._submitOutPack()
break
case '取消分包':
this._cancelOutPack()
break
case '添加':
this._editModal(false)
break
case '复制历史样品':
this._copyHisSample()
break
case '导入样品':
this._importSample()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '导出':
this._exportSample()
break
case '添加模拟样品':
this._editImitateModal(false)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_backData(data) {
this.getPage.records[this.index].code = data.code
this._codeEdit({ id: this.itemId, obj: { code: data.code } })
},
_codeEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_compareSymbolEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_limitValueEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_unitEdit: async function(data) {
const result = await soilEntrust.pageItemEdit(data)
if (result) {
this.$message.success('保存成功')
this._page()
} else {
this.$message.warning('保存失败')
}
},
_submitOutPack() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定分包这' + this.selectIds.length + '条',
onOk: () => {
this._submit()
}
})
}
},
_cancelOutPack() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定取消这' + this.selectIds.length + '条分包',
onOk: () => {
this._cancelSub()
}
})
}
},
_submit: async function(data) {
if (data !== undefined) {
this.selectIds = data
}
const result = await soilEntrust.submitOutPack(this.selectIds)
if (result) {
this._resultChange('分包成功')
}
},
_cancelSub: async function(data) {
if (data !== undefined) {
this.selectIds = data
}
const result = await soilEntrust.cancelOutPack(this.selectIds)
if (result) {
this._resultChange('取消分包成功')
}
},
_exportSample() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条样品')
} else {
this.$Modal.confirm({
title: '提示',
content: '确定导出这' + this.selectIds.length + '条样品',
onOk: () => {
http.open(
'/food/v1/sample/company/export',
{ ids: this.selectIds.join(',') },
'_blank'
)
}
})
}
},
_copyHisSample() {
this.$refs.refModal._open(this.sampleId)
},
_iconClick(res, data, componentName, index) {
this.currentComponent = componentName
this.$nextTick(function() {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '复制':
this._copy(data)
break
case '删除':
console.log(index)
this._deleteById(data.id)
break
case '导出样品委托协议':
this._exportAgreement(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_exportAgreement(id) {
this.$store
.dispatch(
'ReportExport/getById',
'food-contract-company-export-sample-agreement'
)
.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) {
const selectIds = []
switch (msg) {
case 'selectData':
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
// case 'iconClick':
// this._iconClick(data.name, data.rowData, data.componentName)
// break
case 'page':
this._page()
break
case 'changeSize':
this._page()
break
}
},
_open(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.sampleId = id // 委托id
this.$refs.pageTable._hideLoading()
this._getGroupList()
this._page()
},
_openRecord(id) {
this.formObj = this.$resetFields(this.formObj)
this.dateList = []
this.showModal = true
this.sampleId = id // 委托id
this.$refs.pageTable._hideLoading()
this.showOption = false
this._page()
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj = this.$serializeForm(this.formObj)
this.formObj.sampleId = this.sampleId
const result = await soilEntrust.pageItem(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
console.log(result)
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this._deleteOk(ids)
}
})
},
_deleteOk: async function(ids) {
const result = await soilEntrust.deleteById(ids)
if (result) {
this._resultChange('删除成功! ')
}
},
_deleteById(id) {
// 删除一条记录
this._deleteByIds([id])
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_detailModal(data) {},
_editModal(edit, data) {
if (edit) {
console.log(data)
this.$refs.sampleManageEdit._open(data)
// localStorage.setItem('type', data.type)
// // 编辑
// this.$store.dispatch('FoodSample/getByCompanyId', data.id).then(() => {
// const result = this.$store.state.FoodSample.companyModel
// if (data.type === 0) {
// // 普通企业样品
// this.$refs.refModal._open(result, this.sampleId)
// } else if (data.type === 3) {
// // 模拟样品
// this._editImitateModal(true, result)
// }
// })
} else {
// 添加
this.$refs.refModal._open('', this.sampleId)
}
},
// 添加编辑模拟样品
_editImitateModal(edit, data) {
if (edit) {
// 模拟样品的编辑
const tempData = JSON.parse(JSON.stringify(data)) // 深拷贝
this.$refs.imitateModal._open(tempData, this.sampleId)
} else {
// 模拟样品的添加
this.$refs.imitateModal._open('', this.sampleId)
}
},
_search() {
this._page()
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.$emit('on-result-change')
},
_copy(data) {
this.$refs.copyModal._open(data.id, data.type)
},
// 复制样品
_copySample(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopySample(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopySample(result)
}
})
},
_copyAll(data) {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
const result = this.$store.state.FoodSample.companyModel
if (data.type === 0) {
// 普通样品
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(function() {
this.$refs.refModal._openCopyAll(result)
})
} else if (data.type === 3) {
// 模拟样品
this.$refs.imitateModal._openCopyAll(result)
}
})
},
// 导入样品
_importSample() {
const data = {
importUrl: '/food/v1/sample/company/import_' + this.sampleId,
downloadUrl: '/food/v1/excel/template/FoodSampleCompany',
title: '导入'
}
this.$refs.refModal._open(data)
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(
this.selectIds,
this.selectData[0],
this.selectData
)
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, 'sample-rel-package-item')
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_operationRecord(id) {
// 操作日志
this.$refs.recordModal._open(id)
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form id="search-wait" :label-width="100" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入试样编号" clearable></Input>
</Form-item>
<Form-item label="是否有试验项目:" class="search-item">
<Select v-model="formObj.haveExp" clearable name="groupId" style="width:150px" placeholder="请选择是否有试验项目">
<Option v-for="(item,index) in itemData" :value="item.value" :key="index">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item label="筛选试样:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.experimentNames" name="experimentNames" placeholder="请输入试验项目" clearable></Input>
</Form-item>
<Form-item label="试验科室:" class="search-item">
<el-select @change="_selGroup" v-model="formObj.groupId" placeholder="请选择" clearable style="width: 100%">
<el-option
v-for="(item,index) in groupoptions"
:key="index"
:label="item.name"
:value="item.id"
/>
</el-select>
</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" :show-search-btn="true" class="contHide">
</btn-list>
</Col>
<Col span="24">
<PTVXETableHeight
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:iconMsg="iconMsg"
select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
: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.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
<!--选择领样人-->
<storageSelect ref="locationModal" @on-result-change="_page()"></storageSelect>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
<KeepAdress ref="keepAdressModal" @on-result-change="_page"></KeepAdress>
<SampleItemSelect ref="sampleItemSelectModal" @on-result-change="_itemImportBack" is-change />
</div>
</template>
<script>
import { soilAptitude, soilEntrust, soilSample } from '../../../../api'
import storageSelect from '../storageSelect'
import SampleItemSelect from './SampleItemSelect'
import SoilSampleItemManage from './SoilSampleItemManage'
import KeepAdress from './KeepAdress'
export default {
components: {
storageSelect,
SoilSampleItemManage,
KeepAdress,
SampleItemSelect
},
data() {
return {
btn: [
{ type: 'primary', id: '', name: '收样室收样' },
{ type: 'primary', id: '', name: '样品留存' },
{ type: 'primary', id: '', name: '导入试验项目' }
],
groupoptions: [],
selectIds: [],
getPage: {},
itemData: [
{
name: '是',
value: 1
},
{
name: '否',
value: 0
}
],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 120, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 100 },
{ title: '现场编号', key: 'siteNo', width: 100 },
{ title: '试验项目', key: 'experimentNames', width: 220 },
{ title: '土质描述', key: 'sampleDescribe', width: 205 },
{ title: '样品包装类型', key: 'samplePack', width: 120 },
{ title: '备注', key: 'remark', width: 210 }
],
iconMsg: [{ type: 'ios-list', id: '', name: '试验项目' }],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
indexList: [],
formObj: {
samplingNum: '',
name: '',
num: '',
detectType: '',
standard: '',
samplingLinkList: [],
haveExp: undefined,
groupName: undefined,
groupId: undefined
},
stdList: [],
sampleLinkList: [
{ value: 0, name: '食品生产' },
{ value: 1, name: '食品流通' },
{ value: 2, name: '餐饮服务' },
{ value: 3, name: '食用农产品' },
{ value: 4, name: '生产' },
{ value: 5, name: '流通' },
{ value: 6, name: '餐饮' }
],
searchOpen: true,
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
// this._getStdList()
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(','),
contractId: this.contractId
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'sampleReceiveSendMan':
// 接收并发放
this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData)
.then(() => {
this._resultChange('接收发放成功')
})
break
case 'sampleMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
_selGroup(data) {
console.log(data)
this.formObj.groupId = data
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_getGroupList: async function() {
const result = await soilAptitude.getGroupList()
if (result) {
this.groupoptions = result
}
},
_detailModal(id) {
// 查看
if (this.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)
})
})
}
},
_open(contractId, type) {
console.log('待接收样品')
this.formObj = this.$resetFields(this.formObj)
$('input[name=contractId]').val(contractId)
this.entrustId = contractId
this.type = type
this.selectIds = []
this.saveWayList = []
this.saveWayString = ''
this._getGroupList()
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
this.formObj.entrustId = this.entrustId
const result = await soilEntrust.pageReceive(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '试验项目':
this._itemManage(data.id)
break
case '复制':
this._copySample(data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '添加':
this._editModal(false)
break
case '接收并发放':
this._submitSend()
break
case '扫码接收':
this.$refs.refModal._open()
break
case '扫码接收并发放':
if (this.acceptSelectUserValue === '是') {
// 扫码接收并发放根据字典是否选人
this.$refs.userModal._open('sampleMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '收样室收样':
this._sampleReceive(this.selectIds)
break
case '样品留存':
this._sampleKeep(this.selectIds)
break
case '导入试验项目':
this._importItem()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this._cusTomePrint()
}
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择至少一条数据!')
} else {
this.$refs.sampleItemSelectModal._open()
}
},
_itemImportBack(data) {
console.log(data)
if (data.length > 0) {
const ids = []
for (let i = 0; i < data.length; i++) {
ids.push(data[i].id)
}
this._importItemOk(ids)
}
},
_importItemOk: async function(ids) {
const result = await soilSample.importExperiments({
aptitudeIds: ids.join(','),
ids: this.selectIds.join(',')
})
if (result) {
this.$Message.success('导入成功')
this._page()
}
},
// 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(
'sampleReceiveSendMan',
'请选择领样人'
)
}
})
} else {
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultChange('接收发放成功')
})
}
}
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择数据进行导出')
} else {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_deleteById(id) {
// 删除一条记录
this.$Modal.confirm({
title: '提示',
content: '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', id).then(() => {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
},
// 添加与编辑
_editModal(edit, data) {
if (edit) {
// 编辑
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.contractId,
'receive-his-wait'
)
})
})
}
} else {
// 添加
if (this.type === 0) {
// 企业
this.currentComponent = 'CompanySampleEdit'
} else {
// 政府和粮油
this.currentComponent = 'SampleGovernEdit'
}
this.$nextTick(() => {
// receive 标识,表示是样品接收的添加页面与其他普通样品的添加页面不同
this.$refs.refModal._open('', this.contractId, 'receive-his-wait')
})
}
},
// 复制样品
_copySample(data) {
this.$Modal.confirm({
title: '提示',
content: '确定要复制该样品信息?',
onOk: () => {
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.companyModel,
'receive-his-wait-copy'
)
})
})
}
}
})
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_sampleKeep(id) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const ids = id.join(',')
this.$refs.keepAdressModal._open(ids)
}
},
// 样品接收
_sampleReceive(id) {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const ids = id.join(',')
this.$refs.locationModal._open(ids)
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-wait'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form v-show="searchOpen" id="search-wait" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item">
<Input v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入试样编号" clearable @on-enter="_formSearch"></Input>
<input name="entrustId" type="hidden">
</Form-item>
<Form-item class="search-btn">
<Button type="primary" @click="_formSearch">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide" @on-result-change="_btnClick">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETableHeight
ref="pageTable"
:table-height="tableHeight"
:get-page="getPage"
:icon-msg="iconMsg"
select-data
@on-result-change="_tableResultChange">
<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.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd HH:MM:ss'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
<!--选择领样人-->
<SampleReceiveModal ref="locationModal" @on-result-change="_page()"></SampleReceiveModal>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
import SampleReceiveModal from '../SampleReceiveModal'
import SoilSampleItemManage from './SoilSampleItemManage'
export default {
components: { SampleReceiveModal, SoilSampleItemManage },
data() {
return {
btn: [
// { type: 'primary', id: '', name: '收样室收样' }
],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 95 },
{ title: '现场编号', key: 'siteNo', width: 100 },
{ title: '接收人', key: 'receiver', width: 120 },
{ title: '接收时间', key: 'receiveTime', width: 140, date: true },
{ title: '收样存储位置', key: 'receiveLocation', width: 140 },
{ title: '土质描述', key: 'sampleDescribe', width: 185 },
{ title: '样品包装类型', key: 'samplePack', width: 120 }
],
iconMsg: [{ type: 'ios-list', id: '', name: '试验项目' }],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
sampleCode: undefined,
name: undefined,
entrustId: ''
},
searchOpen: true,
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
// this._getStdList()
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(','),
contractId: this.contractId
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'sampleMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_open(entrustId, type) {
console.log('待接收样品')
this.formObj = this.$resetFields(this.formObj)
$('input[name=entrustId]').val(entrustId)
this.formObj.entrustId = entrustId
this.selectIds = []
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilEntrust.pageReceiveHis(this.formObj)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '试验项目':
this._itemManage(data.id)
break
case '复制':
this._copySample(data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_itemManage(data) {
// 管理检测项目
if (this.recordHis) {
this.$refs.sampleItemManage._openRecord(data)
} else {
this.$refs.sampleItemManage._open(data)
}
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '添加':
this._editModal(false)
break
case '接收并发放':
this._submitSend()
break
case '扫码接收':
this.$refs.refModal._open()
break
case '扫码接收并发放':
if (this.acceptSelectUserValue === '是') {
// 扫码接收并发放根据字典是否选人
this.$refs.userModal._open('sampleMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '收样室收样':
this._sampleReceive(this.selectIds)
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this._cusTomePrint()
}
break
case 'search':
this.searchOpen = !this.searchOpen
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(
'sampleReceiveSendMan',
'请选择领样人'
)
}
})
} else {
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultChange('接收发放成功')
})
}
}
},
_resultChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择数据进行导出')
} else {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_deleteById(id) {
// 删除一条记录
this.$Modal.confirm({
title: '提示',
content: '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', id).then(() => {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
},
// 添加与编辑
_editModal(edit, data) {
if (edit) {
// 编辑
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.contractId,
'receive-his-wait'
)
})
})
}
} else {
// 添加
if (this.type === 0) {
// 企业
this.currentComponent = 'CompanySampleEdit'
} else {
// 政府和粮油
this.currentComponent = 'SampleGovernEdit'
}
this.$nextTick(() => {
// receive 标识,表示是样品接收的添加页面与其他普通样品的添加页面不同
this.$refs.refModal._open('', this.contractId, 'receive-his-wait')
})
}
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_tableResultChange(msg, data) {
switch (msg) {
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
}
}
}
</script>
<template>
<div>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24" style="padding-bottom: 5px">
<Form id="search-wait-scan" :label-width="100" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="试样编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.sampleCode" name="sampleCode" placeholder="请输入样品编号" clearable></Input>
</Form-item>
<Form-item label="是否有试验项目:" class="search-item">
<Select v-model="formObj.haveExp" clearable name="groupId" style="width:150px" placeholder="请选择是否有试验项目">
<Option v-for="(item,index) in itemData" :value="item.value" :key="index">{{item.name}}</Option>
</Select>
</Form-item>
<Form-item label="筛选试样:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.experimentNames" name="experimentNames" placeholder="请输入试验项目" clearable></Input>
</Form-item>
<Form-item label="试验科室:" class="search-item">
<el-select @change="_selGroup" v-model="formObj.groupId" placeholder="请选择" clearable style="width: 100%">
<el-option
v-for="(item,index) in groupoptions"
:key="index"
:label="item.name"
:value="item.id"
/>
</el-select>
</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" :show-search-btn="true" class="contHide">
<!--<template slot="processTask">-->
<!--<div class="fr process-task">-->
<!--<Button @click="_exportReceiveRecord">导出交接记录</Button>-->
<!--</div>-->
<!--</template>-->
</btn-list>
</Col>
<Col span="24">
<PTVXETableHeight
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.id)">{{scope.row[item.key]}}</a></div>
<div v-else-if="item.key ==='shape'">{{scope.row['shape']}} {{scope.row['shapeRemark']}}</div>
<div v-else-if="item.date">
{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETableHeight>
</Col>
</Row>
</div>
<!--选择领样人-->
</div>
</template>
<script>
import { soilAptitude, soilEntrust } from '../../../../api'
export default {
components: {},
data() {
return {
btn: [
{ type: 'primary', id: '', name: '发放' },
{ type: 'primary', id: '', name: '发放到高级试验' }
],
selectIds: [],
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 100, fixed: 'left' },
{ title: '试样深度', key: 'sampleDepth', width: 95 },
{ title: '现场编号', key: 'siteNo', width: 100 },
{ title: '试验项目', key: 'experimentNames', width: 225 },
{ title: '土质描述', key: 'sampleDescribe', width: 185 },
{ title: '样品包装类型', key: 'samplePack', width: 120 }
],
iconMsg: [{ type: 'md-cloud-download', id: '', name: '导出样品交接单' }],
type: '',
contractId: '', // 合同id
selectData: [],
currentComponent: '',
formObj: {
samplingNum: '',
name: '',
num: '',
detectType: '',
standard: '',
samplingLinkList: [],
haveExp: undefined,
groupName: undefined,
groupId: undefined,
experimentNames: undefined
},
stdList: [],
groupoptions: [],
sampleLinkList: [
{ value: 0, name: '食品生产' },
{ value: 1, name: '食品流通' },
{ value: 2, name: '餐饮服务' },
{ value: 3, name: '食用农产品' },
{ value: 4, name: '生产' },
{ value: 5, name: '流通' },
{ value: 6, name: '餐饮' }
],
itemData: [
{
name: '是',
value: 1
},
{
name: '否',
value: 0
}
],
searchOpen: true,
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
} else {
}
return this.$tableHeight('tableModal')
}
},
mounted() {
// this._getStdList()
// 样品接收是否选择人员
// 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 'sampleSendMan':
// 发放
this.$store.dispatch('FoodSample/submitSend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'sampleScanSend':
// 扫码接收并发放
this.$refs.refModal._open('扫码发放', data)
break
}
},
_selectSampleLink(data) {
console.log(data)
},
_selGroup(data) {
console.log(data)
this.formObj.groupId = data
},
_getGroupList: async function() {
const result = await soilAptitude.getGroupList()
if (result) {
this.groupoptions = result
}
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
case 'ReceiveScan':
// 扫码接收
this._searchTop()
break
default:
this._search()
}
},
_detailModal(id) {
// 查看
if (this.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)
})
})
}
},
_open(contractId, type) {
this.formObj = this.$resetFields(this.formObj)
$('input[name=contractId]').val(contractId)
this.entrustId = contractId
this.type = type
this.selectIds = []
this._getGroupList()
this.$nextTick(() => {
this._page()
})
},
_page: async function() {
this.selectData = []
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj.entrustId = this.entrustId
const result = await soilEntrust.pageSend(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
this._editModal(true, data)
break
case '导出样品交接单':
console.log(data)
break
case '复制':
this._copySample(data)
break
case '操作日志':
this.$refs.refModal._open(data.id)
break
case '删除':
this._deleteById(data.id)
break
case '附件':
this.$refs.refModal._open(data.id, 'sampleId')
break
}
})
},
_btnClick(msg, currentComponent) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case '发放':
this._submitSend()
break
case '发放到高级试验':
this._send()
break
case '扫码发放':
this._oneKeySend()
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '接收':
this._sampleReceive()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this._cusTomePrint()
}
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
})
},
// 扫码发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 扫码发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('sampleScanSend', '请选择领样人')
} else {
// 扫码发放
this.$refs.refModal._open('扫码发放')
}
}
},
// 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.$message.warning('请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
const data = {
ids: this.selectIds.join(',')
}
this.$store.dispatch('FoodSample/submitSendCheck', data).then(() => {
const result = this.$store.state.FoodSample.success
if (result) {
// 验证成功
this.$refs.userModal._open('sampleSendMan', '请选择领样人')
}
})
} else {
const data = {
ids: this.selectIds.join(',')
}
this.$Modal.confirm({
title: '提示',
content: '确定要发放这 ' + this.selectIds.length + ' 条数据?',
onOk: () => {
this._sendSample(data)
}
})
}
}
},
_sendSample: async function(data) {
const result = await soilEntrust.sendSample(data)
if (result) {
this._resultChange('发放成功')
}
},
_send() {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
console.log(this.selectData)
}
},
_resultChange(msg) {
this._page()
this.$Message.success(msg)
this.selectIds = []
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择数据进行导出')
} else {
// eslint-disable-next-line no-undef
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
_deleteById(id) {
// 删除一条记录
this.$Modal.confirm({
title: '提示',
content: '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', id).then(() => {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success('删除成功!')
}
})
}
})
},
// 添加与编辑
_editModal(edit, data) {
if (edit) {
// 编辑
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store.dispatch('FoodSample/getByGovernId', data.id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-wait-send'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(function() {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
this.contractId,
'receive-his-wait'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
this.contractId,
'receive-wait-send'
)
})
})
}
} else {
// 添加
if (this.type === 0) {
// 企业
this.currentComponent = 'CompanySampleEdit'
} else {
// 政府和粮油
this.currentComponent = 'SampleGovernEdit'
}
this.$nextTick(() => {
// receive 标识,表示是样品接收的添加页面与其他普通样品的添加页面不同
this.$refs.refModal._open('', this.contractId, 'receive-wait-send')
})
}
},
// 复制样品
_copySample(data) {
this.$Modal.confirm({
title: '提示',
content: '确定要复制该样品信息?',
onOk: () => {
if (data.type === 1) {
// 政府
this.currentComponent = 'SampleGovernEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else if (data.type === 2) {
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else {
this.currentComponent = 'CompanySampleEdit'
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$nextTick(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.companyModel,
'receive-his-wait-copy'
)
})
})
}
}
})
},
_search() {
this._page()
},
// 刷新上级页面
_searchTop() {
this._page()
this.$emit('on-result-change')
},
_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 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
// 样品接收
_sampleReceive() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
const tempData = {
ids: this.selectIds.join(',')
}
this.$Modal.confirm({
title: '提示',
content: '确定要接收这 ' + this.selectIds.length + ' 条数据?',
onOk: () => {
this.$store
.dispatch('FoodSample/batchSaveReceive', tempData)
.then(() => {
if (this.$store.state.FoodSample.success) {
this.$Message.success('提交成功!')
this.selectData = []
this._searchTop()
}
})
}
})
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
})
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds)
})
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
break
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.formObj.standard = data
break
case 'query':
this.formObj.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-wait-scan'))
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="showModal"
:mask-closable="false"
:width="690"
title="留存位置"
>
<Row>
<Col span="24">
<Form v-model="formObj" :label-width="90" inline onsubmit="return false">
<Form-item class="search-item" label="库房号:" style="margin-left: -25px">
<Input v-model="formObj.warehouse" @on-enter="_formSearch" placeholder="请输入库房号" clearable />
</Form-item>
<!-- <Form-item class="search-item" label="检测依据:">-->
<!-- <Input v-model="formObj.code" placeholder="请输入检测依据名称" clearable @on-enter="_formSearch" />-->
<!-- </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" />
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" :hide-checkbox="true" :is-radio="true" 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">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='type'">
{{scope.row[item.key]===0?'待检':scope.row[item.key]===1?'备样':scope.row[item.key]===2?'备用': ''}}
</div>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilEntrust, soilSample } from '../../../api'
export default {
components: {},
data() {
return {
formObj: {},
ids: '',
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
pageColumns: [
{ title: '库房名', key: 'warehouse', width: 140 },
{ title: '货架号', key: 'name', width: 140 },
{ title: '位置分类', key: 'type', width: 140 }
// { title: '设备', key: 'device', width: 180 },
// { title: '检测依据', key: 'code', width: 180 },
// { title: '检测科室', key: 'groupName', width: 110 },
// { title: '比较符', key: 'compareSymbol', width: 120 },
// { title: '限值', key: 'limitValue' },
// { title: '单位', key: 'unit' },
// { title: '是否系统判定', key: 'judged', width: 120, judged: true },
// { title: '备注', key: 'remark' }
],
catalogueId: '',
getPage: {},
selectData: []
}
},
methods: {
_open(ids) {
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.getPage.records = []
this.$refs.pageTable._hideLoading()
this.selectData = {}
this.ids = ids
this._page()
// if (catalogueId) {
// this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_backData(data) {
console.log(typeof this.index)
this.getPage.records[this.index].code = data.code
this.$set(
this.getPage.records,
this.index,
this.getPage.records[this.index]
)
console.log(this.getPage.records)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.aloneWarehouseLocation(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this._deleteById(data.relPackageId)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
// _deleteOk: async function(id) {
// // const result = await drugCatalogueItem.deleteById(id)
// if (result) {
// this.$Message.success('删除成功')
// this._page()
// }
// },
// table结果 返回整行
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
break
case 'singleSelect':
this.selectData = {}
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_ok() {
const data = this.selectData
console.log('data', data)
if (data.id) {
this.showModal = false
this.$emit('on-result-change', data)
this._hideLoading()
} else {
this.$Message.warning('请选择收样位置')
this._hideLoading()
}
// const ids = []
// data.forEach(item => {
// ids.push(item.id)
// })
// console.log('this.selectData', this.formObj)
},
_receive: async function(data) {
const result = await soilEntrust.receiveSample(data)
if (result) {
this.$refs.footerModal._hideLoading()
this.showModal = false
this.$Message.success('成功收样')
this.$emit('on-result-change')
}
this._hideLoading()
},
_cancel() {
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
<!--检测项目编辑列表(添加、导入检测项目)-->
<template>
<div>
<Modal
v-model="showModal"
:mask-closable="false"
:width="690"
title="收样位置"
>
<Row>
<Col span="24">
<Form v-model="formObj" :label-width="90" inline onsubmit="return false">
<Form-item class="search-item" label="库房号:" style="margin-left: -25px">
<Input v-model="formObj.warehouse" @on-enter="_formSearch" placeholder="请输入库房号" clearable />
</Form-item>
<!-- <Form-item class="search-item" label="检测依据:">-->
<!-- <Input v-model="formObj.code" placeholder="请输入检测依据名称" clearable @on-enter="_formSearch" />-->
<!-- </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" />
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable ref="pageTable" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" :hide-checkbox="true" :is-radio="true" 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">
<span v-if="item.key==='judged'">
{{ scope.row[item.key]===1?'是':'否' }}
</span>
<div v-else-if="item.key==='type'">
{{scope.row[item.key]===0?'待检':scope.row[item.key]===1?'备样':scope.row[item.key]===2?'备用': ''}}
</div>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.compareSymbol"
placeholder="请输入比较符"
/>
</div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.limitValue"
placeholder="请输入限值"
/>
</div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.unit"
placeholder="请输入单位"
/>
</div>
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input
v-model="scope.row.code"
style="width: 130px;"
blur
placeholder="请选择检测依据"
/>
<i @click.stop="_selectjudgeBasis(scope.$index)" style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search"></i>
</div>
<span v-else>
{{ scope.row[item.key] }}
</span>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult" />
</div>
</Modal>
</div>
</template>
<script>
import { soilEntrust, soilSample } from '../../../api'
export default {
components: {},
data() {
return {
formObj: {},
ids: '',
showModal: false,
searchOpen: false,
btn: [],
index: '',
iconMsg: [],
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '确定', type: 'primary' }
],
pageColumns: [
{ title: '库房名', key: 'warehouse', width: 140 },
{ title: '货架号', key: 'name', width: 140 },
{ title: '位置分类', key: 'type', width: 140 }
// { title: '设备', key: 'device', width: 180 },
// { title: '检测依据', key: 'code', width: 180 },
// { title: '检测科室', key: 'groupName', width: 110 },
// { title: '比较符', key: 'compareSymbol', width: 120 },
// { title: '限值', key: 'limitValue' },
// { title: '单位', key: 'unit' },
// { title: '是否系统判定', key: 'judged', width: 120, judged: true },
// { title: '备注', key: 'remark' }
],
catalogueId: '',
getPage: {},
selectData: []
}
},
methods: {
_open(ids) {
this.formObj = this.$resetFields(this.formObj)
this.showModal = true
this.getPage.records = []
this.$refs.pageTable._hideLoading()
this.selectData = {}
this.ids = ids
this._page()
// if (catalogueId) {
// this._page()
// }
},
_handleRow(scope) {
console.log(scope)
},
_selectjudgeBasis(index) {
console.log(index)
this.index = index
this.$refs.EditModal._open()
},
_backData(data) {
console.log(typeof this.index)
this.getPage.records[this.index].code = data.code
this.$set(
this.getPage.records,
this.index,
this.getPage.records[this.index]
)
console.log(this.getPage.records)
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '确定':
this._ok()
break
}
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
const result = await soilSample.aloneWarehouseLocation(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_btnClick(msg) {
switch (msg) {
case '导入检测项目':
this.$refs.relItemModal._open(this.catalogueId)
break
}
},
// 操作列操作
_iconClick(res, data) {
switch (res) {
case '删除':
this._deleteById(data.relPackageId)
break
}
},
// 删除
_deleteById(id) {
this.$Modal.confirm({
title: '提示',
content: '确定删除该数据?',
onOk: () => {
this._deleteOk(id)
}
})
},
// _deleteOk: async function(id) {
// // const result = await drugCatalogueItem.deleteById(id)
// if (result) {
// this.$Message.success('删除成功')
// this._page()
// }
// },
// table结果 返回整行
_tableResultChange(msg, data) {
console.log(msg, data)
switch (msg) {
case 'page':
this._page()
break
case 'selectData':
this.selectData = data
break
case 'singleSelect':
this.selectData = {}
this.selectData = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData)
break
case 'changeSize':
this._page()
break
}
},
_ok() {
const data = this.selectData
console.log('data', data)
if (data.id) {
this.formObj.receiveLocation = data.name
this.formObj.warehouse = data.warehouse
this.formObj.locationId = data.id
this.formObj.ids = this.ids
this._receive(this.formObj)
} else {
this.$Message.warning('请选择收样位置')
this._hideLoading()
}
// const ids = []
// data.forEach(item => {
// ids.push(item.id)
// })
// console.log('this.selectData', this.formObj)
},
_receive: async function(data) {
const result = await soilEntrust.receiveSample(data)
if (result) {
this.$refs.footerModal._hideLoading()
this.showModal = false
this.$Message.success('成功收样')
this.$emit('on-result-change')
}
this._hideLoading()
},
_cancel() {
this.selectData = []
this.showModal = false
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
}
}
}
</script>
......@@ -385,7 +385,29 @@ export default {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
console.log(this.selectData)
this._sendToAlone()
}
},
_sendToAlone() {
if (this.selectIds.length === 0) {
this.$message.warning('请至少选择一条数据!')
} else {
const data = {
ids: this.selectIds.join(',')
}
this.$Modal.confirm({
title: '提示',
content: '确定要发放这 ' + this.selectIds.length + ' 条数据?',
onOk: () => {
this._sendAloneKeep(data)
}
})
}
},
_sendAloneKeep: async function(data) {
const result = await soilEntrust.aloneKeepSample(data)
if (result) {
this._resultChange('发放成功')
}
},
_resultChange(msg) {
......
......@@ -13,6 +13,7 @@ import StorehousePlace from '../pages/soil-alone-sample-manage/storehouse-place-
import StorehouseSample from '../pages/soil-alone-sample-manage/storehouse-sample-manage/AddressManage'
import ReviewEntrust from '../pages/meter-entrust/entrust-review/ReviewEntrust'
import SampleReceiveIndex from '../pages/soil-sample-manage/sample-receive/SampleReceiveIndex'
import AloneKeepIndex from '../pages/soil-sample-manage/sample-alone-keep/SampleReceiveIndex'
import SamplePreparationIndex from '../pages/soil-sample-manage/sample-preparation/SamplePreparationIndex'
import SamplePreparationCheckIndex from '../pages/soil-sample-manage/sample-preparation-check/SamplePreparationIndex'
import AddressManage from '../pages/soil-sample-manage/sample-address/AddressManage'
......@@ -111,6 +112,11 @@ export default [
meta: { title: '样品分波' }
},
{
path: 'alone_keep',
component: AloneKeepIndex,
meta: { title: '独立留存' }
},
{
path: 'prepare',
component: SamplePreparationIndex,
meta: { title: '开土制备' }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment