Commit 6f19fd5f by lichengming

修改了个人检测任务填写检测值和判定按钮

parent fe707766
<template>
<div>
<Modal v-model="showBackModal" :mask-closable="false">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90">
<Form-item label="检测值:" prop="value">
<Input v-model="formObj.value" placeholder="请输入检测值"/>
</Form-item>
<!-- <Form-item label="单位:" prop="unit">-->
<!-- <AutoCompletes :value="formObj.unit" :downData="unitList" @on-result-change="_unitChange"-->
<!-- show-key="name" placeholder="请输入或选择单位"-->
<!-- ></AutoCompletes>-->
<!-- </Form-item>-->
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</div>
</template>
<script>
/**
* 退回原因
*/
import ModalFooter from '../../../components/base/modalFooter'
export default {
components: {
ModalFooter
},
data() {
return {
ids: [], // 合同ids
modalTitle: '批量填写',
showBackModal: false,
formObj: {
value: '',
unit: '',
detection: '',
detectionUnit: '',
analysisDate: ''
},
path: '',
ruleValidate: {
// value: [{required: true, message: '检测值不能为空', trigger: 'blur'}],
},
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
],
unitList: [],
unitListTemp: []
}
},
methods: {
// 分析时间的回显
_analysisResult(msg, data) {
switch (msg) {
case 'selectDate':
this.$set(this.formObj, 'analysisDate', data)
break
}
},
_open(ids) {
this.ids = ids // 合同id
this.showBackModal = true
this.formObj = this.$resetFields(this.formObj)
// this._dicSearch()
this.$refs.footerModal._hideLoading()
},
_dicSearch() {
this.$store
.dispatch('LmsBaseDict/getItem', '数据录入常用单位')
.then(() => {
const resultData = this.$store.state.LmsBaseDict.item
this.unitList = JSON.parse(JSON.stringify(resultData))
this.unitListTemp = JSON.parse(JSON.stringify(resultData))
})
},
_unitChange(msg, data) {
this.formObj.unit = data.name
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
},
_cancel() {
this.showBackModal = false
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const obj = this.$serializeFormSearch(this.formObj)
obj.ids = this.ids.join(',')
console.log('要传的数据', obj)
// this.$store.dispatch('FoodItem/detectionValue', obj).then(() => {
// if (this.$store.state.FoodItem.success) {
// this.$Message.success('填写成功')
// this.showBackModal = false
// this.$emit('on-result-change')
// }
// this.$refs.footerModal._hideLoading()
// })
} else {
this.$refs.footerModal._hideLoading()
this.$Message.error('表单验证失败!')
}
})
}
}
}
</script>
<template>
<div>
<Modal v-model="showBackModal" :mask-closable="false" class="zIndex-1100">
<p slot="header">{{modalTitle}}</p>
<div>
<Form ref="formObj" :model="formObj" :rules="ruleValidate" :label-width="90">
<Form-item label="判定结果:" prop="type">
<RadioGroup v-model="formObj.type">
<Radio :label="1">合格</Radio>
<Radio :label="2">不合格</Radio>
<Radio :label="3">不判定</Radio>
</RadioGroup>
</Form-item>
</Form>
</div>
<div slot="footer">
<ModalFooter ref="footerModal" @on-result-change="_footerResult" :footer="footerList"></ModalFooter>
</div>
</Modal>
</div>
</template>
<script>
/**
* 判定
*/
import ModalFooter from '../../../components/base/modalFooter'
export default {
components: {
ModalFooter
},
data() {
return {
ids: [], // 合同ids
modalTitle: '判定',
showBackModal: false,
formObj: {
type: 1
},
path: '',
ruleValidate: {
type: [
{
type: 'number',
required: true,
message: '判定结果不能为空',
trigger: 'blur'
}
]
},
footerList: [
{ id: '', name: '取消', type: '' },
{ id: '', name: '保存', type: 'primary' }
]
}
},
methods: {
_open(ids) {
this.ids = ids // 合同id
this.showBackModal = true
this.formObj.type = 1
this.$refs.footerModal._hideLoading()
},
_cancel() {
this.showBackModal = false
},
_footerResult(name) {
switch (name) {
case '取消':
this._cancel()
break
case '保存':
this._ok()
break
}
this.$refs.footerModal._hideLoading()
},
_ok() {
this.$refs.formObj.validate(valid => {
if (valid) {
const data = {}
data.ids = this.ids.join(',')
this.$extend(data, { type: this.formObj.type })
console.log('要传的数据', data)
this.showBackModal = false
// this.$store.dispatch('FoodItem/judge', data).then(() => {
// if (this.$store.state.FoodItem.success) {
// this.$Message.success('判定成功')
// this.showBackModal = false
// this.$emit('on-result-change')
// }
// })
} else {
this.$Message.error('表单验证失败!')
}
})
}
}
}
</script>
......@@ -10,24 +10,24 @@
<Form id="formId" :label-width="80" inline onsubmit="return false">
<label class="label-sign"></label>
<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 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 class="search-btn" style="margin-left: -10px">
<Button type="primary" @click="_formSearch">搜索</Button>
<Button @click="_formSearch" type="primary">搜索</Button>
</Form-item>
</Form>
</Col>
<Col span="24">
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" class="contHide"
@on-result-change="_btnClick"></btn-list>
<btn-list :msg="btn" :open="searchOpen" :show-search-btn="true" @on-result-change="_btnClick"
class="contHide"></btn-list>
</Col>
<Col span="24">
<PTVXETable ref="pageTable" :table-height="tableHeight" :form-id="formId" :get-page="getPage"
:icon-msg="iconMsg" select-data @on-result-change="_tableResultChange">
:icon-msg="iconMsg" @on-result-change="_tableResultChange" select-data>
<vxe-table-column
v-for="item in pageColumns"
:key="item.key"
......@@ -48,9 +48,9 @@
<div v-else-if="item.key==='testValue'">
<el-input
v-model="scope.row.testValue"
@blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"
size="medium"
placeholder="请输入检测结果"
@blur="_handleTestValueEdit(scope.row.id,scope.row.testValue)"
/>
</div>
<div v-else-if="item.key==='progress'">
......@@ -64,12 +64,18 @@
</Row>
</div>
</Modal>
<fillout ref="fillout"></fillout>
<decide ref="decide"></decide>
</div>
</template>
<script>
import { meterItem } from '../../../api'
import fillout from './DetectionValue'
import decide from './Judge'
export default {
components: {
fillout,
decide
// FoodSampleGovernDetail,
// CopyModal,
// FoodSampleGovernLYEdits
......@@ -169,9 +175,16 @@ export default {
this.currentComponent = componentName
this.$nextTick(function() {
switch (msg) {
case '判定':
this._judge()
break
case '完成':
this._testEnd()
break
case '填写检测值':
// this._handleTestValueEdit()
this._detectionValue()
break
case '导入检测项目':
this._importItem()
break
......@@ -187,6 +200,20 @@ export default {
}
})
},
_detectionValue() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.fillout._open(this.selectIds)
}
},
_judge() {
if (this.selectIds.length === 0) {
this.$Message.warning('请至少选择一条数据!')
} else {
this.$refs.decide._open(this.selectIds)
}
},
_iconClick(res, data, componentName) {
this.currentComponent = componentName
this.$nextTick(function() {
......
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