Commit 14730474 authored by sxl's avatar sxl 💬

fix;禅道bug修改

parent a8971bb3
import request from '@/utils/request' import request from '@/utils/request'
//查询巡检记录列表 //查询巡检记录列表
export function listLog() { export function listLog(data) {
return request({ return request({
url: '/gemho/inspection/list', url: '/gemho/inspection/list',
method: 'get' method: 'get',
params: data
}) })
} }
//获取巡检记录详细信息 //获取巡检记录详细信息
......
import request from '@/utils/request' import request from '@/utils/request'
//获取巡检任务列表 //获取巡检任务列表
export function listTask() { export function listTask(data) {
return request({ return request({
url: '/inspection/task/list', url: '/inspection/task/list',
method: 'get' method: 'get',
params: data
}) })
} }
//获取巡检任务详情 //获取巡检任务详情
......
import request from '@/utils/request' import request from '@/utils/request'
//获取巡检任务列表 //获取巡检任务列表
export function listTask() { export function listTask(data) {
return request({ return request({
url: '/placeInspection/task/list', url: '/placeInspection/task/list',
method: 'get' method: 'get',
params: data
}) })
} }
//获取巡检任务详情 //获取巡检任务详情
......
...@@ -785,10 +785,10 @@ $spacing: 16px; ...@@ -785,10 +785,10 @@ $spacing: 16px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
padding: 0 $spacing; padding: 0 $spacing;
padding-top: 16vh; padding-top: 173px;
background: url('~@/assets/images/screen/bg12.png'); background: url('~@/assets/images/screen/bg12.png');
color: #fff; color: #fff;
min-height: 100vh; height: 100%;
box-sizing: border-box; box-sizing: border-box;
} }
......
...@@ -4,8 +4,18 @@ ...@@ -4,8 +4,18 @@
<el-form-item label="巡检日期" prop="pollingData"> <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>
<el-form-item label="巡检人" prop="userId"> <el-form-item label="巡检人" prop="inspectionUserId">
<el-input v-model="queryParams.userId" placeholder="请输入巡检人" clearable @keyup.enter.native="handleQuery" /> <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>
<el-form-item label="报修单编号" prop="repairsId"> <el-form-item label="报修单编号" prop="repairsId">
<el-input v-model="queryParams.repairsId" placeholder="请输入报修单编号" clearable @keyup.enter.native="handleQuery" /> <el-input v-model="queryParams.repairsId" placeholder="请输入报修单编号" clearable @keyup.enter.native="handleQuery" />
...@@ -30,11 +40,6 @@ ...@@ -30,11 +40,6 @@
<el-table-column label="巡检人" align="center" prop="inspectionUserName" /> <el-table-column label="巡检人" align="center" prop="inspectionUserName" />
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备状态" align="center" prop="deviceState"> <el-table-column label="设备状态" align="center" prop="deviceState">
<template slot-scope="scope"> <template slot-scope="scope">
<el-tag v-if="scope.row.deviceState == 1" type="success">正常</el-tag> <el-tag v-if="scope.row.deviceState == 1" type="success">正常</el-tag>
<el-tag v-else type="danger">异常</el-tag> <el-tag v-else type="danger">异常</el-tag>
...@@ -48,7 +53,8 @@ ...@@ -48,7 +53,8 @@
</template> </template>
<script> <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 { export default {
name: 'Inspection', name: 'Inspection',
...@@ -77,11 +83,13 @@ export default { ...@@ -77,11 +83,13 @@ export default {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
pollingData: null, pollingData: null,
userId: null, userName: null,
deviceId: null, deviceId: null,
deviceState: null, deviceState: null,
repairsId: null, repairsId: null,
}, },
// 用户下拉选项
useroptions: [],
// 表单参数 // 表单参数
form: {}, form: {},
// 表单校验 // 表单校验
...@@ -89,25 +97,41 @@ export default { ...@@ -89,25 +97,41 @@ export default {
userId: [{ required: true, message: '巡检人不能为空', trigger: 'blur' }], userId: [{ required: true, message: '巡检人不能为空', trigger: 'blur' }],
deviceId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }], deviceId: [{ required: true, message: '设备id不能为空', trigger: 'blur' }],
}, },
} };
}, },
created() { created() {
this.getList() this.getList();
}, },
methods: { methods: {
/** 查询巡检记录列表 */ /** 查询巡检记录列表 */
getList() { getList() {
this.loading = true this.loading = true;
listLog(this.queryParams).then((response) => { listLog(this.queryParams).then(response => {
this.inspectionList = response.rows this.inspectionList = response.rows;
this.total = response.total this.total = response.total;
this.loading = false 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() { cancel() {
this.open = false this.open = false;
this.reset() this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -123,74 +147,74 @@ export default { ...@@ -123,74 +147,74 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null, remark: null,
} };
this.resetForm('form') this.resetForm('form');
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.getList() this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm');
this.handleQuery() this.handleQuery();
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) this.ids = selection.map(item => item.id);
this.single = selection.length !== 1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset();
this.open = true this.open = true;
this.title = '添加巡检记录' this.title = '添加巡检记录';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getLog(id).then((response) => { getLog(id).then(response => {
this.form = response.data this.form = response.data;
this.open = true this.open = true;
this.title = '修改巡检记录' this.title = '修改巡检记录';
}) });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateLog(this.form).then((response) => { updateLog(this.form).then(response => {
this.$modal.msgSuccess('修改成功') this.$modal.msgSuccess('修改成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} else { } else {
addLog(this.form).then((response) => { addLog(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess('新增成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} }
} }
}) });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除巡检记录编号为"' + ids + '"的数据项?') .confirm('是否确认删除巡检记录编号为"' + ids + '"的数据项?')
.then(function () { .then(function () {
return delLog(ids) return delLog(ids);
}) })
.then(() => { .then(() => {
this.getList() this.getList();
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess('删除成功');
}) })
.catch(() => {}) .catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
...@@ -200,8 +224,8 @@ export default { ...@@ -200,8 +224,8 @@ export default {
...this.queryParams, ...this.queryParams,
}, },
`inspection_${new Date().getTime()}.xlsx` `inspection_${new Date().getTime()}.xlsx`
) );
}, },
}, },
} };
</script> </script>
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编号" align="center" prop="deviceNo" /> <el-table-column label="设备编号" align="center" prop="deviceNo" />
<el-table-column label="巡检状态" align="center" prop="taskState"> <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>
<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"> <template slot-scope="scope">
...@@ -88,13 +88,13 @@ ...@@ -88,13 +88,13 @@
</template> </template>
<script> <script>
import { listTask, getTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/patrolProject' import { listTask, getTask, delTask, addTask, updateTask, getInspectionUser } from '@/api/patrol/patrolProject';
import { listDevice as deviceTypeList } from '@/api/device/deviceType' import { listDevice as deviceTypeList } from '@/api/device/deviceType';
import { listDevice } from '@/api/device/device' import { listDevice } from '@/api/device/device';
import { listDept } from '@/api/system/dept' import { listDept } from '@/api/system/dept';
import { listUser } from '@/api/system/user' import { listUser } from '@/api/system/user';
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css';
export default { export default {
components: { components: {
Treeselect, Treeselect,
...@@ -137,6 +137,11 @@ export default { ...@@ -137,6 +137,11 @@ export default {
status: undefined, status: undefined,
deptId: undefined, deptId: undefined,
}, },
taskStateList: [
{ label: '待巡检', value: 0 },
{ label: '巡检中', value: 1 },
{ label: '已完成', value: 2 },
],
// 表单参数 // 表单参数
form: {}, form: {},
deptOptions: [], deptOptions: [],
...@@ -190,104 +195,104 @@ export default { ...@@ -190,104 +195,104 @@ export default {
pickerOptions: { pickerOptions: {
disabledDate(time) { disabledDate(time) {
// 禁用今天之前的日期(含今天零点) // 禁用今天之前的日期(含今天零点)
return time.getTime() < new Date(new Date().toLocaleDateString()).getTime() return time.getTime() < new Date(new Date().toLocaleDateString()).getTime();
}, },
}, },
} };
}, },
created() { created() {
this.getList() this.getList();
}, },
methods: { methods: {
// 远程搜索 // 远程搜索
remoteMethod(queryString) { remoteMethod(queryString) {
this.loading = true this.loading = true;
getInspectionUser({ getInspectionUser({
userName: queryString, userName: queryString,
}).then((response) => { }).then(response => {
this.useroptions = response.rows this.useroptions = response.rows;
this.loading = false this.loading = false;
}) });
}, },
/** 转换部门数据结构 */ /** 转换部门数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children delete node.children;
} }
return { return {
id: node.deptId, id: node.deptId,
label: node.deptName, label: node.deptName,
children: node.children, children: node.children,
} };
}, },
deptSelect(val) { deptSelect(val) {
this.queryParamsUser.deptId = val.deptId this.queryParamsUser.deptId = val.deptId;
this.form.inspectionUserId = null this.form.inspectionUserId = null;
this.getUserList() this.getUserList();
}, },
/** 查询用户列表 */ /** 查询用户列表 */
getUserList() { getUserList() {
listUser(this.addDateRange(this.queryParamsUser)).then((response) => { listUser(this.addDateRange(this.queryParamsUser)).then(response => {
this.userList = response.rows this.userList = response.rows;
}) });
}, },
//根据设备类型查询设备列表 //根据设备类型查询设备列表
getDeviceList(val) { getDeviceList(val) {
// 清空部门 // 清空部门
this.deptOptions = [] this.deptOptions = [];
const typeDeptIds = this.deviceTypeList.find((item) => item.id === val).typeDeptIds const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds;
// 如果有关联的部门ID,则进行查询 // 如果有关联的部门ID,则进行查询
if (typeDeptIds && typeDeptIds.length > 0) { if (typeDeptIds && typeDeptIds.length > 0) {
// 创建所有 listDept 请求的 Promise 数组 // 创建所有 listDept 请求的 Promise 数组
const deptPromises = typeDeptIds.map((deptId) => const deptPromises = typeDeptIds.map(deptId =>
listDept({ deptId: deptId }) listDept({ deptId: deptId })
.then((response) => { .then(response => {
// 处理并返回数据 // 处理并返回数据
return this.handleTree(response.data, 'deptId') return this.handleTree(response.data, 'deptId');
}) })
.catch((error) => { .catch(error => {
return [] // 返回空数组,避免 Promise.all 失败 return []; // 返回空数组,避免 Promise.all 失败
}) })
) );
//等待所有请求完成 //等待所有请求完成
Promise.all(deptPromises) Promise.all(deptPromises)
.then((deptData) => { .then(deptData => {
this.deptOptions = deptData.flat() this.deptOptions = deptData.flat();
})
.catch((error) => {
console.error('获取部门数据失败:', error)
}) })
.catch(error => {
console.error('获取部门数据失败:', error);
});
} }
this.form.deviceId = null this.form.deviceId = null;
this.form.inspectionUserId = null this.form.inspectionUserId = null;
listDevice({ listDevice({
deviceType: this.form.deviceType, deviceType: this.form.deviceType,
}).then((response) => { }).then(response => {
this.deviceList = response.rows this.deviceList = response.rows;
}) });
}, },
/** 查询巡检任务列表 */ /** 查询巡检任务列表 */
getList() { getList() {
this.loading = true this.loading = true;
listTask(this.queryParams).then((response) => { listTask(this.queryParams).then(response => {
this.taskList = response.rows this.taskList = response.rows;
this.total = response.total this.total = response.total;
this.loading = false this.loading = false;
}) });
// 设备类型列表 // 设备类型列表
deviceTypeList().then((response) => { deviceTypeList().then(response => {
this.deviceTypeList = response.rows this.deviceTypeList = response.rows;
}) });
getInspectionUser({ getInspectionUser({
userName: null, userName: null,
}).then((response) => { }).then(response => {
this.useroptions = response.rows this.useroptions = response.rows;
}) });
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false;
this.reset() this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -302,64 +307,64 @@ export default { ...@@ -302,64 +307,64 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null, remark: null,
} };
this.resetForm('form') this.resetForm('form');
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.getList() this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm');
this.handleQuery() this.handleQuery();
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) this.ids = selection.map(item => item.id);
this.single = selection.length !== 1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset();
this.open = true this.open = true;
this.title = '添加巡检任务' this.title = '添加巡检任务';
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateTask(this.form).then((response) => { updateTask(this.form).then(response => {
this.$modal.msgSuccess('修改成功') this.$modal.msgSuccess('修改成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} else { } else {
addTask(this.form).then((response) => { addTask(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess('新增成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} }
} }
}) });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除巡检任务编号为"' + ids + '"的数据项?') .confirm('是否确认删除巡检任务编号为"' + ids + '"的数据项?')
.then(function () { .then(function () {
return delTask(ids) return delTask(ids);
}) })
.then(() => { .then(() => {
this.getList() this.getList();
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess('删除成功');
}) })
.catch(() => {}) .catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
...@@ -369,8 +374,8 @@ export default { ...@@ -369,8 +374,8 @@ export default {
...this.queryParams, ...this.queryParams,
}, },
`task_${new Date().getTime()}.xlsx` `task_${new Date().getTime()}.xlsx`
) );
}, },
}, },
} };
</script> </script>
...@@ -23,9 +23,9 @@ ...@@ -23,9 +23,9 @@
<el-table-column label="设备名称" align="center" prop="deviceName" /> <el-table-column label="设备名称" align="center" prop="deviceName" />
<el-table-column label="设备编码" align="center" prop="deviceNo" /> <el-table-column label="设备编码" align="center" prop="deviceNo" />
<el-table-column label="巡检人" align="center" prop="inspectionUserName" /> <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"> <template slot-scope="scope">
<span>{{ scope.row.deviceErrorDetail || '-' }}</span> <span>{{ scope.row.deviceErroDetail || '-' }}</span>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="维修单日期" align="center" prop="repairsDate" width="180"> <el-table-column label="维修单日期" align="center" prop="repairsDate" width="180">
...@@ -90,8 +90,8 @@ ...@@ -90,8 +90,8 @@
</template> </template>
<script> <script>
import { listMaintain, getMaintain, delMaintain, addMaintain, updateMaintain } from '@/api/repair/repairLog' import { listMaintain, getMaintain, delMaintain, addMaintain, updateMaintain } from '@/api/repair/repairLog';
import { listDevice as listDeviceType } from '@/api/device/deviceType' import { listDevice as listDeviceType } from '@/api/device/deviceType';
export default { export default {
name: 'Maintain', name: 'Maintain',
...@@ -144,28 +144,28 @@ export default { ...@@ -144,28 +144,28 @@ export default {
rules: { rules: {
repairsId: [{ required: true, message: '维修单编号不能为空', trigger: 'blur' }], repairsId: [{ required: true, message: '维修单编号不能为空', trigger: 'blur' }],
}, },
} };
}, },
created() { created() {
this.getList() this.getList();
listDeviceType().then((response) => { listDeviceType().then(response => {
this.deviceTypeList = response.rows this.deviceTypeList = response.rows;
}) });
}, },
methods: { methods: {
/** 查询维修历史列表 */ /** 查询维修历史列表 */
getList() { getList() {
this.loading = true this.loading = true;
listMaintain(this.queryParams).then((response) => { listMaintain(this.queryParams).then(response => {
this.maintainList = response.rows this.maintainList = response.rows;
this.total = response.total this.total = response.total;
this.loading = false this.loading = false;
}) });
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false;
this.reset() this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -187,68 +187,68 @@ export default { ...@@ -187,68 +187,68 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null, remark: null,
} };
this.resetForm('form') this.resetForm('form');
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.getList() this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm');
this.handleQuery() this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset();
this.open = true this.open = true;
this.title = '添加维修历史' this.title = '添加维修历史';
}, },
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {
this.reset() this.reset();
const id = row.id || this.ids const id = row.id || this.ids;
getMaintain(id).then((response) => { getMaintain(id).then(response => {
this.form = response.data this.form = response.data;
this.open = true this.open = true;
this.title = '修改维修历史' this.title = '修改维修历史';
}) });
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form.id != null) { if (this.form.id != null) {
updateMaintain(this.form).then((response) => { updateMaintain(this.form).then(response => {
this.$modal.msgSuccess('修改成功') this.$modal.msgSuccess('修改成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} else { } else {
addMaintain(this.form).then((response) => { addMaintain(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess('新增成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} }
} }
}) });
}, },
/** 删除按钮操作 */ /** 删除按钮操作 */
handleDelete(row) { handleDelete(row) {
const ids = row.id || this.ids const ids = row.id || this.ids;
this.$modal this.$modal
.confirm('是否确认删除维修历史编号为"' + ids + '"的数据项?') .confirm('是否确认删除维修历史编号为"' + ids + '"的数据项?')
.then(function () { .then(function () {
return delMaintain(ids) return delMaintain(ids);
}) })
.then(() => { .then(() => {
this.getList() this.getList();
this.$modal.msgSuccess('删除成功') this.$modal.msgSuccess('删除成功');
}) })
.catch(() => {}) .catch(() => {});
}, },
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
...@@ -258,8 +258,8 @@ export default { ...@@ -258,8 +258,8 @@ export default {
...this.queryParams, ...this.queryParams,
}, },
`maintain_${new Date().getTime()}.xlsx` `maintain_${new Date().getTime()}.xlsx`
) );
}, },
}, },
} };
</script> </script>
...@@ -132,14 +132,14 @@ ...@@ -132,14 +132,14 @@
</template> </template>
<script> <script>
import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject' import { listWorkOrder, getWorkOrder, addWorkOrder, updateWorkOrder } from '@/api/repair/repairProject';
import { listDevice as listDeviceType } from '@/api/device/deviceType' import { listDevice as listDeviceType } from '@/api/device/deviceType';
import { listDevice as listDeviceName } from '@/api/device/device' import { listDevice as listDeviceName } from '@/api/device/device';
import { listUser } from '@/api/system/user' import { listUser } from '@/api/system/user';
import { listDept } from '@/api/system/dept' import { listDept } from '@/api/system/dept';
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect';
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css';
import FileUploadInspec from '@/components/FileUploadInspec' import FileUploadInspec from '@/components/FileUploadInspec';
export default { export default {
name: 'WorkOrder', name: 'WorkOrder',
components: { Treeselect, FileUploadInspec }, components: { Treeselect, FileUploadInspec },
...@@ -220,64 +220,64 @@ export default { ...@@ -220,64 +220,64 @@ export default {
maintainDeptId: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }], maintainDeptId: [{ required: true, message: '部门名称不能为空', trigger: 'blur' }],
maintainUserId: [{ required: true, message: '维修负责人不能为空', trigger: 'blur' }], maintainUserId: [{ required: true, message: '维修负责人不能为空', trigger: 'blur' }],
}, },
} };
}, },
created() { created() {
this.getList() this.getList();
listDeviceType().then((response) => { listDeviceType().then(response => {
this.deviceTypeList = response.rows this.deviceTypeList = response.rows;
}) });
}, },
methods: { methods: {
/** 查询工单派遣列表 */ /** 查询工单派遣列表 */
getList() { getList() {
this.loading = true this.loading = true;
listWorkOrder(this.queryParams).then((response) => { listWorkOrder(this.queryParams).then(response => {
this.workOrderList = response.rows this.workOrderList = response.rows;
this.total = response.total this.total = response.total;
this.loading = false this.loading = false;
}) });
}, },
// 设备名称 // 设备名称
getDeviceName(val) { getDeviceName(val) {
// 清空部门 // 清空部门
this.deptOptions = [] this.deptOptions = [];
const typeDeptIds = this.deviceTypeList.find((item) => item.id === val).typeDeptIds const typeDeptIds = this.deviceTypeList.find(item => item.id === val).typeDeptIds;
// 如果有关联的部门ID,则进行查询 // 如果有关联的部门ID,则进行查询
if (typeDeptIds && typeDeptIds.length > 0) { if (typeDeptIds && typeDeptIds.length > 0) {
// 创建所有 listDept 请求的 Promise 数组 // 创建所有 listDept 请求的 Promise 数组
const deptPromises = typeDeptIds.map((deptId) => const deptPromises = typeDeptIds.map(deptId =>
listDept({ deptId: deptId }) listDept({ deptId: deptId })
.then((response) => { .then(response => {
// 处理并返回数据 // 处理并返回数据
return this.handleTree(response.data, 'deptId') return this.handleTree(response.data, 'deptId');
}) })
.catch((error) => { .catch(error => {
return [] // 返回空数组,避免 Promise.all 失败 return []; // 返回空数组,避免 Promise.all 失败
}) })
) );
//等待所有请求完成 //等待所有请求完成
Promise.all(deptPromises) Promise.all(deptPromises)
.then((deptData) => { .then(deptData => {
this.deptOptions = deptData.flat() this.deptOptions = deptData.flat();
})
.catch((error) => {
console.error('获取部门数据失败:', error)
}) })
.catch(error => {
console.error('获取部门数据失败:', error);
});
} }
listDeviceName({ deviceType: val }).then((response) => { listDeviceName({ deviceType: val }).then(response => {
this.deviceNameList = response.rows this.deviceNameList = response.rows;
}) });
this.form.deviceName = null this.form.deviceName = null;
this.form.deviceNo = null this.form.deviceNo = null;
this.form.maintainDeptId = null this.form.maintainDeptId = null;
}, },
// 取消按钮 // 取消按钮
cancel() { cancel() {
this.open = false this.open = false;
this.reset() this.reset();
}, },
// 表单重置 // 表单重置
reset() { reset() {
...@@ -301,123 +301,124 @@ export default { ...@@ -301,123 +301,124 @@ export default {
updateBy: null, updateBy: null,
updateTime: null, updateTime: null,
remark: null, remark: null,
} };
this.resetForm('form') this.resetForm('form');
}, },
/** 搜索按钮操作 */ /** 搜索按钮操作 */
handleQuery() { handleQuery() {
this.queryParams.pageNum = 1 this.queryParams.pageNum = 1;
this.getList() this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm('queryForm') this.resetForm('queryForm');
this.handleQuery() this.handleQuery();
}, },
// 多选框选中数据 // 多选框选中数据
handleSelectionChange(selection) { handleSelectionChange(selection) {
this.ids = selection.map((item) => item.id) this.ids = selection.map(item => item.id);
this.single = selection.length !== 1 this.single = selection.length !== 1;
this.multiple = !selection.length this.multiple = !selection.length;
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.reset() this.reset();
this.open = true this.open = true;
this.title = '添加工单派遣' this.title = '添加工单派遣';
// listDept().then((response) => { // listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId') // this.deptOptions = this.handleTree(response.data, 'deptId')
// }) // })
}, },
/** 派单 */ /** 派单 */
handleUpdate(row) { handleUpdate(row) {
const id = row.id || this.ids const id = row.id || this.ids;
listDept().then((response) => { listDept().then(response => {
this.deptOptions = this.handleTree(response.data, 'deptId') this.deptOptions = this.handleTree(response.data, 'deptId');
}) });
getWorkOrder(id).then((response) => { getWorkOrder(id).then(response => {
this.form = response.data this.form = response.data;
this.openpd = true console.log(this.form);
this.title = '派遣' this.openpd = true;
}) this.title = '派遣';
});
}, },
// 查看 // 查看
handleView(row) { handleView(row) {
const id = row.id || this.ids const id = row.id || this.ids;
// listDept().then((response) => { // listDept().then((response) => {
// this.deptOptions = this.handleTree(response.data, 'deptId') // this.deptOptions = this.handleTree(response.data, 'deptId')
// }) // })
getWorkOrder(id).then((response) => { getWorkOrder(id).then(response => {
this.form = response.data this.form = response.data;
this.open = true this.open = true;
this.title = '查看' this.title = '查看';
console.log(this.form) console.log(this.form);
}) });
}, },
/** 转换部门数据结构 */ /** 转换部门数据结构 */
normalizer(node) { normalizer(node) {
if (node.children && !node.children.length) { if (node.children && !node.children.length) {
delete node.children delete node.children;
} }
return { return {
id: node.deptId, id: node.deptId,
label: node.deptName, label: node.deptName,
children: node.children, children: node.children,
} };
}, },
deptSelect(val) { deptSelect(val) {
this.queryParamsUser.deptId = val.deptId this.queryParamsUser.deptId = val.deptId;
this.form.maintainUserId = null this.form.maintainUserId = null;
this.getUserList() this.getUserList();
}, },
/** 查询用户列表 */ /** 查询用户列表 */
getUserList() { getUserList() {
listUser(this.addDateRange(this.queryParamsUser)).then((response) => { listUser(this.addDateRange(this.queryParamsUser)).then(response => {
this.userList = response.rows this.userList = response.rows;
}) });
}, },
getDeviceNo(val) { getDeviceNo(val) {
this.form._deviceName = val this.form._deviceName = val;
this.form.deviceName = val.deviceName this.form.deviceName = val.deviceName;
this.form.deviceNo = val.deviceNo this.form.deviceNo = val.deviceNo;
this.form.deviceId = val.deviceId this.form.deviceId = val.deviceId;
}, },
/** 提交按钮 */ /** 提交按钮 */
submitForm() { submitForm() {
this.$refs['form'].validate((valid) => { this.$refs['form'].validate(valid => {
if (valid) { if (valid) {
if (this.form._deviceName) { if (this.form._deviceName) {
delete this.form._deviceName delete this.form._deviceName;
} }
addWorkOrder(this.form).then((response) => { addWorkOrder(this.form).then(response => {
this.$modal.msgSuccess('新增成功') this.$modal.msgSuccess('新增成功');
this.open = false this.open = false;
this.getList() this.getList();
}) });
} }
}) });
}, },
// 派单提交 // 派单提交
submitFormOrder() { submitFormOrder() {
this.$refs['formpd'].validate((valid) => { this.$refs['formpd'].validate(valid => {
if (valid) { if (valid) {
updateWorkOrder({ ...this.form, ...this.formpd }).then((response) => { updateWorkOrder({ ...this.form, ...this.formpd }).then(response => {
this.$modal.msgSuccess('派单成功') this.$modal.msgSuccess('派单成功');
this.openpd = false this.openpd = false;
this.getList() this.getList();
}) });
} }
}) });
}, },
// 文件上传回调 // 文件上传回调
fileSuccess(val) { fileSuccess(val) {
this.form.deviceErrorPhotos = val this.form.deviceErrorPhotos = val;
}, },
// 文件删除 // 文件删除
handleRemove(url) { handleRemove(url) {
this.form.deviceErrorPhotos = url this.form.deviceErrorPhotos = url;
}, },
}, },
} };
</script> </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