Commit cccfb0f5 authored by 高滢's avatar 高滢

feat(定制检测方案): 添加

parent 0ab8053f
import request from '@/utils/request' import request from '@/utils/request'
// 获取项目 // 获取项目
export const getObjectList = () => { export const getObjectList = (data) => {
return request({ return request({
url: '/Object/Data/getList', url: '/Object/Data/getList',
method: 'post' method: 'post',
data
}) })
} }
......
<template> <template>
<div class="checkbox-input-box">
<div> <div>
<div v-for="(i, k) in items.options" class="checkbox-item" :key="k"> <div v-for="(i, k) in items.options" class="checkbox-item" :key="k">
<el-checkbox <el-checkbox
:disabled="status" :disabled="status"
:model="i.check" v-model="model.list[k].check"
@change=" @change="
e => { e => {
checkOne(i, e) checkOne(i, e)
...@@ -16,17 +17,20 @@ ...@@ -16,17 +17,20 @@
<el-input <el-input
v-bind="items" v-bind="items"
placeholder="请输入" placeholder="请输入"
:disabled="!list[k].check" :disabled="!model.list[k].check"
style="width: 10rem; margin: 0 10px" style="width: 10rem; margin: 0 10px"
v-model="list[k].value" v-model="model.list[k].value"
@input="input" @input="input"
> >
</el-input> </el-input>
<div style="width: 20rem; display: inline-block; vertical-align: middle"> <div
style="width: 20rem; display: inline-block; vertical-align: middle"
>
{{ i.object }} {{ i.object }}
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script> <script>
export default { export default {
...@@ -55,16 +59,17 @@ export default { ...@@ -55,16 +59,17 @@ export default {
return { return {
model: { model: {
value: '', value: '',
list: [] list: [],
} }
} }
}, },
created() { created() {
this.value = this.defaultValue
this.reset() this.reset()
}, },
watch: { watch: {
defaultValue(newVal) { defaultValue(newVal) {
// this.list = newVal this.model.value = newVal
}, },
status(newVal) { status(newVal) {
this.reset() this.reset()
...@@ -75,8 +80,8 @@ export default { ...@@ -75,8 +80,8 @@ export default {
mounted() { mounted() {
if (this.defaultValue) { if (this.defaultValue) {
this.model = this.defaultValue this.model = this.defaultValue
this.$emit('changeVal', { name: this.prop, val: this.model }) this.$emit('changeVal', { name: this.prop, val: this.result })
this.$emit('makeRecord', { name: this.prop, record: this.result }) this.$emit('makeRecord', { name: this.prop, record: this.model })
} else { } else {
this.reset() this.reset()
} }
...@@ -112,37 +117,51 @@ export default { ...@@ -112,37 +117,51 @@ export default {
}) })
return arr return arr
}, },
checkOne(i, e) {
if (this.merge) {
this.$emit('mergeVal', {
name: e,
flag: i.flag ? i.flag.split(',') : []
})
}
},
input(val) { input(val) {
let arr = [] let arr = []
this.mdoel.list.map(i => { console.log(this.model)
this.model.list.map(i => {
if (i.check) { if (i.check) {
arr.push(i.useCaseNo) arr.push(i.useCaseNo)
} }
}) })
this.$emit('changeVal', { name: this.prop, val: arr.join(',') }) this.$emit('changeVal', { name: this.prop, val: arr.join(',') })
this.$emit('makeRecord', { name: this.prop, record: this.mdoel.list }) this.$emit('makeRecord', { name: this.prop, record: this.model })
}, },
reset() { reset() {
this.model.list = [] this.model.list = []
this.items.options.map(i => { this.items.options.map(i => {
this.model.list.push({ this.model.list.push({
value: '', value: '',
id: i.id,
check: false, check: false,
useCaseNo: i.useCaseNo, useCaseNo: i.useCaseNo,
key: i.value, key: i.value,
id: i.id,
flag: i.flag flag: i.flag
}) })
}) })
} },
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.checkbox-item { .checkbox-item {
// display: flex;
// align-items: center;
// justify-content: flex-start;
margin-bottom: 10px;
}
.checkbox-input-box {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; justify-content: space-between;
margin-bottom: 10px;
} }
</style> </style>
<template> <template>
<div> <div>
<div v-if="prop == 'chcek9'" style="display: inline flex"> <div v-if="prop == 'chcek10'" style="display: inline flex">
<span>关键配置参数:</span> <span>关键配置参数:</span>
<el-checkbox-group v-model="value" :disabled="status" @change="input"> <el-checkbox-group v-model="value" :disabled="status" @change="input">
<el-checkbox <el-checkbox
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<span></span> <span></span>
</div> </div>
<div v-if="prop == 'chcek9'" style="display: inline flex"> <div v-if="prop == 'chcek10'" style="display: inline flex">
<span>标定参数:</span> <span>标定参数:</span>
<el-checkbox-group v-model="value" :disabled="status" @change="input"> <el-checkbox-group v-model="value" :disabled="status" @change="input">
<el-checkbox <el-checkbox
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</el-checkbox-group> </el-checkbox-group>
</div> </div>
<el-checkbox-group <el-checkbox-group
v-if="prop != 'chcek9'" v-if="prop != 'chcek10'"
v-model="value" v-model="value"
:disabled="status" :disabled="status"
@change="input" @change="input"
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
</div> </div>
</el-upload> </el-upload>
</div> </div>
<div v-if="prop=='chcek5'"> <div v-if="prop=='chcek6'">
<el-upload <el-upload
class="upload-demo" class="upload-demo"
:action="uploadImgUrl" :action="uploadImgUrl"
......
...@@ -202,18 +202,16 @@ export default { ...@@ -202,18 +202,16 @@ export default {
i.record = this.record[i.key] i.record = this.record[i.key]
codes.push(this.form[i.key]) codes.push(this.form[i.key])
} }
console.log(i)
arr.push(i) arr.push(i)
}) })
codes = codes.filter(item => item && item !== '') codes = codes.filter(item => item && item !== '')
console.log({ console.log({
record: arr, record: JSON.stringify(arr),
codes: codes.join(',') codes: codes.join(',')
}) })
return { return {
record: arr, record: JSON.stringify(arr),
codes: codes.join(',') codes: codes.join(',')
} }
} else { } else {
......
...@@ -100,6 +100,8 @@ export default { ...@@ -100,6 +100,8 @@ export default {
}, },
data() { data() {
return { return {
inspectionStandardId:'',
modelInitial:[],
model: [], model: [],
loading: false, loading: false,
form: { form: {
...@@ -131,10 +133,8 @@ export default { ...@@ -131,10 +133,8 @@ export default {
'form.inspectionStandardId': { 'form.inspectionStandardId': {
handler(newValue, oldValue) { handler(newValue, oldValue) {
if (newValue) { if (newValue) {
// this.model.inspectionItem = []
console.log(newValue)
this.getTaskType(newValue) this.getTaskType(newValue)
this.handleLoad()
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.form.clearValidate('inspectionItem') this.$refs.form.clearValidate('inspectionItem')
}) })
...@@ -160,11 +160,11 @@ export default { ...@@ -160,11 +160,11 @@ export default {
if (this.$route.query.id !== undefined) { if (this.$route.query.id !== undefined) {
this.getTaskDetail(this.$route.query.id) this.getTaskDetail(this.$route.query.id)
} else { } else {
this.handleLoad()
this.form = { this.form = {
inspectionStandardId:"1", inspectionStandardId:"1",
inspectionItem: ['trfis'] inspectionItem: ['trfis']
} }
this.handleLoad()
} }
}) })
}, },
...@@ -180,6 +180,8 @@ export default { ...@@ -180,6 +180,8 @@ export default {
this.form = res.data this.form = res.data
this.form.inspectionItem = this.form.inspectionItem.split(',') this.form.inspectionItem = this.form.inspectionItem.split(',')
this.model = JSON.parse(res.data.specifyPlan) this.model = JSON.parse(res.data.specifyPlan)
this.modelInitial = JSON.parse(res.data.specifyPlan)
this.inspectionStandardId = this.form.inspectionStandardId
this.form.id = undefined this.form.id = undefined
} }
}) })
...@@ -191,7 +193,7 @@ export default { ...@@ -191,7 +193,7 @@ export default {
if (form.inspectionItem.indexOf('trfis') !== -1) { if (form.inspectionItem.indexOf('trfis') !== -1) {
const res = await this.$refs.check.getValidateVaule() const res = await this.$refs.check.getValidateVaule()
form.specifyPlan = JSON.stringify(res.record) form.specifyPlan = res.record
form.useCaseNo = res.codes form.useCaseNo = res.codes
} }
form.inspectionItem = form.inspectionItem.join(',') form.inspectionItem = form.inspectionItem.join(',')
...@@ -251,8 +253,11 @@ export default { ...@@ -251,8 +253,11 @@ export default {
}) })
}, },
handleLoad() { handleLoad() {
getObjectList().then(res => { getObjectList({standardType:this.form.inspectionStandardId}).then(res => {
if (res.code == 200) { if (res.code == 200) {
if (this.$route.query.id !== undefined && this.form.inspectionStandardId===this.inspectionStandardId) {
this.model = this.modelInitial
}else {
this.model = res.data.map(i => { this.model = res.data.map(i => {
return { return {
...i, ...i,
...@@ -262,7 +267,7 @@ export default { ...@@ -262,7 +267,7 @@ export default {
} }
} }
}) })
// this.$message.success('加载成功') }
} else { } else {
this.$message.error('加载失败') this.$message.error('加载失败')
} }
......
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