This commit is contained in:
lb 2024-02-23 09:45:43 +08:00
джерело 67a76869e1
коміт 4d1b72fae7
5 змінених файлів з 948 додано та 8 видалено

@ -53,6 +53,14 @@
</el-table-column>
<el-table-column
v-if="selectedBox[3]"
label="班次"
prop="groupClass">
<template slot-scope="scope">
{{ scope.row.groupClass || '---' }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[4]"
label="确认截止时间"
prop="confirmDueTime">
<template slot-scope="scope">
@ -60,7 +68,7 @@
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[4]"
v-if="selectedBox[5]"
width="150"
label="备注"
prop="remark">
@ -119,7 +127,7 @@
import moment from 'moment';
export default {
name: 'WaitingListTable',
name: 'CheckOrderListTable',
components: {},
props: ['tableData', 'page', 'limit'],
filters: {
@ -138,6 +146,9 @@ export default {
{
label: '巡检时间',
},
{
label: '班次',
},
{
label: '确认截止时间',
},
@ -145,7 +156,7 @@ export default {
label: '备注',
},
],
selectedBox: [true, true, true, true, true],
selectedBox: [true, true, true, true, true, true],
selectedOrder: [],
};
},

@ -0,0 +1,180 @@
<!--
* @Author: lb
* @Date: 2024-2-23 09:16:25
* @LastEditors: lb
* @LastEditTime: 2024-2-23 09:16:25
* @Description: 设备巡检待确认弹窗
-->
<template>
<el-form
ref="form"
:model="dataForm"
:rules="dataRule"
@keyup.enter.native="dataFormSubmit()"
label-width="128px"
v-loading="formLoading"
label-position="top">
<el-row :gutter="20">
<el-col>
<el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
</el-form-item>
</el-col>
<el-col>
<el-form-item
label="部门"
prop="departmentId"
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
<el-select
v-model="dataForm.departmentId"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="班次" prop="groupClass">
<el-select
v-model="dataForm.groupClass"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="d in groupOptions"
:key="d.value"
:label="d.label"
:value="d.label" />
</el-select>
</el-form-item>
</el-col>
<!-- <el-col>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" />
</el-form-item>
</el-col> -->
</el-row>
</el-form>
</template>
<script>
export default {
name: 'ContentAdd',
data() {
return {
formLoading: false,
dataForm: {
id: null,
name: null,
departmentId: null,
groupClass: null,
// special: true,
},
dataRule: {
name: [
{ required: true, message: '巡检单名称不能为空', trigger: 'blur' },
],
},
equipmentOptions: [],
groupOptions: [],
departmentOptions: [],
};
},
mounted() {
this.initOptions();
},
methods: {
reset() {
this.dataForm = {
id: null,
name: null,
departmentId: null,
groupClass: null,
// special: true,
};
},
async initOptions() {
this.formLoading = true;
const urls = [
'/base/core-department/listAll',
'/base/group-classes/listAll',
];
try {
const [dpt, grp] = await Promise.all(
urls.map((url) => this.$axios(url))
);
if (dpt.code == 0) {
this.departmentOptions = dpt.data.map((item) => ({
label: item.name,
value: item.id,
}));
}
if (grp.code == 0) {
this.groupOptions = grp.data.map((item) => ({
label: item.name,
value: item.id,
}));
}
this.formLoading = false;
} catch (err) {
this.formLoading = false;
console.error(err);
}
},
async init(row) {
if (!row || !row.id) {
return;
}
const res = await this.$axios({
url: '/base/equipment-check-order/get?id=' + row.id,
});
if (res.code == 0) {
Object.keys(this.dataForm).forEach((key) => {
this.dataForm[key] = res.data[key];
if (key == 'groupClass') {
this.dataForm.groupClass = res.data.groupClass.split(',');
}
});
}
},
async dataFormSubmit() {
let valid = false;
try {
valid = await this.$refs.form.validate();
} catch (err) {}
if (!valid) return;
const res = await this.$axios({
url:
'/base/equipment-check-order' +
(this.dataForm.id ? '/update' : '/create'),
method: this.dataForm.id ? 'put' : 'post',
data: {
...this.dataForm,
special: true,
status: 1,
groupClass: this.dataForm.groupClass.join(','),
},
});
if (res.code == 0) {
this.$emit('refreshDataList');
this.$message.success(this.dataForm.id ? '更新成功' : '创建成功');
}
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

@ -0,0 +1,751 @@
<!--
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">
<div class="form-part" style="margin-bottom: 32px">
<!-- <el-skeleton v-if="!showForm" animated /> -->
<el-form
class="equipment-info-form"
ref="form"
:model="form"
label-width="200px"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="保养计划单号" prop="maintainOrderNumber">
<!-- :rules="[
{
required: true,
message: '请输入保养计划单号',
trigger: 'blur',
},
]" -->
<el-input
v-model="form.maintainOrderNumber"
disabled
:placeholder="`请输入保养计划单号`" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="保养计划名称" prop="planName">
<el-input
v-model="form.planName"
placeholder="请输入保养计划名称"
disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="部门" prop="departmentId">
<!-- :rules="[
{ required: true, message: '请选择部门', trigger: 'blur' },
]" -->
<el-select
v-model="form.departmentId"
:placeholder="`请选择部门`"
clearable
disabled
filterable>
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<!-- :rules="[
{ required: true, message: '请选择产线', trigger: 'blur' },
]" -->
<el-select
v-model="form.lineId"
:placeholder="`请选择产线`"
disabled
clearable
filterable>
<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="8">
<el-form-item label="计划保养人员" prop="maintainer">
<el-select
v-model="form.planMaintainWorker"
placeholder="请选择计划保养人员"
disabled
clearable
filterable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划开始时间" prop="planStartTime">
<el-date-picker
v-model="form.planStartTime"
type="datetime"
disabled
placeholder="请选择计划开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划结束时间" prop="planEndTime">
<el-date-picker
v-model="form.planEndTime"
type="datetime"
disabled
placeholder="请选择计划结束时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际开始时间"
prop="startTime"
:rules="[
{
required: true,
message: '请选择实际开始时间',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.startTime"
type="datetime"
placeholder="请选择实际开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际结束时间"
prop="endTime"
:rules="[
{
required: true,
message: '请选择实际结束时间',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.endTime"
type="datetime"
placeholder="请选择实际结束时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际保养人员"
prop="maintainWorker"
:rules="[
{
required: true,
message: '请选择实际保养人员',
trigger: 'blur',
},
]">
<el-select
v-model="form.maintainWorker"
:placeholder="`请选择实际保养人员`"
multiple
clearable
filterable>
<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" :placeholder="`请输入备注`" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<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>
</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: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
],
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;
}
},
async handleConfirm() {
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(','),
planMaintainWorker: this.form.planMaintainWorker?.join(','),
},
});
if (code == 0) {
this.$modal.msgSuccess('更新成功');
}
this.btnLoading = false;
this.$emit('refreshDataList');
this.handleCancel();
});
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row) {
this.visible = true;
this.row = row;
this.getInfo(row);
this.getAttrList(row);
},
async getInfo(row) {
this.formLoading = true;
const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + row.id
);
if (res.code == 0) {
this.form = res.data;
this.form.maintainWorker = res.data.maintainWorker.split(',');
this.form.planMaintainWorker = res.data.planMaintainWorker?.split(',');
this.formLoading = false;
}
this.formLoading = false;
},
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;
},
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;
},
//
handleSave() {
this.$refs.form.validate(async (valid) => {
if (valid) {
await this.$axios({
url: '/urlupdate', // this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: 'post', // isEdit ? 'put' : 'post',
data: this.form,
});
this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
this.visible = false;
this.$emit('refreshDataList');
}
});
},
handleCancel() {
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: '/base/equipment-maintain-log-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-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;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
},
};
</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>

@ -68,7 +68,7 @@
<script>
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addOrUpdata from './add-or-updata.vue';
import add from './add.vue';
import add from './Content-add.vue';
import { parseTime } from '../../core/mixins/code-filter';
import CheckOrderListTable from './CheckOrderListTable.vue';
@ -181,7 +181,7 @@ export default {
pageNo: 1,
pageSize: 10,
name: null,
status: 0,
status: 1,
},
//
form: {},
@ -270,7 +270,7 @@ export default {
/** 新增按钮操作 */
handleAdd() {
this.open = true;
this.title = '添加巡检设置';
this.title = '添加待确认巡检设置';
this.$nextTick(() => {
this.$refs.add.init();
});

@ -86,8 +86,6 @@
v-if="recordDetailVisible"
ref="recordDetailDrawer"
@closed="recordDetailVisible = false" />
<!-- 详情 -->
</div>
</template>