Merge pull request 'projects/mesxc-lb' (#222) from projects/mesxc-lb into projects/mesxc-test
Reviewed-on: #222
This commit is contained in:
commit
9beca01fef
@ -87,6 +87,7 @@ const user = {
|
||||
// 获取用户信息
|
||||
GetInfo({ commit, state }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log('GetInfo')
|
||||
getInfo().then(res => {
|
||||
// 没有 data 数据,赋予个默认值
|
||||
if (!res) {
|
||||
@ -96,7 +97,7 @@ const user = {
|
||||
user: {
|
||||
id: '',
|
||||
avatar: '',
|
||||
userName: '',
|
||||
username: '',
|
||||
nickname: ''
|
||||
}
|
||||
}
|
||||
@ -113,7 +114,7 @@ const user = {
|
||||
commit('SET_ROLES', ['ROLE_DEFAULT'])
|
||||
}
|
||||
commit('SET_ID', user.id)
|
||||
commit('SET_NAME', user.userName)
|
||||
// commit('SET_NAME', user.username) //无效调用,接口未提供username值
|
||||
commit('SET_NICKNAME', user.nickname)
|
||||
commit('SET_AVATAR', avatar)
|
||||
resolve(res)
|
||||
|
4
src/utils/equipment-module.js
Normal file
4
src/utils/equipment-module.js
Normal file
@ -0,0 +1,4 @@
|
||||
import { getDictData } from './dict';
|
||||
|
||||
export const groupConnectWorkshop = (groupName, workshopValue) =>
|
||||
`${groupName} - ${getDictData('workshop', workshopValue)?.label}`;
|
@ -51,10 +51,7 @@
|
||||
{{ scope.row.planCheckTime | timeFilter }}
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column
|
||||
v-if="selectedBox[3]"
|
||||
label="班次"
|
||||
prop="groupClass">
|
||||
<el-table-column v-if="selectedBox[3]" label="班次" prop="groupClass">
|
||||
<template slot-scope="scope">
|
||||
{{ scope.row.groupClass || '---' }}
|
||||
</template>
|
||||
@ -129,7 +126,7 @@ import moment from 'moment';
|
||||
export default {
|
||||
name: 'CheckOrderListTable',
|
||||
components: {},
|
||||
props: ['tableData', 'page', 'limit'],
|
||||
props: ['tableData', 'page', 'limit', 'permissionGuard'],
|
||||
filters: {
|
||||
timeFilter: (val) =>
|
||||
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---',
|
||||
@ -170,12 +167,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
checkSelectable(row, index) {
|
||||
return true;
|
||||
// return (
|
||||
// row.relatePlan == 2 ||
|
||||
// (row.relatePlan == 1 &&
|
||||
// (!row.confirmDueTime || +row.confirmDueTime >= new Date().getTime()))
|
||||
// );
|
||||
return this.permissionGuard(row);
|
||||
},
|
||||
handleSelectionChange(val) {
|
||||
this.selectedOrder = val;
|
||||
|
@ -60,6 +60,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { groupConnectWorkshop } from '@/utils/equipment-module';
|
||||
|
||||
export default {
|
||||
name: 'ContentAdd',
|
||||
data() {
|
||||
@ -114,7 +116,7 @@ export default {
|
||||
}
|
||||
if (grp.code == 0) {
|
||||
this.groupOptions = grp.data.map((item) => ({
|
||||
label: item.name,
|
||||
label: groupConnectWorkshop(item.name, item.roomNameDict),
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
@ -173,8 +175,8 @@ export default {
|
||||
special: true,
|
||||
status: 1,
|
||||
// status: confirmed ? 2 : 1,
|
||||
groupClass: this.dataForm.groupClass.join(','),
|
||||
checkPerson: this.$store.getters.userId,
|
||||
groupClass: this.dataForm.groupClass?.join(','),
|
||||
checkPerson: this.$store.getters.nickname,
|
||||
},
|
||||
});
|
||||
if (res.code == 0) {
|
||||
|
@ -268,8 +268,8 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
getConfirmed() {
|
||||
return this.$confirm('是否直接确认巡检记录', '提示', {
|
||||
getConfirmed(message = '是否直接确认巡检记录') {
|
||||
return this.$confirm(message, '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning',
|
||||
@ -281,25 +281,31 @@ export default {
|
||||
return this.$message.error('请添加巡检内容');
|
||||
}
|
||||
|
||||
let confirmed = false;
|
||||
/** 询问 是否保存记录 */
|
||||
try {
|
||||
confirmed = await this.getConfirmed();
|
||||
} catch (err) {
|
||||
confirmed = false;
|
||||
}
|
||||
if (await this.getConfirmed('是否保存记录')) {
|
||||
/** 询问 是否直接确认 */
|
||||
try {
|
||||
if (await this.getConfirmed('是否直接确认巡检记录')) {
|
||||
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('已确认');
|
||||
}
|
||||
}
|
||||
|
||||
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.$emit('refreshDataList');
|
||||
this.handleCancel();
|
||||
} catch (err) {
|
||||
this.handleCancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (err) {}
|
||||
|
||||
// this.btnLoading = true;
|
||||
// this.$nextTick(async () => {
|
||||
@ -319,8 +325,6 @@ export default {
|
||||
// this.$emit('refreshDataList');
|
||||
// this.handleCancel();
|
||||
// });
|
||||
this.$emit('refreshDataList');
|
||||
this.handleCancel();
|
||||
},
|
||||
|
||||
handleEmitFun(val) {
|
||||
|
@ -29,7 +29,16 @@
|
||||
v-loading="formLoading">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="巡检单名称" prop="name">
|
||||
<el-form-item
|
||||
label="巡检单名称"
|
||||
prop="name"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '巡检单名称不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-input
|
||||
v-model="form.name"
|
||||
:disabled="disableEdit"
|
||||
@ -196,6 +205,7 @@
|
||||
|
||||
<script>
|
||||
import DialogForm from '../../../components/DialogForm/index.vue';
|
||||
import { groupConnectWorkshop } from '@/utils/equipment-module';
|
||||
|
||||
const SmallTitle = {
|
||||
name: 'SmallTitle',
|
||||
@ -230,7 +240,15 @@ export default {
|
||||
return {
|
||||
visible: false,
|
||||
btnLoading: false,
|
||||
form: {},
|
||||
form: {
|
||||
id: null,
|
||||
name: null,
|
||||
departmentId: null,
|
||||
groupClass: null,
|
||||
checkPerson: null,
|
||||
planCheckTime: null,
|
||||
remark: null,
|
||||
},
|
||||
formLoading: false,
|
||||
departmentList: [],
|
||||
inspectorOptions: [],
|
||||
@ -411,24 +429,41 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
resetForm() {
|
||||
this.form = {
|
||||
id: null,
|
||||
name: null,
|
||||
departmentId: null,
|
||||
groupClass: null,
|
||||
checkPerson: null,
|
||||
planCheckTime: null,
|
||||
remark: null,
|
||||
};
|
||||
},
|
||||
async handleConfirm() {
|
||||
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('更新成功');
|
||||
try {
|
||||
const valid = await this.$refs['form'].validate();
|
||||
if (!valid) return;
|
||||
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();
|
||||
} catch (err) {
|
||||
this.btnLoading = false;
|
||||
}
|
||||
this.btnLoading = false;
|
||||
this.$emit('refreshDataList');
|
||||
this.handleCancel();
|
||||
});
|
||||
},
|
||||
|
||||
@ -445,14 +480,22 @@ export default {
|
||||
},
|
||||
|
||||
async getInfo(row) {
|
||||
console.log('row', row);
|
||||
this.resetForm();
|
||||
const res = await this.$axios(
|
||||
'/base/equipment-check-order/get?id=' + row.id
|
||||
);
|
||||
if (res.code == 0) {
|
||||
this.form = res.data;
|
||||
this.form.groupClass = res.data.groupClass.split(',');
|
||||
this.form.checkPerson = res.data.checkPerson?.split(',');
|
||||
Object.keys(this.form).forEach((key) => {
|
||||
if (key == 'groupClass' || key == 'checkPerson') {
|
||||
this.form[key] =
|
||||
(res.data[key] &&
|
||||
res.data[key].trim() != '' &&
|
||||
res.data[key].split(',')) ||
|
||||
[];
|
||||
} else {
|
||||
this.form[key] = res.data[key];
|
||||
}
|
||||
});
|
||||
this.formLoading = false;
|
||||
}
|
||||
this.formLoading = false;
|
||||
@ -497,8 +540,8 @@ export default {
|
||||
if (userlist.code == 0) {
|
||||
inspectorList = inspectorList.concat(
|
||||
(userlist.data?.list || []).map((item) => ({
|
||||
label: item.username,
|
||||
value: item.id,
|
||||
label: item.nickname,
|
||||
value: item.nickname,
|
||||
}))
|
||||
);
|
||||
}
|
||||
@ -516,7 +559,7 @@ export default {
|
||||
case 'groupClass':
|
||||
res = await this.$axios(urls[1]);
|
||||
this.groupOptions = (res.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
label: groupConnectWorkshop(item.name, item.roomNameDict),
|
||||
value: item.id,
|
||||
}));
|
||||
break;
|
||||
@ -524,22 +567,6 @@ export default {
|
||||
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;
|
||||
},
|
||||
|
@ -18,6 +18,7 @@
|
||||
:table-data="list"
|
||||
:page="queryParams.pageNo"
|
||||
:limit="queryParams.pageSize"
|
||||
:permissionGuard="checkConfirmPermission"
|
||||
@edit="handleEdit"
|
||||
@detail="handleDetail"
|
||||
@delete="handleDelete"
|
||||
@ -177,6 +178,7 @@ export default {
|
||||
pageSize: 10,
|
||||
name: null,
|
||||
status: 1,
|
||||
special: true,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
@ -296,6 +298,12 @@ export default {
|
||||
});
|
||||
},
|
||||
|
||||
/** 按钮、选择权限 */
|
||||
checkConfirmPermission(row) {
|
||||
const isAdmin = false; // 后续再修改
|
||||
return !row.confirmDueTime || row.confirmDueTime >= new Date().getTime() || isAdmin;
|
||||
},
|
||||
|
||||
/** 编辑 */
|
||||
handleEdit(row, detail) {
|
||||
this.editOpen = true;
|
||||
@ -313,7 +321,7 @@ export default {
|
||||
return this.$axios({
|
||||
url:
|
||||
'/base/equipment-check-order/confirm?confirmPerson=' +
|
||||
this.$store.getters.userId,
|
||||
this.$store.getters.nickname,
|
||||
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
|
||||
method: 'put',
|
||||
data: [id],
|
||||
@ -349,16 +357,16 @@ export default {
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.$modal
|
||||
.confirm('是否确认导出所有巡检设置?')
|
||||
.confirm('是否确认导出所有巡检单?')
|
||||
.then(() => {
|
||||
this.exportLoading = true;
|
||||
return this.$axios({
|
||||
url: '/base/equipment-check-order/export-excel',
|
||||
// params: {
|
||||
// name: this.queryParams.name,
|
||||
// status: 1,
|
||||
// special: true,
|
||||
// },
|
||||
params: {
|
||||
name: this.queryParams.name,
|
||||
status: 1,
|
||||
special: true,
|
||||
},
|
||||
responseType: 'blob',
|
||||
});
|
||||
})
|
||||
|
@ -324,8 +324,8 @@ export default {
|
||||
method: 'put',
|
||||
data: {
|
||||
...this.form,
|
||||
groupClass: this.form.groupClass.join(','),
|
||||
checkPerson: this.form.checkPerson.join(','),
|
||||
groupClass: this.form.groupClass?.join(','),
|
||||
checkPerson: this.form.checkPerson?.join(','),
|
||||
},
|
||||
});
|
||||
if (code == 0) {
|
||||
@ -401,8 +401,8 @@ export default {
|
||||
if (userlist.code == 0) {
|
||||
inspectorList = inspectorList.concat(
|
||||
(userlist.data?.list || []).map((item) => ({
|
||||
label: item.username,
|
||||
value: item.id,
|
||||
label: item.nickname,
|
||||
value: item.nickname,
|
||||
}))
|
||||
);
|
||||
}
|
||||
|
@ -89,6 +89,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { groupConnectWorkshop } from '@/utils/equipment-module';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@ -107,6 +109,12 @@ export default {
|
||||
dataRule: {
|
||||
confirmTimeLimit: [
|
||||
{ required: true, message: '确认时限不能为空', trigger: 'blur' },
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数字类型',
|
||||
trigger: 'blur',
|
||||
transform: (val) => Number(val),
|
||||
},
|
||||
],
|
||||
code: [
|
||||
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' },
|
||||
@ -160,7 +168,7 @@ export default {
|
||||
}
|
||||
if (grp.code == 0) {
|
||||
this.groupOptions = grp.data.map((item) => ({
|
||||
label: item.name,
|
||||
label: groupConnectWorkshop(item.name, item.roomNameDict),
|
||||
value: item.id,
|
||||
}));
|
||||
}
|
||||
@ -186,7 +194,10 @@ export default {
|
||||
Object.keys(this.dataForm).forEach((key) => {
|
||||
this.dataForm[key] = res.data[key];
|
||||
if (key == 'groupClass') {
|
||||
this.dataForm.groupClass = res.data.groupClass.split(',')
|
||||
this.dataForm.groupClass =
|
||||
res.data.groupClass &&
|
||||
res.data.groupClass.trim() != '' &&
|
||||
res.data.groupClass.split(',');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -23,7 +23,7 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障发生时间" prop="faultTime">
|
||||
<span>{{ parseTime(dataForm.faultTime) }}</span>
|
||||
<span style="color: #000a;">{{ parseTime(dataForm.faultTime) }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障级别" prop="faultLevel">
|
||||
<span>
|
||||
<span style="color: #000a;">
|
||||
{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="故障类型" prop="faultType">
|
||||
<span>
|
||||
<span style="color: #000a;">
|
||||
{{ getDictDataLabel('fault-type', dataForm.faultType) }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
@ -59,19 +59,19 @@
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修工" prop="repairman">
|
||||
<span>{{ dataForm.repairman }}</span>
|
||||
<span style="color: #000a;">{{ dataForm.repairman }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="联系方式" prop="repairmanPhone">
|
||||
<span>{{ dataForm.repairmanPhone }}</span>
|
||||
<span style="color: #000a;">{{ dataForm.repairmanPhone }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="维修方式" prop="repairMode">
|
||||
<span>
|
||||
<span style="color: #000a;">
|
||||
{{ getDictDataLabel('repair-mode', dataForm.repairMode) }}
|
||||
</span>
|
||||
</el-form-item>
|
||||
@ -88,25 +88,25 @@
|
||||
:disabled="disabled"
|
||||
@delete="!disabled && handleDeleteFile(file, col.prop)" />
|
||||
</div>
|
||||
<p v-else>暂无附件</p>
|
||||
<p v-else style="color: #000a;">暂无附件</p>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="创建时间" prop="createTime">
|
||||
<span>{{ parseTime(dataForm.createTime) }}</span>
|
||||
<span style="color: #000a;">{{ parseTime(dataForm.createTime) }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="8">
|
||||
<el-form-item label="创建人" prop="creator">
|
||||
<span>{{ dataForm.creator }}</span>
|
||||
<span style="color: #000a;">{{ dataForm.creator }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
|
||||
<el-col :span="24">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<span>{{ dataForm.remark }}</span>
|
||||
<span style="color: #000a;">{{ dataForm.remark || '- 无 -' }}</span>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -159,8 +159,7 @@ const uploadedFile = {
|
||||
document.body.removeChild(link);
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
mounted() {},
|
||||
render: function (h) {
|
||||
return (
|
||||
<div
|
||||
@ -338,6 +337,10 @@ export default {
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.drawer-body__content >>> .el-form-item__label {
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.drawer-body__footer {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
|
@ -27,7 +27,6 @@
|
||||
<div class="drawer-body flex">
|
||||
<div class="drawer-body__content">
|
||||
<section>
|
||||
<SmallTitle>保养信息</SmallTitle>
|
||||
<div class="form-part" style="margin-bottom: 32px">
|
||||
<el-skeleton v-if="!showForm" animated />
|
||||
<el-form
|
||||
|
@ -44,10 +44,7 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="部门"
|
||||
prop="departmentId"
|
||||
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
|
||||
<el-form-item label="部门" prop="departmentId">
|
||||
<el-select
|
||||
v-model="form.departmentId"
|
||||
:placeholder="`请选择部门`"
|
||||
@ -84,10 +81,7 @@
|
||||
</el-col>
|
||||
|
||||
<el-col :span="12">
|
||||
<el-form-item
|
||||
label="产线"
|
||||
prop="lineId"
|
||||
:rules="[{ required: true, message: '请选择产线', trigger: 'blur' }]">
|
||||
<el-form-item label="产线" prop="lineId">
|
||||
<el-select
|
||||
v-model="form.lineId"
|
||||
:placeholder="`请选择产线`"
|
||||
@ -183,6 +177,7 @@
|
||||
label="保养时长(h)"
|
||||
prop="maintainDuration"
|
||||
:rules="[
|
||||
{ required: true, message: '保养时长不能为空', trigger: 'blur' },
|
||||
{
|
||||
type: 'number',
|
||||
message: '请输入正确的数字',
|
||||
|
@ -27,7 +27,6 @@
|
||||
<div class="drawer-body flex">
|
||||
<div class="drawer-body__content">
|
||||
<section>
|
||||
<SmallTitle>保养信息</SmallTitle>
|
||||
<div class="form-part" style="margin-bottom: 32px">
|
||||
<el-skeleton v-if="!showForm" animated />
|
||||
<el-form
|
||||
@ -130,8 +129,8 @@
|
||||
width="35%"
|
||||
:append-to-body="true"
|
||||
custom-class="baseDialog"
|
||||
@close="closeDetailForm"
|
||||
@cancel="closeDetailForm"
|
||||
@close="detailAddVisible = false"
|
||||
@cancel="detailAddVisible = false"
|
||||
@confirm="submitDetailForm">
|
||||
<DialogForm
|
||||
v-if="detailAddVisible"
|
||||
@ -238,7 +237,7 @@ export default {
|
||||
detailTableProps: [
|
||||
{ prop: 'equipmentName', label: '设备名称' },
|
||||
{ prop: 'program', label: '保养项目' },
|
||||
{ prop: 'remark', label: '备注' },
|
||||
// { prop: 'remark', label: '备注' },
|
||||
],
|
||||
detailTableQuery: {
|
||||
pageNo: 1,
|
||||
@ -318,9 +317,21 @@ export default {
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
|
||||
resetForm() {
|
||||
this.detailForm = {
|
||||
planId: null,
|
||||
equipmentId: null,
|
||||
program: '',
|
||||
maintenanceDes: '',
|
||||
remark: '',
|
||||
};
|
||||
},
|
||||
|
||||
closeDetailForm() {
|
||||
this.detailAddVisible = false;
|
||||
},
|
||||
|
||||
async submitDetailForm() {
|
||||
// validation
|
||||
this.$refs.detailForm.validate(async (valid) => {
|
||||
@ -411,7 +422,10 @@ export default {
|
||||
}
|
||||
},
|
||||
handleAddDetail() {
|
||||
this.detailAddVisible = true;
|
||||
this.resetForm();
|
||||
this.$nextTick(() => {
|
||||
this.detailAddVisible = true;
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -63,7 +63,6 @@
|
||||
import moment from 'moment';
|
||||
import basicPageMixin from '@/mixins/lb/basicPageMixin';
|
||||
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record';
|
||||
import { publicFormatter } from '@/utils/dict';
|
||||
import PlanConfigAdd from './PlanConfig--add.vue';
|
||||
import PlanConfigAddContent from './PlanConfig--addContent.vue';
|
||||
|
||||
@ -102,8 +101,13 @@ export default {
|
||||
{ prop: 'name', label: '计划名称' },
|
||||
{ prop: 'departmentName', label: '部门' },
|
||||
{ width: 144, prop: 'lineName', label: '产线名' },
|
||||
{ width: 144, prop: 'maintenancePeriod', label: '保养频率(天/次)' },
|
||||
{ width: 144, prop: 'firstMaintenanceTime', label: '首次保养时间' },
|
||||
{ width: 132, prop: 'maintenancePeriod', label: '保养频率(天/次)' },
|
||||
{
|
||||
width: 180,
|
||||
prop: 'firstMaintenanceTime',
|
||||
label: '首次保养时间',
|
||||
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
|
||||
},
|
||||
{ width: 144, prop: 'maintainDuration', label: '保养时长' },
|
||||
{ prop: 'maintainer', label: '计划保养人员' },
|
||||
{
|
||||
|
@ -29,7 +29,7 @@
|
||||
</el-col>
|
||||
|
||||
<!-- 产线名 -->
|
||||
<el-col :span="8">
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="产线名" prop="lineId">
|
||||
<el-select
|
||||
v-model="formFilters.lineId"
|
||||
@ -45,10 +45,10 @@
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
|
||||
<!-- 工段名 -->
|
||||
<el-col :span="8">
|
||||
<!-- <el-col :span="8">
|
||||
<el-form-item label="工段名" prop="sectionId">
|
||||
<el-select
|
||||
v-model="formFilters.sectionId"
|
||||
@ -64,7 +64,7 @@
|
||||
:value="opt.value" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-col> -->
|
||||
|
||||
<!-- 设备名称 -->
|
||||
<el-col :span="8">
|
||||
@ -116,16 +116,7 @@
|
||||
|
||||
<!-- 故障级别 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="故障级别"
|
||||
prop="faultLevel"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '故障级别不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-form-item label="故障级别" prop="faultLevel">
|
||||
<el-select
|
||||
v-model="form.faultLevel"
|
||||
placeholder="故障级别"
|
||||
@ -216,12 +207,7 @@
|
||||
|
||||
<!-- 维修工 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修工"
|
||||
prop="repairman"
|
||||
:rules="[
|
||||
{ required: true, message: '维修工不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-form-item label="维修工" prop="repairman">
|
||||
<el-select
|
||||
v-model="form.repairman"
|
||||
@change="$emit('update', form)"
|
||||
@ -241,12 +227,7 @@
|
||||
|
||||
<!-- 联系方式 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="联系方式"
|
||||
prop="repairmanPhone"
|
||||
:rules="[
|
||||
{ required: true, message: '联系方式不能为空', trigger: 'blur' },
|
||||
]">
|
||||
<el-form-item label="联系方式" prop="repairmanPhone">
|
||||
<el-input
|
||||
v-model="form.repairmanPhone"
|
||||
@change="$emit('update', form)"
|
||||
@ -257,16 +238,7 @@
|
||||
|
||||
<!-- 维修方式 - 数据字典 -->
|
||||
<el-col :span="8">
|
||||
<el-form-item
|
||||
label="维修方式"
|
||||
prop="repairMode"
|
||||
:rules="[
|
||||
{
|
||||
required: true,
|
||||
message: '维修方式不能为空',
|
||||
trigger: 'blur',
|
||||
},
|
||||
]">
|
||||
<el-form-item label="维修方式" prop="repairMode">
|
||||
<el-select
|
||||
v-model="form.repairMode"
|
||||
placeholder="维修方式"
|
||||
@ -308,7 +280,7 @@
|
||||
</el-col>
|
||||
|
||||
<!-- 备注 -->
|
||||
<el-col :span="24">
|
||||
<el-col :span="8">
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
v-model="form.remark"
|
||||
@ -544,16 +516,16 @@ export default {
|
||||
dataForm: {
|
||||
handler(val) {
|
||||
this.form = JSON.parse(JSON.stringify(val));
|
||||
if (this.form.equipmentCategory != null) {
|
||||
setTimeout(() => {
|
||||
this.equipmentOptions = this.equipmentList
|
||||
.filter((item) => item.special)
|
||||
.filter(
|
||||
(item) => item.specialType === this.form.equipmentCategory
|
||||
)
|
||||
.map((item) => ({ label: item.name, value: item.id }));
|
||||
}, 1000);
|
||||
}
|
||||
// if (this.form.equipmentCategory != null) {
|
||||
// setTimeout(() => {
|
||||
// this.equipmentOptions = this.equipmentList
|
||||
// .filter((item) => item.special)
|
||||
// .filter(
|
||||
// (item) => item.specialType === this.form.equipmentCategory
|
||||
// )
|
||||
// .map((item) => ({ label: item.name, value: item.id }));
|
||||
// }, 1000);
|
||||
// }
|
||||
if (this.hasFiles) {
|
||||
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
|
||||
this.form.files = this.form.files ?? [];
|
||||
@ -591,9 +563,9 @@ export default {
|
||||
this.formLoading = true;
|
||||
await this.getCode();
|
||||
await this.initEquipment();
|
||||
await this.initLines();
|
||||
// await this.initLines();
|
||||
await this.initWorker();
|
||||
await this.initSections();
|
||||
// await this.initSections();
|
||||
this.formLoading = false;
|
||||
this.isInit = false;
|
||||
this.setInitWorker();
|
||||
@ -602,36 +574,37 @@ export default {
|
||||
/** 设置默认维修工为用户自己 */
|
||||
setInitWorker() {
|
||||
/** 获取用户自身id */
|
||||
const userId = this.$store.getters.userId;
|
||||
const nickname = this.$store.getters.nickname;
|
||||
this.$nextTick(() => {
|
||||
this.form.repairman = [userId];
|
||||
this.form.repairman = [nickname];
|
||||
});
|
||||
},
|
||||
|
||||
/** 获取产线 */
|
||||
async initLines() {
|
||||
const res = await this.$axios('/base/core-production-line/listAll');
|
||||
this.lineOptions = (res.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
},
|
||||
// async initLines() {
|
||||
// const res = await this.$axios('/base/core-production-line/listAll');
|
||||
// this.lineOptions = (res.data || []).map((item) => ({
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// }));
|
||||
// },
|
||||
|
||||
// /** 获取工段 */
|
||||
// async initSections(byLineId) {
|
||||
// this.formLoading = !this.isInit && true;
|
||||
// const res = await this.$axios({
|
||||
// url:
|
||||
// byLineId && !this.isInit
|
||||
// ? '/base/core-workshop-section/listByParentId?id=' + byLineId
|
||||
// : '/base/core-workshop-section/listAll',
|
||||
// });
|
||||
// this.sectionOptions = (res.data || []).map((item) => ({
|
||||
// label: item.name,
|
||||
// value: item.id,
|
||||
// }));
|
||||
// this.formLoading = !this.isInit && false;
|
||||
// },
|
||||
|
||||
/** 获取工段 */
|
||||
async initSections(byLineId) {
|
||||
this.formLoading = !this.isInit && true;
|
||||
const res = await this.$axios({
|
||||
url:
|
||||
byLineId && !this.isInit
|
||||
? '/base/core-workshop-section/listByParentId?id=' + byLineId
|
||||
: '/base/core-workshop-section/listAll',
|
||||
});
|
||||
this.sectionOptions = (res.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
this.formLoading = !this.isInit && false;
|
||||
},
|
||||
/** 获取设备 */
|
||||
async initEquipment(type = 'special-equipment') {
|
||||
const response = await this.$axios('/base/core-equipment/listAll');
|
||||
@ -642,8 +615,8 @@ export default {
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
}));
|
||||
this.equipmentOptions = equipmentOptions;
|
||||
this.allSpeicalEquipments = equipmentOptions;
|
||||
this.equipmentOptions = [...equipmentOptions];
|
||||
this.allSpeicalEquipments = [...equipmentOptions];
|
||||
},
|
||||
/** 获取维修工 - 同时从用户表和员工表拉取数据 */
|
||||
async initWorker() {
|
||||
@ -658,8 +631,8 @@ export default {
|
||||
});
|
||||
list = list.concat(
|
||||
(userList.data?.list || []).map((item) => ({
|
||||
label: item.username,
|
||||
value: item.id,
|
||||
label: item.nickname,
|
||||
value: item.nickname,
|
||||
}))
|
||||
);
|
||||
/** worker */
|
||||
@ -669,7 +642,7 @@ export default {
|
||||
list = list.concat(
|
||||
(workerList.data || []).map((item) => ({
|
||||
label: item.name,
|
||||
value: item.id,
|
||||
value: item.name,
|
||||
}))
|
||||
);
|
||||
/** setting */
|
||||
|
@ -42,6 +42,7 @@
|
||||
<base-dialog
|
||||
:dialogTitle="title"
|
||||
:dialogVisible="open"
|
||||
width="60%"
|
||||
@close="cancel"
|
||||
@cancel="cancel"
|
||||
@confirm="submitForm">
|
||||
@ -146,6 +147,7 @@ export default {
|
||||
label: '故障明细',
|
||||
minWidth: 120,
|
||||
showOverflowtooltip: true,
|
||||
subcomponent: htmls,
|
||||
},
|
||||
{
|
||||
prop: 'maintenanceStartTime',
|
||||
@ -172,6 +174,7 @@ export default {
|
||||
label: '维修描述',
|
||||
showOverflowtooltip: true,
|
||||
width: 110,
|
||||
subcomponent: htmls,
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
|
Loading…
Reference in New Issue
Block a user