Commit 1122094a by lichengming

修改了中海油服项目

parent 7099ca8d
...@@ -8,6 +8,7 @@ import { https } from '../https' ...@@ -8,6 +8,7 @@ import { https } from '../https'
export default { export default {
// page // page
page: data => http.post('soil/v1/entrust/page', data).then(res => res), page: data => http.post('soil/v1/entrust/page', data).then(res => res),
pageItem: data => http.post('soil/v1/experiment/page', data).then(res => res),
pageReview: data => pageReview: data =>
http.post('soil/v1/entrust/page_review', data).then(res => res), http.post('soil/v1/entrust/page_review', data).then(res => res),
pageSampleReceive: data => pageSampleReceive: data =>
...@@ -68,5 +69,17 @@ export default { ...@@ -68,5 +69,17 @@ export default {
photoView: data => photoView: data =>
http http
.get('soil/v1/sample_photo/view?objectKey=' + data.objectKey) .get('soil/v1/sample_photo/view?objectKey=' + data.objectKey)
.then(res => res) .then(res => res),
// 试样制备表
preparePage: data =>
http
.post('soil/v1/sample/obtain_prepare_data?ids=' + data)
.then(res => res),
// 试样制备完成
savePrepare: data =>
https
.post('soil/v1/sample/prepare_ok', JSON.stringify(data))
.then(res => res),
// 试验室按样品分页列表
pageTake: data => http.post('soil/v1/sample/page_take', data).then(res => res)
} }
...@@ -123,17 +123,17 @@ ...@@ -123,17 +123,17 @@
</Spin> </Spin>
</div> </div>
<!--图片预览--> <!--图片预览-->
<!-- <div>--> <div>
<!-- <vue-gallery-slideshow :images="imgViewList" :index="imgViewIndex"--> <vue-gallery-slideshow :images="imgViewList" :index="imgViewIndex"
<!-- @close="imgViewIndex = null"></vue-gallery-slideshow>--> @close="imgViewIndex = null"></vue-gallery-slideshow>
<!-- </div>--> </div>
</div> </div>
</template> </template>
<script> <script>
// import VueGallerySlideshow from 'vue-gallery-slideshow' // import VueGallerySlideshow from 'vue-gallery-slideshow'
import global from '../../../api/config' import global from '../../../api/config'
import { meterEntrust, soilEntrust } from '../../../api' import { meterEntrust } from '../../../api'
/** /**
* 公共组件modal 弹框(支持上传,下载,预览,删除附件等操作) * 公共组件modal 弹框(支持上传,下载,预览,删除附件等操作)
*/ */
...@@ -217,6 +217,7 @@ export default { ...@@ -217,6 +217,7 @@ export default {
this.idsObj = idsObj this.idsObj = idsObj
this.urlData = data this.urlData = data
this.action = global.baseURL + data.uploadFileUrl + data.id this.action = global.baseURL + data.uploadFileUrl + data.id
this.downloadFileUrlFile = data.downloadFileUrl
this.$nextTick(() => { this.$nextTick(() => {
this._page() this._page()
}) })
...@@ -294,14 +295,18 @@ export default { ...@@ -294,14 +295,18 @@ export default {
} }
}, },
// 预览图片(该合同下所有的) // 预览图片(该合同下所有的)
// _viewImg(data) { _viewImg(data) {
_viewImg: async function(data) { // _viewImg: async function(data) {
console.log(data) // console.log(data)
const viewKey = {} // const viewKey = {}
viewKey.objectKey = data.objectKey // viewKey.objectKey = data.objectKey
console.log(viewKey) // console.log(viewKey)
const result = await soilEntrust.photoView(viewKey) // const result = await soilEntrust.photoView(viewKey)
console.log(result) // console.log(result)
const imgViewList = []
imgViewList.push(global.baseURL + this.downloadFileUrlFile + data.id)
this.imgViewList = imgViewList
this.imgViewIndex = 0
// if (this.urlData.viewUri === '/meter/v1/entrust_attachment/preview/') { // if (this.urlData.viewUri === '/meter/v1/entrust_attachment/preview/') {
// const id = data.entrustId // const id = data.entrustId
// const result = await meterEntrust.entrustPreview(id) // const result = await meterEntrust.entrustPreview(id)
......
...@@ -8,6 +8,12 @@ ...@@ -8,6 +8,12 @@
<Form-item label="试验名称" prop="name" class="width-48"> <Form-item label="试验名称" prop="name" class="width-48">
<Input v-model="formObj.name" name="name" placeholder="请输入试验名称"/> <Input v-model="formObj.name" name="name" placeholder="请输入试验名称"/>
</Form-item> </Form-item>
<Form-item label="检测科室" prop="groupName" class="width-48">
<Input v-model="formObj.groupName" name="groupName" placeholder="请输入试验名称"/>
</Form-item>
<Form-item label="检测依据" prop="testBasis" class="width-48">
<Input v-model="formObj.testBasis" name="testBasis" placeholder="请输入试验名称"/>
</Form-item>
<Form-item label="英文名称" prop="elName" class="width-48"> <Form-item label="英文名称" prop="elName" class="width-48">
<Input v-model="formObj.elName" name="elName" <Input v-model="formObj.elName" name="elName"
placeholder="请输入英文名称"/> placeholder="请输入英文名称"/>
...@@ -57,7 +63,9 @@ export default { ...@@ -57,7 +63,9 @@ export default {
shortName: '', shortName: '',
mainType: '', mainType: '',
smallType: '', smallType: '',
testMethod: '' testMethod: '',
groupName: '',
testBasis: ''
}, },
ruleValidate: { ruleValidate: {
name: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }] name: [{ required: true, message: '项目名称不能为空', trigger: 'blur' }]
......
...@@ -9,16 +9,16 @@ ...@@ -9,16 +9,16 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form v-show="searchOpen" id="search-sample-company" inline onsubmit="return false" :label-width="90"> <Form id="search-sample-company" v-show="searchOpen" :label-width="90" inline onsubmit="return false">
<label class="label-sign"></label> <label class="label-sign"></label>
<Form-item label="检测项目:" class="search-item"> <Form-item label="检测项目:" class="search-item">
<Input v-model="formObj.name" placeholder="请输入检测项目" clearable @on-enter="_formSearch" /> <Input v-model="formObj.name" @on-enter="_formSearch" placeholder="请输入检测项目" clearable />
</Form-item> </Form-item>
<Form-item label="检测依据:" class="search-item"> <Form-item label="检测依据:" class="search-item">
<Input v-model="formObj.code" placeholder="请输入检测依据" clearable @on-enter="_formSearch" /> <Input v-model="formObj.code" @on-enter="_formSearch" placeholder="请输入检测依据" clearable />
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_formSearch"> <Button @click="_formSearch" type="primary">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" class="contHide" :open="searchOpen" show-search-btn="true" @on-result-change="_btnClick"></btn-list> <btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" class="contHide" show-search-btn="true"></btn-list>
</Col> </Col>
<!-- 表格 --> <!-- 表格 -->
<Col span="24"> <Col span="24">
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a> <a @click.stop="_detailModal(scope.row)">{{ scope.row[item.key] }}</a>
</div> </div>
<div v-else-if="item.key==='epibolyItem'" @click.stop="_handleRow(scope)"> <div v-else-if="item.key==='epibolyItem'" @click.stop="_handleRow(scope)">
<el-select v-if="showOption" v-model="scope.row.epibolyItem" placeholder="请选择" @change="_optionChange(scope.row)"> <el-select v-if="showOption" v-model="scope.row.epibolyItem" @change="_optionChange(scope.row)" placeholder="请选择">
<el-option <el-option
v-for="(item,index) in subOptions" v-for="(item,index) in subOptions"
:key="index" :key="index"
...@@ -66,35 +66,35 @@ ...@@ -66,35 +66,35 @@
<div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)"> <div v-else-if="item.key==='code'" @click.stop="_handleRow(scope)">
<el-input <el-input
v-model="scope.row.code" v-model="scope.row.code"
@blur="_codeEdit({id:scope.row.id, obj :{code:scope.row.code}})"
style="width: 130px;" style="width: 130px;"
blur blur
placeholder="请选择检测依据" placeholder="请选择检测依据"
@blur="_codeEdit({id:scope.row.id, obj :{code:scope.row.code}})"
/> />
<i style="cursor: pointer;font-size: 14px;" class="icons iconfont pt-search icon-search" @click.stop="_selectjudgeBasis(scope.row.id,scope.$index)"></i> <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>
<div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)"> <div v-else-if="item.key==='compareSymbol'" @click.stop="_handleRow(scope)">
<el-input <el-input
v-model="scope.row.compareSymbol" v-model="scope.row.compareSymbol"
@blur="_compareSymbolEdit({id:scope.row.id, obj :{compareSymbol:scope.row.compareSymbol}})"
blur blur
placeholder="请输入比较符" placeholder="请输入比较符"
@blur="_compareSymbolEdit({id:scope.row.id, obj :{compareSymbol:scope.row.compareSymbol}})"
/> />
</div> </div>
<div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)"> <div v-else-if="item.key==='limitValue'" @click.stop="_handleRow(scope)">
<el-input <el-input
v-model="scope.row.limitValue" v-model="scope.row.limitValue"
@blur="_limitValueEdit({id:scope.row.id, obj :{limitValue:scope.row.limitValue}})"
blur blur
placeholder="请输入限值" placeholder="请输入限值"
@blur="_limitValueEdit({id:scope.row.id, obj :{limitValue:scope.row.limitValue}})"
/> />
</div> </div>
<div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)"> <div v-else-if="item.key==='unit'" @click.stop="_handleRow(scope)">
<el-input <el-input
v-model="scope.row.unit" v-model="scope.row.unit"
@blur="_unitEdit({id:scope.row.id, obj :{unit:scope.row.unit}})"
blur blur
placeholder="请输入单位" placeholder="请输入单位"
@blur="_unitEdit({id:scope.row.id, obj :{unit:scope.row.unit}})"
/> />
</div> </div>
<div v-else> <div v-else>
...@@ -472,7 +472,9 @@ export default { ...@@ -472,7 +472,9 @@ export default {
Object.assign(this.formObj, this.$refs.pageTable._searchParams()) Object.assign(this.formObj, this.$refs.pageTable._searchParams())
this.formObj = this.$serializeForm(this.formObj) this.formObj = this.$serializeForm(this.formObj)
this.formObj.sampleId = this.sampleId this.formObj.sampleId = this.sampleId
const result = await soilEntrust.page(this.$serializeForm(this.formObj)) const result = await soilEntrust.pageItem(
this.$serializeForm(this.formObj)
)
if (result) { if (result) {
this.$refs.pageTable._hideLoading() this.$refs.pageTable._hideLoading()
this.getPage = result this.getPage = result
......
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
</Modal> </Modal>
<SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage> <SoilSampleItemManage ref="sampleItemManage" @on-result-change="_page"></SoilSampleItemManage>
<DescribeDetailModal ref="writeDetailModal" @on-result-change="_page"></DescribeDetailModal> <DescribeDetailModal ref="writeDetailModal" @on-result-change="_page"></DescribeDetailModal>
<PreparationModal ref="preModal" @on-result-change="_page"></PreparationModal>
</div> </div>
</template> </template>
<script> <script>
...@@ -87,9 +88,10 @@ import { soilEntrust } from '../../api' ...@@ -87,9 +88,10 @@ import { soilEntrust } from '../../api'
import { getLodop } from '../../plugins/clodop/LodopFuncs' import { getLodop } from '../../plugins/clodop/LodopFuncs'
import SoilSampleItemManage from './SoilSampleItemManage' import SoilSampleItemManage from './SoilSampleItemManage'
import DescribeDetailModal from './sample-preparation/DescribeDetailModal' import DescribeDetailModal from './sample-preparation/DescribeDetailModal'
import PreparationModal from './sample-preparation/Preparation'
let LODOP let LODOP
export default { export default {
components: { SoilSampleItemManage, DescribeDetailModal }, components: { SoilSampleItemManage, DescribeDetailModal, PreparationModal },
data() { data() {
return { return {
formId: 'soilSampleManage', formId: 'soilSampleManage',
...@@ -244,6 +246,7 @@ export default { ...@@ -244,6 +246,7 @@ export default {
this._printLabel() this._printLabel()
break break
case '试样制备': case '试样制备':
this._samplePre()
break break
case '批量填写土质描述详情': case '批量填写土质描述详情':
this._writeDetail(this.selectIds) this._writeDetail(this.selectIds)
...@@ -266,6 +269,13 @@ export default { ...@@ -266,6 +269,13 @@ export default {
} }
}) })
}, },
_samplePre() {
if (this.selectIds.length === 0) {
this.$message.warning('至少选择一条数据')
} else {
this.$refs.preModal._open(this.selectIds.join(','))
}
},
_writeDetail(id) { _writeDetail(id) {
if (this.selectIds.length === 0) { if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!') this.$Message.warning('请至少选中一条样品数据!')
......
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="100" class="zIndex-1000 full-screen">
<p slot="header">制备</p>
<Row>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" class="contHide"></btn-list>
</Col>
<!--内容-->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange"
:form-id="formId"
select-data
is-edit
hide-page>
<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.key==='prepareWay'" @click="_handleRow(scope)">
<AutoComplete v-model="scope.row.prepareWay" :downData="preparationWayData" :wayData="wayData"
:handleObj="scope" @on-result-change="_preparationChange" clearable
placeholder="输入或选择制备方式"></AutoComplete>
</div>
<div v-else-if="item.key==='unit'" @click="_handleRow(scope)">
<el-input v-model="scope.row.unit" name="unit" placeholder="输入或选择单位">
</el-input>
</div>
<div v-else-if="item.key==='quantity'" @click="_handleRow(scope)">
<el-input v-model="scope.row.quantity" name="quantity" placeholder="输入数量">
</el-input>
</div>
<span v-else-if="item.key==='type'">{{ scope.row[item.key]===0? '检样':'备样' }}</span>
<div v-else-if="item.key==='keepWay'" @click="_handleRow(scope)">
<AutoComplete v-model="scope.row.keepWay" :handleObj="scope" :downData="saveWayData"
@on-result-change="_saveChange" clearable
placeholder="输入或选择保存方式" show-key="name"></AutoComplete>
</div>
<div v-else-if="item.key==='keepContainer'" @click="_handleRow(scope)">
<AutoComplete v-model="scope.row.keepContainer" :handleObj="scope" :downData="packList"
@on-result-change="_packSaveChange" clearable
placeholder="输入或选择保存容器" show-key="name"></AutoComplete>
</div>
<!-- <div v-else-if="item.key==='prepareDate'">-->
<!-- <Date-picker v-model="scope.row.prepareDate" type="date" style="width:100%;"-->
<!-- placeholder="请选择日期"></Date-picker>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='prepareDate' && isAccurate === '是'" @click="_handleRow(scope)">-->
<!-- <date-picker :editable="false" :transfer="true" v-model="scope.row.prepareDate" type="datetime"-->
<!-- placeholder="选择时间"-->
<!-- format="yyyy-MM-dd HH:mm" style="width:100%"></date-picker>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='prepareDate' && isAccurate === '否'" @click="_handleRow(scope)">-->
<!-- <date-picker :editable="false" :transfer="true" v-model="scope.row.prepareDate" type="datetime"-->
<!-- placeholder="选择时间"-->
<!-- format="yyyy-MM-dd" style="width:100%"></date-picker>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='prepareDate' && !isAccurate" @click="_handleRow(scope)">-->
<!-- <date-picker :editable="false" :transfer="true" v-model="scope.row.prepareDate" type="datetime"-->
<!-- placeholder="选择时间"-->
<!-- format="yyyy-MM-dd" style="width:100%"></date-picker>-->
<!-- </div>-->
<!-- <div v-else-if="item.key==='prepareDate'" @click="_handleRow(scope)">-->
<!-- <el-date-picker-->
<!-- v-model="scope.row.prepareDate"-->
<!-- @change="timeChange($event)"-->
<!-- type="datetime"-->
<!-- size="mini"-->
<!-- placeholder="选择日期时间">-->
<!-- </el-date-picker>-->
<!-- </div>-->
<div v-else-if="item.key==='preparer'" @click="_handleRow(scope)">
<el-input v-model="scope.row.preparer" @focus="_handleRow(scope)"
placeholder="制备人" size="small" name="preparer"></el-input>
</div>
<div v-else-if="item.key==='remark'" @click="_handleRow(scope)">
<el-input v-model="scope.row.remark" @focus="_handleRow(scope)" placeholder="备注"
size="small"></el-input>
</div>
<span v-else>{{scope.row[item.key]}}</span>
</template>
<!--只读模板-->
<template v-slot="scope">
<div v-if="item.key==='prepareDate' && isAccurate === '是'">
<div>
{{scope.row.prepareDate?$dateformat(scope.row.preparationDate,'yyyy-mm-dd HH:MM'):''}}
</div>
</div>
<div v-else-if="item.key==='prepareDate' && isAccurate === '否'">
<div>
{{scope.row.prepareDate?$dateformat(scope.row.preparationDate,'yyyy-mm-dd'):''}}
</div>
</div>
<div v-else-if="item.key==='prepareDate' && !isAccurate">
<div>
{{scope.row.prepareDate?$dateformat(scope.row.preparationDate,'yyyy-mm-dd'):''}}
</div>
</div>
<div v-else-if="item.key==='num'">
<div v-if="scope.row.itemPreparation===0">{{scope.row[item.key]}}</div>
<div v-else-if="scope.row.itemPreparation===1" class="red-color">
{{scope.row[item.key]}}
</div>
</div>
<span v-else-if="item.key==='type'">{{ scope.row[item.key]===0? '检样':'备样' }}</span>
<span v-else-if="item.key==='status'">{{ scope.row[item.key].display }}</span>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
<!--打印标签-->
<!--选择人员-->
</Modal>
</div>
</template>
<script>
import AutoComplete from '../../../components/base/AutoCompletes'
import Global from '../../../api/config'
import { soilEntrust } from '../../../api'
export default {
components: {
AutoComplete
},
data() {
return {
formId: 'preparationModal',
showModal: false,
wayData: new Map(),
formObj: {},
tableHeight: document.documentElement.clientHeight - 215,
footerList: [],
list: [
{ name: '取消', type: '', id: '' },
// {name: '仅流转微生物', type: 'primary', id: ''},
{ name: '制备完成', type: 'primary', id: '' }
],
btn: [
{ type: 'success', id: '', name: '打印标签' },
{ type: 'error', id: '', name: '删除' }
],
iconMsg: [
{ type: 'md-create', id: '', name: '批量赋值' },
{ type: 'md-trash', id: '', name: '删除' }
],
getPage: {
records: []
},
selectData: [],
selectIds: [],
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 130 },
{ title: '试样深度', key: 'sampleDepth', width: 130 },
{ title: '检验科室', key: 'groupName', width: 130 },
// 暂时屏蔽
// {title: '打印份数', key: 'printNum', width: 110},
{ title: '制备类型', key: 'type', width: 130 },
{
title: '制备方式',
key: 'prepareWay',
width: 130,
editCell: true
},
{
title: '制备数量',
key: 'quantity',
width: 150,
editCell: true
},
{ title: '单位', key: 'unit', width: 110, editCell: true },
{ title: '状态', key: 'status', width: 150 },
{ title: '保存方式', key: 'keepWay', width: 150, editCell: true },
{ title: '保存容器', key: 'keepContainer', width: 150, editCell: true },
{
title: '制备时间',
key: 'prepareDate',
width: 200,
editCell: true
},
{
title: '制备人',
key: 'preparer',
width: 130,
editCell: true
},
{ title: '备注', key: 'remark', width: 150, editCell: true }
],
currentRow: {},
preparationWayData: [],
resultStateWayData: [],
saveWayData: [],
sampleIds: '',
unitData: [],
locationList: [],
packList: [],
isAccurate: ''
}
},
methods: {
// 获取存储位置
_locationChange(msg, data, handleObj) {
this.currentRow = handleObj
switch (msg) {
case 'select':
this.$set(this.currentRow, 'storePlace', data)
break
case 'query':
this.$set(this.currentRow, 'storePlace', data)
this._getLocation(data)
break
case 'focus':
this._getLocation()
break
}
},
_getLocation(data) {
const obj = {}
if (data) {
obj.storePlace = data
}
this.$store
.dispatch('FoodSamplePreparation/getPositionList', obj)
.then(() => {
this.locationList = this.$store.state.FoodSamplePreparation.list
})
},
// 单位
_unitChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.unit = data
break
case 'query':
this.currentRow.unit = data
break
}
},
// 多个参数查询
_dicSearch() {
const data = [
'制备单位',
'制备方式',
'制备后状态',
'保存方式',
'制备保存容器',
'制备时间是否精确至时分'
]
this.$store.dispatch('LmsBaseDict/listDict', data).then(() => {
const result = this.$store.state.LmsBaseDict.list
// 0-数据录入常用单位
for (let j = 0; j < result[0].length; j++) {
this.unitData.push(result[0][j].name)
}
// 1-制备方式
for (let j = 0; j < result[1].length; j++) {
this.preparationWayData.push(result[1][j].name)
this.wayData.set(result[1][j].name, result[1][j].code)
}
// 2-制备后状态
this.resultStateWayData = result[2]
// 3-保存方式
this.saveWayData = result[3]
// 4-制备保存容器
this.packList = result[4]
// 5-制备时间是否精确至时分
this.isAccurate = result[5][0].name
})
},
_preparationChange(msg, data, handleObj) {
this._handleRow(handleObj)
this.currentRow.prepareWay = data
},
_testItemChange(msg, data, handleObj) {
this._handleRow(handleObj)
this.currentRow.resultState = data.name
},
_saveChange(msg, data, handleObj) {
this._handleRow(handleObj)
this.currentRow.keepWay = data.name
},
timeChange(data) {
console.log(data)
this.currentRow.prepareDate = data
},
_packSaveChange(msg, data, handleObj) {
this._handleRow(handleObj)
this.currentRow.keepContainer = data.name
},
_open(sampleIds) {
this.sampleIds = sampleIds
console.log(this.sampleIds)
this.showModal = true
this.getPage.records = []
this.unitData = []
this.footerList = []
for (let i = 0; i < this.list.length; i++) {
if (this.$showBtn(this.list[i].id)) {
this.footerList.push(this.list[i])
}
}
this._page()
// this._dicSearch()
},
_page: async function() {
const result = await soilEntrust.preparePage(this.sampleIds)
if (result) {
console.log(result)
this.$refs.pageTable._hideLoading()
this.getPage.records = result
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '仅流转微生物':
this._changeMic()
break
case '制备完成':
this._ok()
break
}
},
_cancel() {
this.showModal = false
this._hideLoading()
},
_changeMic() {
const preList = []
for (let i = 0; i < this.getPage.records.length; i++) {
const obj = {
groupName: this.getPage.records[i].groupName,
groupId: this.getPage.records[i].groupId,
sampleId: this.getPage.records[i].sampleId,
itemName: this.getPage.records[i].itemName,
resultQuantity: this.getPage.records[i].resultQuantity,
preparationWay: this.getPage.records[i].preparationWay,
unit: this.getPage.records[i].unit,
remark: this.getPage.records[i].remark,
resultState: this.getPage.records[i].resultState,
saveWay: this.getPage.records[i].saveWay,
pack: this.getPage.records[i].pack,
storePlace: this.getPage.records[i].storePlace,
preparationDate: this.getPage.records[i].preparationDate,
sampleQuantity: this.getPage.records[i].sampleQuantity,
preparationPerson: this.getPage.records[i].preparationPerson,
preparationPersonId: this.getPage.records[i].preparationPersonId
}
if (this.getPage.records[i].id) {
obj.id = this.getPage.records[i].id
}
preList.push(obj)
}
this.$store
.dispatch('FoodSamplePreparation/saveBatch', {
foodSamplePreparationList: preList,
flag: 1
})
.then(() => {
if (this.$store.state.FoodSamplePreparation.success) {
this.showModal = false
this.$Message.success('操作成功')
this.$emit('on-result-change')
}
this.$refs.footerModal._hideLoading()
})
},
_ok() {
console.log(this.getPage.records)
const prepareList = []
for (let i = 0; i < this.getPage.records.length; i++) {
prepareList.push(this.getPage.records[i])
}
this.save({ prepareList: prepareList })
// const preList = []
// for (let i = 0; i < this.getPage.records.length; i++) {
// const reg = /^[0-9]+([.]{1}[0-9]+){0,1}$/
// if (!reg.test(this.getPage.records[i].resultQuantity)) {
// this.$Message.warning('制备数量请输入数字')
// this._hideLoading()
// return
// }
// const obj = {
// groupName: this.getPage.records[i].groupName
// }
// if (this.getPage.records[i].id) {
// obj.id = this.getPage.records[i].id
// }
// preList.push(obj)
// }
},
save: async function(data) {
const result = await soilEntrust.savePrepare(data)
console.log(result)
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_tableResultChange(msg, data) {
const user = Global.getUserInfo()
switch (msg) {
case 'page':
let times = ''
const list = this.$store.state.FoodSample.list
console.log(list)
for (let i = 0; i < list.length; i++) {
this.getPage.records.push({
currentIndex: i,
id: list[i].id === undefined ? '' : list[i].id,
num: list[i].num,
name: list[i].name,
groupName: list[i].groupName,
groupId: list[i].groupId,
itemName: list[i].itemName,
preparationWay: list[i].preparationWay,
receiveQuantity: list[i].receiveQuantity,
resultQuantity: list[i].resultQuantity
? list[i].resultQuantity
: 0,
unit: list[i].unit,
resultState: list[i].resultState ? list[i].resultState : '泥状',
saveWay: list[i].saveWay ? list[i].saveWay : '冷冻',
pack: list[i].pack ? list[i].pack : '',
storePlace: list[i].storePlace ? list[i].storePlace : '',
preparationDate: list[i].preparationDate
? list[i].preparationDate
: (times =
times === ''
? new Date()
: new Date(
new Date(times).getTime() +
Math.round(Math.random() * 1 * 5) * 1000
)),
remark: list[i].remark,
sampleQuantity: list[i].sampleQuantity
? list[i].sampleQuantity
: '',
preparationPerson: list[i].preparationPerson
? list[i].preparationPerson
: user.realname,
preparationPersonId: list[i].preparationPersonId
? list[i].preparationPersonId
: user.id,
sampleId: list[i].sampleId,
resultDate: list[i].resultDate,
groupNameRel: list[i].groupNameRel,
contractName: list[i].contractName,
printNum: 1,
itemPreparation: list[i].itemPreparation
})
}
this.$refs.pageTable._hideLoading()
break
case 'selectData':
this.selectData = data
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
break
case 'iconClick':
this._iconClick(
data.name,
data.rowData,
data.componentName,
data.rowIndex
)
break
}
},
_btnClick(msg) {
switch (msg) {
case '打印标签':
if (this.selectData.length > 0) {
this.$refs.printer._open()
} else {
this.$Message.warning('请至少选择一条数据')
}
break
case '删除':
this._deleteSelected()
break
}
},
_printerResult(data) {
this.$refs.printNumber._open(this.selectData, data.printerVal)
},
_deleteSelected() {
// 批量删除
const selectData = this.selectData
if (selectData.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(
selectData,
'确定删除 ' + selectData.length + ' 条记录?'
)
}
},
_iconClick(res, data, componentName, rowIndex) {
this.currentRow = data
switch (res) {
case '批量赋值':
this._copyPlan(data)
break
case '删除':
this._deleteByIds([data])
break
}
},
_deleteByIds(rows, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
for (let i = 0; i < rows.length; i++) {
const index = this.getPage.records.indexOf(rows[i])
this.getPage.records.splice(index, 1)
}
this.$Message.success('操作成功')
this.selectData = []
this.selectIds = []
}
})
},
_selectStaff() {
this.$refs.userModal._open('preparationPerson')
},
_userData(data) {
// 选择人员返回数据
this.currentRow.preparationPerson = data.realname
this.currentRow.preparationPersonId = data.userId
},
// 批量赋值(这里用index判断,不用id是因为id有时候没有值,而且id不能随意赋值)
_copyPlan(data) {
const ids = this.selectData
const records = this.getPage.records
if (ids.length === 0) {
this.$Message.warning('请勾选数据进行赋值!')
} else {
for (let i = 0; i < ids.length; i++) {
for (let j = 0; j < records.length; j++) {
if (ids[i].currentIndex === records[j].currentIndex) {
this._singleCopy(j, data)
}
}
}
}
},
// 单独赋值信息
_singleCopy(j, data) {
const tempData = {
preparationWay: data.preparationWay,
resultQuantity: data.resultQuantity ? data.resultQuantity : 0,
unit: data.unit,
resultState: data.resultState ? data.resultState : '',
saveWay: data.saveWay ? data.saveWay : '',
pack: data.pack ? data.pack : '',
storePlace: data.storePlace ? data.storePlace : '',
printNum: data.printNum ? data.printNum : 1,
remark: data.remark ? data.remark : ''
}
this.getPage.records[j].preparationWay = tempData.preparationWay
this.getPage.records[j].resultQuantity = tempData.resultQuantity
this.getPage.records[j].unit = tempData.unit
this.getPage.records[j].resultState = tempData.resultState
this.getPage.records[j].saveWay = tempData.saveWay
this.getPage.records[j].pack = tempData.pack
this.getPage.records[j].storePlace = tempData.storePlace
this.getPage.records[j].printNum = tempData.printNum
this.getPage.records[j].remark = tempData.remark
},
// 操作的序号
_handleRow(data) {
this.currentRow = data.row
}
}
}
</script>
...@@ -60,7 +60,11 @@ import Operation from '../../../components/operation/Operation' ...@@ -60,7 +60,11 @@ import Operation from '../../../components/operation/Operation'
import SoilSampleManage from '../SoilSampleManage' import SoilSampleManage from '../SoilSampleManage'
import SamplePreparationEdit from './SamplePreparationEdit' import SamplePreparationEdit from './SamplePreparationEdit'
export default { export default {
components: { Operation, SamplePreparationEdit, SoilSampleManage }, components: {
Operation,
SamplePreparationEdit,
SoilSampleManage
},
data() { data() {
return { return {
currentComponent: '', currentComponent: '',
......
<template>
<div>
<Modal v-model="showModal" width="100" class="modal-footer-none full-screen">
<p slot="header">{{modalTitle}}</p>
<div>
<!--内容-->
<Row>
<!--查询-->
<Col span="24">
<Form :label-width="110" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item label="样品编号:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.num" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item label="样品名称:" class="search-item">
<Input @on-enter="_formSearch" v-model="formObj.sampleName" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" @on-result-change="_btnClick" :show-search-btn="true" class="contHide">
<template slot="processTask">
<div class="fr process-task">
<el-checkbox v-model="formObj.onlyAbort" @change="_page" :true-label="1"
:false-label="0" size="medium">查看终止项目
</el-checkbox>
</div>
</template>
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable" :tableHeight="tableHeight" @on-result-change="_tableResultChange"
:getPage="getPage"
is-edit
is-group
select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
:edit-render="item.editCell?{autofocus: 'input'}:null"
sortable
>
<!--可编辑模板-->
<template v-slot:edit="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.sampleId)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.status">{{scope.row[item.key] === undefined ?'':scope.row[item.key].display}}
</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='epibolyItem'">{{scope.row.epibolyItem?'是':'否'}}</div>
<div v-else-if="item.key==='qualified'">{{scope.row.qualified?scope.row.qualified.display:''}}</div>
<!--科室 start-->
<div v-else-if="item.key==='groupName'">
<el-select v-model="scope.row.groupName" @change="_groupChange" @click.native.stop="_handleRow(scope)"
transfer
size="small">
<el-option :label="item.name" :value="item.name" v-for="item in groupData"
:key="item.name"></el-option>
</el-select>
</div>
<!--科室 end-->
<!--检测依据简称 start-->
<div v-else-if="item.key==='testBasisSm'">
<el-select v-model="scope.row.testBasisSm"
@change="_saveTestBasisSm(scope)"
placeholder="请选择检测依据简称"
size="small"
style="width:100%">
<el-option
v-for="item in testBasisSmList"
:key="item"
:label="item"
:value="item">
</el-option>
</el-select>
</div>
<!--检测依据简称 end-->
<!--检测依据名+号 start-->
<div v-else-if="item.key==='testBasisAndName'">
<AutoCompletesTestBasis :value="scope.row.testBasisAndName" :downData="testBasisData"
@on-result-change="_testBasisChange" :handleObj="scope"
placeholder="请选择检测依据" focus blur
></AutoCompletesTestBasis>
</div>
<!--检测依据名+号 end-->
<!--检测方法 start-->
<div v-else-if="item.key==='testMethod'">
<AutoCompletes :value="scope.row.testMethod" :downData="testMethodData"
@on-result-change="_testMethodChange" :handleObj="scope"
placeholder="请选择检测方法" focus blur show-key="testMethod"
></AutoCompletes>
</div>
<!--检测方法 end-->
<div v-else>{{scope.row[item.key]}}</div>
</template>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.sampleId)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.status">{{scope.row[item.key] === undefined ?'':scope.row[item.key].display}}
</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.key==='epibolyItem'">{{scope.row.epibolyItem?'是':'否'}}</div>
<div v-else-if="item.key==='qualified'">{{scope.row.qualified?scope.row.qualified.display:''}}</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</Modal>
</div>
</template>
<script>
/* 查看样品(企业和政府) */
import { soilEntrust } from '../../../api'
export default {
components: {},
data() {
return {
showModal: false,
selectData: [],
selectIds: [],
modalTitle: '检测项目',
type: '', // 判断是企业或政府委托
getPage: {},
pageColumns: [
{ title: '产品', key: 'subClass', width: 200, fixed: 'left' },
{ title: '样品编号', key: 'num', width: 180, detail: true },
{ title: '样品名称', key: 'sampleName', width: 120 },
{ title: '样品大类', key: 'firstClass', width: 130 },
{ title: '样品细类', key: 'detectType', width: 120 },
{ title: '抽样单编号', key: 'samplingNum', width: 140 },
{ title: '检测项目', key: 'name', width: 200 },
{ title: '状态', key: 'progress', width: 120, status: true },
{ title: '检测科室', key: 'groupName', width: 130, editCell: true },
{ title: '省局项目ID', key: 'provinceItemId', width: 120 },
{
title: '检测依据简称',
key: 'testBasisSm',
width: 200,
editCell: true
},
{
title: '检测依据',
key: 'testBasisAndName',
width: 300,
editCell: true
},
{ title: '检测方法', key: 'testMethod', width: 200, editCell: true },
{ title: '判定依据', key: 'judgeBasisAndName', width: 300 },
{ title: '检测值', key: 'testValue', width: 120 },
{ title: '单位', key: 'unit', width: 120 },
{ title: '结果判定', key: 'qualified', width: 120 },
{ title: '检出限', key: 'detection', width: 120 },
{ title: '限量', key: 'limitDefault', width: 120 },
{ title: '是否分包', key: 'epibolyItem', width: 120 },
{ title: '接收日期', key: 'receiveDate', width: 120, date: true },
{ title: '抽样日期', key: 'samplingDate', width: 120, date: true },
{ title: '签发人', key: 'issuer', width: 120 },
{ title: '签发日期', key: 'issueDate', width: 120, date: true },
{ title: '下单日期', key: 'ctime', width: 120, date: true },
{ title: '说明', key: 'labRemark', width: 200 },
{ title: '备注', key: 'remark' }
],
btn: [
// {type: 'primary', id: 'food-sampling-list-item-match', name: '匹配省抽项目'},
{
type: 'error',
id: 'ZBC',
name: '删除'
}
// {type: '', id: 'food-sampling-list-reset-sc-id', name: '重置省局ID',},
],
formObj: {
contractId: '',
samplingNum: '',
name: '',
num: '',
samplingDateBegin: '',
samplingDateEnd: '',
receiveDateBegin: '',
receiveDateEnd: '',
ctimeBegin: '',
ctimeEnd: '',
testBasis: '',
detectType: '',
mateTestBasisSm: 0,
hasProvinceId: 0,
groupIds: '',
sampleName: '',
firstClass: '',
onlyAbort: 0,
qced: 0
},
receiveDateList: [],
ctimeList: [],
samplingDateList: [],
searchOpen: false,
groupData: [],
testBasisSmList: [],
testBasisData: [],
testMethodData: [],
currentRow: {},
judgeList: [{ name: '是', value: 1 }, { name: '否', value: 0 }],
// 检测科室
selectGroupData: []
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 320)
} else {
return this.$tableHeight('', 175)
}
}
},
mounted() {
// this._getGroup()
},
methods: {
// 搜索项检测科室变化
_groupDataChange(data) {
this.formObj.groupIds = data.join(',')
},
_handleRow(data) {
this.currentRow = data.row
},
// 科室
_getGroup() {
this.$store.dispatch('LmsUserGroup/list').then(() => {
this.groupData = this.$store.state.LmsUserGroup.list
})
},
// 选择科室
_groupChange(e) {
const obj = this.groupData.find(item => item.name === e)
if (obj) {
this.$set(this.currentRow, 'groupId', obj.id)
this.$set(this.currentRow, 'groupName', obj.name)
}
this._save()
},
// 获取方法简称
_getTestBasisSm(data) {
this.$store
.dispatch('FoodItem/listAbbreviationByItem', { ids: data.row.id })
.then(() => {
const result = this.$store.state.FoodItem.list
if (result) {
this.testBasisSmList = result
} else {
this.testBasisSmList = []
}
})
},
// 方法简称(只是这个界面同批量的方法一样)
_saveTestBasisSm(data) {
this.currentRow = data.row
this.$store
.dispatch('FoodItem/assignmentAbbreviation', {
ids: this.currentRow.id,
abbreviation: this.currentRow.testBasisSm
})
.then(() => {
const result = this.$store.state.FoodItem.success
if (result) {
// 不要刷新表格,只刷新当前行数据
this.$store
.dispatch('FoodItem/getItemByContract', {
id: this.currentRow.id,
contractId: this.formObj.contractId,
page: 1,
rows: 1,
qced: 0
})
.then(() => {
const newObj = this.$store.state.FoodItem.page.records
if (newObj && newObj.length > 0) {
this.$set(
this.currentRow,
'testBasisAndName',
newObj[0].testBasisAndName ? newObj[0].testBasisAndName : ''
)
this.$set(
this.currentRow,
'testBasisId',
newObj[0].testBasisId ? newObj[0].testBasisId : ''
)
this.$set(
this.currentRow,
'testBasisName',
newObj[0].testBasisName ? newObj[0].testBasisName : ''
)
this.$set(
this.currentRow,
'testBasis',
newObj[0].testBasis ? newObj[0].testBasis : ''
)
this.$set(
this.currentRow,
'testMethod',
newObj[0].testMethod ? newObj[0].testMethod : ''
)
this.$set(
this.currentRow,
'groupName',
newObj[0].groupName ? newObj[0].groupName : ''
)
this.$set(
this.currentRow,
'groupId',
newObj[0].groupId ? newObj[0].groupId : ''
)
}
})
}
})
},
// 获取检测依据
_testBasisList(data) {
const obj = {}
if (this.currentRow.name) {
obj.name = this.currentRow.name
} else {
// 没有填检测项目检测依据的下拉就为空
this.testBasisData = []
return
}
if (data) {
obj.testBasis = data
}
this.$store.dispatch('FoodAptitudeItem/getTestBasis', obj).then(() => {
this.testBasisData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测依据结果
_testBasisChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.currentRow.testBasisAndName =
data.testBasis + ' ' + data.testBasisName
this.currentRow.testBasis = data.testBasis
this.currentRow.testBasisId = data.stdId
this.currentRow.testBasisName = data.testBasisName
this.currentRow.groupId = data.groupId
? data.groupId
: this.groupData[0].id
this.currentRow.groupName = data.groupName
? data.groupName
: this.groupData[0].name
this._save()
break
case 'query':
this.currentRow.testBasisAndName = data
// 只要搜索就清空已填的值
this.currentRow.testBasisName = ''
this.currentRow.testBasisId = ''
this.currentRow.testBasis = ''
this._testBasisList(data)
break
case 'focus':
this._testBasisList()
break
case 'blur':
// 如果没有依据,则清空
if (this.currentRow.testBasisId === '') {
this.currentRow.testBasisAndName = ''
}
this._save()
break
}
},
// 获取检测方法
_testMethodList(testMethod) {
const obj = {}
if (this.currentRow.name && this.currentRow.testBasisId) {
obj.name = this.currentRow.name
obj.stdId = this.currentRow.testBasisId
} else {
this.testMethodData = []
return
}
if (testMethod) {
obj.testMethod = testMethod
}
this.$store.dispatch('FoodAptitudeItem/getTestMethod', obj).then(() => {
this.testMethodData = this.$store.state.FoodAptitudeItem.list
})
},
// 检测方法结果
_testMethodChange(msg, data, handleObj) {
this._handleRow(handleObj)
switch (msg) {
case 'select':
this.$set(this.currentRow, 'testMethod', data.testMethod)
// testMethodTemp 临时存在
this.$set(this.currentRow, 'testMethodTemp', data.testMethod)
// 查询科室
this.$store
.dispatch('FoodAptitudeItem/getGroupInfo', {
name: this.currentRow.name,
stdId: this.currentRow.testBasisId,
testMethod: this.currentRow.testMethod
})
.then(() => {
const groupObj = this.$store.state.FoodAptitudeItem.model
this.$set(this.currentRow, 'groupId', groupObj.groupId)
this.$set(this.currentRow, 'groupName', groupObj.groupName)
this._save()
})
break
case 'query':
this.$set(this.currentRow, 'testMethod', data.testMethod)
this.$set(this.currentRow, 'testMethodTemp', '')
this._testMethodList(data.testMethod)
break
case 'focus':
this._testMethodList()
break
case 'blur':
// 只能选择检测方法
if (
this.currentRow.testMethodTemp === '' ||
this.currentRow.testMethodTemp === undefined
) {
this.$set(this.currentRow, 'testMethod', '')
}
this._save()
break
}
},
// 抽样日期
_samplingDateChange(data) {
this.formObj.samplingDateBegin = data[0]
this.formObj.samplingDateEnd = data[1]
},
// 接收日期
_receiveChange(data) {
this.formObj.receiveDateBegin = data[0]
this.formObj.receiveDateEnd = data[1]
},
// 下单日期
_ctimeChange(data) {
this.formObj.ctimeBegin = data[0]
this.formObj.ctimeEnd = data[1]
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodItem.page
this.selectIds = []
break
case 'selectData':
const selectIds = []
for (let i = 0; i < data.length; i++) {
selectIds.push(data[i].id)
}
this.selectIds = selectIds
this.selectData = data
break
case 'changeSize':
this._page()
break
}
},
_btnClick(msg) {
switch (msg) {
case '匹配省抽项目':
this._matchItem()
break
case '删除':
this._deleteSelected()
break
case '选择依据简称':
this._selTestBasisSm()
break
case '重置省局ID':
this._resetScId()
break
case '终止':
this._operateItem(msg)
break
case '恢复终止项目':
this._operateItem(msg)
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
// 恢复、终止
_operateItem(name) {
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else if (name === '终止') {
this.$Modal.confirm({
title: '提示',
content: '确定要' + name + '这 ' + ids.length + ' 条项目?',
onOk: () => {
this.$refs.reasonModal._open('终止原因')
}
})
} else if (name === '恢复终止项目') {
this.$store
.dispatch('FoodItem/restoreVerification', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodItem.success
this._restore(result)
})
}
},
// 终止项目恢复
_restore(result) {
if (result !== '') {
this.$Modal.confirm({
title: '提示',
content: result,
onOk: () => {
this.$store
.dispatch('FoodItem/projectRestore', {
ids: this.selectIds.join(','),
contractId: this.formObj.contractId,
deleteReport: 1
})
.then(() => {
this._resultChange('恢复成功!')
})
}
})
} else {
this.$store
.dispatch('FoodItem/projectRestore', {
ids: this.selectIds.join(','),
contractId: this.formObj.contractId,
deleteReport: 0
})
.then(() => {
this._resultChange('恢复成功!')
})
}
},
// 原因返回的结果
_reasonResult(data, msg) {
const temp = {
reason: data,
ids: this.selectIds.join(','),
contractId: this.formObj.contractId
}
if (msg === '终止原因') {
this.$store.dispatch('FoodItem/archivesStop', temp).then(() => {
this._resultChange('终止成功!')
})
}
},
_resetScId() {
if (this.selectIds.length === 0) {
this.$Modal.confirm({
title: '提示',
content: '请确认是否重置整个任务下所有检测项目的省局ID?',
onOk: () => {
this._resetScIdOk()
}
})
} else {
this._resetScIdOk()
}
},
_resetScIdOk() {
const obj = { contractId: this.formObj.contractId }
if (this.selectIds.length) {
obj.ids = this.selectIds.join(',')
}
this.$store.dispatch('FoodItem/resetProvinceItemId', obj).then(() => {
if (this.$store.state.FoodItem.success) {
this.$Message.success('操作成功!')
this._page()
}
})
},
// 选择检测依据简称
_selTestBasisSm() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条检测项目!')
} else {
this.$store
.dispatch('FoodItem/listAbbreviationByItem', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodItem.list
// 弹出选择框
this.$refs.basisSmModal._open(this.selectIds, result)
})
}
},
_matchItem() {
const list = this.selectData
for (let i = 0; i < list.length; i++) {
const obj = this.selectData.find(item => item.name !== list[i].name)
if (obj) {
this.$Modal.confirm({
title: '提示',
content:
'一次只能手动匹配同一分类下的同一项目,您选中的检测项目名称不同,是否继续?',
onOk: () => {
this.$refs.matchModal._open(
this.selectIds,
this.formObj.contractId
)
}
})
return
}
}
this.$refs.matchModal._open(this.selectIds, this.formObj.contractId)
},
_matchChange(msg) {
switch (msg) {
case 'page':
this._page()
break
case 'manual':
this.$refs.tabModal._open(
this.formObj.contractId,
this.selectIds,
this.selectData[0].samplingNum,
this.selectData[0].provinceClassifyId
)
break
}
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content,
onOk: () => {
this.$store
.dispatch('FoodItem/deleteItemByIds', { ids: ids.join(',') })
.then(() => {
this._resultChange('删除成功!')
})
}
})
},
_resultChange(msg) {
if (this.$store.state.FoodItem.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
this.$emit('on-result-change')
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.page(this.$serializeForm(this.formObj))
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_open(id, type) {
this.formObj = this.$resetFields(this.formObj)
this.formObj.hasProvinceId = 0
this.formObj.mateTestBasisSm = 0
this.formObj.onlyAbort = 0
this.formObj.contractId = id
this.receiveDateList = []
this.ctimeList = []
this.samplingDateList = []
this.type = type
this.showModal = true
this.currentRow = {}
this.selectGroupData = []
this._page()
},
_detailModal(id) {
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$refs.governSampleDetail._open(
this.$store.state.FoodSample.governModel
)
})
},
// 保存 除结果判定(除手工判定)
_save() {
let tempBool = true
setTimeout(() => {
if (tempBool) {
this.$refs.pageTable._showLoading()
}
}, 1500)
const item = this.currentRow
const obj = {
unit: item.unit,
testMethod: item.testMethod,
limitDefault: item.limitDefault,
limitValue: item.limitValue,
compareSymbol: item.compareSymbol,
limitType: item.limitType,
judged: item.judged,
detection: item.detection,
labRemark: item.labRemark,
microbeN: item.microbeN ? item.microbeN : 0,
microbeC: item.microbeC ? item.microbeC : 0,
microbeM: item.microbeM ? item.microbeM : 0,
microbeBm: item.microbeBm ? item.microbeBm : 0,
qualified: item.qualified.value,
subClass: item.subClass,
testBasisSm: item.testBasisSm,
testBasisName: item.testBasisName,
testBasis: item.testBasis,
singleConclusion: item.singleConclusion,
groupId: item.groupId,
groupName: item.groupName
}
if (item.testBasisId) {
obj.testBasisId = item.testBasisId
}
if (item.judgeBasisId) {
obj.judgeBasisId = item.judgeBasisId
obj.judgeBasis = item.judgeBasis
obj.judgeBasisName = item.judgeBasisName
} else {
obj.judgeBasis = item.judgeBasis
obj.judgeBasisName = item.judgeBasisName
}
const data = {
id: item.id,
obj: obj
}
this.$store.dispatch('FoodItem/itemEdit', data).then(() => {
if (this.$store.state.FoodItem.success) {
tempBool = false
this.$refs.pageTable._hideLoading()
} else {
this.$Message.error('保存失败')
tempBool = false
this.$refs.pageTable._hideLoading()
}
})
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="按委托接收" name="entrust">
<ReceiveByEntrust ref="entrustTabs"></ReceiveByEntrust>
</el-tab-pane>
<el-tab-pane label="按样品接收" name="sample">
<ReceiveBySample ref="sampleTabs"></ReceiveBySample>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import ReceiveByEntrust from './TakeByEntrust'
import ReceiveBySample from './TakeBySample'
export default {
name: 'MeterSummaryEntrustIndex',
components: {
ReceiveByEntrust,
ReceiveBySample
},
data() {
return {
activeName: 'entrust'
}
},
mounted() {
this.activeName = 'entrust'
this._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'entrust') {
this._page()
} else {
this.$refs.sampleTabs._page()
}
},
_page() {
this.$refs.entrustTabs._page()
}
}
}
</script>
<style scoped>
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="70" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="委托商:">
<Input v-model="formObj.client" @on-enter="_formSearch" placeholder="请输入委托编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="委托编号:">
<Input v-model="formObj.entrustCode" @on-enter="_formSearch" placeholder="请输入委托单位" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
:iconMsg="iconMsg"
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:width="item.width"
:min-width="200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<span v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</span>
<span v-else-if="item.status">{{scope.row[item.key].display}}</span>
<div v-else-if="item.type">{{scope.row[item.key] === 0 ? '企业':scope.row[item.key] ===
1?'政府':scope.row[item.key] === 2?'食品类抽样单': ''}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
<!-- <SampleManage ref="sampleManageModal" @on-result-change="_page"></SampleManage>-->
<ItemManage ref="itemManageModal" @on-result-change="_page"></ItemManage>
<Operation ref="operation"></Operation>
</div>
</template>
<script>
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api'
import Operation from '../../../components/operation/Operation'
// import SampleManage from './SampleManage'
import ItemManage from './ItemManage'
export default {
components: {
UserInfo,
// SampleManage,
ItemManage,
Operation
},
data() {
return {
formObj: {
client: undefined,
entrustCode: undefined
},
typeList: [{ name: '企业', value: 0 }, { name: '政府', value: 1 }],
iconMsg: [
{
type: 'ios-beaker',
id: '',
name: '管理样品'
},
{
type: 'ios-list',
id: '',
name: '项目管理'
},
{
type: 'md-create',
id: '',
name: '编辑协议'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
getPage: {},
pageColumns: [
{ title: '委托商', key: 'client', width: 200 },
{ title: '委托编号', key: 'entrustCode', width: 120 },
{ title: '委托日期', key: 'entrustDate', width: 120, date: true },
{ title: '钻孔位置', key: 'boreholeLocation', width: 120 },
{ title: '水深(米)', key: 'waterDepth', width: 120 },
{ title: '钻孔名称', key: 'boreholeName', width: 120 },
{ title: '进度', key: 'progress', width: 120, status: true },
{ title: '工程号', key: 'projectNo', width: 120 },
{ title: '报告编号', key: 'reportCode', width: 120 },
{ title: '制表日期', key: 'tabulateDate', width: 120, date: true },
{ title: '制表人', key: 'tabulater', width: 120 },
{ title: '批准日期', key: 'approveDate', width: 120, date: true },
{ title: '批准人', key: 'approver', width: 120 },
{ title: '检验类别', key: 'testType', width: 120 }
],
searchOpen: false,
btn: [
{
type: 'primary',
id: 'ZBC',
name: '一键接收'
}
],
selectIds: [],
currentComponent: '',
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearch')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// 样品接收是否选择人员
// this.acceptSelectUserValue = localStorage.getItem('acceptSelectUserValue')
},
methods: {
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'contractSendMan':
// 一键发放
this.$store.dispatch('FoodContract/oneKeySend', sendData).then(() => {
this._resultChange('发放成功')
})
break
case 'contractReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', sendData)
.then(() => {
this._resultChange('一键接收并发放成功')
})
break
case 'sampleSendScanMan':
// 扫码发放
this.$refs.refModal._open('扫码发放', data)
break
case 'sampleReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 一键接收并发放
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
default:
this._page()
}
},
_btnClick(msg, componentName) {
this.currentComponent = componentName
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg)
}
})
},
// btn操作
_btnOption(msg) {
console.log(msg)
switch (msg) {
case '一键接收':
this._oneKeyReceive()
break
case '一键发放':
this._oneKeySend()
break
case '一键接收并发放':
this._oneKeyReceiveSend()
break
case '扫码接收':
this.currentComponent = 'ReceiveScan'
this.$nextTick(function() {
this.$refs.refModal._open()
})
break
case '扫码发放':
this._scanSend('sampleSendScanMan')
break
case '扫码接收并发放':
this._scanSend('sampleReceiveSendScanMan')
break
case '信息维护':
this._maintainInfo()
break
case '登记协议':
this._editModals(msg)
break
}
},
// 扫码接收并发放
_scanSend(msg) {
if (msg === 'sampleReceiveSendScanMan' || msg === 'sampleSendScanMan') {
// 扫码接收并发放判断是够选人
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open(msg, '请选择领样人')
} else {
this.$refs.refModal._open('扫码发放')
}
} else {
// 其他
this.$refs.userModal._open(msg, '请选择领样人')
}
},
// 一键接收并发放
_oneKeyReceiveSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 根据字典是否选择人员
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
// 选择人员接收并发放
this.$store
.dispatch('FoodContract/oneKeyReceiveSendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodContract.success
if (result) {
// 验证成功
this.$refs.userModal._open(
'contractReceiveSendMan',
'请选择领样人'
)
}
})
} else {
// 不选择人员
this.$store
.dispatch('FoodContract/oneKeyReceiveSend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('一键接收并发放成功')
})
}
}
},
// 一键发放
_oneKeySend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
// 一键发放判断是否选人
// eslint-disable-next-line no-lonely-if
if (this.acceptSelectUserValue === '是') {
this.$store
.dispatch('FoodContract/oneKeySendCheck', {
ids: this.selectIds.join(',')
})
.then(() => {
if (this.$store.state.FoodContract.success) {
this.$refs.userModal._open('contractSendMan', '请选择领样人')
}
})
} else {
// 一键发放
this.$store
.dispatch('FoodContract/oneKeySend', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('发放成功')
})
}
}
},
// 一键接收
_oneKeyReceive() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
this.$Modal.confirm({
title: '提示',
content:
'确定要一键接收这 ' + this.selectIds.length + ' 条委托下的样品?',
onOk: () => {
this.$store
.dispatch('FoodContract/oneKeyReceive', {
ids: this.selectIds.join(',')
})
.then(() => {
this._resultChange('接收成功')
})
}
})
}
},
// 信息维护
_maintainInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.currentComponent = 'MaintainInfoModal'
this.$nextTick(() => {
this.$refs.refModal._open(this.selectIds, 1)
})
}
},
_iconClick(res, data, currentComponent) {
this.currentComponent = currentComponent
console.log(res)
this.$nextTick(() => {
switch (res) {
case '管理样品':
this._editModal(data.id, data.type, data.cname)
break
case '项目管理':
this.$refs.itemManageModal._open(data.id)
break
case '编辑协议':
this._editModals(res, data)
break
case '附件':
this._upload(data.id)
break
case '操作日志':
this._operationRecord(data.id)
break
}
})
},
_editModal(id, type, name) {
this.$refs.sampleManageModal._open(id, type, name)
},
_editModals(res, data) {
if (res === '登记协议') {
this.$refs.editModal._open(res, data)
} else if (res === '编辑协议') {
this.$store
.dispatch('FoodContract/verificationEdit', { id: data.id })
.then(() => {
if (this.$store.state.FoodContract.model === true) {
this.$refs.editModal._open(res, data)
}
})
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodContract.page
break
case 'selectIds':
this.selectIds = data
break
case 'iconClick':
this._iconClick(data.name, data.rowData, data.componentName)
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageSampleReceive(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_detailModal(id, type) {
// 查看
this.$store.dispatch('FoodContract/getById', id).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.operation._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'contractId')
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-rel-sample" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" v-model="formObj.num" name="num" placeholder="请输入样品编号" clearable></Input>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" v-model="formObj.name" name="name" placeholder="请输入样品名称" clearable></Input>
</Form-item>
<Form-item class="search-btn">
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<!--操作-->
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
@on-result-change="_tableResultChange"
:getPage="getPage"
:icon-msg="iconMsg"
select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
sortable
>
<template slot-scope="scope">
<div v-if="item.detail"><a @click.stop="_detailModal(scope.row.contractId,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<div v-else-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}
</div>
<div v-else-if="item.sampleDetail"><a @click.stop="_sampleDetailModal(scope.row.id,scope.row.type)">{{scope.row[item.key]}}</a>
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
<!--组件加载-->
<!--打印(可填打印数量)-->
<!--选择领样人-->
<UserInfo ref="userModal" @on-result-change="_userResult"></UserInfo>
</div>
</template>
<script>
import http from '../../../api/http'
import UserInfo from '../../../components/user-info-single/AssignPerson'
import { soilEntrust } from '../../../api'
export default {
components: {
UserInfo
},
data() {
return {
formObj: { num: undefined, name: undefined },
iconMsgDis: [],
iconMsg: [
{
type: 'md-create',
id: '',
name: '编辑'
},
{ type: 'md-cloud', id: '', name: '附件' },
{ type: 'md-trash', id: '', name: '删除' },
{
type: 'ios-clock',
id: '',
name: '操作日志'
}
],
// 操作列
sampleFile: {
type: 'cloud',
id: '',
name: '样品附件',
componentName: 'FileManage'
},
sampleFileDis: {
type: 'cloud',
id: '',
name: '样品附件',
disabled: true
},
edit: {
type: 'compose',
id: 'rel-sample-receive-edit-sample',
name: '编辑'
},
del: {
type: 'trash-a',
id: 'rel-sample-receive-del-sample',
name: '删除'
},
copy: {
type: 'ios-copy',
id: 'rel-sample-receive-copy-sample',
name: '复制'
},
record: {
type: 'ios-clock',
id: '',
name: '操作日志',
componentName: 'FoodSampleRecord'
},
sampleDownloadContract: {
type: 'share',
id: 'food-sample-receive-sample-download-contract',
name: '导出委托协议'
},
getPage: {},
pageColumns: [
{ title: '试样编号', key: 'sampleCode', width: 130 },
{ title: '试样深度', key: 'sampleDepth', width: 130 },
{ title: '检测科室', key: 'groupName', width: 160 },
{ title: '保存容器', key: 'keepContainer', width: 160 },
{ title: '保存方式', key: 'keepWay', width: 160 },
{ title: '制备方式', key: 'prepareWay', width: 160 },
{ title: '制备人', key: 'preparer', width: 130 },
{ title: '制备数量', key: 'quantity', width: 130 },
{ title: '单位', key: 'unit', width: 130 }
],
searchOpen: false,
btn: [
{ type: 'primary', id: 'ZBC', name: '接收并发放', componentName: '' }
],
selectIds: [],
selectData: [],
currentComponent: '',
printerVal: '', // 选择的打印机
standard: '',
stdList: [],
acceptSelectUserValue: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 340)
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
mounted() {
// // 获取当前的执行标准下拉项
// this._getStdList()
},
methods: {
// 接收的返回保存
_userResult(data, msg) {
const sendData = {
ids: this.selectIds.join(',')
}
if (data) {
sendData.person = data.realname
sendData.personId = data.userId
}
switch (msg) {
case 'relReceiveSendMan':
// 一键接收并发放
this.$store
.dispatch('FoodSample/sampleReceiveSend', sendData)
.then(() => {
this._resultSampleChange('接收并发放成功')
})
break
case 'relReceiveSendScanMan':
// 扫码接收并发放
this.$refs.refModal._open('扫码接收发放', data)
break
}
},
// 抽样日期
_makeDateChange(data) {
$('input[name=samplingDateBegin]').val(data[0])
$('input[name=samplingDateEnd]').val(data[1])
},
// 组件返回值
_componentResult(data, msg) {
switch (this.currentComponent) {
case 'SelectPrinter':
this._printerResult(data)
break
default:
this._page()
}
},
_btnClick(msg, currentComponent, formTypeObj) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (msg) {
case 'search':
this.searchOpen = !this.searchOpen
break
default:
this._btnOption(msg, formTypeObj)
}
})
},
// btn操作
_btnOption(msg, formTypeObj) {
switch (msg) {
case '扫码接收并发放':
// 根据字典判断是否选择人员
if (this.acceptSelectUserValue === '是') {
this.$refs.userModal._open('relReceiveSendScanMan', '请选择领样人')
} else {
this.$refs.refModal._open('扫码接收发放')
}
break
case '接收并发放':
this._submitSend()
break
case '添加':
if (formTypeObj.uri === 'DLTB-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByDLTB'
} else if (formTypeObj.uri === 'HES-company-contract-reg') {
this.currentComponent = 'FoodContractCompanyEditByHES'
} else {
this.currentComponent = 'FoodContractCompanyEdit'
}
this.$nextTick(() => {
this.$refs.refModal._openReceive()
})
break
case '导入检测项目':
this._importItem()
break
case '导入检测项目包':
this._importItemPackage()
break
case '复制历史样品检测项目':
this._copyHisItem()
break
case '删除':
this._deleteSelected()
break
case '打印标签':
this._selectPrinter('print-label')
break
case '自定义打印':
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条样品信息')
} else {
this._cusTomePrint()
}
break
}
},
// 1.自定义打印,除检样、备样、留样 增加制备标签,需要单独的查询制备标签的数据,
// 2.样品接收位置的制备用制备的的接口,将当前的保存方式置空,打印出来手动填写
_cusTomePrint() {
this.$store
.dispatch('FoodSample/preparationButton', {
sampleIds: this.selectIds.join(',')
})
.then(() => {
const result = this.$store.state.FoodSample.list
for (let i = 0; i < result.length; i++) {
// 样品制备保存方式
result[i].saveWay = ''
}
// 样品的数据和制备样品的数据
this.$refs.refModal._open(this.selectData, result)
})
},
// 接收并发放
_submitSend() {
if (this.selectIds.length === 0) {
this.$msgTip('warning', '请至少选择一条数据!')
} else {
const data = {
ids: this.selectIds.join(',')
}
if (this.acceptSelectUserValue === '是') {
// 根据字典接收并发放
this.$store
.dispatch('FoodSample/submitReceiveSendCheck', data)
.then(() => {
const result = this.$store.state.FoodSample.success
if (result) {
// 验证成功
this.$refs.userModal._open('relReceiveSendMan', '请选择领样人')
}
})
} else {
this.$store
.dispatch('FoodSample/sampleReceiveSend', data)
.then(() => {
this._resultSampleChange('接收并发放成功')
})
}
}
},
_exportReceiveRecord() {
// 导出交接记录
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
/* this.$Modal.confirm({
title: '提示',
content: '确定导出所有记录?',
onOk: () => {
http.open('/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids);
}
}); */
} else {
http.open(
'/food/report/excel/sheet?_u=db样品来源.report.xml&ids=' + ids
)
}
},
// 单个删除
_deleteById(id) {
this._deleteByIds([id], '确定删除该条记录?')
},
_deleteByIds(ids, content) {
this.$Modal.confirm({
title: '提示',
content: content || '确定删除该记录?',
onOk: () => {
this.$store.dispatch('FoodSample/deleteByIds', ids).then(() => {
this._resultSampleChange('删除成功!')
})
}
})
},
_deleteSelected() {
// 批量删除
const ids = this.selectIds
if (ids.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this._deleteByIds(ids, '确定删除 ' + ids.length + ' 条记录?')
}
},
// 导入检测项目包
_importItemPackage() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
// 导入检测项目
_importItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds, this.selectData[0])
}
},
_copyHisItem() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条样品数据!')
} else {
this.$refs.refModal._open(this.selectIds)
}
},
_iconClick(res, data, currentComponent, rowIndex, obj) {
this.currentComponent = currentComponent
this.$nextTick(() => {
switch (res) {
case '编辑':
if (data.type === 0) {
// 企业--编辑的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
this.$store
.dispatch('FoodSample/companyPage', {
contractId: data.contractId
})
.then(() => {
const num = this.$store.state.FoodSample.companyPage
.total
if (num <= 1) {
// 无配置表单 委托的编辑界面
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
} else {
// 样品的编辑界面
this.currentComponent = 'FoodSampleCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel,
data.contractId,
'receive-his-wait'
)
})
})
}
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceive(
this.$store.state.FoodContract.model
)
})
})
}
})
} else if (data.type === 1) {
// 政府--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
} else {
// 粮油--只是编辑样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel,
data.contractId,
'receive-his-wait'
)
})
})
}
break
case '删除':
this._deleteById(data.id)
break
case '复制':
if (data.type === 0) {
// 企业--复制的是委托和样品信息
this.$store
.dispatch('SysForm/getByBtnCode', obj.btnId)
.then(() => {
const result = this.$store.state.SysForm.list
if (result.length === 0) {
// 无配置表单
this.currentComponent = 'FoodContractCompanyEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'DLTB-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByDLTB'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
} else if (
result.length === 1 &&
result[0].uri === 'HES-company-contract-reg'
) {
// 只有一个配置表单(不需要选择)
this.currentComponent = 'FoodContractCompanyEditByHES'
this.$nextTick(() => {
this.$store
.dispatch('FoodContract/getBySampleId', data.id)
.then(() => {
this.$refs.refModal._openReceiveCopy(
this.$store.state.FoodContract.model
)
})
})
}
})
} else if (data.type === 1) {
// 政府--只是复制样品信息
this.currentComponent = 'FoodSampleGovernEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
} else {
// 粮油--只是复制样品信息
this.currentComponent = 'FoodSampleGovernLYEdit'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.id)
.then(() => {
this.$refs.refModal._openCopyAll(
this.$store.state.FoodSample.governModel,
'receive-his-wait-copy'
)
})
})
}
break
case '操作日志':
this._operationRecord(data.id)
break
case '导出委托协议':
// this.$Modal.confirm({
// title: '提示',
// content: '确认要下载委托单?',
// onOk: () => {
// http.open('/food/v1/sample/export_sample_form?id=' + data.id);
// }
// });
this._downContractForm(data.id)
break
case '样品附件':
this._upload(data.id)
break
}
})
},
_downContractForm(id) {
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-receive-sample-download-contract'
)
.then(() => {
if (this.$store.state.ReportExport.model) {
if (this.$store.state.ReportExport.model.indexOf('?') !== -1) {
window.open(
this.$store.state.ReportExport.model + '&sampleId=' + id,
'_blank'
)
} else {
window.open(
this.$store.state.ReportExport.model + '?sampleId=' + id,
'_blank'
)
}
}
})
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage = this.$store.state.FoodSample.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log(this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageTake(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
// 查看委托
_detailModal(contractId, type) {
this.$store.dispatch('FoodContract/getById', contractId).then(() => {
if (type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 查看样品
_sampleDetailModal(id, type) {
if (type === 0) {
// 政府
this.currentComponent = 'FoodSampleCompanyDetail'
this.$store.dispatch('FoodSample/getByCompanyId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.companyModel)
})
})
} else {
this.currentComponent = 'FoodSampleGovernDetail'
this.$store.dispatch('FoodSample/getByGovernId', id).then(() => {
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodSample.governModel)
})
})
}
},
_editModal(id, type) {
this.$refs.refModal._open(id, type)
},
_search() {
this._page()
},
_operationRecord(id) {
// 操作日志
this.$refs.refModal._open(id)
},
_resultChange(msg) {
if (this.$store.state.FoodContract.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_resultSampleChange(msg) {
if (this.$store.state.FoodSample.success) {
this._page()
this.$Message.success(msg)
this.selectIds = []
}
},
_upload(id) {
// 上传文件
this.$refs.refModal._open(id, 'sampleId')
},
// 选择完打印机之后
_printerResult(data) {
// printModal 不能使用动态组件,否则第二次打不开,原因未知
switch (data.type) {
// 打印标签--直接打印
case 'print-label':
this.$refs.printModal._printOpen(this.selectData, data.printerVal)
break
}
},
// 选择打印机
_selectPrinter(msg) {
if (this.selectData.length === 0) {
this.$Message.warning('请至少选择一条数据')
} else {
this.$refs.refModal._open(msg)
}
},
_stdResult(msg, data) {
switch (msg) {
case 'select':
this.standard = data
break
case 'query':
this.standard = data
this._getStdList(data)
break
case 'focus':
this._getStdList()
break
}
},
// 查询执行标准
_getStdList(data) {
const obj = Object.assign({}, this.$serialize('search-form-rel-sample'))
if (data) {
obj.standard = data
}
this.$store.dispatch('FoodSample/listReceiveStandard', obj).then(() => {
this.stdList = this.$store.state.FoodSample.list
})
}
}
}
</script>
<template>
<div>
<div class="layout-content-padding">
<div class="layout-content-main">
<el-tabs v-model="activeName" @tab-click="_changeTabs">
<el-tab-pane label="余样管理" name="wait">
<SampleBackupsManage ref="waitTabs"></SampleBackupsManage>
</el-tab-pane>
<el-tab-pane label="余样查询" name="query">
<SampleBackupsQuery ref="queryTabs"></SampleBackupsQuery>
</el-tab-pane>
</el-tabs>
</div>
</div>
</div>
</template>
<script>
import SampleBackupsManage from './tab/SampleSurplusManage'
import SampleBackupsQuery from './tab/SampleSurplusQuery'
export default {
components: {
SampleBackupsManage,
SampleBackupsQuery
},
data() {
return {
activeName: 'wait'
}
},
mounted() {
this.activeName = 'wait'
this.$refs.waitTabs._page()
},
methods: {
_changeTabs(tab, event) {
if (tab.name === 'wait') {
this.$refs.waitTabs._page()
} else if (tab.name === 'applyRecord') {
// this.$refs.applyRecordTabs._page()
} else {
this.$refs.queryTabs._page()
}
}
}
}
</script>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" name="sampleSn" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" name="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" :open="searchOpen" @on-result-change="_btnClick" :showSearchBtn="true"
class="contHide">
</btn-list>
</Col>
<!--样品数量-->
<Col span="24">
<div style="display: flex;padding-bottom: 10px;">
<div v-for="(item,index) in contList" :key="index" class="reimbursement-item">
<p :class="item.color?item.color:''">{{item.value}}</p>
<p>{{item.name}}</p>
</div>
</div>
</Col>
<!-- 表格 -->
<Col span="24">
<PTVXETable
id="samplePreManage"
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
@on-result-change="_tableResultChange"
select-data>
<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.key==='status'">
{{scope.row[item.key]===undefined?'':scope.row[item.key].display}}
</div>
<a v-else-if="item.key==='code'" @click.stop="_detailModal(scope.row)">{{scope.row[item.key]}}</a>
<a v-else-if="item.key==='sampleSn'"
@click.stop="_sampleDetailModal(scope.row)">{{scope.row[item.key]}}</a>
<div v-else-if="item.key==='backupPlace'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div>
<div v-else>
<AutoCompletes :value="scope.row.backupPlace" :downData="locList" @on-result-change="_locChange"
name="backupPlace" placeholder="请输入或选择存储位置" focus
show-key="backupPlace"></AutoCompletes>
</div>
</div>
<div v-else-if="item.key==='storageCondition'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">{{scope.row[item.key]}}</div>
<div v-else>
<el-select v-model="scope.row.storageCondition" clearable style="width:100%" size="small">
<el-option v-for="item in conditionList" :value="item.name" :key="item.name">{{ item.name }}
</el-option>
</el-select>
</div>
</div>
<div v-else-if="item.key==='handleQuantity'" @click.stop="_handleIndex(scope)">
<div v-if="editIndex!==scope.rowIndex">
{{scope.row[item.key]}}{{scope.row['sampleUnit'] &&
scope.row['handleQuantity']?scope.row['sampleUnit']:''}}
</div>
<div v-else>
<Row>
<Col span="18">
<el-input v-model="scope.row.handleQuantity" placeholder="处理数量" clearable size="small"/>
</Col>
<Col span="6">
<div style="line-height: 32px">{{scope.row['sampleUnit']?scope.row['sampleUnit']:''}}</div>
</Col>
</Row>
</div>
</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>
<template slot="col">
<vxe-table-column
:width="80"
title="操作"
align="center"
fixed="right">
<template slot-scope="scope">
<VXEIconList :msg="editIndex===scope.rowIndex?iconMsgSave:iconMsg" @on-result-change="_iconClick"
:rowData="scope.row" :rowIndex="scope.rowIndex"></VXEIconList>
</template>
</vxe-table-column>
</template>
</PTVXETable>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
import AutoCompletes from '../../../../components/base/AutoCompletes'
// eslint-disable-next-line no-unused-vars
import http from '../../../../api/http'
import { soilEntrust } from '../../../../api'
export default {
components: {
AutoCompletes
},
data() {
return {
currentComponent: '',
searchOpen: false,
formObj: {},
selectData: [],
selectIds: [],
selectSampleIds: [],
getPage: {},
btn: [
{
type: 'primary',
id: 'food-sample-preparation-his-all',
name: '制备'
},
{
type: 'primary',
id: 'food-sample-preparation-his-no-pre',
name: '无需制备'
},
{
type: 'primary',
id: 'food-sample-preparation-his-scan-pre',
name: '扫码制备'
},
// { type: '', id: '', name: '填写存放信息' },
// { type: '', id: '', name: '申请处理' },
// { type: '', id: '', name: '导出' },
{
type: '',
id: 'food-sample-prepare-record-export',
name: '导出备样记录'
}
],
iconMsg: [
{ type: 'md-create', id: '', name: '编辑' } // food-sample-prepare-edit
],
iconMsgSave: [{ type: 'ios-checkmark', id: '', name: '保存' }],
pageColumns: [
{ title: '委托商', key: 'client', width: 180 },
{ title: '委托编号', key: 'entrustCode', width: 180 },
{ title: '存储条件', key: 'conditions', width: 180 },
{ title: '试样编号', key: 'sampleCode', width: 180 },
{ title: '试样深度', key: 'sampleDepth', width: 180 },
{ title: '样品包装类型', key: 'samplePack', width: 180 },
{ title: '现场编号', key: 'siteNo', width: 180 },
{ title: '备样位置', key: 'backupLocation', width: 180 },
{ title: '备样数量', key: 'quantity', width: 180 },
{ title: '备样人', key: 'backupUser', width: 140 },
{ title: '钻孔位置', key: 'boreholeLocation', width: 110 },
{ title: '钻孔名称', key: 'boreholeName', width: 160 },
{ title: '水深(米)', key: 'waterDepth', width: 160 },
{ title: '状态', key: 'status', width: 160 },
{ title: '备份开始日期', key: 'startTime', width: 170 },
{ title: '备份结束日期', key: 'endTime', width: 170 }
/* {title: '处置方式', key: 'handleMethod', width: 120,}, */
],
conditionList: [],
locList: [],
currentIndex: -1,
editIndex: -1,
endDateBegin: '',
endDateEnd: '',
contList: [
{ key: 'backupCount', name: '今日新增数量', value: 0 },
{
key: 'backupCountOver',
name: '超期数量',
value: 0,
color: 'red-color'
},
{
key: 'backupCountWarn',
name: '预警数量',
value: 0,
color: 'warning-color'
}
],
// 只看预警和超期样品
warnAndOver: 0,
sampleHandleValue: '',
issueDateBegin: '',
issueDateEnd: '',
isEligible: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('', 385)
} else {
return this.$tableHeight('', 300)
}
},
colorComputed() {
return function(date) {
if (this.$warningValue(date) < 0) {
return '#eb6877' // 红色
} else if (
this.$warningValue(date) >= 0 &&
this.$warningValue(date) <= this.sampleHandleValue
) {
return '#f90' // 橙色
}
}
}
},
mounted() {
// 样品存储期限预警
// this.sampleHandleValue = Number(localStorage.getItem('sampleHandleValue'))
// this._getLocList()
// this._getConditionList()
// this._getBackUpCount()
},
methods: {
// 签发日期
_issueDateChange(date) {
this.issueDateBegin = date[0]
this.issueDateEnd = date[1]
},
// 重新请求page以及备样数量
_relPage() {
this._page()
// this._getBackUpCount()
},
// 查询卡片备样数量
_getBackUpCount() {
this.$store.dispatch('FoodSampleBackup/backUpCount').then(() => {
const result = this.$store.state.FoodSampleBackup.model
const length = this.contList.length
for (let i = 0; i < length; i++) {
this.$set(this.contList[i], 'value', result[this.contList[i].key])
}
})
},
// 选择时间
_endDateChange(data) {
this.getPage.records[this.currentIndex].endDate = data
},
// 查询-接收日期
_dateChange(data) {
this.endDateBegin = data[0]
this.endDateEnd = data[1]
},
_save() {
this.$nextTick(function() {
const data = {
ids: this.getPage.records[this.currentIndex].id,
backupPlace: this.getPage.records[this.currentIndex].backupPlace,
storageCondition: this.getPage.records[this.currentIndex]
.storageCondition,
endDate: this.getPage.records[this.currentIndex].endDate,
handleQuantity: this.getPage.records[this.currentIndex].handleQuantity
}
this.$store.dispatch('FoodSampleBackup/batchEdit', data).then(() => {
if (this.$store.state.FoodSampleBackup.success) {
} else {
this.$msgTip('error', '保存失败!')
}
this._relPage()
})
})
},
_iconClick(res, data, componentName, index) {
this.currentIndex = index
switch (res) {
case '编辑':
this.editIndex = index
break
case '保存':
console.log('保存')
// if (data.endDate !== '') {
// // 非空情况下格式化赋值,如果不判断会格式化为当天的日期
// this._endDateChange(this.$dateformat(data.endDate, 'yyyy-mm-dd'))
// }
// this._save()
this.editIndex = -1
break
}
},
_locChange(msg, data) {
switch (msg) {
case 'select':
this.getPage.records[this.currentIndex].backupPlace = data.backupPlace
break
case 'query':
this.getPage.records[this.currentIndex].backupPlace = data.backupPlace
this._getLocList(data.backupPlace)
break
case 'focus':
this._getLocList()
break
}
},
_getLocList(data) {
const obj = {}
if (data) {
obj.backupPlace = data
}
this.$store.dispatch('FoodSampleBackup/getPositionList', obj).then(() => {
this.locList = this.$store.state.FoodSampleBackup.list
})
},
_getConditionList() {
this.$store.dispatch('LmsBaseDict/getItem', '保存方式').then(() => {
this.conditionList = this.$store.state.LmsBaseDict.item
})
},
_exportReceiveRecord() {
// 导出备样记录
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选中一条数据!')
} else {
const obj = {
param: 'ids',
ids: this.selectIds,
url: ''
}
this.$store
.dispatch('ReportExport/getById', 'food-sample-prepare-record-export')
.then(() => {
const result = this.$store.state.ReportExport.model
obj.url = result
this.$exportByQuery(obj)
})
}
},
// 操作的序号
_handleIndex(data) {
this.currentIndex = data.rowIndex
},
_btnClick(msg) {
switch (msg) {
case '制备':
this._preMethod()
break
case '无需制备':
this._noPreMethod()
break
case '扫码制备':
this._scanPreMethod()
break
case '填写存放信息':
this._batchEdit()
break
case '申请处理':
this._handle()
break
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出')
} else {
this._export()
}
break
case '导出备样记录':
this._exportReceiveRecord()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
// 制备
_preMethod() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.preModal._open(this.selectSampleIds)
}
},
// 无需制备
_noPreMethod() {
if (this.selectSampleIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.noPreModal._open(this.selectSampleIds)
}
},
_scanPreMethod() {
this.$refs.scanPreModal._open()
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.getPage.records = []
this.getPage = {
total: this.$store.state.LmsFoodSamplePrepare.page.total,
pages: this.$store.state.LmsFoodSamplePrepare.page.pages,
current: this.$store.state.LmsFoodSamplePrepare.page.current,
size: this.$store.state.LmsFoodSamplePrepare.page.size,
records: []
}
const tableList = this.$store.state.LmsFoodSamplePrepare.page.records
for (let i = 0; i < tableList.length; i++) {
this.getPage.records.push({
sampleId:
tableList[i].sampleId !== undefined
? tableList[i].sampleId
: '',
sampleSn:
tableList[i].sampleSn !== undefined
? tableList[i].sampleSn
: '',
sampleName:
tableList[i].sampleName !== undefined
? tableList[i].sampleName
: '',
backupPlace:
tableList[i].backupPlace !== undefined
? tableList[i].backupPlace
: '',
cname: tableList[i].cname !== undefined ? tableList[i].cname : '',
storageCondition:
tableList[i].storageCondition !== undefined
? tableList[i].storageCondition
: '',
quantity:
tableList[i].quantity !== undefined
? tableList[i].quantity
: '',
sampleQuantity:
tableList[i].sampleQuantity !== undefined
? tableList[i].sampleQuantity
: '',
handleQuantity:
tableList[i].handleQuantity !== undefined
? tableList[i].handleQuantity
: '',
sampleUnit:
tableList[i].sampleUnit !== undefined
? tableList[i].sampleUnit
: '',
endDate:
tableList[i].endDate !== undefined
? new Date(tableList[i].endDate)
: '',
handleMethod:
tableList[i].handleMethod !== undefined
? tableList[i].handleMethod
: '',
id: tableList[i].id !== undefined ? tableList[i].id : '',
contractName:
tableList[i].contractName !== undefined
? tableList[i].contractName
: '',
code: tableList[i].code !== undefined ? tableList[i].code : '',
contractSn:
tableList[i].contractSn !== undefined
? tableList[i].contractSn
: '',
progress:
tableList[i].progress !== undefined
? tableList[i].progress
: '',
type: tableList[i].type !== undefined ? tableList[i].type : '',
issueDate:
tableList[i].issueDate !== undefined
? tableList[i].issueDate
: '',
sampleRemark:
tableList[i].sampleRemark !== undefined
? tableList[i].sampleRemark
: '',
contractRemark:
tableList[i].contractRemark !== undefined
? tableList[i].contractRemark
: '',
isEligible:
tableList[i].isEligible !== undefined
? tableList[i].isEligible
: '',
remark:
tableList[i].remark !== undefined ? tableList[i].remark : '',
contractId:
tableList[i].contractId !== undefined
? tableList[i].contractId
: ''
})
}
this.selectIds = []
this.selectData = []
this.selectSampleIds = []
break
case 'selectData':
this.selectData = data
this.selectIds = []
this.selectSampleIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
this.selectSampleIds.push(data[i].sampleId)
}
break
case 'changeSize':
this._page()
break
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
this._getBackUpCount()
},
_page: async function() {
this.editIndex = -1
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageBackup(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_batchEdit() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.editModal._open(this.selectData)
}
},
_handle() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.applyModal._open(this.selectData)
}
},
// 委托详情
_detailModal(data) {
// 查看
this.$store.dispatch('FoodContract/getById', data.contractId).then(() => {
if (data.type === 0) {
// 企业委托 ’0‘
this.currentComponent = 'FoodContractCompanyDetail'
} else {
// 政府委托 ’1‘
this.currentComponent = 'FoodContractGovernDetail'
}
this.$nextTick(() => {
this.$refs.refModal._open(this.$store.state.FoodContract.model)
})
})
},
// 样品详情
_sampleDetailModal(data) {
if (data.type === 1) {
// 政府
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
})
}
},
/** *********************************导出-begin*********************************************/
_export() {
let result = []
if (this.selectData.length === 0) {
// 导出全部数据
this.$store
.dispatch('LmsFoodSamplePrepare/page', this._searchParams())
.then(() => {
result = this.$store.state.LmsFoodSamplePrepare.page.records
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'samplePreManage',
'备样记录',
this.pageColumns,
result
)
}
})
})
} else {
// 只导出选中的数据
result = this.selectData
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'samplePreManage',
'备样记录',
this.pageColumns,
result
)
}
})
}
},
// 参数
_searchParams() {
const data = this.$serialize('search-form')
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出样品台账-end*********************************************/
}
}
</script>
<style scoped>
/******副样、备样卡片********/
.reimbursement-item {
flex: 1;
border-radius: 5px;
border: 1px solid #e8e8e8;
padding-bottom: 10px;
}
.reimbursement-item + .reimbursement-item {
margin-left: 20px;
}
.reimbursement-item p {
text-align: center;
margin: 0;
}
.reimbursement-item > p:first-child {
font-size: 22px;
line-height: 40px;
}
</style>
<template>
<div>
<!--内容-->
<div class="layout-content-padding">
<div class="layout-content-main">
<Row>
<!--查询-->
<Col span="24">
<Form id="search-form-query" :label-width="80" v-show="searchOpen" inline onsubmit="return false">
<label class="label-sign"></label>
<Form-item class="search-item" label="样品编号:">
<Input @on-enter="_formSearch" name="sampleSn" placeholder="请输入样品编号" clearable/>
</Form-item>
<Form-item class="search-item" label="样品名称:">
<Input @on-enter="_formSearch" name="sampleName" placeholder="请输入样品名称" clearable/>
</Form-item>
<Form-item class="search-item" label="存储位置:">
<Input @on-enter="_formSearch" name="backupPlace" placeholder="请输入存储位置" clearable/>
</Form-item>
<Form-item class="search-item" label="存储期限:">
<Date-picker @on-change="_dateChange" :editable="false" type="daterange" split-panels
style="width:100%;" placeholder="请选择存储期限"></Date-picker>
<input v-model="endDateBegin" type="hidden" name="endDateBegin">
<input v-model="endDateEnd" type="hidden" name="endDateEnd">
</Form-item>
<Form-item class="search-item" label="委托单位:" style="margin-left: 8px;">
<Input @on-enter="_formSearch" name="cname" placeholder="请输入委托单位" clearable/>
</Form-item>
<Form-item class="search-item" label="委托名称:">
<Input @on-enter="_formSearch" name="contractName" 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" :showSearchBtn="true"
class="contHide"></btn-list>
</Col>
<!-- 表格 -->
<Col span="24">
<!--<ElementTable :tableHeight="tableHeight" @on-result-change="_tableResultChange"-->
<!--ref="pageTable" :getPage="getPage" id="perSampleQuery" selectData>-->
<!--<el-table-column-->
<!--show-overflow-tooltip-->
<!--sortable-->
<!--:prop="item.key"-->
<!--:label="item.title"-->
<!--:width="item.width"-->
<!--:min-width="200"-->
<!--:fixed="item.fixed?item.fixed:undefined"-->
<!--v-for="item in pageColumns" :key="item.key">-->
<!--<template slot-scope="scope">-->
<!--<div v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</div>-->
<!--<a v-else-if="item.key==='sampleSn'"-->
<!--@click.stop="_sampleDetailModal(scope.row)">{{scope.row[item.key]}}</a>-->
<!--<div v-else-if="item.key==='progress'">-->
<!--{{scope.row[item.key]===undefined?'':scope.row[item.key].display}}-->
<!--</div>-->
<!--<div v-else>{{scope.row[item.key]}}</div>-->
<!--</template>-->
<!--</el-table-column>-->
<!--</ElementTable>-->
<PTVXETable id="perSampleQuery" ref="pageTable"
:tableHeight="tableHeight" @on-result-change="_tableResultChange" :getPage="getPage" select-data>
<vxe-table-column
:field="item.key"
:title="item.title"
:min-width="item.width?item.width:200"
:fixed="item.fixed?item.fixed:undefined"
v-for="item in pageColumns"
:key="item.key" sortable>
<template slot-scope="scope">
<div v-if="item.date">{{scope.row[item.key]?$dateformat(scope.row[item.key],'yyyy-mm-dd'):''}}</div>
<a v-else-if="item.key==='sampleSn'"
@click.stop="_sampleDetailModal(scope.row)">{{scope.row[item.key]}}</a>
<div v-else-if="item.key==='progress'">
{{scope.row[item.key]===undefined?'':scope.row[item.key].display}}
</div>
<div v-else>{{scope.row[item.key]}}</div>
</template>
</vxe-table-column>
</PTVXETable>
</Col>
</Row>
</div>
</div>
</div>
</template>
<script>
import { soilEntrust } from '../../../../api'
export default {
components: {},
data() {
return {
currentComponent: '',
selectIds: [],
formObj: {},
btn: [
// { type: '', id: '', name: '导出' },
{
type: '',
id: 'food-sample-handle-already-export-sample-store',
name: '导出样品贮存表'
}
],
pageColumns: [
{ title: '样品编号', key: 'sampleSn', width: 180 },
{ title: '样品名称', key: 'sampleName', width: 140 },
{ title: '状态', key: 'progress', width: 110, status: true },
{ title: '存储期限', key: 'endDate', width: 120, date: true },
{ title: '委托单位', key: 'cname', width: 140 },
{ title: '委托名称', key: 'contractName', width: 170 },
{ title: '处置方式', key: 'handleMethod', width: 120 },
{ title: '处理人', key: 'handlePerson', width: 100 },
{ title: '处理时间', key: 'handleTime', width: 120, date: true },
{ title: '处理申请人', key: 'applyer', width: 120 },
{ title: '申请时间', key: 'applyDate', width: 120, date: true },
{ title: '存储位置', key: 'backupPlace', width: 100 },
{ title: '存储条件', key: 'storageCondition', width: 120 },
{ title: '样品数量', key: 'quantity', width: 100 },
{ title: '备样数量', key: 'sampleQuantity', width: 100 },
{ title: '样品备注', key: 'sampleRemark' },
{ title: '委托备注', key: 'contractRemark' }
],
searchOpen: false,
getPage: {},
selectData: [],
endDateBegin: '',
endDateEnd: ''
}
},
computed: {
tableHeight: function() {
if (this.searchOpen) {
return this.$tableHeight('tabSearchTwo')
} else {
return this.$tableHeight('tabNoSearch')
}
}
},
methods: {
_page: async function() {
Object.assign(this.formObj, this.$refs.pageTable._searchParams())
console.log('this.formObj', this.formObj)
const result = await soilEntrust.pageSampleReceive(
this.$serializeForm(this.formObj)
)
if (result) {
this.$refs.pageTable._hideLoading()
this.getPage = result
}
},
_tableResultChange(msg, data) {
switch (msg) {
case 'page':
this.selectIds = []
this.getPage = this.$store.state.FoodSampleBackup.page
break
case 'selectData':
this.selectData = data
this.selectIds = []
for (let i = 0; i < data.length; i++) {
this.selectIds.push(data[i].id)
}
break
case 'changeSize':
this._page()
break
// default :
// this._page();
}
},
_formSearch() {
this.$refs.pageTable._pageChange(1)
},
_dateChange(data) {
this.endDateBegin = data[0]
this.endDateEnd = data[1]
},
_btnClick(msg) {
switch (msg) {
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出')
} else {
this._export()
}
break
case '导出样品贮存表':
this._exportSampleStore()
break
case 'search':
this.searchOpen = !this.searchOpen
break
}
},
_exportSampleStore() {
const obj = {
param: 'ids',
ids: this.selectIds,
url: '',
queryObj: this.$serialize('search-form-query')
}
this.$store
.dispatch(
'ReportExport/getById',
'food-sample-handle-already-export-sample-store'
)
.then(() => {
const result = this.$store.state.ReportExport.model
obj.url = result
this.$exportByQuery(obj)
})
},
// 样品详情
_sampleDetailModal(data) {
if (data.type === 1) {
// 政府
this.currentComponent = 'FoodSampleGovernDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByGovernId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.governModel
)
})
})
} else {
this.currentComponent = 'FoodSampleCompanyDetail'
this.$nextTick(() => {
this.$store
.dispatch('FoodSample/getByCompanyId', data.sampleId)
.then(() => {
this.$refs.refModal._open(
this.$store.state.FoodSample.companyModel
)
})
})
}
},
/** *********************************导出-begin*********************************************/
_export() {
let result = []
if (this.selectData.length === 0) {
// 导出全部数据
this.$store
.dispatch('FoodSampleBackup/perSampleQuery', this._searchParams())
.then(() => {
result = this.$store.state.FoodSampleBackup.page.records
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'perSampleQuery',
'样品处理',
this.pageColumns,
result
)
}
})
})
} else {
// 只导出选中的数据
result = this.selectData
this.$Modal.confirm({
title: '提示',
content:
this.selectData.length === 0
? '确定导出全部数据(最多导出5000条)?'
: '确定导出这' + result.length + ' 条数据?',
onOk: () => {
this.$exportExcel(
'perSampleQuery',
'样品处理',
this.pageColumns,
result
)
}
})
}
},
// 参数
_searchParams() {
const data = this.$serialize('search-form-query')
return this.$extend(data, { page: 1, rows: 5000 })
}
/** *********************************导出样品台账-end*********************************************/
}
}
</script>
...@@ -11,6 +11,8 @@ import SampleReceiveIndex from '../pages/soil-sample-manage/sample-receive/Sampl ...@@ -11,6 +11,8 @@ import SampleReceiveIndex from '../pages/soil-sample-manage/sample-receive/Sampl
import SamplePreparationIndex from '../pages/soil-sample-manage/sample-preparation/SamplePreparationIndex' import SamplePreparationIndex from '../pages/soil-sample-manage/sample-preparation/SamplePreparationIndex'
import AddressManage from '../pages/soil-sample-manage/sample-address/AddressManage' import AddressManage from '../pages/soil-sample-manage/sample-address/AddressManage'
import BackupsManage from '../pages/soil-sample-manage/backups-manage/SampleBackupsIndex' import BackupsManage from '../pages/soil-sample-manage/backups-manage/SampleBackupsIndex'
import SampleTakeIndex from '../pages/soil-sample-manage/sample-take/SampleTakeIndex'
import SurplusManage from '../pages/soil-sample-manage/surplus-manage/SampleSurplusIndex'
import Blank from '~/pages/blank' import Blank from '~/pages/blank'
export default [ export default [
{ {
...@@ -50,7 +52,7 @@ export default [ ...@@ -50,7 +52,7 @@ export default [
}, },
{ {
path: 'take', path: 'take',
component: workbench, component: SampleTakeIndex,
meta: { title: '试验室领样' } meta: { title: '试验室领样' }
}, },
{ {
...@@ -59,6 +61,11 @@ export default [ ...@@ -59,6 +61,11 @@ export default [
meta: { title: '备样管理' } meta: { title: '备样管理' }
}, },
{ {
path: 'surplus',
component: SurplusManage,
meta: { title: '余样管理' }
},
{
path: 'receive_location', path: 'receive_location',
component: AddressManage, component: AddressManage,
meta: { title: '收样位置管理' } 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