Update 保养计划配置

This commit is contained in:
lb 2024-02-02 16:56:45 +08:00
vanhempi 3a3e33db0e
commit da5596766c
4 muutettua tiedostoa jossa 314 lisäystä ja 110 poistoa

Näytä tiedosto

@ -14,7 +14,8 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082'
# VUE_APP_BASE_API = 'http://10.70.2.2:8080'
VUE_APP_BASE_API = 'http://192.168.0.33:48082'
VUE_APP_BASE_API = 'http://192.168.1.47:48082'
# VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082'

Näytä tiedosto

@ -106,6 +106,8 @@ export default {
case 'detail':
this.handleDetail(data);
break;
default:
this.handleTableActions({data, type});
}
},
// 处理搜索栏按钮

Näytä tiedosto

@ -15,34 +15,55 @@
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="计划名称"
label="保养计划名称"
prop="name"
:rules="[
{ required: true, message: '请输入计划名称', trigger: 'blur' },
{ required: true, message: '请输入保养计划名称', trigger: 'blur' },
]">
<el-input
v-model="form.name"
@change="$emit('update', form)"
:placeholder="`请输入计划名称`"
:placeholder="`请输入保养计划名称`"
:disabled="disabled" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="计划编号"
label="保养计划编号"
prop="code"
:rules="[
{ required: true, message: '请输入计划编号', trigger: 'blur' },
{ required: true, message: '请输入保养计划编号', trigger: 'blur' },
]">
<el-input
v-model="form.code"
@change="$emit('update', form)"
:placeholder="`请输入计划编号`"
:placeholder="`请输入保养计划编号`"
:disabled="disabled" />
</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="[
@ -59,10 +80,29 @@
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</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-form-item
label="设备"
prop="equipmentId"
:rules="[{ required: true, message: '请选择设备', trigger: 'blur' }]">
@ -77,42 +117,9 @@
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保养类型" prop="maintainType">
<el-select
v-model="form.maintainType"
:placeholder="`请选择保养类型`"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.MAINTAIN_TYPE)"
:key="opt.value"
:label="opt.label"
:value="+opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="保养时长(h)"
prop="maintainDuration"
:rules="[
{
type: 'number',
message: '请输入正确的数字',
trigger: 'blur',
transform: (val) => Number(val),
},
]">
<el-input
v-model="form.maintainDuration"
@change="$emit('update', form)"
:placeholder="`请输入保养时长`"
:disabled="disabled" />
</el-form-item>
</el-form-item> -->
</el-col>
<el-col :span="12">
<el-form-item
label="保养频率(天/次)"
@ -133,6 +140,100 @@
:disabled="disabled" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="确认时限(h)"
prop="confirmTimeLimit"
:rules="[
{ required: true, message: '请输入确认时限', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字',
trigger: 'blur',
transform: (val) => Number(val),
},
]">
<el-input
v-model="form.confirmTimeLimit"
@change="$emit('update', form)"
:placeholder="`请输入确认时限(小时)`"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- <el-col :span="12">
<el-form-item label="保养类型" prop="maintainType">
<el-select
v-model="form.maintainType"
:placeholder="`请选择保养类型`"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.MAINTAIN_TYPE)"
:key="opt.value"
:label="opt.label"
:value="+opt.value" />
</el-select>
</el-form-item>
</el-col> -->
<el-col :span="12">
<el-form-item
label="保养时长(h)"
prop="maintainDuration"
:rules="[
{
type: 'number',
message: '请输入正确的数字',
trigger: 'blur',
transform: (val) => Number(val),
},
]">
<el-input
v-model="form.maintainDuration"
@change="$emit('update', form)"
:placeholder="`请输入保养时长(小时)`"
:disabled="disabled" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="首次保养时间" prop="firstMaintenanceTime">
<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
@ -168,6 +269,10 @@ export default {
type: Boolean,
default: false,
},
edit: {
type: Boolean,
default: false,
},
hasFiles: {
type: Boolean | Array,
default: false,
@ -185,20 +290,21 @@ export default {
return {
form: {},
formLoading: true,
dataLoaded: false,
equipmentList: [],
equipmentOptions: [],
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
@ -224,8 +330,33 @@ export default {
},
},
mounted() {
this.getEquipmentList();
this.getCode('/base/equipment-maintain-plan/getCode');
!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 */
@ -253,6 +384,29 @@ export default {
}));
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) {

Näytä tiedosto

@ -24,7 +24,7 @@
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:width="180"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -44,7 +44,7 @@
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :has-files="false" />
<DialogForm v-if="open" ref="form" :edit="form.id != null" v-model="form" :has-files="false" />
</base-dialog>
</div>
</template>
@ -64,11 +64,15 @@ export default {
const t = new Date();
const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()];
return {
searchBarKeys: ['equipmentName', 'specialType', 'createTime'],
searchBarKeys: ['planName'], // 'specialType', 'equipmentName', 'createTime'],
tableBtn: [
// {
// type: 'detail',
// btnName: '',
// },
{
type: 'detail',
btnName: '保养记录',
type: 'addContent',
btnName: '添加内容',
},
this.$auth.hasPermi('equipment:plan-config:update')
? {
@ -84,6 +88,23 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'name', label: '计划名称' },
{ prop: 'departmentName', label: '部门' },
{ width: 144, prop: 'lineName', label: '产线名' },
{ width: 144, prop: 'maintenancePeriod', label: '保养频率(天/次)' },
{ width: 144, prop: 'firstMaintenanceTime', label: '首次保养时间' },
{ width: 144, prop: 'maintainDuration', label: '保养时长' },
{ prop: 'maintainer', label: '计划保养人员' },
{
width: 144,
prop: 'confirmTimeLimit',
label: '确认时限',
filter: (val) =>
val != null && val > 24
? `${(val - (val % 24)) / 24}${val % 24}小时`
: `${val}小时`,
},
{ prop: 'remark', label: '备注' },
// {
// prop: 'createTime',
// label: '',
@ -91,59 +112,64 @@ export default {
// width: 180,
// filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
// },
{ prop: 'name', label: '计划名称' },
{ prop: 'code', label: '计划编号' },
{
prop: 'enabled',
label: '启用状态',
filter: (val) => ['停用', '启用'][val],
},
{ prop: 'lineName', label: '产线' },
{
prop: 'equipmentCategory',
label: '设备大类',
filter: (val) =>
val != null ? ['-', '安全', '消防', '特种'][val] : '-',
},
{ prop: 'equipmentName', label: '设备名称' },
{ width: 144, prop: 'maintainDuration', label: '计划保养用时(h)' },
{ width: 144, prop: 'maintenancePeriod', label: '保养频率(天/次)' },
{
prop: 'maintainType',
label: '保养类型',
filter: publicFormatter('maintain_type'),
},
{ prop: 'remark', label: '备注' },
// { prop: 'code', label: '' },
// {
// prop: 'enabled',
// label: '',
// filter: (val) => ['', ''][val],
// },
// {
// prop: 'equipmentCategory',
// label: '',
// filter: (val) =>
// val != null ? ['-', '', '', ''][val] : '-',
// },
// { prop: 'equipmentName', label: '' },
// { width: 144, prop: 'maintainDuration', label: '(h)' },
// {
// prop: 'maintainType',
// label: '',
// filter: publicFormatter('maintain_type'),
// },
],
searchBarFormConfig: [
{
type: 'select',
label: '设备大类',
selectOptions: [
{ id: 1, name: '安全设备' },
{ id: 2, name: '消防设备' },
{ id: 3, name: '特种设备' },
],
placeholder: '请选择设备大类',
param: 'specialType',
},
// {
// type: 'select',
// label: '',
// selectOptions: [
// { id: 1, name: '' },
// { id: 2, name: '' },
// { id: 3, name: '' },
// ],
// placeholder: '',
// param: 'specialType',
// },
{
type: 'input',
label: '设备名',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'datePicker',
label: '时间段',
dateType: 'daterange',
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
param: 'createTime',
label: '保养计划名称',
placeholder: '请输入保养计划名称',
param: 'planName',
// selectOptions: [
// {name: 1, id: 1}
// ]
},
// {
// type: 'input',
// label: '',
// placeholder: '',
// param: 'equipmentName',
// },
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange',
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// param: 'createTime',
// },
{
type: 'button',
btnName: '查询',
@ -271,9 +297,10 @@ export default {
queryParams: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
createTime: null,
// equipmentName: null,
// createTime: null,
specialType: null,
planName: null,
},
//
form: {},
@ -311,19 +338,33 @@ export default {
/** 表单重置 */
reset() {
this.form = {
id: null,
code: null,
name: null,
equipmentId: null,
enabled: null,
// equipmentId: null,
maintainer: null,
lineId: null,
departmentId: null,
// enabled: null,
maintenancePeriod: null,
maintainDuration: null,
maintainType: null,
remark: null,
enabled: 1,
equipmentCategory: null,
confirmTimeLimit: null,
firstMaintenanceTime: null,
speical: false,
// equipmentCategory: null,
};
this.resetForm('form');
},
handleTableActions({data, type}) {
switch(type) {
case 'addContent':
//
alert('添加内容...')
break;
}
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
@ -364,7 +405,6 @@ export default {
const id = row.id;
this.info({ id }).then((response) => {
this.form = response.data;
debugger;
this.open = true;
this.title = '修改保养计划';
});
@ -377,7 +417,10 @@ export default {
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.put({
...this.form,
maintainer: this.form.maintainer.join(','),
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
@ -385,7 +428,11 @@ export default {
return;
}
//
this.post(this.form).then((response) => {
this.post({
...this.form,
special: true,
maintainer: this.form.maintainer.join(','),
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();