Commit 1f4d8d1e by lichengming

修改了余样管理的批量填写信息

parent fdc9bd87
<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="保存容器:" prop="keepContainer">
<Input v-model="formObj.keepContainer" clearable placeholder="请输入保存容器"></Input>
</Form-item>
<Form-item label="制备数量">
<Input v-model="formObj.quantity" clearable placeholder="请输入备样数量"></Input>
</Form-item>
<Form-item label="留存位置">
<Input v-model="formObj.keepLocation" clearable placeholder="请输入留存位置"></Input>
</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
},
// 存储条件 回调
_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.editPrepare(data)
if (result) {
this.$Message.success('保存成功')
this.$emit('on-result-change')
this.showModal = false
}
}
}
}
</script>
......@@ -86,10 +86,12 @@
</div>
<SampleParpareApply ref="applyModal" @on-result-change="_page"></SampleParpareApply>
<Operation ref="recordModal"></Operation>
<SampleSurplusBatchEdit ref="batchEdit" @on-result-change="_page"></SampleSurplusBatchEdit>
</div>
</template>
<script>
import SampleParpareApply from '../SurplusParpareApply'
import SampleSurplusBatchEdit from '../SampleSurplusBatchEdit'
// eslint-disable-next-line no-unused-vars
import http from '../../../../api/http'
import { soilSample } from '../../../../api'
......@@ -97,7 +99,8 @@ import Operation from '../../../../components/operation/Operation'
export default {
components: {
SampleParpareApply,
Operation
Operation,
SampleSurplusBatchEdit
},
data() {
return {
......@@ -119,6 +122,11 @@ export default {
type: 'primary',
id: '',
name: '完成处理'
},
{
type: 'primary',
id: '',
name: '批量填写存放信息'
}
// { type: '', id: '', name: '填写存放信息' },
// { type: '', id: '', name: '申请处理' },
......@@ -349,6 +357,9 @@ export default {
case '填写存放信息':
this._batchEdit()
break
case '批量填写存放信息':
this._writeInfo()
break
case '导出':
if (this.getPage.records.length === 0) {
this.$Message.warning('暂无数据,不可导出')
......@@ -364,6 +375,13 @@ export default {
break
}
},
_writeInfo() {
if (this.selectIds.length === 0) {
this.$Message.warning('请选择一条或多条数据!')
} else {
this.$refs.batchEdit._open(this.selectIds)
}
},
_resultChange(msg) {
this.$Message.success(msg)
this._page()
......
......@@ -81,6 +81,7 @@ export default {
businessTypeList: 0
},
entrustId: '',
clientList: [],
selectData: [],
itemIds: [],
footerList: [
......@@ -140,10 +141,11 @@ export default {
_hideLoading() {
this.$refs.footerModal._hideLoading()
},
_open(ids, entrustId) {
_open(ids, entrustId, clientInfo) {
console.log(Global.recordURL)
this.formObj = this.$resetFields(this.formObj)
this.entrustId = entrustId
this.clientList = clientInfo
this._classTree()
this.showModal = true
this.itemIds = ids
......@@ -205,9 +207,10 @@ export default {
recordUrl = Global.recordURL
}
const url =
recordUrl + '/print/v1/eln/template_YT_' + this.selectData[0].id
recordUrl + '/print/v1/eln/template_meter_' + this.selectData[0].id
const params = {
ids: this.itemIds.join(',')
ids: this.itemIds.join(','),
client: this.clientList[0]
}
this.$refs.iframeModal._createIframe(url, params)
console.log('原始记录', url, params)
......
......@@ -457,7 +457,9 @@ export default {
this.$message.warning('请至少选择一条数据')
} else {
const errorInfo = []
const clientInfo = []
for (let i = 0; i < this.selectData.length; i++) {
clientInfo.push(this.selectData[i].client)
console.log(this.selectData[i].recorded)
if (this.selectData[i].recorded !== '否') {
errorInfo.push(this.selectData[i].index + 1)
......@@ -467,7 +469,11 @@ export default {
this.$Message.warning('所选数据中有已填写原始记录的')
} else {
console.log('打开填写原始记录界面')
this.$refs.recordModal._open(this.selectIds, this.entrustId)
this.$refs.recordModal._open(
this.selectIds,
this.entrustId,
clientInfo
)
}
}
},
......
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