Commit 2a4a2448 by wangweidong

土工试验Lims

parent 1f327831
......@@ -71,6 +71,8 @@ export default {
http.post('soil/v1/sample/page_prepare', data).then(res => res),
pagePrepareHis: data =>
http.post('soil/v1/sample/page_prepare_his', data).then(res => res),
pagePrepareDetailHis: data =>
http.post('soil/v1/prepare/page_prepare_his', data).then(res => res),
sampleEdit: data =>
http.put(
'soil/v1/sample/' + data.id + '?describeDetail=' + data.describeDetail
......@@ -92,6 +94,7 @@ export default {
http
.post('soil/v1/sample/obtain_prepare_data?ids=' + data)
.then(res => res),
// 试样制备完成
savePrepare: data =>
https
......
<template>
<div>
<Modal v-model="showModal" :mask-closable="false" width="100" class="zIndex-1000 full-screen">
<Modal v-model="showModal" :mask-closable="false" width="90" 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>
<btn-list :msg="btn" class="contHide" @on-result-change="_btnClick"></btn-list>
</Col>
<!--内容-->
<Col span="24">
<PTVXETable
ref="pageTable"
:tableHeight="tableHeight"
:getPage="getPage"
@on-result-change="_tableResultChange"
:table-height="tableHeight"
:get-page="getPage"
:form-id="formId"
select-data
hide-page>
hide-page
@on-result-change="_tableResultChange">
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
......@@ -27,105 +27,12 @@
: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'" @click="_handleTimeRow(scope)">-->
<!-- <el-date-picker-->
<!-- v-model="scope.row.prepareDate"-->
<!-- type="datetime"-->
<!-- placeholder="选择日期时间">-->
<!-- </el-date-picker>-->
<!-- </div>-->
<div v-else-if="item.key==='prepareDate'">
<Date-picker v-model="scope.row.prepareDate" type="date" format="yyyy-MM-dd HH:mm" 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-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>
<div v-else-if="item.key==='prepareDate'">
<div v-if="item.key==='prepareDate'">
{{scope.row.prepareDate?$dateformat(scope.row.preparationDate,'yyyy-mm-dd HH:MM'):''}}
</div>
<span v-else-if="item.key==='type'">{{ scope.row[item.key]===0? '检样':'备样' }}</span>
<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>
......@@ -134,7 +41,7 @@
</Col>
</Row>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
<modal-footer ref="footerModal" :footer="footerList" @on-result-change="_footerResult"></modal-footer>
</div>
<!--打印标签-->
<!--选择人员-->
......@@ -143,25 +50,22 @@
</template>
<script>
import AutoComplete from '../../../components/base/AutoCompletes'
import Global from '../../../api/config'
import { soilEntrust } from '../../../api'
export default {
components: {
AutoComplete
},
components: {},
data() {
return {
formId: 'preparationModal',
showModal: false,
wayData: new Map(),
formObj: {},
formObj: {
sampleId: undefined
},
tableHeight: document.documentElement.clientHeight - 215,
footerList: [],
list: [
{ name: '取消', type: '', id: '' },
// {name: '仅流转微生物', type: 'primary', id: ''},
{ name: '关闭', type: 'primary', id: '' }
],
btn: [{ type: 'error', id: 'ZBC', name: '删除' }],
......@@ -178,8 +82,6 @@ export default {
{ 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: '制备方式',
......@@ -211,7 +113,7 @@ export default {
preparationWayData: [],
resultStateWayData: [],
saveWayData: [],
sampleIds: '',
sampleId: '',
unitData: [],
locationList: [],
......@@ -231,21 +133,7 @@ export default {
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) {
......@@ -259,37 +147,6 @@ export default {
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
......@@ -310,8 +167,9 @@ export default {
this._handleRow(handleObj)
this.currentRow.keepContainer = data.name
},
_open(sampleIds) {
this.sampleIds = sampleIds
_open(sampleId) {
this.sampleIds = sampleId
this.formObj.sampleId = sampleId
console.log(this.sampleIds)
this.showModal = true
this.getPage.records = []
......@@ -326,16 +184,11 @@ export default {
// this._dicSearch()
},
_page: async function() {
const result = await soilEntrust.preparePage(this.sampleIds)
const result = await soilEntrust.pagePrepareDetailHis(this.formObj)
if (result) {
console.log(result)
this.getPage = result
this.$refs.pageTable._hideLoading()
this.getPage.records = result
for (let j = 0; j < result.length; j++) {
console.log(result[j].prepareDate)
console.log(new Date(result[j].prepareDate))
this.getPage.records[j].prepareDate = new Date(result[j].prepareDate)
}
}
},
_footerResult(name) {
......@@ -346,87 +199,12 @@ export default {
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)
this._resultChange('制备成功')
},
_resultChange(msg) {
this.showModal = false
this.$Message.success(msg)
......@@ -437,58 +215,8 @@ export default {
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':
......@@ -572,46 +300,6 @@ export default {
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
......
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