Commit 14730474 authored by sxl's avatar sxl 💬

fix;禅道bug修改

parent a8971bb3
import request from '@/utils/request'
//查询巡检记录列表
export function listLog() {
export function listLog(data) {
return request({
url: '/gemho/inspection/list',
method: 'get'
method: 'get',
params: data
})
}
//获取巡检记录详细信息
......
import request from '@/utils/request'
//获取巡检任务列表
export function listTask() {
export function listTask(data) {
return request({
url: '/inspection/task/list',
method: 'get'
method: 'get',
params: data
})
}
//获取巡检任务详情
......
import request from '@/utils/request'
//获取巡检任务列表
export function listTask() {
export function listTask(data) {
return request({
url: '/placeInspection/task/list',
method: 'get'
method: 'get',
params: data
})
}
//获取巡检任务详情
......
......@@ -785,10 +785,10 @@ $spacing: 16px;
display: flex;
justify-content: space-between;
padding: 0 $spacing;
padding-top: 16vh;
padding-top: 173px;
background: url('~@/assets/images/screen/bg12.png');
color: #fff;
min-height: 100vh;
height: 100%;
box-sizing: border-box;
}
......
<template>
<div class="app-container">
<el-form
:model="queryParams"
ref="queryForm"
size="small"
:inline="true"
v-show="showSearch"
label-width="68px"
>
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="巡检日期" prop="pollingData">
<el-date-picker
clearable
v-model="queryParams.pollingData"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择巡检日期"
>
</el-date-picker>
<el-date-picker clearable v-model="queryParams.pollingData" type="date" value-format="yyyy-MM-dd" placeholder="请选择巡检日期"> </el-date-picker>
</el-form-item>
<el-form-item label="巡检人" prop="inspectionUserId">
<el-select
......@@ -28,135 +14,57 @@
:remote-method="remoteMethod"
:loading="loading"
>
<el-option
v-for="item in useroptions"
:key="item.userId"
:label="item.nickName + '/' + item.nickName"
:value="item.userId"
>
</el-option>
<el-option v-for="item in useroptions" :key="item.userId" :label="item.userName + '/' + item.nickName" :value="item.userId"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="巡检地点" prop="placeId">
<el-select
v-model="queryParams.placeId"
placeholder="请选择巡检地点"
clearable
>
<el-option
v-for="item in placeList"
:key="item.id"
:label="item.placeName"
:value="item.id"
/>
<el-select v-model="queryParams.placeId" placeholder="请选择巡检地点" clearable>
<el-option v-for="item in placeList" :key="item.id" :label="item.placeName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item>
<el-button
type="primary"
icon="el-icon-search"
size="mini"
@click="handleQuery"
>搜索</el-button
>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
>重置</el-button
>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['inspection:task:add']"
>新增</el-button
>
<el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['inspection:task:add']">新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['inspection:task:edit']"
<el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['inspection:task:edit']"
>修改</el-button
>
</el-col>
<right-toolbar
:showSearch.sync="showSearch"
@queryTable="getList"
></right-toolbar>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table
v-loading="loading"
:data="taskList"
@selection-change="handleSelectionChange"
>
<el-table v-loading="loading" :data="taskList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column
label="巡检日期"
align="center"
prop="pollingData"
width="180"
>
<el-table-column label="巡检日期" align="center" prop="pollingData" width="180">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.pollingData, "{y}-{m}-{d}") }}</span>
<span>{{ parseTime(scope.row.pollingData, '{y}-{m}-{d}') }}</span>
</template>
</el-table-column>
<el-table-column
label="巡检人"
align="center"
prop="inspectionUserName"
/>
<el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="巡检地点" align="center" prop="placeName" />
<el-table-column label="巡检状态" align="center" prop="taskState">
<template slot-scope="scope">
{{ scope.row.taskState == 1 ? "已完成" : "巡检中" }}
{{ scope.row.taskState == 1 ? '已完成' : '巡检中' }}
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column
label="操作"
align="center"
class-name="small-padding fixed-width"
>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['inspection:task:edit']"
>修改</el-button
>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['inspection:task:remove']"
>删除</el-button
>
<el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)" v-hasPermi="['inspection:task:edit']">修改</el-button>
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)" v-hasPermi="['inspection:task:remove']">删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
<!-- 添加或修改巡检任务对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
......@@ -183,37 +91,17 @@
:remote-method="remoteMethod"
:loading="loading"
>
<el-option
v-for="item in useroptions"
:key="item.userId"
:label="item.nickName + '/' + item.nickName"
:value="item.userId"
>
</el-option>
<el-option v-for="item in useroptions" :key="item.userId" :label="item.nickName + '/' + item.nickName" :value="item.userId"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="巡检地点" prop="placeId">
<el-select
v-model="form.placeId"
placeholder="请选择巡检地点"
clearable
@change="placeList"
>
<el-option
v-for="item in placeList"
:key="item.id"
:label="item.placeName"
:value="item.id"
/>
<el-select v-model="form.placeId" placeholder="请选择巡检地点" clearable @change="placeList">
<el-option v-for="item in placeList" :key="item.id" :label="item.placeName" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
type="textarea"
placeholder="请输入内容"
/>
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
......@@ -225,17 +113,10 @@
</template>
<script>
import {
listTask,
getTask,
delTask,
addTask,
updateTask,
getInspectionUser,
} from "@/api/patrol/placeInspection";
import { listLog as placeList } from "@/api/patrol/patrolLocation";
import { listTask, getTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/placeInspection';
import { listLog as placeList } from '@/api/patrol/patrolLocation';
export default {
name: "Task",
name: 'Task',
data() {
return {
// 遮罩层
......@@ -253,7 +134,7 @@ export default {
// 巡检任务表格数据
taskList: [],
// 弹出层标题
title: "",
title: '',
// 是否显示弹出层
open: false,
// 查询参数
......@@ -269,15 +150,9 @@ export default {
form: {},
// 表单校验
rules: {
pollingData: [
{ required: true, message: "巡检日期不能为空", trigger: "blur" },
],
inspectionUserId: [
{ required: true, message: "巡检人不能为空", trigger: "blur" },
],
placeId: [
{ required: true, message: "巡检地点不能为空", trigger: "blur" },
],
pollingData: [{ required: true, message: '巡检日期不能为空', trigger: 'blur' }],
inspectionUserId: [{ required: true, message: '巡检人不能为空', trigger: 'blur' }],
placeId: [{ required: true, message: '巡检地点不能为空', trigger: 'blur' }],
},
// 巡检地点列表
placeList: [],
......@@ -288,9 +163,7 @@ export default {
pickerOptions: {
disabledDate(time) {
// 禁用今天之前的日期(含今天零点)
return (
time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
);
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
},
},
};
......@@ -304,8 +177,7 @@ export default {
this.loading = true;
getInspectionUser({
userName: queryString,
}).then((response) => {
console.log(response.rows, "response.rows");
}).then(response => {
this.useroptions = response.rows;
this.loading = false;
......@@ -316,25 +188,25 @@ export default {
getDeviceList() {
listDevice({
deviceType: this.form.deviceType,
}).then((response) => {
}).then(response => {
this.deviceList = response.rows;
});
},
/** 查询巡检任务列表 */
getList() {
this.loading = true;
listTask(this.queryParams).then((response) => {
listTask(this.queryParams).then(response => {
this.taskList = response.rows;
this.total = response.total;
this.loading = false;
});
// 巡检地点列表
placeList().then((response) => {
placeList().then(response => {
this.placeList = response.rows;
});
getInspectionUser({
userName: null,
}).then((response) => {
}).then(response => {
this.useroptions = response.rows;
});
},
......@@ -353,7 +225,7 @@ export default {
taskState: null,
remark: null,
};
this.resetForm("form");
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
......@@ -362,12 +234,12 @@ export default {
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.resetForm('queryForm');
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id);
this.ids = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
......@@ -375,34 +247,34 @@ export default {
handleAdd() {
this.reset();
this.open = true;
this.title = "添加巡检任务";
this.title = '添加巡检任务';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids;
getTask(id).then((response) => {
getTask(id).then(response => {
this.form = {
...response.data,
deviceType: Number(response.data.deviceType),
};
this.open = true;
this.title = "修改巡检任务";
this.title = '修改巡检任务';
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate((valid) => {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateTask(this.form).then((response) => {
this.$modal.msgSuccess("修改成功");
updateTask(this.form).then(response => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
} else {
addTask(this.form).then((response) => {
this.$modal.msgSuccess("新增成功");
addTask(this.form).then(response => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
......@@ -420,7 +292,7 @@ export default {
})
.then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
......
......@@ -4,8 +4,18 @@
<el-form-item label="巡检日期" prop="pollingData">
<el-date-picker clearable v-model="queryParams.pollingData" type="date" value-format="yyyy-MM-dd" placeholder="请选择巡检日期"> </el-date-picker>
</el-form-item>
<el-form-item label="巡检人" prop="userId">
<el-input v-model="queryParams.userId" placeholder="请输入巡检人" clearable @keyup.enter.native="handleQuery" />
<el-form-item label="巡检人" prop="inspectionUserId">
<el-select
v-model="queryParams.inspectionUserId"
filterable
remote
reserve-keyword
placeholder="请输入关键词"
:remote-method="remoteMethod"
:loading="loading"
>
<el-option v-for="item in useroptions" :key="item.userId" :label="item.userName + '/' + item.nickName" :value="item.userId"> </el-option>
</el-select>
</el-form-item>
<el-form-item label="报修单编号" prop="repairsId">
<el-input v-model="queryParams.repairsId" placeholder="请输入报修单编号" clearable @keyup.enter.native="handleQuery" />
......@@ -30,11 +40,6 @@
<el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备状态" align="center" prop="deviceState">
<template slot-scope="scope">
<el-tag v-if="scope.row.deviceState == 1" type="success">正常</el-tag>
<el-tag v-else type="danger">异常</el-tag>
......@@ -48,7 +53,8 @@
</template>
<script>
import { listLog, getLog, delLog, addLog, updateLog } from '@/api/patrol/patrolLog'
import { listLog, getLog, delLog, addLog, updateLog } from '@/api/patrol/patrolLog';
import { getInspectionUser } from '@/api/patrol/placeInspection';
export default {
name: 'Inspection',
......@@ -77,11 +83,13 @@ export default {
pageNum: 1,
pageSize: 10,
pollingData: null,
userId: null,
userName: null,
deviceId: null,
deviceState: null,
repairsId: null,
},
// 用户下拉选项
useroptions: [],
// 表单参数
form: {},
// 表单校验
......@@ -89,25 +97,41 @@ export default {
userId: [{ required: true, message: '巡检人不能为空', trigger: 'blur' }],
deviceId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
},
}
};
},
created() {
this.getList()
this.getList();
},
methods: {
/** 查询巡检记录列表 */
getList() {
this.loading = true
listLog(this.queryParams).then((response) => {
this.inspectionList = response.rows
this.total = response.total
this.loading = false
})
this.loading = true;
listLog(this.queryParams).then(response => {
this.inspectionList = response.rows;
this.total = response.total;
this.loading = false;
});
getInspectionUser({
userName: null,
}).then(response => {
this.useroptions = response.rows;
});
},
// 远程搜索
remoteMethod(queryString) {
this.loading = true;
getInspectionUser({
userName: queryString,
}).then(response => {
this.useroptions = response.rows;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false
this.reset()
this.open = false;
this.reset();
},
// 表单重置
reset() {
......@@ -123,74 +147,74 @@ export default {
updateBy: null,
updateTime: null,
remark: null,
}
this.resetForm('form')
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
this.resetForm('queryForm');
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
this.ids = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加巡检记录'
this.reset();
this.open = true;
this.title = '添加巡检记录';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getLog(id).then((response) => {
this.form = response.data
this.open = true
this.title = '修改巡检记录'
})
this.reset();
const id = row.id || this.ids;
getLog(id).then(response => {
this.form = response.data;
this.open = true;
this.title = '修改巡检记录';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateLog(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
updateLog(this.form).then(response => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
} else {
addLog(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
addLog(this.form).then(response => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}
}
})
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除巡检记录编号为"' + ids + '"的数据项?')
.then(function () {
return delLog(ids)
return delLog(ids);
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
......@@ -200,8 +224,8 @@ export default {
...this.queryParams,
},
`inspection_${new Date().getTime()}.xlsx`
)
);
},
},
}
};
</script>
......@@ -33,7 +33,7 @@
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编号" align="center" prop="deviceNo" />
<el-table-column label="巡检状态" align="center" prop="taskState">
<template slot-scope="scope">{{ scope.row.taskState == 1 ? '已完成' : '巡检中' }}</template>
<template slot-scope="scope">{{ selectDictLabels(taskStateList, scope.row.taskState) }}</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
......@@ -88,13 +88,13 @@
</template>
<script>
import { listTask, getTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/patrolProject'
import { listDevice as deviceTypeList } from '@/api/device/deviceType'
import { listDevice } from '@/api/device/device'
import { listDept } from '@/api/system/dept'
import { listUser } from '@/api/system/user'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { listTask, getTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/patrolProject';
import { listDevice as deviceTypeList } from '@/api/device/deviceType';
import { listDevice } from '@/api/device/device';
import { listDept } from '@/api/system/dept';
import { listUser } from '@/api/system/user';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
export default {
components: {
Treeselect,
......@@ -137,6 +137,11 @@ export default {
status: undefined,
deptId: undefined,
},
taskStateList: [
{ label: '待巡检', value: 0 },
{ label: '巡检中', value: 1 },
{ label: '已完成', value: 2 },
],
// 表单参数
form: {},
deptOptions: [],
......@@ -190,104 +195,104 @@ export default {
pickerOptions: {
disabledDate(time) {
// 禁用今天之前的日期(含今天零点)
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime()
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
},
},
}
};
},
created() {
this.getList()
this.getList();
},
methods: {
// 远程搜索
remoteMethod(queryString) {
this.loading = true
this.loading = true;
getInspectionUser({
userName: queryString,
}).then((response) => {
this.useroptions = response.rows
this.loading = false
})
}).then(response => {
this.useroptions = response.rows;
this.loading = false;
});
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
delete node.children;
}
return {
id: node.deptId,
label: node.deptName,
children: node.children,
}
};
},
deptSelect(val) {
this.queryParamsUser.deptId = val.deptId
this.form.inspectionUserId = null
this.getUserList()
this.queryParamsUser.deptId = val.deptId;
this.form.inspectionUserId = null;
this.getUserList();
},
/** 查询用户列表 */
getUserList() {
listUser(this.addDateRange(this.queryParamsUser)).then((response) => {
this.userList = response.rows
})
listUser(this.addDateRange(this.queryParamsUser)).then(response => {
this.userList = response.rows;
});
},
//根据设备类型查询设备列表
getDeviceList(val) {
// 清空部门
this.deptOptions = []
const typeDeptIds = this.deviceTypeList.find((item) => item.id === val).typeDeptIds
this.deptOptions = [];
const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds;
// 如果有关联的部门ID,则进行查询
if (typeDeptIds && typeDeptIds.length > 0) {
// 创建所有 listDept 请求的 Promise 数组
const deptPromises = typeDeptIds.map((deptId) =>
const deptPromises = typeDeptIds.map(deptId =>
listDept({ deptId: deptId })
.then((response) => {
.then(response => {
// 处理并返回数据
return this.handleTree(response.data, 'deptId')
return this.handleTree(response.data, 'deptId');
})
.catch((error) => {
return [] // 返回空数组,避免 Promise.all 失败
.catch(error => {
return []; // 返回空数组,避免 Promise.all 失败
})
)
);
//等待所有请求完成
Promise.all(deptPromises)
.then((deptData) => {
this.deptOptions = deptData.flat()
})
.catch((error) => {
console.error('获取部门数据失败:', error)
.then(deptData => {
this.deptOptions = deptData.flat();
})
.catch(error => {
console.error('获取部门数据失败:', error);
});
}
this.form.deviceId = null
this.form.inspectionUserId = null
this.form.deviceId = null;
this.form.inspectionUserId = null;
listDevice({
deviceType: this.form.deviceType,
}).then((response) => {
this.deviceList = response.rows
})
}).then(response => {
this.deviceList = response.rows;
});
},
/** 查询巡检任务列表 */
getList() {
this.loading = true
listTask(this.queryParams).then((response) => {
this.taskList = response.rows
this.total = response.total
this.loading = false
})
this.loading = true;
listTask(this.queryParams).then(response => {
this.taskList = response.rows;
this.total = response.total;
this.loading = false;
});
// 设备类型列表
deviceTypeList().then((response) => {
this.deviceTypeList = response.rows
})
deviceTypeList().then(response => {
this.deviceTypeList = response.rows;
});
getInspectionUser({
userName: null,
}).then((response) => {
this.useroptions = response.rows
})
}).then(response => {
this.useroptions = response.rows;
});
},
// 取消按钮
cancel() {
this.open = false
this.reset()
this.open = false;
this.reset();
},
// 表单重置
reset() {
......@@ -302,64 +307,64 @@ export default {
updateBy: null,
updateTime: null,
remark: null,
}
this.resetForm('form')
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
this.resetForm('queryForm');
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
this.ids = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加巡检任务'
this.reset();
this.open = true;
this.title = '添加巡检任务';
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateTask(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
updateTask(this.form).then(response => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
} else {
addTask(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
addTask(this.form).then(response => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}
}
})
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除巡检任务编号为"' + ids + '"的数据项?')
.then(function () {
return delTask(ids)
return delTask(ids);
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
......@@ -369,8 +374,8 @@ export default {
...this.queryParams,
},
`task_${new Date().getTime()}.xlsx`
)
);
},
},
}
};
</script>
......@@ -23,9 +23,9 @@
<el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编码" align="center" prop="deviceNo" />
<el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="设备故障描述" align="center" prop="deviceErrorDetail">
<el-table-column label="设备故障描述" align="center" prop="deviceErroDetail">
<template slot-scope="scope">
<span>{{ scope.row.deviceErrorDetail || '-' }}</span>
<span>{{ scope.row.deviceErroDetail || '-' }}</span>
</template>
</el-table-column>
<el-table-column label="维修单日期" align="center" prop="repairsDate" width="180">
......@@ -90,8 +90,8 @@
</template>
<script>
import { listMaintain, getMaintain, delMaintain, addMaintain, updateMaintain } from '@/api/repair/repairLog'
import { listDevice as listDeviceType } from '@/api/device/deviceType'
import { listMaintain, getMaintain, delMaintain, addMaintain, updateMaintain } from '@/api/repair/repairLog';
import { listDevice as listDeviceType } from '@/api/device/deviceType';
export default {
name: 'Maintain',
......@@ -144,28 +144,28 @@ export default {
rules: {
repairsId: [{ required: true, message: '维修单编号不能为空', trigger: 'blur' }],
},
}
};
},
created() {
this.getList()
listDeviceType().then((response) => {
this.deviceTypeList = response.rows
})
this.getList();
listDeviceType().then(response => {
this.deviceTypeList = response.rows;
});
},
methods: {
/** 查询维修历史列表 */
getList() {
this.loading = true
listMaintain(this.queryParams).then((response) => {
this.maintainList = response.rows
this.total = response.total
this.loading = false
})
this.loading = true;
listMaintain(this.queryParams).then(response => {
this.maintainList = response.rows;
this.total = response.total;
this.loading = false;
});
},
// 取消按钮
cancel() {
this.open = false
this.reset()
this.open = false;
this.reset();
},
// 表单重置
reset() {
......@@ -187,68 +187,68 @@ export default {
updateBy: null,
updateTime: null,
remark: null,
}
this.resetForm('form')
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加维修历史'
this.reset();
this.open = true;
this.title = '添加维修历史';
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const id = row.id || this.ids
getMaintain(id).then((response) => {
this.form = response.data
this.open = true
this.title = '修改维修历史'
})
this.reset();
const id = row.id || this.ids;
getMaintain(id).then(response => {
this.form = response.data;
this.open = true;
this.title = '修改维修历史';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateMaintain(this.form).then((response) => {
this.$modal.msgSuccess('修改成功')
this.open = false
this.getList()
})
updateMaintain(this.form).then(response => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
} else {
addMaintain(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
addMaintain(this.form).then(response => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}
}
})
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids
const ids = row.id || this.ids;
this.$modal
.confirm('是否确认删除维修历史编号为"' + ids + '"的数据项?')
.then(function () {
return delMaintain(ids)
return delMaintain(ids);
})
.then(() => {
this.getList()
this.$modal.msgSuccess('删除成功')
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {})
.catch(() => {});
},
/** 导出按钮操作 */
handleExport() {
......@@ -258,8 +258,8 @@ export default {
...this.queryParams,
},
`maintain_${new Date().getTime()}.xlsx`
)
);
},
},
}
};
</script>
......@@ -132,14 +132,14 @@
</template>
<script>
import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject'
import { listDevice as listDeviceType } from '@/api/device/deviceType'
import { listDevice as listDeviceName } from '@/api/device/device'
import { listUser } from '@/api/system/user'
import { listDept } from '@/api/system/dept'
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import FileUploadInspec from '@/components/FileUploadInspec'
import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject';
import { listDevice as listDeviceType } from '@/api/device/deviceType';
import { listDevice as listDeviceName } from '@/api/device/device';
import { listUser } from '@/api/system/user';
import { listDept } from '@/api/system/dept';
import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import FileUploadInspec from '@/components/FileUploadInspec';
export default {
name: 'WorkOrder',
components: { Treeselect, FileUploadInspec },
......@@ -220,64 +220,64 @@ export default {
maintainDeptId: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
maintainUserId: [{ required: true, message: '维修负责人不能为空', trigger: 'blur' }],
},
}
};
},
created() {
this.getList()
listDeviceType().then((response) => {
this.deviceTypeList = response.rows
})
this.getList();
listDeviceType().then(response => {
this.deviceTypeList = response.rows;
});
},
methods: {
/** 查询工单派遣列表 */
getList() {
this.loading = true
listWorkOrder(this.queryParams).then((response) => {
this.workOrderList = response.rows
this.loading = true;
listWorkOrder(this.queryParams).then(response => {
this.workOrderList = response.rows;
this.total = response.total
this.loading = false
})
this.total = response.total;
this.loading = false;
});
},
// 设备名称
getDeviceName(val) {
// 清空部门
this.deptOptions = []
const typeDeptIds = this.deviceTypeList.find((item) => item.id === val).typeDeptIds
this.deptOptions = [];
const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds;
// 如果有关联的部门ID,则进行查询
if (typeDeptIds && typeDeptIds.length > 0) {
// 创建所有 listDept 请求的 Promise 数组
const deptPromises = typeDeptIds.map((deptId) =>
const deptPromises = typeDeptIds.map(deptId =>
listDept({ deptId: deptId })
.then((response) => {
.then(response => {
// 处理并返回数据
return this.handleTree(response.data, 'deptId')
return this.handleTree(response.data, 'deptId');
})
.catch((error) => {
return [] // 返回空数组,避免 Promise.all 失败
.catch(error => {
return []; // 返回空数组,避免 Promise.all 失败
})
)
);
//等待所有请求完成
Promise.all(deptPromises)
.then((deptData) => {
this.deptOptions = deptData.flat()
})
.catch((error) => {
console.error('获取部门数据失败:', error)
.then(deptData => {
this.deptOptions = deptData.flat();
})
.catch(error => {
console.error('获取部门数据失败:', error);
});
}
listDeviceName({ deviceType: val }).then((response) => {
this.deviceNameList = response.rows
})
this.form.deviceName = null
this.form.deviceNo = null
this.form.maintainDeptId = null
listDeviceName({ deviceType: val }).then(response => {
this.deviceNameList = response.rows;
});
this.form.deviceName = null;
this.form.deviceNo = null;
this.form.maintainDeptId = null;
},
// 取消按钮
cancel() {
this.open = false
this.reset()
this.open = false;
this.reset();
},
// 表单重置
reset() {
......@@ -301,123 +301,124 @@ export default {
updateBy: null,
updateTime: null,
remark: null,
}
this.resetForm('form')
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm')
this.handleQuery()
this.resetForm('queryForm');
this.handleQuery();
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id)
this.single = selection.length !== 1
this.multiple = !selection.length
this.ids = selection.map(item => item.id);
this.single = selection.length !== 1;
this.multiple = !selection.length;
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = '添加工单派遣'
this.reset();
this.open = true;
this.title = '添加工单派遣';
// listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId')
// })
},
/** 派单 */
handleUpdate(row) {
const id = row.id || this.ids
listDept().then((response) => {
this.deptOptions = this.handleTree(response.data, 'deptId')
})
getWorkOrder(id).then((response) => {
this.form = response.data
this.openpd = true
this.title = '派遣'
})
const id = row.id || this.ids;
listDept().then(response => {
this.deptOptions = this.handleTree(response.data, 'deptId');
});
getWorkOrder(id).then(response => {
this.form = response.data;
console.log(this.form);
this.openpd = true;
this.title = '派遣';
});
},
// 查看
handleView(row) {
const id = row.id || this.ids
const id = row.id || this.ids;
// listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId')
// })
getWorkOrder(id).then((response) => {
this.form = response.data
this.open = true
this.title = '查看'
console.log(this.form)
})
getWorkOrder(id).then(response => {
this.form = response.data;
this.open = true;
this.title = '查看';
console.log(this.form);
});
},
/** 转换部门数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children
delete node.children;
}
return {
id: node.deptId,
label: node.deptName,
children: node.children,
}
};
},
deptSelect(val) {
this.queryParamsUser.deptId = val.deptId
this.form.maintainUserId = null
this.getUserList()
this.queryParamsUser.deptId = val.deptId;
this.form.maintainUserId = null;
this.getUserList();
},
/** 查询用户列表 */
getUserList() {
listUser(this.addDateRange(this.queryParamsUser)).then((response) => {
this.userList = response.rows
})
listUser(this.addDateRange(this.queryParamsUser)).then(response => {
this.userList = response.rows;
});
},
getDeviceNo(val) {
this.form._deviceName = val
this.form.deviceName = val.deviceName
this.form.deviceNo = val.deviceNo
this.form.deviceId = val.deviceId
this.form._deviceName = val;
this.form.deviceName = val.deviceName;
this.form.deviceNo = val.deviceNo;
this.form.deviceId = val.deviceId;
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
this.$refs['form'].validate(valid => {
if (valid) {
if (this.form._deviceName) {
delete this.form._deviceName
delete this.form._deviceName;
}
addWorkOrder(this.form).then((response) => {
this.$modal.msgSuccess('新增成功')
this.open = false
this.getList()
})
addWorkOrder(this.form).then(response => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
}
})
});
},
// 派单提交
submitFormOrder() {
this.$refs['formpd'].validate((valid) => {
this.$refs['formpd'].validate(valid => {
if (valid) {
updateWorkOrder({ ...this.form, ...this.formpd }).then((response) => {
this.$modal.msgSuccess('派单成功')
this.openpd = false
this.getList()
})
updateWorkOrder({ ...this.form, ...this.formpd }).then(response => {
this.$modal.msgSuccess('派单成功');
this.openpd = false;
this.getList();
});
}
})
});
},
// 文件上传回调
fileSuccess(val) {
this.form.deviceErrorPhotos = val
this.form.deviceErrorPhotos = val;
},
// 文件删除
handleRemove(url) {
this.form.deviceErrorPhotos = url
this.form.deviceErrorPhotos = url;
},
},
}
};
</script>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment