projects/mesxc-zhp #215

Merged
juzi merged 4 commits from projects/mesxc-zhp into projects/mesxc-test 2024-02-28 11:23:36 +08:00
18 changed files with 1301 additions and 155 deletions
Showing only changes of commit bf90cc453d - Show all commits

View File

@ -20,9 +20,10 @@ VUE_APP_TITLE = MES系统
# VUE_APP_BASE_API = 'http://192.168.1.8:48082' # VUE_APP_BASE_API = 'http://192.168.1.8:48082'
# VUE_APP_BASE_API = 'http://192.168.4.159:48080' # VUE_APP_BASE_API = 'http://192.168.4.159:48080'
# VUE_APP_BASE_API = 'http://192.168.1.104:48082' # VUE_APP_BASE_API = 'http://192.168.1.104:48082'
VUE_APP_BASE_API = 'http://192.168.0.33:48082' # VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.62:48082' # VUE_APP_BASE_API = 'http://192.168.1.62:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.78:48082'
VUE_APP_BASE_API = 'http://192.168.1.47:48082'
# socket地址 # socket地址
VUE_APP_Socket_API = 'ws://192.168.0.30:8888' VUE_APP_Socket_API = 'ws://192.168.0.30:8888'
VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081' VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081'

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-21 09:04:48 * @LastEditTime: 2024-02-27 15:38:04
* @Description: * @Description:
--> -->
<template> <template>
@ -322,14 +322,14 @@ export default {
this.listQuery.total = response.data.total; this.listQuery.total = response.data.total;
}); });
}, },
init(id, isdetail) { init(row, isdetail) {
this.initData(); this.initData();
this.isdetail = isdetail || false; this.isdetail = isdetail || false;
this.dataForm.id = id || undefined; this.dataForm.id = row.id || undefined;
this.isedit = id ? true : false; this.isedit = row?.id && row?.externalCode ? true : false;
console.log('你好', this.isedit) console.log('你好', this.isedit)
this.visible = true; this.visible = true;
if (id) { if (row) {
this.idAttrShow = true this.idAttrShow = true
} else { } else {
this.idAttrShow = false this.idAttrShow = false
@ -340,7 +340,7 @@ export default {
if (this.dataForm.id) { if (this.dataForm.id) {
// //
this.urlOptions.infoURL(id).then(response => { this.urlOptions.infoURL(this.dataForm.id).then(response => {
this.dataForm = response.data this.dataForm = response.data
// this.dataForm.area = response.data.area || 0 // this.dataForm.area = response.data.area || 0
// this.dataForm.weight = response.data.weight || 0 // this.dataForm.weight = response.data.weight || 0

View File

@ -74,9 +74,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
getCoreProductAttr({ getCoreProductAttr(this.dataForm.id).then((res) => {
id: this.dataForm.id
}).then((res) => {
const { name, value } = res.data; const { name, value } = res.data;
this.dataForm.name = name; this.dataForm.name = name;
this.dataForm.value = value; this.dataForm.value = value;

View File

@ -141,6 +141,22 @@ export default {
}, },
created() {}, created() {},
methods: { methods: {
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// //
deleteHandle(id, name, index) { deleteHandle(id, name, index) {
this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", { this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
@ -168,7 +184,7 @@ export default {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情"; this.addOrEditTitle = "详情";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true); this.$refs.addOrUpdate.init(val.data, true);
}); });
} }
}, },

View File

@ -121,7 +121,6 @@
<el-select <el-select
v-model="dataForm.roomNameDict" v-model="dataForm.roomNameDict"
filterable filterable
:disabled="isdetail || isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择车间名称"> placeholder="请选择车间名称">
<el-option <el-option
@ -282,6 +281,7 @@ export default {
this.urlOptions.createURL(this.dataForm).then(response => { this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.visible = false; this.visible = false;
this.$emit("refreshDataList");
// this.$confirm('使?', '', { // this.$confirm('使?', '', {
// confirmButtonText: '', // confirmButtonText: '',
// cancelButtonText: '', // cancelButtonText: '',

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-27 08:58:08 * @LastEditTime: 2024-02-27 09:41:00
* @Description: * @Description:
--> -->
<template> <template>
@ -428,9 +428,9 @@ export default {
status: 1 status: 1
}).then(response => { }).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
// this.idAttrShow = true this.idAttrShow = true
this.dataForm.id = response.data this.dataForm.id = response.data
this.visible = false; // this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");
}); });
}); });

View File

@ -31,44 +31,6 @@
:limit.sync="queryParams.pageSize" :limit.sync="queryParams.pageSize"
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加) -->
<!-- <base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="60%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogFormUnplanned
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'" />
<el-row v-if="mode === 'detail'" slot="footer" type="flex" justify="end">
<el-col :span="12">
<el-button size="small" class="btnTextStyle" @click="cancel">
关闭
</el-button>
</el-col>
</el-row>
</base-dialog> -->
<!-- 编辑 -->
<!-- <UnplannedEditDrawer
ref="unplanned"
v-if="openUnplannedDrawer"
@refreshDataList="getList"
@destroy="openUnplannedDrawer = false" />
<PlannedEditDrawer
ref="planned"
v-if="openPlannedDrawer"
@refreshDataList="getList"
@destroy="openPlannedDrawer = false" />
<RecordDetail
v-if="recordDetailVisible"
ref="recordDetailDrawer"
@destroy="recordDetailVisible = false" /> -->
<add-or-update <add-or-update
v-if="addOrUpdateVisible" v-if="addOrUpdateVisible"
ref="addOrUpdate" ref="addOrUpdate"
@ -80,16 +42,12 @@
import AddOrUpdate from './add-or-updata'; import AddOrUpdate from './add-or-updata';
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import DialogFormUnplanned from './WaitingList--add--unplanned.vue';
// import UnplannedEditDrawer from './WaitingListUnplanned--edit.vue';
// import PlannedEditDrawer from './WaitingListPlanned--edit.vue';
import { import {
exportCheckOrderExcel, exportCheckOrderExcel,
} from '@/api/equipment/base/maintain/record'; } from '@/api/equipment/base/maintain/record';
import WaitingListTable from './WaitingListTable.vue'; import WaitingListTable from './WaitingListTable.vue';
// import RecordDetail from './Record--detail.vue';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); // const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = { const btn = {
name: 'tableBtn', name: 'tableBtn',
@ -160,9 +118,7 @@ export default {
plain: true, plain: true,
}, },
{ {
type: this.$auth.hasPermi('equipment:check-setting:export') type: 'button',
? 'button'
: '',
btnName: '导出', btnName: '导出',
name: 'export', name: 'export',
plain: true, plain: true,

View File

@ -118,10 +118,10 @@ export default {
// : undefined, // : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'configName', label: '巡检单名称' }, { prop: 'name', label: '巡检单名称' },
{ prop: 'equipmentName', label: '部门' }, { prop: 'department', label: '部门' },
{ prop: 'actualTime1', label: '巡检时间', filter: parseTime }, { prop: 'actualCheckTime', label: '巡检时间', filter: parseTime },
{ prop: 'actualTime', label: '班次' }, { prop: 'groupClass', label: '班次' },
{ prop: 'opt', label: '巡检内容', name: '详情', subcomponent: btn }, { prop: 'opt', label: '巡检内容', name: '详情', subcomponent: btn },
{ prop: 'remark', label: '备注' } { prop: 'remark', label: '备注' }
// { prop: 'origin', label: '', filter: (val) => ['', '', 'PDA'][val] }, // { prop: 'origin', label: '', filter: (val) => ['', '', 'PDA'][val] },

View File

@ -542,13 +542,13 @@ export default {
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal this.$modal
.confirm('是否确认导出所有保养记录?') .confirm('是否确认导出所有待确认的保养记录?')
.then(() => { .then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportMaintainLogExcel(params); return exportMaintainLogExcel(params);
}) })
.then((response) => { .then((response) => {
this.$download.excel(response, '设备保养记录.xls'); this.$download.excel(response, '设备保养待确认记录.xls');
this.exportLoading = false; this.exportLoading = false;
}) })
.catch(() => {}); .catch(() => {});

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-23 15:28:46 * @LastEditTime: 2024-02-27 10:33:31
* @Description: * @Description:
--> -->
<template> <template>
@ -92,7 +92,14 @@
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="计划保养人员" prop="maintainer"> <el-form-item label="计划保养人员" prop="maintainer">
<el-input v-model="dataForm.maintainer" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入计划保养人员" /> <el-select v-model="dataForm.maintainer" placeholder="请选择计划保养人员" style="width: 100%;" :disabled="isdetail" multiple filterable>
<el-option
v-for="item in personList"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -107,6 +114,7 @@
<script> <script>
import basicAdd from '../../../../core/mixins/basic-add'; import basicAdd from '../../../../core/mixins/basic-add';
// import { getCoreProductAttrPage, deleteCoreProductAttr } from "@/api/base/coreProduct"; // import { getCoreProductAttrPage, deleteCoreProductAttr } from "@/api/base/coreProduct";
import { getWorkerList } from '@/api/base/worker'
import { getCoreDepartmentList } from "@/api/base/coreDepartment"; import { getCoreDepartmentList } from "@/api/base/coreDepartment";
import { createPlan, updatePlan, getCode, getPlan } from '@/api/equipment/base/maintain/planconfig'; import { createPlan, updatePlan, getCode, getPlan } from '@/api/equipment/base/maintain/planconfig';
import { getCorePLList } from '@/api/base/coreProductionLine'; import { getCorePLList } from '@/api/base/coreProductionLine';
@ -144,6 +152,7 @@ export default {
}, },
menuOptions: [], menuOptions: [],
proLineList: [], proLineList: [],
personList: [],
visible: false, visible: false,
isdetail: false, isdetail: false,
isedit: false, isedit: false,
@ -178,6 +187,9 @@ export default {
// 线 // 线
const resline = await getCorePLList(); const resline = await getCorePLList();
this.proLineList = resline.data; this.proLineList = resline.data;
//
const personres = await getWorkerList()
this.personList = personres.data || []
}, },
getList() { getList() {
// //
@ -194,7 +206,6 @@ export default {
this.isdetail = isdetail || false; this.isdetail = isdetail || false;
this.dataForm.id = id || undefined; this.dataForm.id = id || undefined;
this.isedit = id ? true : false; this.isedit = id ? true : false;
console.log('你好22', id)
this.visible = true; this.visible = true;
// if (id) { // if (id) {
// this.idAttrShow = true // this.idAttrShow = true
@ -209,12 +220,6 @@ export default {
// //
this.urlOptions.infoURL({ id: this.dataForm.id }).then(response => { this.urlOptions.infoURL({ id: this.dataForm.id }).then(response => {
this.dataForm = response.data this.dataForm = response.data
// if (this.dataForm.materialType !== undefined) {
// this.dataForm.materialType = String(this.dataForm.materialType)
// }
// if (this.dataForm.productType !== undefined) {
// this.dataForm.productType = String(this.dataForm.productType)
// }
}); });
// //
// this.getList(); // this.getList();
@ -259,7 +264,10 @@ export default {
} }
// //
if (this.dataForm.id) { if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => { this.urlOptions.updateURL({
...this.dataForm,
maintainer: this.dataForm.maintainer.join(',')
}).then(response => {
this.$modal.msgSuccess("修改成功"); this.$modal.msgSuccess("修改成功");
this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");
@ -267,11 +275,14 @@ export default {
return; return;
} }
// //
this.urlOptions.createURL(this.dataForm).then(response => { this.urlOptions.createURL({
...this.dataForm,
maintainer: this.dataForm.maintainer.join(',')
}).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
// this.idAttrShow = true // this.idAttrShow = true
this.dataForm.id = response.data this.dataForm.id = response.data
// this.visible = false; this.visible = false;
this.$emit("refreshDataList"); this.$emit("refreshDataList");
}); });
}); });

View File

@ -157,12 +157,12 @@ export default {
} catch (err) {} } catch (err) {}
if (!valid) return; if (!valid) return;
let confirmed = false; // let confirmed = false;
try { // try {
confirmed = await this.getConfirmed(); // confirmed = await this.getConfirmed();
} catch (err) { // } catch (err) {
confirmed = false; // confirmed = false;
} // }
const res = await this.$axios({ const res = await this.$axios({
url: url:
'/base/equipment-check-order' + '/base/equipment-check-order' +
@ -171,7 +171,8 @@ export default {
data: { data: {
...this.dataForm, ...this.dataForm,
special: true, special: true,
status: confirmed ? 2 : 1, status: 1,
// status: confirmed ? 2 : 1,
groupClass: this.dataForm.groupClass.join(','), groupClass: this.dataForm.groupClass.join(','),
checkPerson: this.$store.getters.userId, checkPerson: this.$store.getters.userId,
}, },
@ -179,7 +180,9 @@ export default {
if (res.code == 0) { if (res.code == 0) {
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.$message.success(this.dataForm.id ? '更新成功' : '创建成功'); this.$message.success(this.dataForm.id ? '更新成功' : '创建成功');
return res.data;
} }
return null;
}, },
}, },
}; };

View File

@ -0,0 +1,515 @@
<!--
filename: Content-edit.vue
author: liubin
date: 2024-2-24 11:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">添加巡检内容</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<SmallTitle>巡检内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div
v-if="!disableEdit && !disableModifyDetail"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加内容
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
slot="handleBtn"
label="操作"
v-if="!disableEdit"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="attrTotal > 0"
:total="attrTotal"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">
{{ disableEdit ? '返回' : '取消' }}
</el-button>
<el-button
v-if="!disableEdit"
type="primary"
:loading="btnLoading"
@click="handleConfirm">
保存
</el-button>
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '../../../components/DialogForm/index.vue';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id
data() {
return {
visible: false,
btnLoading: false,
form: {},
formLoading: false,
departmentList: [],
inspectorOptions: [],
attrList: [],
attrTotal: 0,
attrTitle: '',
attrForm: {
id: null,
orderId: null,
program: null,
checkResult: null,
equipmentId: null,
},
attrFormVisible: false,
attrRows: [
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '巡检项目',
prop: 'program',
rules: [
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '巡检结果',
prop: 'checkResult',
rules: [
{ required: true, message: '巡检结果不能为空', trigger: 'blur' },
],
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
},
}, //
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
attrFormSubmitting: false,
attrListLoading: false,
// syncFileListFlag: null,
tableBtn: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
],
row: null,
groupOptions: [],
disableEdit: false,
};
},
computed: {
departmentOptions() {
return (this.departmentList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
disableModifyDetail() {
return this.form && this.form.confirmTimeLimit != undefined;
},
attrTableProps() {
return [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
},
];
},
},
mounted() {
this.formLoading = true;
},
methods: {
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.attrQuery.params.equipmentName = btn.equipmentName;
this.getAttrList();
break;
}
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() {
if (this.attrList.length == 0) {
return this.$message.error('请添加巡检内容');
}
let confirmed = false;
try {
confirmed = await this.getConfirmed();
} catch (err) {
confirmed = false;
}
if (confirmed) {
const res = await this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.nickname,
method: 'put',
data: [this.row.id],
});
if (res.code == 0) {
this.$message.success('已确认');
}
}
// this.btnLoading = true;
// this.$nextTick(async () => {
// const { code, data } = await this.$axios({
// url: '/base/equipment-check-order/update',
// method: 'put',
// data: {
// ...this.form,
// groupClass: this.form.groupClass.join(','),
// checkPerson: this.form.checkPerson.join(','),
// },
// });
// if (code == 0) {
// this.$modal.msgSuccess('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
this.$emit('refreshDataList');
this.handleCancel();
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row, detail) {
if (detail) this.disableEdit = true;
this.visible = true;
this.row = row;
this.getAttrList(row);
},
async getAttrList(row, condition = {}) {
if (!row) row = this.row;
this.attrListLoading = true;
const res = await this.$axios({
url: '/base/equipment-check-order-det/page',
method: 'get',
params: {
...this.attrQuery.params,
orderId: row.id,
...condition,
},
});
if (res.code == 0) {
this.attrList = res.data.list;
this.attrTotal = res.data.total;
}
this.attrListLoading = false;
},
handleCancel() {
if (!this.attrList.length) {
return this.$message.error('请添加巡检内容');
}
this.visible = false;
},
resetAttrform() {
this.attrForm = {
id: null,
orderId: null,
equipmentId: null,
program: null,
checkResult: null,
};
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加巡检内容';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: '/base/equipment-check-order-det/get',
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑巡检单详情';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该巡检内容?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: '/base/equipment-check-order-det/delete?id=' + attrId,
method: 'delete',
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? '/base/equipment-check-order-det/update'
: '/base/equipment-check-order-det/create',
method: isEdit ? 'put' : 'post',
data: { ...this.attrForm, orderId: this.row.id },
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-date-editor,
.drawer >>> .el-select {
width: 100%;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -14,7 +14,7 @@
custom-class="mes-drawer" custom-class="mes-drawer"
size="60%" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title">编辑</SmallTitle> <SmallTitle slot="title">{{ disableEdit ? '详情' : '编辑' }}</SmallTitle>
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
@ -129,7 +129,7 @@
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
<div <div
v-if="!disableEdit" v-if="!disableEdit && !disableModifyDetail"
style="position: absolute; top: -40px; right: 0"> style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
@ -146,7 +146,7 @@
<method-btn <method-btn
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
v-if="!disableEdit" v-if="!disableEdit && !disableModifyDetail"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -234,20 +234,6 @@ export default {
formLoading: false, formLoading: false,
departmentList: [], departmentList: [],
inspectorOptions: [], inspectorOptions: [],
attrTableProps: [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
},
],
attrList: [], attrList: [],
attrTotal: 0, attrTotal: 0,
attrTitle: '', attrTitle: '',
@ -339,6 +325,66 @@ export default {
value: item.id, value: item.id,
})); }));
}, },
disableModifyDetail() {
return this.form && this.form.confirmTimeLimit != undefined;
},
attrTableProps() {
return [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
subcomponent: this.disableModifyDetail
? {
name: 'TableCellInput',
props: ['injectData'],
data() {
return {
inputvalue: null,
};
},
mounted() {
this.inputvalue = this.injectData.checkResult;
},
methods: {
async handleValueChange(newCheckResult) {
document.body.style.cursor = 'wait';
await this.$axios({
url: '/base/equipment-check-order-det/update',
method: 'put',
data: {
orderId: this.injectData.orderId,
equipmentId: this.injectData.equipmentId,
program: this.injectData.program,
id: this.injectData.id,
checkResult: newCheckResult,
},
});
document.body.style.cursor = 'default';
},
},
render: function (h) {
return (
<el-input
size="small"
key={this.injectData.id}
v-model={this.inputvalue}
onChange={this.handleValueChange}
/>
);
},
}
: null,
},
];
},
}, },
mounted() { mounted() {
this.formLoading = true; this.formLoading = true;
@ -399,6 +445,7 @@ export default {
}, },
async getInfo(row) { async getInfo(row) {
console.log('row', row);
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-check-order/get?id=' + row.id '/base/equipment-check-order/get?id=' + row.id
); );
@ -511,7 +558,7 @@ export default {
handleAddAttr() { handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录'); if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform(); this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加巡检内容';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },

View File

@ -41,17 +41,17 @@
<add ref="add" @refreshDataList="successSubmit" /> <add ref="add" @refreshDataList="successSubmit" />
</base-dialog> </base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
<edit <edit
ref="content-edit" ref="content-edit"
v-if="editOpen" v-if="editOpen"
@refreshDataList="getList" @refreshDataList="getList"
@destroy="editOpen = false" /> @destroy="editOpen = false" />
<AddCheckDet
ref="content-detail"
v-if="detOpen"
@refreshDataList="getList"
@destroy="detOpen = false" />
</div> </div>
</template> </template>
@ -62,14 +62,16 @@ import add from './Content-add.vue';
import { parseTime } from '../../core/mixins/code-filter'; import { parseTime } from '../../core/mixins/code-filter';
import CheckOrderListTable from './CheckOrderListTable.vue'; import CheckOrderListTable from './CheckOrderListTable.vue';
import edit from './Content-edit.vue'; import edit from './Content-edit.vue';
import AddCheckDet from './Content-add_detail.vue';
export default { export default {
name: 'SpecialEquipmentCheckConfig', name: 'SpecialEquipmentCheckConfig',
components: { addOrUpdata, add, edit, CheckOrderListTable }, components: { addOrUpdata, add, edit, AddCheckDet, CheckOrderListTable },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
editOpen: false, editOpen: false,
detOpen: false,
addOrUpdateVisible: false, addOrUpdateVisible: false,
addOrEditTitle: '', addOrEditTitle: '',
searchBarKeys: ['name'], searchBarKeys: ['name'],
@ -188,8 +190,19 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
handleSubmit() { async handleSubmit() {
this.$refs.add.dataFormSubmit(); const id = await this.$refs.add.dataFormSubmit();
setTimeout(() => {
this.handleAddDetail(id);
}, 500);
},
handleAddDetail(id) {
this.detOpen = true;
this.$nextTick(() => {
this.$refs['content-detail'].init({ id });
});
}, },
successSubmit() { successSubmit() {
@ -268,7 +281,7 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.open = true; this.open = true;
this.title = '添加待确认巡检设置'; this.title = '新增巡检单';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.add.init(); this.$refs.add.init();
}); });

View File

@ -76,6 +76,7 @@
v-if="openUnplannedDrawer" v-if="openUnplannedDrawer"
@refreshDataList="getList" @refreshDataList="getList"
@destroy="openUnplannedDrawer = false" /> @destroy="openUnplannedDrawer = false" />
<PlannedEditDrawer <PlannedEditDrawer
ref="planned" ref="planned"
v-if="openPlannedDrawer" v-if="openPlannedDrawer"
@ -86,6 +87,12 @@
v-if="recordDetailVisible" v-if="recordDetailVisible"
ref="recordDetailDrawer" ref="recordDetailDrawer"
@closed="recordDetailVisible = false" /> @closed="recordDetailVisible = false" />
<UnplannedAddDet
ref="unplanned-det"
v-if="openUnplannedDetDrawer"
@refreshDataList="getList"
@destroy="openUnplannedDetDrawer = false" />
</div> </div>
</template> </template>
@ -95,8 +102,8 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogFormUnplanned from './WaitingList--add--unplanned.vue'; import DialogFormUnplanned from './WaitingList--add--unplanned.vue';
import UnplannedEditDrawer from './WaitingListUnplanned--edit.vue'; import UnplannedEditDrawer from './WaitingListUnplanned--edit.vue';
import PlannedEditDrawer from './WaitingListPlanned--edit.vue'; import PlannedEditDrawer from './WaitingListPlanned--edit.vue';
import UnplannedAddDet from './WaitingListUnplanned--add_detail.vue';
import { import {
deleteEqMaintainLog,
exportMaintainLogExcel, exportMaintainLogExcel,
} from '@/api/equipment/base/maintain/record'; } from '@/api/equipment/base/maintain/record';
import WaitingListTable from './WaitingListTable.vue'; import WaitingListTable from './WaitingListTable.vue';
@ -134,7 +141,8 @@ export default {
WaitingListTable, WaitingListTable,
RecordDetail, RecordDetail,
UnplannedEditDrawer, UnplannedEditDrawer,
PlannedEditDrawer UnplannedAddDet,
PlannedEditDrawer,
}, },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
@ -461,7 +469,7 @@ export default {
allSpecialEquipments: [], allSpecialEquipments: [],
openPlannedDrawer: false, openPlannedDrawer: false,
openUnplannedDrawer: false, openUnplannedDrawer: false,
openPlannedDrawer: false, openUnplannedDetDrawer: false,
}; };
}, },
watch: { watch: {
@ -681,7 +689,6 @@ export default {
if (!valid) { if (!valid) {
return; return;
} }
//
if (this.form.id != null) { if (this.form.id != null) {
this.put({ this.put({
...this.form, ...this.form,
@ -694,24 +701,7 @@ export default {
this.getList(); this.getList();
}); });
return; return;
} } else {
//
this.getConfirmed()
.then((confirmed) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: true,
relatePlan: 2,
confirmed: true,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
})
.catch((err) => {
this.post({ this.post({
...this.form, ...this.form,
maintainWorker: this.form.maintainWorker.join(','), maintainWorker: this.form.maintainWorker.join(','),
@ -722,8 +712,40 @@ export default {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();
setTimeout(() => {
this.handleAddDet(response.data);
}, 450);
}); });
}); }
//
// this.getConfirmed()
// .then((confirmed) => {
// this.post({
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(','),
// special: true,
// relatePlan: 2,
// confirmed: true,
// }).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// })
// .catch((err) => {
// this.post({
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(','),
// special: true,
// relatePlan: 2,
// confirmed: false,
// }).then((response) => {
// this.$modal.msgSuccess('');
// this.open = false;
// this.getList();
// });
// });
}); });
}, },
/** 确认 */ /** 确认 */
@ -757,6 +779,15 @@ export default {
}); });
} }
}, },
/** 新增后添加内容 */
handleAddDet(id) {
this.openUnplannedDetDrawer = true;
this.$nextTick(() => {
this.$refs['unplanned-det'].init({ id });
});
},
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
this.$modal this.$modal

