projects/mesxc-lb #205

Merged
gtz217 merged 38 commits from projects/mesxc-lb into projects/mesxc-test 2024-02-26 02:14:07 +08:00
5 changed files with 160 additions and 202 deletions
Showing only changes of commit 9ad83f84fa - Show all commits

View File

@ -84,12 +84,12 @@ export default {
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:update')
? {
type: 'detail',
btnName: '查看详情',
}
: undefined,
// this.$auth.hasPermi('equipment:check-setting:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:check-setting:delete')
? {
type: 'delete',
@ -175,51 +175,6 @@ export default {
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '配置名称',
prop: 'name',
rules: [
{ required: true, message: '配置名称不能为空', trigger: 'blur' },
],
},
{
input: true,
label: '配置编码',
prop: 'code',
url: '/base/equipment-check-config/getCode',
rules: [
{ required: true, message: '配置编码不能为空', trigger: 'blur' },
],
},
],
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
},
rules: [
{
required: true,
message: '设备名称不能为空',
trigger: 'change',
},
],
},
{
input: true,
label: '设备编码', // TODO:
prop: 'equipmentCode',
},
],
],
//
open: false,
//
@ -227,6 +182,7 @@ export default {
pageNo: 1,
pageSize: 10,
name: null,
status: 0,
},
//
form: {},
@ -314,26 +270,18 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
this.open = true;
this.title = '添加巡检设置';
this.$nextTick(() => {
this.$refs.add.init();
})
});
},
/** 修改按钮操作 */
handleUpdate(row) {
// this.reset();
// const id = row.id;
// this.info({ id }).then((response) => {
// this.form = response.data;
// this.open = true;
// this.title = '';
// });
this.open = true;
this.title = '修改巡检设置';
this.$nextTick(() => {
this.$refs.add.init(row.id);
this.$refs.add.init(row);
});
},
/** 提交按钮 */
@ -397,11 +345,11 @@ export default {
this.$refs.addOrUpdate.init(id, true);
});
},
handleAddDetail({ id }) {
handleAddDetail(row) {
this.addOrUpdateVisible = true;
this.addOrEditTitle = '添加巡检';
this.addOrEditTitle = '添加内容';
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
this.$refs.addOrUpdate.init(row);
});
},
/** 导出按钮操作 */

View File

