新增报表
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form ref="form" :model="dataForm" label-width="120px" v-loading="formLoading">
|
||||
<el-form ref="dataForm" :model="dataForm" label-width="120px" v-loading="formLoading" label-position="top">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="产线" prop="productionLineId"
|
||||
@@ -24,8 +24,22 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-col :span="24">
|
||||
<el-form-item label="检测内容" prop="inspectionDetIdList"
|
||||
:rules="[{ required: true, message: '不能为空', trigger: 'change' }]">
|
||||
<div class="itemDet" v-for="item in inspectionDetList" :key="item.typeId" style="padding: 0 20px;">
|
||||
<div>{{ item.typeName}} </div>
|
||||
<!-- <div>{{ item.data }} </div> -->
|
||||
<div class="content">
|
||||
<el-checkbox-group v-model="dataForm.inspectionDetIdList" @change="handleCheckedCitiesChange">
|
||||
<el-checkbox v-for="i in item.data" :key="i.content" :label="i.detId">{{ i.content }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- <el-col :span="12">
|
||||
<el-form-item label="按钮盒识别码" prop="buttonId" :rules="[
|
||||
{ required: true, message: '不能为空', trigger: 'blur' },
|
||||
{
|
||||
@@ -65,28 +79,36 @@
|
||||
<el-option v-for="opt in inspectionDetList" :key="opt.value" :label="opt.label" :value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import basicAdd from '../../mixins/basic-add';
|
||||
import {
|
||||
createQualityInspectionBoxBtn,
|
||||
updateQualityInspectionBoxBtn,
|
||||
getQualityInspectionBoxBtn,
|
||||
getListByLineSection
|
||||
} from '@/api/base/qualityInspectionBoxBtn';
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
prop: 'dataForm',
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: {},
|
||||
props: {
|
||||
dataForm: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
},
|
||||
mixins: [basicAdd],
|
||||
data() {
|
||||
return {
|
||||
return {
|
||||
urlOptions: {
|
||||
// isGetCode: false,
|
||||
// codeURL: getCode,
|
||||
createURL: createQualityInspectionBoxBtn,
|
||||
updateURL: updateQualityInspectionBoxBtn,
|
||||
infoURL: getQualityInspectionBoxBtn,
|
||||
},
|
||||
dataForm: {
|
||||
// id: null,
|
||||
sectionId: null,
|
||||
productionLineId: null,
|
||||
inspectionDetIdList:[],
|
||||
},
|
||||
formLoading: true,
|
||||
productionLineList: [],
|
||||
inspectionDetList:[],
|
||||
@@ -96,6 +118,7 @@ export default {
|
||||
mounted() {
|
||||
this.getProductionLineList()
|
||||
this.getQualityInspectionDetList()
|
||||
// this.getList()
|
||||
// this.getWorksectionList();
|
||||
// this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
|
||||
// this.formLoading = false;
|
||||
@@ -108,13 +131,56 @@ export default {
|
||||
watch: {
|
||||
'dataForm.productionId': {
|
||||
handler(id) {
|
||||
if (id != null) this.getWorksectionList(id);
|
||||
if (id != null) this.getWorksectionList(id)
|
||||
},
|
||||
immediate: true,
|
||||
immediate: true
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 模拟透传 ref */
|
||||
methods: {
|
||||
init(obj) {
|
||||
// console.log(productionLineId);
|
||||
console.log(obj);
|
||||
this.visible = true;
|
||||
// if(obj.id)
|
||||
this.dataForm.id = obj.id ? obj.id : ""
|
||||
this.$nextTick(() => {
|
||||
this.$refs["dataForm"].resetFields()
|
||||
if (obj) {
|
||||
getListByLineSection({
|
||||
productionLineId: obj.productionLineId,
|
||||
sectionId: obj.sectionId,
|
||||
}).then((res) => {
|
||||
console.log(res);
|
||||
this.dataForm.inspectionDetIdList = res.data
|
||||
})
|
||||
}
|
||||
if (this.dataForm.id) {
|
||||
this.urlOptions.infoURL(obj.id).then(response => {
|
||||
this.dataForm.id = response.data.id
|
||||
this.dataForm.productionLineId = response.data.productionLineId
|
||||
this.dataForm.sectionId = response.data.sectionId
|
||||
// if (this.setData) {
|
||||
// this.setDataForm()
|
||||
// }
|
||||
});
|
||||
} else {
|
||||
// if (this.urlOptions.isGetCode) {
|
||||
// this.getCode()
|
||||
// }
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 模拟透传 ref */
|
||||
handleCheckedCitiesChange(value) {
|
||||
;console.log(value);
|
||||
// let checkedCount = value.length;
|
||||
// this.checkAll = checkedCount === this.cities.length;
|
||||
// this.isIndeterminate = checkedCount > 0 && checkedCount < this.cities.length;
|
||||
},
|
||||
// getList() {
|
||||
// console.log(this.dataForm.sectionId);
|
||||
|
||||
// },
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
@@ -138,14 +204,34 @@ export default {
|
||||
async getQualityInspectionDetList() {
|
||||
this.formLoading = true;
|
||||
const res = await this.$axios({
|
||||
url: '/base/quality-inspection-det/listAll',
|
||||
url: '/base/quality-inspection-det/inspectionMap',
|
||||
method: 'get',
|
||||
});
|
||||
if (res.code == 0) {
|
||||
this.inspectionDetList = res.data.map((item) => ({
|
||||
label: item.content,
|
||||
value: item.content,
|
||||
}));
|
||||
console.log(res)
|
||||
let arr = []
|
||||
for (let i in res.data) {
|
||||
let obj = {
|
||||
typeName: res.data[i].length !== 0 ? res.data[i][0].typeName : '',
|
||||
typeId: res.data[i].length !== 0 ? res.data[i][0].typeId : '',
|
||||
data:[]
|
||||
}
|
||||
let detArr = []
|
||||
res.data[i].forEach(ele => {
|
||||
detArr.push({
|
||||
detId: ele.id,
|
||||
content: ele.content
|
||||
})
|
||||
})
|
||||
obj.data = detArr
|
||||
arr.push(obj)
|
||||
}
|
||||
this.inspectionDetList = arr
|
||||
console.log(this.inspectionDetList);
|
||||
// this.inspectionDetList = res.data.map((item) => ({
|
||||
// label: item.content,
|
||||
// value: item.content,
|
||||
// }));
|
||||
}
|
||||
this.formLoading = false;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user