Commit 92667396 by lichengming

修改了备样管理批样填写

parent 2aa68ee8
<template>
<div>
<Modal v-model="showModal" :mask-closable="false">
<p slot="header">填写存放信息</p>
<div>
<Form id="storage-location-form" ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="100">
<Form-item label="存储条件:">
<el-select :value="formObj.conditions" @change="selCondi" style="width:100%" size="small">
<el-option v-for="item in conditionList" :value="item.name" :key="item.name">{{ item.name }}
</el-option>
</el-select>
</Form-item>
<Form-item label="备样位置:" prop="backupLocation">
<Input v-model="formObj.backupLocation" clearable placeholder="请输入备样位置"></Input>
</Form-item>
<Form-item label="备样数量">
<Input v-model="formObj.quantity" clearable placeholder="请输入备样数量"></Input>
</Form-item>
<Form-item label="备样人:">
<el-select :value="formObj.backupUser" @change="selUser" style="width:100%" size="small">
<el-option v-for="item in backupUserList" :value="item.id" :label="item.realname" :key="item.realname">{{ item.realname }}
</el-option>
</el-select>
</Form-item>
</Form>
</div>
<div slot="footer">
<modal-footer ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></modal-footer>
</div>
</Modal>
</div>
</template>
<script>
import { soilSample } from '../../../api'
export default {
components: {},
data() {
return {
ids: [], // 委托ids
showModal: false,
formObj: {},
ruleValidate: {
backupLocation: [
{ required: true, message: '备样位置不能为空', trigger: 'blur' }
]
},
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
conditionList: [],
locList: [],
backupUserList: [],
sampleUnit: ''
}
},
mounted() {
this._getConditionList()
this._getUserList()
},
methods: {
_locChange(msg, data) {
switch (msg) {
case 'select':
this.formObj.backupPlace = data.backupPlace
this._getCondition(data.backupPlace)
break
case 'query':
this.formObj.backupPlace = data.backupPlace
this._getLocList(data.backupPlace)
break
}
},
selCondi(data) {
this.$forceUpdate()
this.formObj.conditions = data
},
selUser(data) {
this.$forceUpdate()
if (data) {
for (let i = 0; i < this.backupUserList.length; i++) {
if (this.backupUserList[i].id === data) {
this.formObj.backupUser = this.backupUserList[i].realname
}
}
} else {
this.getPage.records[this.currentIndex].backupUser = ''
}
this.formObj.backupUserId = data
// this.$forceUpdate()
// this.getPage.records[this.currentIndex].backupUser = data
// this.getPage.records[this.currentIndex].backupUser = data
},
// 存储条件 回调
_locChangeCondition(msg, data) {
switch (msg) {
case 'select':
this.formObj.storageCondition = data.name
this._getLocCondition(data.name)
break
case 'query':
this.formObj.storageCondition = data.name
this._getLocConditionList(data.name)
break
}
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_open(data) {
this.showModal = true
this.formObj = this.$resetFields(this.formObj)
this.sampleUnit = ''
this.$refs.footerModal._hideLoading()
this.ids = data
// 循环遍历数据
},
_getConditionList: async function() {
const result = await soilSample.getDictList('存储条件')
if (result) {
this.conditionList = result
}
},
_getUserList: async function() {
const result = await soilSample.getUserList()
if (result) {
console.log(result)
this.backupUserList = result.records
}
},
//
_dateChange(data) {
this.formObj.endDate = data
},
_cancel() {
this.showModal = false
this.$refs.footerModal._hideLoading()
},
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = this.formObj
this._saveInfo({ id: this.ids.join(','), obj: data })
} else {
this.$Message.error('表单验证失败!')
this.$refs.footerModal._hideLoading()
}
})
},
_saveInfo: async function(data) {
const result = await soilSample.editBackup(data)
if (result) {
this.$Message.success('保存成功')
}
}
}
}
</script>
......@@ -93,11 +93,13 @@
</div>
<SampleParpareApply ref="applyModal" @on-result-change="_page"></SampleParpareApply>
<Operation ref="recordModal"></Operation>
<SampleParpareBatchEdit ref="batchEdit"></SampleParpareBatchEdit>
</div>
</template>
<script>
// import AutoCompletes from '../../../../components/base/AutoCompletes'
import SampleParpareApply from '../SampleParpareApply'
import SampleParpareBatchEdit from '../SampleParpareBatchEdit'
// eslint-disable-next-line no-unused-vars
import http from '../../../../api/http'
import { soilEntrust, soilSample } from '../../../../api'
......@@ -106,6 +108,7 @@ export default {
components: {
// AutoCompletes,
SampleParpareApply,
SampleParpareBatchEdit,
Operation
},
data() {
......@@ -130,6 +133,11 @@ export default {
},
{
type: 'primary',
id: '',
name: '批量填写存放信息'
},
{
type: 'primary',
id: 'food-sample-preparation-his-all',
name: '制备'
},
......@@ -423,6 +431,9 @@ export default {
case '申请处理':
this._applyDispose()
break
case '批量填写存放信息':
this._writeInfo()
break
case '完成处理':
this._handleApply()
break
......@@ -453,6 +464,13 @@ export default {
break
}
},
_writeInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.batchEdit._open(this.selectIds)
}
},
_handleApply() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
......@@ -521,104 +539,6 @@ export default {
switch (msg) {
case 'page':
this._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
......
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