Commit cccfb0f5 authored by 高滢's avatar 高滢

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

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