1
This commit is contained in:
parent
9f82aac931
commit
86996f8dd2
@ -30,7 +30,7 @@
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="保养计划名称" prop="name">
|
||||
<span>---</span>
|
||||
<el-input value="---" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@ -97,19 +97,19 @@
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划保养人员" prop="maintainer">
|
||||
<span>---</span>
|
||||
<el-input value="---" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划开始时间" prop="firstMaintenanceTime">
|
||||
<span>---</span>
|
||||
<el-input value="---" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划结束时间" prop="firstMaintenanceTime">
|
||||
<span>---</span>
|
||||
<el-input value="---" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
@ -0,0 +1,399 @@
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
date: 2023-08-15 10:32:36
|
||||
description: 弹窗的表单组件
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:size="size"
|
||||
:label-position="labelPosition"
|
||||
v-loading="formLoading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="保养计划单号"
|
||||
prop="code"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入保养计划单号', trigger: 'blur' },
|
||||
]">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入保养计划单号`"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="保养计划名称" prop="name">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
disabled
|
||||
:placeholder="`请输入保养计划名称`" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="部门"
|
||||
prop="departmentId"
|
||||
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
|
||||
<el-select
|
||||
v-model="form.departmentId"
|
||||
:placeholder="`请选择部门`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in departmentOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item
|
||||
label="设备大类"
|
||||
prop="equipmentCategory"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择设备大类', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.equipmentCategory"
|
||||
:placeholder="`请选择设备大类`"
|
||||
:disabled="disabled"
|
||||
@change="handleEqTypeChange">
|
||||
<el-option
|
||||
v-for="opt in equipmentTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="产线"
|
||||
prop="lineId"
|
||||
:rules="[{ required: true, message: '请选择产线', trigger: 'blur' }]">
|
||||
<el-select
|
||||
v-model="form.lineId"
|
||||
:placeholder="`请选择产线`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in lineOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划保养人员" prop="maintainer">
|
||||
<el-input v-model="form.maintainer" disabled />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="计划开始时间"
|
||||
prop="firstMaintenanceTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择计划开始时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择计划开始时间"
|
||||
@change="$emit('update', form)"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="计划结束时间"
|
||||
prop="firstMaintenanceTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择计划结束时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择计划结束时间"
|
||||
@change="$emit('update', form)"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际开始时间"
|
||||
prop="firstMaintenanceTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际开始时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择实际开始时间"
|
||||
@change="$emit('update', form)"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际结束时间"
|
||||
prop="firstMaintenanceTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际结束时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择实际结束时间"
|
||||
@change="$emit('update', form)"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际保养人员"
|
||||
prop="maintainer"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际保养人员', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.maintainer"
|
||||
:placeholder="`请选择计划保养人员`"
|
||||
:disabled="disabled"
|
||||
multiple
|
||||
clearable
|
||||
filterable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in maintainerOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入备注`"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
prop: 'dataForm',
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: {},
|
||||
props: {
|
||||
rows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
dataForm: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
edit: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hasFiles: {
|
||||
type: Boolean | Array,
|
||||
default: false,
|
||||
},
|
||||
labelPosition: {
|
||||
type: String,
|
||||
default: 'right',
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
formLoading: true,
|
||||
equipmentTypeOptions: [
|
||||
{ label: '安全设备', value: 1 },
|
||||
{ label: '消防设备', value: 2 },
|
||||
{ label: '特种设备', value: 3 },
|
||||
],
|
||||
lineList: [],
|
||||
maintainerList: [],
|
||||
departmentList: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
dataForm: {
|
||||
handler(val) {
|
||||
this.form = JSON.parse(JSON.stringify(val));
|
||||
if (typeof val.maintainer == 'string')
|
||||
this.form.maintainer = val.maintainer.split(',');
|
||||
if (this.form.equipmentCategory != null) {
|
||||
setTimeout(() => {
|
||||
this.equipmentOptions = this.equipmentList
|
||||
.filter((item) => item.special)
|
||||
.filter(
|
||||
(item) => item.specialType === this.form.equipmentCategory
|
||||
)
|
||||
.map((item) => ({ label: item.name, value: item.id }));
|
||||
}, 1000);
|
||||
}
|
||||
if (this.hasFiles) {
|
||||
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
|
||||
this.form.files = this.form.files ?? [];
|
||||
} else if (Array.isArray(this.hasFiles)) {
|
||||
this.hasFiles.forEach((prop) => {
|
||||
this.form[prop] = this.form[prop] ?? [];
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
!this.edit && this.getCode('/base/equipment-maintain-plan/getCode');
|
||||
this.getList('maintainer');
|
||||
this.getList('department');
|
||||
this.getList('line');
|
||||
},
|
||||
computed: {
|
||||
departmentOptions() {
|
||||
return (this.departmentList || []).map((item) => ({
|
||||
id: item.id,
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
lineOptions() {
|
||||
return (this.lineList || []).map((item) => ({
|
||||
id: item.id,
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
maintainerOptions() {
|
||||
return (this.maintainerList || []).map((item) => ({
|
||||
id: item.id,
|
||||
label: item.name,
|
||||
value: item.name,
|
||||
}));
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 模拟透传 ref */
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
// getCode
|
||||
async getCode(url) {
|
||||
this.formLoading = true;
|
||||
const response = await this.$axios(url);
|
||||
this.formLoading = false;
|
||||
this.form.code = response.data || '';
|
||||
},
|
||||
// initialize
|
||||
async getEquipmentList() {
|
||||
this.formLoading = true;
|
||||
const response = await this.$axios('/base/core-equipment/listAll');
|
||||
this.equipmentList = response.data || [];
|
||||
this.equipmentOptions = (response.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
this.formLoading = false;
|
||||
},
|
||||
async getList(source = 'department') {
|
||||
const urls = [
|
||||
'/base/core-production-line/listAll',
|
||||
'/base/core-department/listAll',
|
||||
'/base/core-worker/listAll',
|
||||
];
|
||||
let res;
|
||||
switch (source) {
|
||||
case 'department':
|
||||
res = await this.$axios(urls[1]);
|
||||
this.departmentList = res.data || [];
|
||||
break;
|
||||
case 'maintainer':
|
||||
res = await this.$axios(urls[2]);
|
||||
this.maintainerList = res.data || [];
|
||||
break;
|
||||
case 'line':
|
||||
res = await this.$axios(urls[0]);
|
||||
this.lineList = res.data || [];
|
||||
break;
|
||||
}
|
||||
this.formLoading = false;
|
||||
},
|
||||
|
||||
// handlers
|
||||
handleEqTypeChange(type) {
|
||||
this.form.equipmentId = null;
|
||||
if (type) {
|
||||
this.equipmentOptions = this.equipmentList
|
||||
.filter((item) => item.special)
|
||||
.filter((item) => item.specialType === type)
|
||||
.map((item) => ({ label: item.name, value: item.id }));
|
||||
} else
|
||||
this.equipmentOptions = this.equipmentList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
// this.$emit('update', this.form)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-date-editor,
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -0,0 +1,373 @@
|
||||
<!--
|
||||
filename: dialogForm.vue
|
||||
author: liubin
|
||||
date: 2023-08-15 10:32:36
|
||||
description: 弹窗的表单组件
|
||||
-->
|
||||
|
||||
<template>
|
||||
<el-form
|
||||
ref="form"
|
||||
:model="form"
|
||||
:size="size"
|
||||
:label-position="labelPosition"
|
||||
v-loading="formLoading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="保养计划单号"
|
||||
prop="code"
|
||||
:rules="[
|
||||
{ required: true, message: '请输入保养计划单号', trigger: 'blur' },
|
||||
]">
|
||||
<el-input
|
||||
v-model="form.code"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入保养计划单号`"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="保养计划名称" prop="name">
|
||||
<span>---</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="部门"
|
||||
prop="departmentId"
|
||||
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
|
||||
<el-select
|
||||
v-model="form.departmentId"
|
||||
:placeholder="`请选择部门`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in departmentOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<!-- <el-form-item
|
||||
label="设备大类"
|
||||
prop="equipmentCategory"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择设备大类', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.equipmentCategory"
|
||||
:placeholder="`请选择设备大类`"
|
||||
:disabled="disabled"
|
||||
@change="handleEqTypeChange">
|
||||
<el-option
|
||||
v-for="opt in equipmentTypeOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item> -->
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="产线"
|
||||
prop="lineId"
|
||||
:rules="[{ required: true, message: '请选择产线', trigger: 'blur' }]">
|
||||
<el-select
|
||||
v-model="form.lineId"
|
||||
:placeholder="`请选择产线`"
|
||||
:disabled="disabled"
|
||||
clearable
|
||||
filterable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in lineOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划保养人员" prop="maintainer">
|
||||
<span>---</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划开始时间" prop="firstMaintenanceTime">
|
||||
<span>---</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item label="计划结束时间" prop="firstMaintenanceTime">
|
||||
<span>---</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际开始时间"
|
||||
prop="firstMaintenanceTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际开始时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择实际开始时间"
|
||||
@change="$emit('update', form)"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际结束时间"
|
||||
prop="firstMaintenanceTime"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际结束时间', trigger: 'blur' },
|
||||
]">
|
||||
<el-date-picker
|
||||
v-model="form.firstMaintenanceTime"
|
||||
type="datetime"
|
||||
:disabled="edit"
|
||||
placeholder="请选择实际结束时间"
|
||||
@change="$emit('update', form)"
|
||||
value-format="timestamp"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="实际保养人员"
|
||||
prop="maintainer"
|
||||
:rules="[
|
||||
{ required: true, message: '请选择实际保养人员', trigger: 'blur' },
|
||||
]">
|
||||
<el-select
|
||||
v-model="form.maintainer"
|
||||
:placeholder="`请选择计划保养人员`"
|
||||
:disabled="disabled"
|
||||
multiple
|
||||
clearable
|
||||
filterable
|
||||
@change="$emit('update', form)">
|
||||
<el-option
|
||||
v-for="opt in maintainerOptions"
|
||||
:key="opt.value"
|
||||
:label="opt.label"
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
@change="$emit('update', form)"
|
||||
:placeholder="`请输入备注`"
|
||||
:disabled="disabled" />
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'DialogForm',
|
||||
model: {
|
||||
prop: 'dataForm',
|
||||
event: 'update',
|
||||
},
|
||||
emits: ['update'],
|
||||
components: {},
|
||||
props: {
|
||||
rows: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
dataForm: {
|
||||
type: Object,
|
||||
default: () => ({}),
|
||||
},
|
||||
disabled: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
edit: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
hasFiles: {
|
||||
type: Boolean | Array,
|
||||
default: false,
|
||||
},
|
||||
labelPosition: {
|
||||
type: String,
|
||||
default: 'right',
|
||||
},
|
||||
size: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
form: {},
|
||||
formLoading: true,
|
||||
equipmentTypeOptions: [
|
||||
{ label: '安全设备', value: 1 },
|
||||
{ label: '消防设备', value: 2 },
|
||||
{ label: '特种设备', value: 3 },
|
||||
],
|
||||
lineList: [],
|
||||
maintainerList: [],
|
||||
departmentList: [],
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
dataForm: {
|
||||
handler(val) {
|
||||
this.form = JSON.parse(JSON.stringify(val));
|
||||
if (typeof val.maintainer == 'string')
|
||||
this.form.maintainer = val.maintainer.split(',');
|
||||
if (this.form.equipmentCategory != null) {
|
||||
setTimeout(() => {
|
||||
this.equipmentOptions = this.equipmentList
|
||||
.filter((item) => item.special)
|
||||
.filter(
|
||||
(item) => item.specialType === this.form.equipmentCategory
|
||||
)
|
||||
.map((item) => ({ label: item.name, value: item.id }));
|
||||
}, 1000);
|
||||
}
|
||||
if (this.hasFiles) {
|
||||
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
|
||||
this.form.files = this.form.files ?? [];
|
||||
} else if (Array.isArray(this.hasFiles)) {
|
||||
this.hasFiles.forEach((prop) => {
|
||||
this.form[prop] = this.form[prop] ?? [];
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
!this.edit && this.getCode('/base/equipment-maintain-plan/getCode');
|
||||
this.getList('maintainer');
|
||||
this.getList('department');
|
||||
this.getList('line');
|
||||
},
|
||||
computed: {
|
||||
departmentOptions() {
|
||||
return (this.departmentList || []).map((item) => ({
|
||||
id: item.id,
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
lineOptions() {
|
||||
return (this.lineList || []).map((item) => ({
|
||||
id: item.id,
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
maintainerOptions() {
|
||||
return (this.maintainerList || []).map((item) => ({
|
||||
id: item.id,
|
||||
label: item.name,
|
||||
value: item.name,
|
||||
}));
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
/** 模拟透传 ref */
|
||||
validate(cb) {
|
||||
return this.$refs.form.validate(cb);
|
||||
},
|
||||
resetFields(args) {
|
||||
return this.$refs.form.resetFields(args);
|
||||
},
|
||||
// getCode
|
||||
async getCode(url) {
|
||||
this.formLoading = true;
|
||||
const response = await this.$axios(url);
|
||||
this.formLoading = false;
|
||||
this.form.code = response.data || '';
|
||||
},
|
||||
// initialize
|
||||
async getEquipmentList() {
|
||||
this.formLoading = true;
|
||||
const response = await this.$axios('/base/core-equipment/listAll');
|
||||
this.equipmentList = response.data || [];
|
||||
this.equipmentOptions = (response.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
this.formLoading = false;
|
||||
},
|
||||
async getList(source = 'department') {
|
||||
const urls = [
|
||||
'/base/core-production-line/listAll',
|
||||
'/base/core-department/listAll',
|
||||
'/base/core-worker/listAll',
|
||||
];
|
||||
let res;
|
||||
switch (source) {
|
||||
case 'department':
|
||||
res = await this.$axios(urls[1]);
|
||||
this.departmentList = res.data || [];
|
||||
break;
|
||||
case 'maintainer':
|
||||
res = await this.$axios(urls[2]);
|
||||
this.maintainerList = res.data || [];
|
||||
break;
|
||||
case 'line':
|
||||
res = await this.$axios(urls[0]);
|
||||
this.lineList = res.data || [];
|
||||
break;
|
||||
}
|
||||
this.formLoading = false;
|
||||
},
|
||||
|
||||
// handlers
|
||||
handleEqTypeChange(type) {
|
||||
this.form.equipmentId = null;
|
||||
if (type) {
|
||||
this.equipmentOptions = this.equipmentList
|
||||
.filter((item) => item.special)
|
||||
.filter((item) => item.specialType === type)
|
||||
.map((item) => ({ label: item.name, value: item.id }));
|
||||
} else
|
||||
this.equipmentOptions = this.equipmentList.map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
// this.$emit('update', this.form)
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.el-date-editor,
|
||||
.el-select {
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
@ -39,7 +39,7 @@
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList" />
|
||||
|
||||
<!-- 对话框(添加 / 修改) -->
|
||||
<!-- 对话框(添加) -->
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
@ -61,10 +61,13 @@
|
||||
</el-row>
|
||||
</base-dialog>
|
||||
|
||||
<!-- 编辑 -->
|
||||
<!-- <RecordDetail
|
||||
v-if="recordDetailVisible"
|
||||
ref="recordDetailDrawer"
|
||||
@closed="recordDetailVisible = false" /> -->
|
||||
|
||||
<!-- 详情 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user