Commit bd65a63e by lichengming

修改了开土制备历史的制备详情按钮

parent becc6221
...@@ -9,13 +9,13 @@ ...@@ -9,13 +9,13 @@
<Row> <Row>
<!--查询--> <!--查询-->
<Col span="24"> <Col span="24">
<Form v-show="searchOpen" id="search-sample-company" :label-width="80" inline onsubmit="return false"> <Form id="search-sample-company" v-show="searchOpen" :label-width="80" 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.sampleCode" placeholder="请输入样品编号" clearable @on-enter="_formSearch" /> <Input v-model="formObj.sampleCode" @on-enter="_formSearch" placeholder="请输入样品编号" clearable />
</Form-item> </Form-item>
<Form-item class="search-btn"> <Form-item class="search-btn">
<Button type="primary" @click="_page"> <Button @click="_page" type="primary">
搜索 搜索
</Button> </Button>
</Form-item> </Form-item>
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
</Col> </Col>
<!--操作--> <!--操作-->
<Col span="24"> <Col span="24">
<btn-list :msg="btn" :open="searchOpen" class="contHide" 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">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true" <PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :loading="true"
:get-page="getPage" :icon-msg="iconMsg" select-data @on-result-change="_tableResultChange"> :get-page="getPage" :icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column <vxe-table-column
v-for="item in pageColumns" v-for="item in pageColumns"
:key="item.key" :key="item.key"
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,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> <PreparationHis ref="preHisModal" @on-result-change="_page"></PreparationHis>
</div> </div>
</template> </template>
<script> <script>
...@@ -70,10 +70,14 @@ import { soilEntrust } from '../../api' ...@@ -70,10 +70,14 @@ import { soilEntrust } from '../../api'
import { getLodop } from '../../plugins/clodop/LodopFuncs' import { getLodop } from '../../plugins/clodop/LodopFuncs'
import SoilSampleItemManage from './SoilSampleItemManageHis' import SoilSampleItemManage from './SoilSampleItemManageHis'
import DescribeDetailModal from './sample-preparation/DescribeDetailModal' import DescribeDetailModal from './sample-preparation/DescribeDetailModal'
import PreparationModal from './sample-preparation/Preparation' import PreparationHis from './sample-preparation/PreparationHis'
let LODOP let LODOP
export default { export default {
components: { SoilSampleItemManage, DescribeDetailModal, PreparationModal }, components: {
SoilSampleItemManage,
DescribeDetailModal,
PreparationHis
},
data() { data() {
return { return {
formId: 'soilSampleManage', formId: 'soilSampleManage',
...@@ -93,6 +97,11 @@ export default { ...@@ -93,6 +97,11 @@ export default {
], ],
iconMsg: [ iconMsg: [
{ {
type: 'ios-paper',
id: '',
name: '制备详情'
},
{
type: 'ios-beaker', type: 'ios-beaker',
id: '', id: '',
name: '管理检测项目' name: '管理检测项目'
...@@ -284,6 +293,9 @@ export default { ...@@ -284,6 +293,9 @@ export default {
case '管理检测项目': case '管理检测项目':
this._itemManage(data.id) this._itemManage(data.id)
break break
case '制备详情':
this._preEdit(data.id)
break
case '编辑': case '编辑':
this._editModal(true, data) this._editModal(true, data)
break break
...@@ -300,6 +312,9 @@ export default { ...@@ -300,6 +312,9 @@ export default {
} }
}) })
}, },
_preEdit(id) {
this.$refs.preHisModal._open(id)
},
_itemManage(data) { _itemManage(data) {
// 管理检测项目 // 管理检测项目
if (this.recordHis) { if (this.recordHis) {
......
<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"
@on-result-change="_tableResultChange"
:form-id="formId"
select-data
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'" @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'">
{{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==='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: 'error', id: 'ZBC', 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
},
{
title: '制备数量',
key: 'quantity',
width: 150
},
{ title: '单位', key: 'unit', width: 110 },
{ title: '状态', key: 'status', width: 150 },
{ title: '保存方式', key: 'keepWay', width: 150 },
{ title: '保存容器', key: 'keepContainer', width: 150 },
{
title: '制备时间',
key: 'prepareDate',
width: 200
},
{
title: '制备人',
key: 'preparer',
width: 130
},
{ title: '备注', key: 'remark', width: 150 }
],
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
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) {
switch (name) {
case '取消':
this._cancel()
break
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)
this.$emit('on-result-change')
this._hideLoading()
},
_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
},
_handleTimeRow(data) {
console.log(this.currentRow)
this.currentRow = data.row
}
}
}
</script>
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