This commit is contained in:
lb 2023-09-18 17:01:44 +08:00
bovenliggende c364162a2a
commit c965dfbc5a
4 gewijzigde bestanden met toevoegingen van 243 en 17 verwijderingen

Bestand weergeven

@ -1,3 +1,5 @@
import moment from 'moment';
/**
* 用于动态表结构的 tableProps 生成
* @param {*} nameData
@ -16,9 +18,9 @@ export function handleNameData(nameData) {
function step1(tree1) {
return Array.from(new Set(tree1.map((item) => item.name)))
.sort()
.map((item) => ({
prop: item,
label: item,
.map((time) => ({
prop: time,
label: moment(time).format('YYYY-MM-DD HH:mm:ss'),
children: [],
}));
}

Bestand weergeven

@ -0,0 +1,233 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-09-11 15:55:13
description: DialogForm for equipmentBindSection only
-->
<template>
<el-form
ref="form"
:model="dataForm"
label-width="100px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col>
<el-form-item
label="产线"
prop="productionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.productionId"
placeholder="请选择产线"
filterable
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item
label="工段"
prop="sectionId"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.sectionId"
placeholder="请选择工段"
filterable
@change="$emit('update', dataForm)">
<el-option
v-for="opt in workshopSectionList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item
label="按钮盒识别码"
prop="buttonId"
:rules="[
{
type: 'number',
message: '请输入整数',
trigger: 'blur',
transform: (val) => Number.isInteger(Number(val)) && Number(val),
},
]">
<el-input
v-model="dataForm.buttonId"
@change="$emit('update', dataForm)"
placeholder="请输入整数" />
</el-form-item>
<!--
<el-form-item
label="报警编码"
prop="code"
:rules="[{ required: true, message: '不能为空', trigger: 'blur' }]">
<el-select
v-model="dataForm.code"
placeholder="请选择产线"
@change="handleProductlineChange">
<el-option
v-for="opt in productionLineList"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item> -->
</el-col>
<el-col>
<el-form-item label="按钮盒模式" prop="model">
<el-input
v-model="dataForm.model"
@change="$emit('update', dataForm)"
placeholder="请输入按钮盒模式" />
</el-form-item>
</el-col>
<el-col>
<el-form-item
label="按钮值"
prop="keyValue"
:rules="[
{
type: 'number',
message: '请输入100以内的整数',
trigger: 'blur',
transform: (val) =>
Number(val) <= 100 && Number.isInteger(+val) && Number(val),
},
]">
<el-input
v-model="dataForm.keyValue"
type="number"
min="0"
max="100"
@change="$emit('update', dataForm)"
placeholder="请输入按钮盒模式" />
</el-form-item>
</el-col>
<el-col>
<el-form-item label="检测内容" prop="inspectionDetContent">
<el-input
type="textarea"
v-model="dataForm.inspectionDetContent"
placeholder="请输入检测内容"
@change="$emit('update', dataForm)"></el-input>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
dataForm: {
type: Object,
default: () => ({}),
},
},
data() {
return {
formLoading: true,
productionLineList: [],
workshopSectionList: [],
};
},
mounted() {
this.getProductionLineList();
// this.getWorksectionList();
// this.getCode('/base/equipment-group-alarm/getCode').then((code) => {
// this.formLoading = false;
// this.$emit('update', {
// ...this.dataForm,
// code,
// });
// });
},
watch: {
'dataForm.productionId': {
handler(id) {
this.getWorksectionList(id);
},
immediate: true
}
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
async getProductionLineList() {
this.formLoading = true;
const res = await this.$axios({
url: '/base/production-line/listAll',
method: 'get',
});
if (res.code == 0) {
this.productionLineList = res.data.map((item) => ({
label: item.name,
value: item.id,
}));
}
this.formLoading = false;
},
async getWorksectionList(id) {
this.formLoading = true;
const res = await this.$axios({
url: '/base/workshop-section/listByParentId',
method: 'get',
params: {
id,
},
});
if (res.code == 0) {
this.workshopSectionList = res.data.map((item) => ({
label: item.name,
value: item.id,
}));
}
this.formLoading = false;
},
async handleProductlineChange(id) {
await this.getWorksectionList(id);
this.dataForm.sectionId = null;
this.$emit('update', this.dataForm);
},
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

Bestand weergeven

@ -39,7 +39,7 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" :dataForm="form" :rows="rows" />
<DialogForm v-if="open" ref="form" v-model="form" :rows="rows" />
</base-dialog>
</div>
</template>
@ -55,11 +55,12 @@ import {
} from '@/api/base/qualityInspectionBoxBtn';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import moment from 'moment';
import DialogForm from './dialogForm.vue';
export default {
name: 'QualityInspectionBoxBtn',
mixins: [basicPageMixin],
components: {},
components: { DialogForm },
data() {
return {
rows: [
@ -114,7 +115,8 @@ export default {
type: 'number',
message: '请输入100以内的整数',
trigger: 'blur',
transform: (val) => Number(val) <= 100 && Number.isInteger(+val) && Number(val),
transform: (val) =>
Number(val) <= 100 && Number.isInteger(+val) && Number(val),
},
],
bind: { type: 'number', min: 0, max: 100 },

Bestand weergeven

@ -45,7 +45,6 @@ export default {
pageNo: 1,
pageSize: 10,
},
// jsondemo: '',
list: [
// {
// inspectionContent: '1',
@ -72,16 +71,6 @@ export default {
url: '/monitoring/record-in-one-day/get',
method: 'get',
});
// console.log(response);
// const {
// // data: { nameData },
// code,
// } = response;
// this.jsondemo = hljs.highlight(
// 'json',
// JSON.stringify(response, null, 2),
// true
// ).value;
const {
data: { data: dyanmicData, nameData },
} = response;