View File

@ -209,12 +209,12 @@
</div> </div>
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0"> <!-- <div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
添加属性 添加属性
</el-button> </el-button>
</div> </div> -->
<base-table <base-table
v-loading="attrListLoading" v-loading="attrListLoading"
:table-props="attrTableProps" :table-props="attrTableProps"
@ -222,11 +222,11 @@
:limit="attrQuery?.params.pageSize || 10" :limit="attrQuery?.params.pageSize || 10"
:table-data="attrList" :table-data="attrList"
@emitFun="handleEmitFun"> @emitFun="handleEmitFun">
<method-btn <!-- <method-btn
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" /> -->
</base-table> </base-table>
<!-- 分页组件 --> <!-- 分页组件 -->
@ -324,6 +324,45 @@ export default {
{ {
prop: 'maintenanceDes', prop: 'maintenanceDes',
label: '保养描述', label: '保养描述',
subcomponent: {
name: 'TableCellInput',
props: ['injectData'],
data() {
return {
inputvalue: null,
};
},
mounted() {
this.inputvalue = this.injectData.maintenanceDes;
},
methods: {
async handleValueChange(maintenanceDes) {
document.body.style.cursor = 'wait';
await this.$axios({
url: '/base/equipment-maintain-log-det/update',
method: 'put',
data: {
logId: this.injectData.logId,
remark: this.injectData.remark,
program: this.injectData.program,
id: this.injectData.id,
maintenanceDes: maintenanceDes,
},
});
document.body.style.cursor = 'default';
},
},
render: function (h) {
return (
<el-input
size="small"
key={this.injectData.id}
v-model={this.inputvalue}
onChange={this.handleValueChange}
/>
);
},
},
}, },
], ],
attrList: [], attrList: [],
@ -584,7 +623,7 @@ export default {
handleAddAttr() { handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录'); if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform(); this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },
@ -597,14 +636,14 @@ export default {
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; this.attrForm = res.data;
this.attrTitle = '编辑设备属性'; this.attrTitle = '编辑保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
}, },
// //
handleDeleteAttr(attrId) { handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养内容?', '提示', { this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',

View File

@ -0,0 +1,516 @@
<!--
filename: WaitingListUnplanned--edit.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">添加保养项目</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加项目
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="attrTotal > 0"
:total="attrTotal"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '../../../components/DialogForm/index.vue';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id
data() {
return {
visible: false,
btnLoading: false,
form: {},
formLoading: false,
lineList: [],
maintainerList: [],
departmentList: [],
attrTableProps: [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
{
prop: 'maintenanceDes',
label: '保养描述',
},
],
attrList: [],
attrTotal: 0,
attrTitle: '',
attrForm: {
id: null,
logId: null,
program: null,
maintenanceDes: null,
remark: null,
},
attrFormVisible: false,
attrRows: [
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
// method: 'post',
// queryParams: {
// pageNo: 1,
// pageSize: 100,
// special: true,
// },
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '保养项目',
prop: 'program',
},
],
[
{
input: true,
label: '保养描述',
prop: 'maintenanceDes',
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
},
}, //
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
attrFormSubmitting: false,
attrListLoading: false,
// syncFileListFlag: null,
tableBtn: [],
row: null,
};
},
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,
}));
},
},
mounted() {
// this.getList('maintainer');
// this.getList('department');
// this.getList('line');
},
methods: {
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.attrQuery.params.equipmentName = btn.equipmentName;
this.getAttrList();
break;
}
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() {
if (this.attrList.length == 0) {
return this.$message.error('请添加保养项目');
}
let confirmed = false;
try {
confirmed = await this.getConfirmed();
} catch (err) {
confirmed = false;
}
if (confirmed) {
const res = await this.$axios({
url: '/base/equipment-maintain-log/confirm',
method: 'put',
data: [this.row.id],
});
if (res.code == 0) {
this.$message.success('已确认');
}
}
// this.btnLoading = true;
// this.$nextTick(async () => {
// const { code, data } = await this.$axios({
// url: '/base/equipment-maintain-log/update',
// method: 'put',
// data: {
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(','),
// },
// });
// if (code == 0) {
// this.$modal.msgSuccess('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
this.$emit('refreshDataList');
this.handleCancel();
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row) {
this.visible = true;
this.row = row;
this.getAttrList(row);
},
async getAttrList(row, condition = {}) {
if (!row) row = this.row;
this.attrListLoading = true;
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page',
method: 'get',
params: {
...this.attrQuery.params,
logId: row.id,
...condition,
},
});
if (res.code == 0) {
this.attrList = res.data.list;
this.attrTotal = res.data.total;
}
this.attrListLoading = false;
},
handleCancel() {
if (!this.attrList.length) {
return this.$message.error('请添加保养项目');
}
this.visible = false;
},
resetAttrform() {
this.attrForm = {
id: null,
logId: this.row.id,
maintenanceDes: '',
program: null,
remark: null,
};
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加保养项目';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/get',
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑保养项目';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: 'url delete', // this.sections[1].urlDelete,
method: 'delete',
params: { id: attrId },
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? '/base/equipment-maintain-log-det/update'
: '/base/equipment-maintain-log-det/create',
method: isEdit ? 'put' : 'post',
data: this.attrForm,
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-date-editor,
.drawer >>> .el-select {
width: 100%;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -559,7 +559,7 @@ export default {
handleAddAttr() { handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录'); if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform(); this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },
@ -572,14 +572,14 @@ export default {
}); });
if (res.code == 0) { if (res.code == 0) {
this.attrForm = res.data; this.attrForm = res.data;
this.attrTitle = '编辑设备属性'; this.attrTitle = '编辑保养项目';
this.attrFormVisible = true; this.attrFormVisible = true;
} }
}, },
// //
handleDeleteAttr(attrId) { handleDeleteAttr(attrId) {
this.$confirm('确定删除该属性?', '提示', { this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定', confirmButtonText: '确定',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',