Browse Source

Merge branch 'projects/mesxc-test' into projects/mesxc-dy

pull/216/head
helloDy 6 months ago
parent
commit
c71d99a21e
6 changed files with 629 additions and 43 deletions
  1. +1
    -1
      src/views/specialEquipment/check/Content-add_detail.vue
  2. +1
    -1
      src/views/specialEquipment/check/Content.vue
  3. +62
    -31
      src/views/specialEquipment/maintain/WaitingList.vue
  4. +46
    -7
      src/views/specialEquipment/maintain/WaitingListPlanned--edit.vue
  5. +516
    -0
      src/views/specialEquipment/maintain/WaitingListUnplanned--add_detail.vue
  6. +3
    -3
      src/views/specialEquipment/maintain/WaitingListUnplanned--edit.vue

+ 1
- 1
src/views/specialEquipment/check/Content-add_detail.vue View File

@@ -269,7 +269,7 @@ export default {
},

getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',


+ 1
- 1
src/views/specialEquipment/check/Content.vue View File

@@ -281,7 +281,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.open = true;
this.title = '新巡检单';
this.title = '新巡检单';
this.$nextTick(() => {
this.$refs.add.init();
});


+ 62
- 31
src/views/specialEquipment/maintain/WaitingList.vue View File

@@ -76,6 +76,7 @@
v-if="openUnplannedDrawer"
@refreshDataList="getList"
@destroy="openUnplannedDrawer = false" />

<PlannedEditDrawer
ref="planned"
v-if="openPlannedDrawer"
@@ -86,6 +87,12 @@
v-if="recordDetailVisible"
ref="recordDetailDrawer"
@closed="recordDetailVisible = false" />

<UnplannedAddDet
ref="unplanned-det"
v-if="openUnplannedDetDrawer"
@refreshDataList="getList"
@destroy="openUnplannedDetDrawer = false" />
</div>
</template>

@@ -95,8 +102,8 @@ 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 UnplannedAddDet from './WaitingListUnplanned--add_detail.vue';
import {
deleteEqMaintainLog,
exportMaintainLogExcel,
} from '@/api/equipment/base/maintain/record';
import WaitingListTable from './WaitingListTable.vue';
@@ -134,7 +141,8 @@ export default {
WaitingListTable,
RecordDetail,
UnplannedEditDrawer,
PlannedEditDrawer
UnplannedAddDet,
PlannedEditDrawer,
},
mixins: [basicPageMixin],
data() {
@@ -461,7 +469,7 @@ export default {
allSpecialEquipments: [],
openPlannedDrawer: false,
openUnplannedDrawer: false,
openPlannedDrawer: false,
openUnplannedDetDrawer: false,
};
},
watch: {
@@ -681,7 +689,6 @@ export default {
if (!valid) {
return;
}
// 修改的提交
if (this.form.id != null) {
this.put({
...this.form,
@@ -694,36 +701,51 @@ export default {
this.getList();
});
return;
} else {
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();
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();
});
});
// 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) {
this.$modal


+ 46
- 7
src/views/specialEquipment/maintain/WaitingListPlanned--edit.vue View File

@@ -209,12 +209,12 @@
</div>

<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">
<i class="el-icon-plus"></i>
添加属性
</el-button>
</div>
</div> -->
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
@@ -222,11 +222,11 @@
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
<!-- <method-btn
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
@clickBtn="handleTableBtnClick" /> -->
</base-table>

<!-- 分页组件 -->
@@ -324,6 +324,45 @@ export default {
{
prop: 'maintenanceDes',
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: [],
@@ -584,7 +623,7 @@ export default {
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加设备属性';
this.attrTitle = '添加保养项目';
this.attrFormVisible = true;
},

@@ -597,14 +636,14 @@ export default {
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备属性';
this.attrTitle = '编辑保养项目';
this.attrFormVisible = true;
}
},

// 删除属性
handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养内容?', '提示', {
this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',


+ 516
- 0
src/views/specialEquipment/maintain/WaitingListUnplanned--add_detail.vue 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>

+ 3
- 3
src/views/specialEquipment/maintain/WaitingListUnplanned--edit.vue View File

@@ -559,7 +559,7 @@ export default {
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加设备属性';
this.attrTitle = '添加保养项目';
this.attrFormVisible = true;
},

@@ -572,14 +572,14 @@ export default {
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备属性';
this.attrTitle = '编辑保养项目';
this.attrFormVisible = true;
}
},

// 删除属性
handleDeleteAttr(attrId) {
this.$confirm('确定删除该属性?', '提示', {
this.$confirm('确定删除该保养项目?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',


Loading…
Cancel
Save