Update 保养计划配置

This commit is contained in:
lb 2024-02-02 16:56:45 +08:00
parent 3a3e33db0e
commit da5596766c
4 changed files with 314 additions and 110 deletions

View File

@ -14,7 +14,8 @@ VUE_APP_TITLE = MES系统
# 芋道管理系统/开发环境 # 芋道管理系统/开发环境
# VUE_APP_BASE_API = 'http://100.64.0.26:48082' # 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://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.4.173:48080'
# VUE_APP_BASE_API = 'http://192.168.2.173:48080' # VUE_APP_BASE_API = 'http://192.168.2.173:48080'
# VUE_APP_BASE_API = 'http://192.168.1.49:48082' # VUE_APP_BASE_API = 'http://192.168.1.49:48082'

View File

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

View File

@ -15,34 +15,55 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="计划名称" label="保养计划名称"
prop="name" prop="name"
:rules="[ :rules="[
{ required: true, message: '请输入计划名称', trigger: 'blur' }, { required: true, message: '请输入保养计划名称', trigger: 'blur' },
]"> ]">
<el-input <el-input
v-model="form.name" v-model="form.name"
@change="$emit('update', form)" @change="$emit('update', form)"
:placeholder="`请输入计划名称`" :placeholder="`请输入保养计划名称`"
:disabled="disabled" /> :disabled="disabled" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="计划编号" label="保养计划编号"
prop="code" prop="code"
:rules="[ :rules="[
{ required: true, message: '请输入计划编号', trigger: 'blur' }, { required: true, message: '请输入保养计划编号', trigger: 'blur' },
]"> ]">
<el-input <el-input
v-model="form.code" v-model="form.code"
@change="$emit('update', form)" @change="$emit('update', form)"
:placeholder="`请输入计划编号`" :placeholder="`请输入保养计划编号`"
:disabled="disabled" /> :disabled="disabled" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <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="设备大类" label="设备大类"
prop="equipmentCategory" prop="equipmentCategory"
:rules="[ :rules="[
@ -59,10 +80,29 @@
:label="opt.label" :label="opt.label"
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</el-form-item> </el-form-item> -->
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <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="设备" label="设备"
prop="equipmentId" prop="equipmentId"
:rules="[{ required: true, message: '请选择设备', trigger: 'blur' }]"> :rules="[{ required: true, message: '请选择设备', trigger: 'blur' }]">
@ -77,42 +117,9 @@
:label="opt.label" :label="opt.label"
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</el-form-item> </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>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="保养频率(天/次)" label="保养频率(天/次)"
@ -133,6 +140,100 @@
:disabled="disabled" /> :disabled="disabled" />
</el-form-item> </el-form-item>
</el-col> </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-col :span="24">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input <el-input
@ -168,6 +269,10 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
edit: {
type: Boolean,
default: false,
},
hasFiles: { hasFiles: {
type: Boolean | Array, type: Boolean | Array,
default: false, default: false,
@ -185,20 +290,21 @@ export default {
return { return {
form: {}, form: {},
formLoading: true, formLoading: true,
dataLoaded: false,
equipmentList: [],
equipmentOptions: [],
equipmentTypeOptions: [ equipmentTypeOptions: [
{ label: '安全设备', value: 1 }, { label: '安全设备', value: 1 },
{ label: '消防设备', value: 2 }, { label: '消防设备', value: 2 },
{ label: '特种设备', value: 3 }, { label: '特种设备', value: 3 },
], ],
lineList: [],
maintainerList: [],
departmentList: []
}; };
}, },
watch: { watch: {
dataForm: { dataForm: {
handler(val) { handler(val) {
this.form = JSON.parse(JSON.stringify(val)); this.form = JSON.parse(JSON.stringify(val));
if (typeof val.maintainer == 'string') this.form.maintainer = val.maintainer.split(',')
if (this.form.equipmentCategory != null) { if (this.form.equipmentCategory != null) {
setTimeout(() => { setTimeout(() => {
this.equipmentOptions = this.equipmentList this.equipmentOptions = this.equipmentList
@ -224,8 +330,33 @@ export default {
}, },
}, },
mounted() { mounted() {
this.getEquipmentList(); !this.edit && this.getCode('/base/equipment-maintain-plan/getCode');
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: { methods: {
/** 模拟透传 ref */ /** 模拟透传 ref */
@ -253,6 +384,29 @@ export default {
})); }));
this.formLoading = false; 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 // handlers
handleEqTypeChange(type) { handleEqTypeChange(type) {

View File

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