@ -380,9 +380,6 @@ export default {
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
// this.open = true;
// this.title = '';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();

View File

@ -1,8 +1,8 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-12-01 11:02:43
* @LastEditors: lb
* @LastEditTime: 2024-02-22 11:02:43
* @Description:
-->
<template>
@ -24,7 +24,7 @@
@keyup.enter.native="dataFormSubmit()"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<!-- <el-col :span="8">
<el-form-item label="设备大类" prop="equipmentCategory">
<span>
{{
@ -34,21 +34,20 @@
}}
</span>
</el-form-item>
</el-col>
</el-col> -->
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName">
{{ dataForm.equipmentName }}
<!-- <el-input v-model="dataForm.equipmentName" disabled clearable placeholder="请输入设备名称" /> -->
<el-form-item label="巡检单名称" prop="name">
{{ dataForm.name }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="设备编码" prop="equipmentCode">
{{ dataForm.equipmentCode }}
<!-- <el-input
v-model="dataForm.equipmentCode"
clearable
disabled
placeholder="请输入设备编码" /> -->
<el-form-item label="部门" prop="department">
{{ dataForm.department }}
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="巡检时间" prop="planCheckTime">
{{ dataForm.planCheckTime | parseTime }}
</el-form-item>
</el-col>
</el-row>
@ -87,8 +86,8 @@
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
v-show="checkDetList.total > 0"
:total="checkDetList.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@ -103,20 +102,17 @@
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:config-id="dataForm.id"
:orderId="dataForm.id"
@closed="addOrUpdateVisible = false"
@refreshDataList="getList" />
</el-drawer>
</template>
<script>
import {
getEqCheck,
getCheckDetPage,
deleteCheckDet,
} from '@/api/equipment/base/inspection/settings';
import SmallTitle from './SmallTitle';
import attrAdd from './attr-add';
import { DICT_TYPE, getDictDatas } from '@/utils/dict';
import { parseTime } from '../../core/mixins/code-filter';
const tableBtn = [
{
@ -129,50 +125,35 @@ const tableBtn = [
},
];
const tableProps = [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'content',
label: '巡检内容',
},
{
prop: 'code',
label: '巡检内容编码',
},
{
prop: 'description',
label: '备注',
label: '检查项目',
},
];
export default {
components: { SmallTitle, attrAdd },
filters: {
parseTime,
},
data() {
return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: {
infoURL: getEqCheck,
},
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
},
dataForm: {
id: undefined,
code: undefined,
name: '',
materialType: undefined,
productType: undefined,
area: undefined,
specifications: undefined,
processTime: 0,
remark: undefined,
unit: undefined,
name: undefined,
department: undefined,
planCheckTime: undefined,
},
checkDetList: [],
visible: false,
@ -204,7 +185,7 @@ export default {
methods: {
initData() {
this.checkDetList.splice(0);
this.listQuery.total = 0;
this.checkDetList.total = 0;
},
handleClick(raw) {
if (raw.type === 'delete') {
@ -231,39 +212,35 @@ export default {
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
console.log('handle click....', raw);
this.addNew(raw.data);
}
},
getList() {
async getList() {
//
getCheckDetPage({
...this.listQuery,
configId: this.dataForm.id,
}).then((response) => {
this.checkDetList = response.data.list;
this.listQuery.total = response.data.total;
const res = await this.$axios({
url: '/base/equipment-check-order-det/page',
params: { ...this.listQuery, orderId: this.dataForm.id },
});
if (res.code == 0) {
this.checkDetList = res.data.list;
this.checkDetList.total = res.data.total;
}
},
init(id, isdetail) {
init(row, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.dataForm.id = row.id;
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL(id).then((response) => {
this.dataForm = response.data;
});
//
Object.keys(this.dataForm).forEach((key) => {
this.dataForm[key] = row[key];
});
this.getList();
} else {
if (this.urlOptions.isGetCode) {
this.getCode();
}
}
});
},

View File

@ -75,7 +75,7 @@
v-for="d in groupOptions"
:key="d.value"
:label="d.label"
:value="d.value" />
:value="d.label" />
</el-select>
</el-form-item>
</el-col>
@ -185,6 +185,9 @@ export default {
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(',')
}
});
}
},
@ -203,6 +206,7 @@ export default {
data: {
...this.dataForm,
special: true,
status: 0,
groupClass: this.dataForm.groupClass.join(','),
},
});

View File

@ -4,6 +4,7 @@
:width="'30%'"
:append-to-body="true"
:close-on-click-modal="false"
@closed="$emit('closed')"
class="dialog">
<template #title>
<slot name="title">
@ -17,18 +18,33 @@
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="60px"
label-width="90px"
v-loading="formLoading"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="巡检" prop="checkId">
<el-select v-model="dataForm.checkId" filterable placeholder="请选择巡检" style="width: 100%">
<el-option v-for="dict in checkList" :key="dict.id" :label="dict.content"
:value="dict.id" />
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
filterable
clearable
placeholder="请选择设备名称"
style="width: 100%">
<el-option
v-for="dict in equipmentOptions"
:key="dict.value"
:label="dict.label"
:value="dict.value" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="description">
<el-form-item label="巡检项目" prop="program">
<el-input
v-model="dataForm.description"
placeholder="请输入备注"
v-model="dataForm.program"
placeholder="请输入巡检项目"
clearable />
</el-form-item>
<el-form-item label="巡检结果" prop="checkResult">
<el-input
v-model="dataForm.checkResult"
placeholder="请输入巡检结果"
clearable />
</el-form-item>
</el-form>
@ -41,80 +57,96 @@
</template>
<script>
import { getCheckDet, createCheckDet, updateCheckDet, getcheckList } from "@/api/equipment/base/inspection/settings";
export default {
props: {
configId: {
type: String,
default: '',
},
},
props: ['orderId'],
data() {
return {
visible: false,
dataForm: {
id: undefined,
checkId: undefined,
configId: undefined,
description: ''
id: null,
equipmentId: null,
program: null,
checkResult: null,
},
checkList: [],
formLoading: false,
equipmentOptions: [],
dataRule: {
checkId: [{ required: true, message: '巡检不能为空', trigger: 'blur' }],
equipmentId: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
program: [
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
checkResult: [
{ required: true, message: '巡检结果不能为空', trigger: 'blur' },
],
},
};
},
mounted() {
this.getDict()
this.initOptions();
},
methods: {
async getDict() {
const res = await getcheckList()
this.checkList = res.data
async initOptions() {
this.formLoading = true;
const urls = [
'/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
];
try {
const [eq] = await Promise.all(urls.map((url) => this.$axios(url)));
if (eq.code == 0) {
this.equipmentOptions = eq.data.list.map((item) => ({
label: item.name,
value: item.id,
}));
}
this.formLoading = false;
} catch (err) {
this.formLoading = false;
console.error(err);
}
},
init(id) {
this.dataForm.id = id || '';
init(row) {
this.visible = true;
if (row?.id) {
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getCheckDet(this.dataForm.id).then((res) => {
// const { name, value } = res.data;
// this.dataForm.name = name;
// this.dataForm.value = value;
this.dataForm = res.data
this.formLoading = true;
this.$axios({
url: '/base/equipment-check-order-det/get?id=' + row.id,
}).then((res) => {
Object.keys(this.dataForm).forEach((key) => {
this.dataForm[key] = res.data[key];
});
this.formLoading = false;
});
});
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateCheckDet({
async dataFormSubmit() {
let valid = false;
try {
valid = await this.$refs['dataForm'].validate();
} catch (err) {}
if (!valid) return;
const res = await this.$axios({
url:
'base/equipment-check-order-det' +
(this.dataForm.id ? '/update' : '/create'),
method: this.dataForm.id ? 'put' : 'post',
data: {
...this.dataForm,
configId: this.configId
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
orderId: this.orderId,
},
});
if (res.code == 0) {
this.$modal.msgSuccess(this.dataForm.id ? '修改成功' : '新增成功');
this.$emit('refreshDataList');
});
return;
}
//
createCheckDet({
...this.dataForm,
configId: this.configId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};