Merge branch 'projects/mesxc-test' of git.picaiba.com:mt-fe-group/yudao-dev into projects/mesxc-test

This commit is contained in:
gtz 2024-03-01 11:52:49 +08:00
commit 783cb0c3fe
105 changed files with 12248 additions and 1446 deletions

View File

@ -1,8 +1,8 @@
### ###
# @Author: Do not edit # @Author: Do not edit
# @Date: 2023-08-29 09:40:39 # @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-02-23 16:03:51 # @LastEditTime: 2024-02-29 15:53:50
# @LastEditors: zhp # @LastEditors: DY
# @Description: # @Description:
### ###
# 开发环境配置 # 开发环境配置
@ -23,7 +23,7 @@ VUE_APP_TITLE = MES系统
VUE_APP_BASE_API = 'http://192.168.0.33:48082' VUE_APP_BASE_API = 'http://192.168.0.33:48082'
# VUE_APP_BASE_API = 'http://192.168.1.62:48082' # VUE_APP_BASE_API = 'http://192.168.1.62:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.78:48082'
# VUE_APP_BASE_API = 'http://192.168.1.78:48082' # VUE_APP_BASE_API = 'http://192.168.1.47:48082'
# socket地址 # socket地址
VUE_APP_Socket_API = 'ws://192.168.0.30:8888' VUE_APP_Socket_API = 'ws://192.168.0.30:8888'
VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081' VUE_APP_Socket_Dcs_API = 'ws://10.70.180.10:8081'

View File

@ -153,3 +153,12 @@ export function createConCoreWOr(data) {
data: data data: data
}) })
} }
// 修改分配产量
export function updateConCoreWOr(data) {
return request({
url: '/base/core-order-con-work-order/update',
method: 'put',
data: data
})
}

View File

@ -1,7 +1,7 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-11-08 15:56:52 * @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-16 20:15:02 * @LastEditTime: 2024-02-28 18:16:56
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
*/ */
@ -52,6 +52,17 @@ export function exportCheckLogExcel(query) {
}) })
} }
// 导出设备巡检单记录
export function exportCheckOrderExcel(query) {
return request({
url: '/base/equipment-check-order/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 根据设备获得所有巡检配置列表 // 根据设备获得所有巡检配置列表
export function getcheckConfigByEqList(query) { export function getcheckConfigByEqList(query) {
return request({ return request({
@ -68,3 +79,55 @@ export function deleteEqCheckLog(id) {
method: 'delete' method: 'delete'
}) })
} }
// 获得设备巡检单详情分页
export function getCheckOrderDetPage(query) {
return request({
url: '/base/equipment-check-order-det/page',
method: 'get',
params: query
})
}
// 创建设备巡检单详情
export function createCheckOrderDet(data) {
return request({
url: '/base/equipment-check-order-det/create',
method: 'post',
data: data
})
}
// 更新设备巡检单详情
export function updateCheckOrderDet(data) {
return request({
url: '/base/equipment-check-order-det/update',
method: 'put',
data: data
})
}
// 删除设备巡检单详情
export function deleteCheckOrderDet(id) {
return request({
url: '/base/equipment-check-order-det/delete?id=' + id,
method: 'delete'
})
}
// 获得设备巡检计划单
export function getEqCheckOrder(id) {
return request({
url: '/base/equipment-check-order/get?id=' + id,
method: 'get'
})
}
// 获得设备巡检单分页
export function getCheckOrderPage(query) {
return request({
url: '/base/equipment-check-order/page',
method: 'get',
params: query
})
}

View File

@ -1,7 +1,7 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-11-08 15:56:52 * @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-25 16:22:49 * @LastEditTime: 2024-02-25 22:23:54
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
*/ */
@ -100,3 +100,63 @@ export function updateCheckConfig(data) {
data: data data: data
}) })
} }
// 创建巡检单
export function createCheckOrder(data) {
return request({
url: '/base/equipment-check-order/create',
method: 'post',
data: data
})
}
// 更新巡检单
export function updateCheckOrder(data) {
return request({
url: '/base/equipment-check-order/update',
method: 'put',
data: data
})
}
// 获得设备巡检单code
export function getOrderCode() {
return request({
url: '/base/equipment-check-order/getCode',
method: 'get'
})
}
// 获得巡检单
export function getCheckOrder(id) {
return request({
url: '/base/equipment-check-order/get?id=' + id,
method: 'get'
})
}
// 获得巡检单详细
export function getCheckOrderDet(id) {
return request({
url: '/base/equipment-check-order-det/get?id=' + id,
method: 'get'
})
}
// 创建巡检单详情
export function createCheckOrderDet(data) {
return request({
url: '/base/equipment-check-order-det/create',
method: 'post',
data: data
})
}
// 更新巡检单详情
export function updateCheckOrderDet(data) {
return request({
url: '/base/equipment-check-order-det/update',
method: 'put',
data: data
})
}

View File

@ -0,0 +1,26 @@
/*
* @Author: Do not edit
* @Date: 2024-02-26 15:01:48
* @LastEditTime: 2024-02-26 18:09:39
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得设备保养记录分页
export function getLogDetPage(query) {
return request({
url: '/base/equipment-maintain-log-det/page',
method: 'get',
params: query
})
}
// 获得设备巡检单
export function getCheckOrder(query) {
return request({
url: '/base/equipment-check-order/get',
method: 'get',
params: query
})
}

View File

@ -0,0 +1,104 @@
/*
* @Author: Do not edit
* @Date: 2024-02-22 15:14:19
* @LastEditTime: 2024-02-23 19:18:22
* @LastEditors: DY
* @Description:
*/
import request from '@/utils/request'
// 获得设备保养计划配置分页
export function getPlanPage(query) {
return request({
url: '/base/equipment-maintain-plan/page',
method: 'get',
params: query
})
}
// 创建设备保养计划
export function createPlan(data) {
return request({
url: '/base/equipment-maintain-plan/create',
method: 'post',
data: data
})
}
// 更新设备保养计划
export function updatePlan(data) {
return request({
url: '/base/equipment-maintain-plan/update',
method: 'put',
data: data
})
}
// 获得计划code
export function getCode() {
return request({
url: '/base/equipment-maintain-plan/getCode',
method: 'get'
})
}
// 获得计划
export function getPlan(query) {
return request({
url: '/base/equipment-maintain-plan/get',
method: 'get',
params: query
})
}
// 获得设备保养计划配置详情分页
export function getPlanDetPage(query) {
return request({
url: '/base/equipment-maintain-plan-det/page',
method: 'get',
params: query
})
}
// 创建设备保养计划详情
export function createPlanDet(data) {
return request({
url: '/base/equipment-maintain-plan-det/create',
method: 'post',
data: data
})
}
// 更新设备保养计划详情
export function updatePlanDet(data) {
return request({
url: '/base/equipment-maintain-plan-det/update',
method: 'put',
data: data
})
}
// 获得计划详情
export function getPlanDet(query) {
return request({
url: '/base/equipment-maintain-plan-det/get',
method: 'get',
params: query
})
}
// 删除设备保养计划
export function deletePlan(id) {
return request({
url: '/base/equipment-maintain-plan/delete?id=' + id,
method: 'delete'
})
}
// 删除设备保养计划详情
export function deletePlanDet(id) {
return request({
url: '/base/equipment-maintain-plan-det/delete?id=' + id,
method: 'delete'
})
}

View File

@ -1,7 +1,7 @@
/* /*
* @Author: Do not edit * @Author: Do not edit
* @Date: 2023-11-08 15:56:52 * @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-23 19:10:07 * @LastEditTime: 2024-02-26 17:02:53
* @LastEditors: DY * @LastEditors: DY
* @Description: * @Description:
*/ */
@ -42,3 +42,39 @@ export function exportMaintainLogExcel(query) {
responseType: 'blob' responseType: 'blob'
}) })
} }
// 导出巡检单
export function exportCheckOrderExcel(query) {
return request({
url: '/base/equipment-check-order/export-excel',
method: 'get',
params: query,
responseType: 'blob'
})
}
// 获得保养记录
export function getLog(query) {
return request({
url: '/base/equipment-maintain-log/get',
method: 'get',
params: query
})
}
// 获得设备保养记录详情分页
export function getLogDetPage(query) {
return request({
url: '/base/equipment-maintain-log-det/page',
method: 'get',
params: query
})
}
// 删除设备保养记录详情
export function deleteLogDet(id) {
return request({
url: '/base/equipment-maintain-log-det/delete?id=' + id,
method: 'delete'
})
}

View File

@ -68,7 +68,7 @@ export default {
getUserMsg() { getUserMsg() {
let id = this.$store.getters.userId let id = this.$store.getters.userId
getUserSimple(id).then(res => { getUserSimple(id).then(res => {
this.dept = res.data.deptName ? res.data.dept.deptName : '---' this.dept = res.data.deptName ? res.data.deptName : '---'
}) })
}, },
async logout() { async logout() {

View File

@ -87,6 +87,7 @@ const user = {
// 获取用户信息 // 获取用户信息
GetInfo({ commit, state }) { GetInfo({ commit, state }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log('GetInfo')
getInfo().then(res => { getInfo().then(res => {
// 没有 data 数据,赋予个默认值 // 没有 data 数据,赋予个默认值
if (!res) { if (!res) {
@ -96,7 +97,7 @@ const user = {
user: { user: {
id: '', id: '',
avatar: '', avatar: '',
userName: '', username: '',
nickname: '' nickname: ''
} }
} }
@ -113,7 +114,7 @@ const user = {
commit('SET_ROLES', ['ROLE_DEFAULT']) commit('SET_ROLES', ['ROLE_DEFAULT'])
} }
commit('SET_ID', user.id) commit('SET_ID', user.id)
commit('SET_NAME', user.userName) // commit('SET_NAME', user.username) //无效调用接口未提供username值
commit('SET_NICKNAME', user.nickname) commit('SET_NICKNAME', user.nickname)
commit('SET_AVATAR', avatar) commit('SET_AVATAR', avatar)
resolve(res) resolve(res)

View File

@ -0,0 +1,4 @@
import { getDictData } from './dict';
export const groupConnectWorkshop = (groupName, workshopValue) =>
`${groupName} - ${getDictData('workshop', workshopValue)?.label}`;

View File

@ -83,20 +83,14 @@
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item
label="工段排序" label="工段排序"
prop="sort" prop="sort">
:rules="[ <el-input-number
{
type: 'number',
trigger: 'change',
message: '请输入正确的数字类型',
transform: (val) => Number(val),
},
]">
<el-input
v-model="dataForm.sort" v-model="dataForm.sort"
clearable clearable
controls-position="right"
@change="$emit('update', dataForm)" @change="$emit('update', dataForm)"
placeholder="请输入工段排序" /> placeholder="请输入工段排序"
style="width: 100%" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-21 09:04:48 * @LastEditTime: 2024-02-29 15:01:25
* @Description: * @Description:
--> -->
<template> <template>
@ -322,14 +322,14 @@ export default {
this.listQuery.total = response.data.total; this.listQuery.total = response.data.total;
}); });
}, },
init(id, isdetail) { init(row, isdetail) {
this.initData(); this.initData();
this.isdetail = isdetail || false; this.isdetail = isdetail || false;
this.dataForm.id = id || undefined; this.dataForm.id = row?.id || undefined;
this.isedit = id ? true : false; this.isedit = row?.id && row?.externalCode ? true : false;
console.log('你好', this.isedit) console.log('你好', this.isedit)
this.visible = true; this.visible = true;
if (id) { if (row) {
this.idAttrShow = true this.idAttrShow = true
} else { } else {
this.idAttrShow = false this.idAttrShow = false
@ -340,7 +340,7 @@ export default {
if (this.dataForm.id) { if (this.dataForm.id) {
// //
this.urlOptions.infoURL(id).then(response => { this.urlOptions.infoURL(this.dataForm.id).then(response => {
this.dataForm = response.data this.dataForm = response.data
// this.dataForm.area = response.data.area || 0 // this.dataForm.area = response.data.area || 0
// this.dataForm.weight = response.data.weight || 0 // this.dataForm.weight = response.data.weight || 0

View File

@ -74,9 +74,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
getCoreProductAttr({ getCoreProductAttr(this.dataForm.id).then((res) => {
id: this.dataForm.id
}).then((res) => {
const { name, value } = res.data; const { name, value } = res.data;
this.dataForm.name = name; this.dataForm.name = name;
this.dataForm.value = value; this.dataForm.value = value;

View File

@ -141,6 +141,22 @@ export default {
}, },
created() {}, created() {},
methods: { methods: {
//tableBtn
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑";
this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.name, val.data._pageIndex,val.data)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// //
deleteHandle(id, name, index) { deleteHandle(id, name, index) {
this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", { this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
@ -168,7 +184,7 @@ export default {
this.addOrUpdateVisible = true; this.addOrUpdateVisible = true;
this.addOrEditTitle = "详情"; this.addOrEditTitle = "详情";
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.addOrUpdate.init(val.data.id, true); this.$refs.addOrUpdate.init(val.data, true);
}); });
} }
}, },

View File

@ -121,7 +121,6 @@
<el-select <el-select
v-model="dataForm.roomNameDict" v-model="dataForm.roomNameDict"
filterable filterable
:disabled="isdetail || isedit"
style="width: 100%" style="width: 100%"
placeholder="请选择车间名称"> placeholder="请选择车间名称">
<el-option <el-option
@ -254,7 +253,9 @@ export default {
if (this.dataForm.priority !== undefined) { if (this.dataForm.priority !== undefined) {
this.dataForm.priority = String(this.dataForm.priority) this.dataForm.priority = String(this.dataForm.priority)
} }
this.dataForm.priority if (this.dataForm.roomNameDict !== undefined) {
this.dataForm.roomNameDict = String(this.dataForm.roomNameDict)
}
}); });
} else { } else {
if (this.urlOptions.isGetCode) { if (this.urlOptions.isGetCode) {
@ -282,6 +283,7 @@ export default {
this.urlOptions.createURL(this.dataForm).then(response => { this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功"); this.$modal.msgSuccess("新增成功");
this.visible = false; this.visible = false;
this.$emit("refreshDataList");
// this.$confirm('使?', '', { // this.$confirm('使?', '', {
// confirmButtonText: '', // confirmButtonText: '',
// cancelButtonText: '', // cancelButtonText: '',

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-16 09:14:35 * @LastEditTime: 2024-02-29 10:01:52
* @Description: * @Description:
--> -->
<template> <template>
@ -41,12 +41,12 @@
<el-table-column prop="priority" label="优先级" /> <el-table-column prop="priority" label="优先级" />
<el-table-column prop="planAssignmentQuantity" label="计划分配数量" > <el-table-column prop="planAssignmentQuantity" label="计划分配数量" >
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input> <el-input v-model="scope.row.planAssignmentQuantity" :disabled="scope.row.isallocation"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="actualAssignmentQuantity" label="实际分配数量"> <el-table-column prop="actualAssignmentQuantity" label="实际分配数量">
<template slot-scope="scope"> <template slot-scope="scope">
<el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.actualAssignmentQuantity"></el-input> <el-input v-model="scope.row.actualAssignmentQuantity" :disabled="scope.row.isallocation"></el-input>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="操作"> <el-table-column label="操作">
@ -104,7 +104,7 @@
<script> <script>
import basicAdd from '../../core/mixins/basic-add'; import basicAdd from '../../core/mixins/basic-add';
import { getConOrderList, createConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder'; import { getConOrderList, updateConCoreWOr, getCoreWO } from '@/api/base/coreWorkOrder';
import SmallTitle from '../material/SmallTitle'; import SmallTitle from '../material/SmallTitle';
// import { parseTime } from '../../core/mixins/code-filter'; // import { parseTime } from '../../core/mixins/code-filter';
// import attrAdd from './attr-add'; // import attrAdd from './attr-add';
@ -159,8 +159,8 @@ export default {
// }); // });
// return; // return;
} }
// //
createConCoreWOr({ updateConCoreWOr({
...row, ...row,
workOrderId: this.dataForm.id workOrderId: this.dataForm.id
}).then((response) => { }).then((response) => {
@ -173,16 +173,17 @@ export default {
} }
}, },
getList() { getList() {
// Bom //
getConOrderList({ getConOrderList({
...this.listQuery, ...this.listQuery,
workOrderId: this.dataForm.id workOrderId: this.dataForm.id
}).then((response) => { }).then((response) => {
this.tableData = response.data.map(item => { this.tableData = response.data.map(item => {
item.isEdit = false item.isEdit = false
item.isallocation = item.actualAssignmentQuantity ? true : false
return item return item
}); });
this.listQuery.total = response.data.total; this.listQuery.total = response.data.length;
}); });
}, },
// //

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-12-26 16:59:25 * @LastEditTime: 2024-02-29 15:35:02
* @Description: * @Description:
--> -->
<template> <template>
@ -45,7 +45,7 @@
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<div class="blodTip">工单来源</div> <div class="blodTip">工单来源</div>
<div class="lightTip">{{ dataForm.triggerOrigin === 1 ? 'MES' : dataForm.triggerOrigin === 2 ? 'ERP' : ''}}</div> <div class="lightTip">{{ dataForm.triggerOrigin === 1 ? 'MES-手动' : dataForm.triggerOrigin === 2 ? 'MES-订单下发' : 'ERP'}}</div>
</el-col> </el-col>
<el-col :span="3"> <el-col :span="3">
<div class="blodTip">所属订单</div> <div class="blodTip">所属订单</div>
@ -218,7 +218,7 @@
<script> <script>
// import basicAdd from '../../core/mixins/basic-add'; // import basicAdd from '../../core/mixins/basic-add';
import { getCoreWO, getMaterialBomPage, getConOrderList, getCoreWOListById } from "@/api/base/coreWorkOrder"; import { getCoreWO, getCoreWOMaPage, getConOrderList, getCoreWOListById } from "@/api/base/coreWorkOrder";
// import { orderList } from "@/api/base/orderManage"; // import { orderList } from "@/api/base/orderManage";
import { getProcessFlowList } from '@/api/base/orderManage' import { getProcessFlowList } from '@/api/base/orderManage'
import SmallTitle from './SmallTitle'; import SmallTitle from './SmallTitle';
@ -261,8 +261,9 @@ const tableProps = [
const tableProps1 = [ const tableProps1 = [
{ {
prop: 'materialName', prop: 'material',
label: '物料名称' label: '物料名称',
filter: publicFormatter('material')
}, },
{ {
prop: 'unit', prop: 'unit',
@ -270,7 +271,7 @@ const tableProps1 = [
filter: publicFormatter('unit_dict') filter: publicFormatter('unit_dict')
}, },
{ {
prop: 'num', prop: 'remaining',
label: '剩余生产预计消耗' label: '剩余生产预计消耗'
}, },
]; ];
@ -431,11 +432,17 @@ export default {
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}); });
// 使 // 使
if (this.dataForm.planProductId) { console.log()
getMaterialBomPage({ if (this.dataForm.id) {
productId: this.dataForm.planProductId, getCoreWOMaPage({
workOrderId: this.dataForm.id,
pageNo: 1,
pageSize: 100
}).then((response) => { }).then((response) => {
this.materialList = response.data; this.materialList = response.data.records.map((item) => {
item.remaining = item?.num * this.dataForm.remainingQuantity || 0
return item
});
// this.listQuery.total = response.data.length; // this.listQuery.total = response.data.length;
}); });
} }

View File

@ -197,17 +197,7 @@ export default {
{ {
name: 'status', name: 'status',
type: 'equal', type: 'equal',
value: 2 value: 1
},
{
name: 'status',
type: 'equal',
value: 3
},
{
name: 'status',
type: 'equal',
value: 4
} }
] ]
} }
@ -241,6 +231,11 @@ export default {
name: 'status', name: 'status',
type: 'equal', type: 'equal',
value: 2 value: 2
},
{
name: 'status',
type: 'equal',
value: 3
} }
] ]
} }
@ -266,23 +261,23 @@ export default {
] ]
} }
} }
: undefined,
this.$auth.hasPermi(`base:core-work-order:delete`)
? {
type: 'delete',
btnName: '删除',
showParam: {
type: '|',
data: [
{
name: 'status',
type: 'equal',
value: 1
}
]
}
}
: undefined : undefined
// this.$auth.hasPermi(`base:core-work-order:delete`)
// ? {
// type: 'delete',
// btnName: '',
// showParam: {
// type: '|',
// data: [
// {
// name: 'status',
// type: 'equal',
// value: 1
// }
// ]
// }
// }
// : undefined
].filter((v)=>v), ].filter((v)=>v),
tableData: [], tableData: [],
formConfig: [ formConfig: [

View File

@ -1,16 +1,17 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-10-17 16:50:19 * @Date: 2023-10-17 16:50:19
* @LastEditTime: 2023-12-01 16:48:53 * @LastEditTime: 2024-02-28 10:07:29
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
<template> <template>
<el-dialog class="baseDialog" :visible.sync="visible" :show-close="false" :wrapper-closable="false" width="40%" show-close="true"> <el-dialog class="baseDialog" :visible.sync="visible" :show-close="false" :wrapper-closable="false" width="40%"
show-close="true">
<small-title slot="title" :no-padding="true"> <small-title slot="title" :no-padding="true">
{{ !dataForm.id ? '新增' : '编辑' }} {{ !dataForm.id ? '新增' : '编辑' }}
</small-title> </small-title>
<!-- <!--
<div class="content"> <div class="content">
<div class="visual-part"> --> <div class="visual-part"> -->
<el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px" <el-form ref="dataForm" :model="dataForm" :rules="dataRule" label-width="100px"
@ -44,6 +45,12 @@
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12">
<el-form-item label="包装条码" prop="packagingBarCode">
<el-input v-model="dataForm.packagingBarCode" clearable placeholder="请输入包装条码" />
</el-form-item>
</el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="标签模板" prop="modelId"> <el-form-item label="标签模板" prop="modelId">
<el-select v-model="dataForm.modelId" style="width: 100%;" placeholder="请选择标签模板" clearable> <el-select v-model="dataForm.modelId" style="width: 100%;" placeholder="请选择标签模板" clearable>
@ -186,6 +193,7 @@ export default {
workOrderId: null, // (s) workOrderId: null, // (s)
customerId: '', // customerId: '', //
content: '', // id content: '', // id
packagingBarCode: null
}, },
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2023-08-01 14:55:51 * @Date: 2023-08-01 14:55:51
* @LastEditors: zhp * @LastEditors: zhp
* @LastEditTime: 2023-11-24 09:13:50 * @LastEditTime: 2024-02-28 10:38:34
* @Description: * @Description:
--> -->
<template> <template>
@ -55,6 +55,10 @@ const tableProps = [
{ {
prop: 'packagingCode', prop: 'packagingCode',
label: '包装流水号' label: '包装流水号'
},
{
prop: 'packagingBarCode',
label: '包装条码'
}, },
{ {
prop: 'workOrderName', prop: 'workOrderName',

View File

@ -2,7 +2,7 @@
/* /*
* @Date: 2020-12-29 16:49:28 * @Date: 2020-12-29 16:49:28
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-09-12 11:13:34 * @LastEditTime: 2024-02-23 14:50:22
* @FilePath: \basic-admin\src\filters\basicData\index.js * @FilePath: \basic-admin\src\filters\basicData\index.js
* @Description: * @Description:
*/ */
@ -62,6 +62,17 @@ export function parseTime(time, pattern) {
}) })
return time_str return time_str
} }
export function toDay(time) {
if (time < 24) {
return time + '小时'
} else {
const day = ~~(time / 24)
const hour = time % 24
return day + '天' + hour + '小时'
}
}
export default function (dictTable) { export default function (dictTable) {
return function (val) { return function (val) {
return table?.[dictTable]?.[val] return table?.[dictTable]?.[val]

View File

@ -193,7 +193,7 @@ export default {
if (this.exportList.length > 0) { if (this.exportList.length > 0) {
let body = this.exportList.map((x) => [ let body = this.exportList.map((x) => [
x.objName, x.objName,
x.objRemark, x.objCode,
x.energyTypeName, x.energyTypeName,
x.startValue, x.startValue,
x.endValue, x.endValue,

View File

@ -152,7 +152,7 @@ export default {
id: '', id: '',
name: '', name: '',
code: '', code: '',
nuit: '', unit: '',
pricingMethod: 2, pricingMethod: 2,
leaderName: '', leaderName: '',
push: false push: false
@ -186,16 +186,16 @@ export default {
if (res.code === 0) { if (res.code === 0) {
this.form.name = res.data.name this.form.name = res.data.name
this.form.code = res.data.code this.form.code = res.data.code
this.form.nuit = res.data.nuit this.form.unit = res.data.unit
this.form.pricingMethod = res.data.pricingMethod this.form.pricingMethod = res.data.pricingMethod
this.form.leaderName = res.data.leaderName this.form.leaderName = res.data.leaderName
this.form.push = res.data.push ? true : false this.form.push = res.data.push ? true : false
switch(this.form.pricingMethod) { switch(this.form.pricingMethod) {
case 0: case 0:
this.tableData1 = this.form.segPriceList || [] this.tableData1 = res.data.segPriceList || []
break; break;
case 1: case 1:
this.tableData2 = this.form.usedPriceList || [] this.tableData2 = res.data.usedPriceList || []
break; break;
default: default:
} }
@ -233,10 +233,6 @@ export default {
// //
emitButtonClick1() { emitButtonClick1() {
let n = this.tableData1.length let n = this.tableData1.length
// if (n >=3) {
// this.$modal.msgWarning('3')
// return false
// }
let obj = {} let obj = {}
obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime obj.startTime = n === 0 ? '' : this.tableData1[n-1].endTime
obj.endTime = '' obj.endTime = ''
@ -245,10 +241,6 @@ export default {
}, },
emitButtonClick2() { emitButtonClick2() {
let n = this.tableData2.length let n = this.tableData2.length
if (n >=3) {
this.$modal.msgWarning('最多可添加3档计价')
return false
}
let obj = {} let obj = {}
obj.startUsed = n === 0 ? 0 : this.tableData2[n-1].endUsed obj.startUsed = n === 0 ? 0 : this.tableData2[n-1].endUsed
obj.endUsed = 0 obj.endUsed = 0

View File

@ -41,7 +41,7 @@
<base-dialog <base-dialog
:dialogTitle="title" :dialogTitle="title"
:dialogVisible="open" :dialogVisible="open"
width="700px" width="30%"
@close="cancel" @close="cancel"
@cancel="cancel" @cancel="cancel"
@confirm="submitForm"> @confirm="submitForm">

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2024-02-21 18:31:44 * @LastEditTime: 2024-02-22 10:08:13
* @Description: * @Description:
--> -->
<template> <template>
@ -18,6 +18,7 @@
v-model="dataForm.equipmentId" v-model="dataForm.equipmentId"
:options="plLineList" :options="plLineList"
:props="{value: 'id', label: 'name', children: 'children'}" :props="{value: 'id', label: 'name', children: 'children'}"
style="width: 100%"
filterable /> filterable />
</el-form-item> </el-form-item>
<el-form-item label="关联表名" prop="plcId"> <el-form-item label="关联表名" prop="plcId">
@ -110,11 +111,9 @@ export default {
} }
}) })
}) })
console.log('你好', this.plLineList)
}, },
// //
dataFormSubmit() { dataFormSubmit() {
console.log('11', this.dataForm.equipmentId)
this.$refs["dataForm"].validate((valid) => { this.$refs["dataForm"].validate((valid) => {
if (!valid) { if (!valid) {
return false; return false;

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,251 @@
<!--
filename: WaitingListTable.vue
author: liubin
date: 2024-02-05 16:12:55
description:
-->
<template>
<el-table
:data="tableDataWithIndex"
:border="true"
@selection-change="handleSelectionChange"
style="width: 100%"
:header-cell-style="{
background: '#f2f4f9',
color: '#606266',
}"
class="waiting-list-table">
<el-table-column
type="selection"
:width="50"
:selectable="checkSelectable" />
<el-table-column prop="_pageIndex" width="80" align="center">
<template slot="header">
<el-popover placement="bottom-start" width="300" trigger="click">
<div class="setting-box" style="max-height: 400px; overflow-y: auto">
<el-checkbox
v-for="(item, index) in tablePropsLabelList"
:key="'cb' + index"
v-model="selectedBox[index]"
:label="item.label" />
</div>
<i slot="reference" class="el-icon-s-tools" />
</el-popover>
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[0]"
label="巡检单名称"
prop="name"></el-table-column>
<el-table-column v-if="selectedBox[1]" label="部门" prop="planName">
<template slot-scope="scope">
{{ scope.row.department || '---' }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[2]"
label="巡检时间"
prop="planCheckTime">
<template slot-scope="scope">
{{ scope.row.planCheckTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[3]"
label="班次"
prop="groupClass">
<template slot-scope="scope">
{{ scope.row.groupClass || '---' }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[4]"
label="确认截止时间"
prop="confirmDueTime">
<template slot-scope="scope">
{{ scope.row.confirmDueTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[5]"
width="150"
label="备注"
prop="remark">
<template slot-scope="scope">
{{ scope.row.remark }}
</template>
</el-table-column>
<!-- <el-table-column v-if="selectedBox[10]" width="60" label="详情">
<template slot-scope="scope">
<el-button type="text" @click="handelDetail(scope.row)">详情</el-button>
</template>
</el-table-column> -->
<!-- btns -->
<el-table-column width="188" label="操作">
<template slot-scope="scope">
<el-tooltip content="确认" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
:disabled="!checkSelectable(scope.row)"
@click="$emit('confirm', scope.row)">
确认
</el-button>
</el-tooltip>
<!-- line -->
<span style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip content="查看详情" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
@click="$emit('detail', scope.row)">
<i class="iconfont icon-detail primary-color" />
</el-button>
</el-tooltip>
<!-- line -->
<span style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip content="编辑" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
@click="$emit('edit', scope.row)">
<i class="iconfont icon-edit primary-color" />
</el-button>
</el-tooltip>
<!-- line -->
<span style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip content="删除" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
@click="$emit('delete', scope.row)">
<i class="iconfont icon-delete delete-color" />
</el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</template>
<script>
import moment from 'moment';
export default {
name: 'WaitingListTable',
components: {},
props: ['tableData', 'page', 'limit'],
filters: {
timeFilter: (val) =>
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---',
relatePlanFilter: (val) =>
val != null ? ['-', '计划型', '非计划型'][val] : '-',
},
data() {
return {
tablePropsLabelList: [
{
label: '巡检单名称',
},
{
label: '部门',
},
{
label: '巡检时间',
},
{
label: '班次',
},
{
label: '确认截止时间',
},
{
label: '备注',
},
],
selectedBox: [
true,
true,
true,
true,
true,
true
],
selectedPlan: [],
};
},
computed: {
tableDataWithIndex() {
return this.tableData.map((item, index) => ({
...item,
_pageIndex: (this.page - 1) * this.limit + index + 1,
}));
},
},
methods: {
checkSelectable(row, index) {
return true;
},
handleSelectionChange(val) {
this.selectedPlan = val;
},
handleDelete(row) {},
handleDetail(row) {},
handleEdit(row) {},
handleConfirm(row) {},
},
};
</script>
<style scoped>
@import './iconfont/iconfont.css';
.delete-color {
color: #ff5454;
}
.primary-color {
color: #0b58ff;
}
.baseTable .show-col-btn {
margin-right: 5px;
line-height: inherit;
cursor: pointer;
}
.baseTable .el-icon-refresh {
cursor: pointer;
}
</style>
<style>
.waiting-list-table .el-table__body tr.current-row > td.el-table__cell {
background-color: #eaf1fc;
}
.waiting-list-table.el-table .el-table__cell {
padding: 0;
height: 35px;
}
.waiting-list-table .addButton {
width: 100%;
height: 35px;
border-top: none;
color: #0b58ff;
border-color: #ebeef5;
border-radius: 0;
}
.waiting-list-table .addButton:hover {
color: #0b58ff;
border-color: #ebeef5;
background-color: #fff;
}
.waiting-list-table .addButton:focus {
border-color: #ebeef5;
background-color: #fff;
}
.el-tooltip__popper.is-dark {
background: rgba(0, 0, 0, 0.6) !important;
}
.el-tooltip__popper .popper__arrow,
.el-tooltip__popper .popper__arrow::after {
border-top-color: rgba(0, 0, 0, 0.4) !important;
}
</style>

View File

@ -0,0 +1,553 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-29 14:59:28
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" placeholder="请输入巡检单名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="部门" prop="departmentId">
<el-select
v-model="dataForm.departmentId"
:disabled="isdetail"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
:key="opt.id"
:label="opt.name"
:value="opt.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="班次" prop="groupClass">
<el-select
v-model="dataForm.groupClass"
filterable
clearable
multiple
:disabled="isdetail"
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="d in groupOptions"
:key="d.id"
:label="d.label"
:value="d.label" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="巡检人" prop="checkPerson">
<el-select
v-model="dataForm.checkPerson"
:placeholder="`请选择巡检人`"
multiple
clearable
:disabled="isdetail"
filterable
style="width: 100%">
<el-option
v-for="opt in inspectorOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="巡检时间" prop="planCheckTime">
<el-date-picker
v-model="dataForm.planCheckTime"
type="datetime"
:disabled="isdetail"
placeholder="请选择巡检时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
巡检内容
</small-title>
<div v-if="!isdetail">
<div>
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<!-- <template>
<span style="display: inline-block;" @click="addNew()">
<svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
<span class="add">添加</span>
</span>
</template> -->
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="detList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button @click="goback()">取消</el-button>
<!-- <el-button :disabled="isdetail" @click="init(dataForm.id)">重置</el-button> -->
<el-button v-if="isshowConfirm" type="primary" @click="confirmIns()">保存</el-button>
<el-button v-else type="primary" @click="dataFormSubmit()">保存</el-button>
</div>
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:order-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
<script>
import basicAdd from './../../../../core/mixins/basic-add';
import { createCheckOrder, updateCheckOrder, getCheckOrder } from "@/api/equipment/base/inspection/settings";
import { getCheckOrderDetPage, deleteCheckOrderDet } from "@/api/equipment/base/inspection/record";
import SmallTitle from './SmallTitle';
import { parseTime } from '@/utils/ruoyi';
import attrAdd from './attr-add';
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import { getCoreDepartmentList } from "@/api/base/coreDepartment";
import { groupClassesListAll } from '@/api/monitoring/teamProduction'
import { getDictDataLabel } from '@/utils/dict';
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'equipmentName',
label: '设备名称'
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
},
];
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
export default {
mixins: [basicAdd],
components: { SmallTitle, attrAdd },
data() {
return {
tableBtn,
tableProps,
topBtnConfig,
addOrUpdateVisible: false,
isshowConfirm: false,
urlOptions: {
isGetCode: false,
createURL: createCheckOrder,
updateURL: updateCheckOrder,
infoURL: getCheckOrder,
},
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'button',
btnName: '新增',
name: 'add',
color: 'success',
plain: true
}
],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
equipmentName: undefined
},
dataForm: {
id: undefined,
name: '',
departmentId: undefined,
groupClass: [],
checkPerson: [],
planCheckTime: undefined
},
detList: [],
groupOptions: [],
// departmentList: [],
departmentOptions: [],
inspectorOptions: [],
visible: false,
isdetail: false,
isedit: false,
idAttrShow: false,
dataRule: {
name: [{ required: true, message: "巡检单名称不能为空", trigger: "blur" }]
}
};
},
mounted() {
this.getDict()
},
methods: {
async getDict() {
//
const res = await groupClassesListAll();
this.groupOptions = res.data.map((item) => {
item.label = item.name + ' - ' + getDictDataLabel('workshop', item.roomNameDict)
return item
}) || [];
//
const res1 = await getCoreDepartmentList();
this.departmentOptions = res1.data || []
//
let inspectorList = [];
const userlist = await this.$axios({
url: '/system/user/page',
params: { pageNo: 1, pageSize: 100 },
});
if (userlist.code == 0) {
inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({
label: item.username,
value: item.id,
}))
);
}
const workerlist = await this.$axios('/base/core-worker/listAll');
if (workerlist.code == 0) {
inspectorList = inspectorList.concat(
workerlist.data.map((item) => ({
label: item.name,
value: item.id,
}))
);
}
this.inspectorOptions = inspectorList;
// const res1 = await groupClassesListAll();
// this.groupOptions = res1.data || [];
// const res = await getEquipmentAll()
// this.eqList = res.data
},
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.listQuery.equipmentName = btn.equipmentName;
this.getList();
break;
case 'add':
this.addNew()
break;
}
},
initData() {
this.detList.splice(0);
this.listQuery.total = 0;
this.isshowConfirm = false;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除巡检项目名为"${raw.data.program}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteCheckOrderDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getCheckOrderDetPage({
...this.listQuery,
orderId: this.dataForm.id,
}).then((response) => {
this.detList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.isedit = id ? true : false;
console.log('你好', this.isedit)
this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
if (this.dataForm.groupClass && this.dataForm.groupClass !== ''){
this.dataForm.groupClass = response.data?.groupClass.split(',')
} else {
this.dataForm.groupClass = []
}
if (this.dataForm.checkPerson && this.dataForm.checkPerson !== '') {
this.dataForm.checkPerson = response.data?.checkPerson.split(',')
} else {
this.dataForm.checkPerson = []
}
});
//
this.getList();
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async confirmIns() {
this.$refs['dataForm'].validate((valid) => {
if (!valid) {
return;
}
this.$nextTick(() => {
this.getConfirmed().then(confirm => {
this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: [this.dataForm.id],
}).then(res =>{
if (res.code == 0) {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('已确认');
}
})
}).catch(() => {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('取消确认');
})
})
});
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL({
...this.dataForm,
groupClass: this.dataForm.groupClass.join(','),
checkPerson: this.dataForm.checkPerson.join(','),
special: false,
status: 1
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL({
...this.dataForm,
groupClass: this.dataForm.groupClass.join(','),
checkPerson: this.dataForm.checkPerson.join(','),
special: false,
status: 1
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.idAttrShow = true
this.isshowConfirm = true
this.dataForm.id = response.data
// this.visible = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
/* flex: 1; */
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 76vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -32px 15px 0;
font-size: 14px;
}
.add {
color: #0b58ff;
}
</style>

View File

@ -0,0 +1,172 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'35%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
filterable
clearable
placeholder="请选择设备名称"
style="width: 100%">
<el-option
v-for="dict in eqList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
<el-form-item label="巡检项目" prop="program">
<el-input
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>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { createCheckOrderDet, updateCheckOrderDet, getCheckOrderDet } from "@/api/equipment/base/inspection/settings";
import { getEquipmentPage } from '@/api/base/equipment'
export default {
props: {
orderId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
dataForm: {
id: null,
equipmentId: null,
program: null,
checkResult: null
},
eqList: [],
dataRule: {
equipmentId: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
program: [
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
checkResult: [
{ required: true, message: '巡检结果不能为空', trigger: 'blur' },
]
},
};
},
mounted() {
this.getDict();
},
methods: {
async getDict() {
const res = await getEquipmentPage({
pageNo: 1,
pageSize: 100,
special: false
})
this.eqList = res.data.list
},
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getCheckOrderDet(this.dataForm.id).then((res) => {
const { equipmentId, program, checkResult } = res.data;
this.dataForm.equipmentId = equipmentId;
this.dataForm.program = program;
this.dataForm.checkResult = checkResult;
});
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updateCheckOrderDet({
...this.dataForm,
orderId: this.orderId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createCheckOrderDet({
...this.dataForm,
orderId: this.orderId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -0,0 +1,539 @@
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
.icon_lists li .name,
.icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th,
.markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

View File

@ -0,0 +1,38 @@
@font-face {
font-family: "iconfont"; /* Project id 3821755 */
src: url('iconfont.eot?t=1689233106339'); /* IE9 */
src: url('iconfont.eot?t=1689233106339#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAARgAAsAAAAACcAAAAQUAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDKAqGSIUsATYCJAMYCw4ABCAFhGcHVBtUCMiuMG7hiaIkox1FaBhxvd1fpwAN4YKo1v7tWTr8hBRkBQgO7yqKUJKPUKzDjkixjn7/q0vlANCkEHCJtsMvx2eQn04h5rHEE8593TK2y1SC5nbvNG5gqgZBNEWTqFUQLGVFNnVu1TjyMm3SafEsC3y0myW12KdEh2x+deP/zzHTJeG3AVBm4lrnAxpQN0US7s3ijuSE6Jbh1UGv08cgQEivMg5z6m49Qj77TVxDEZww6gXicNkviSbkxgswNeGCj+CgMw1yFRpAnUNegSv+8+UfU/igsBpjnRV3rRV9+Su8Fk1Agv6CW4eAeyvAAhronJlI1tcrVnIMHZ0cCcsUTrRTnQ0CP50B4KfgEub9Lw80BougQBwGI8bYJU4LPwUbBw0/HXAw8NORUM90wsT9JeIMFACux9QckHyQ9FDYTobcGi+FLSjwMxDe3L5s+w9THFYeEs8H303FWMnZ1JuBWFgNPh3bd5wOvJmKI9aTqXeD8eJ66HnfnV1dJPE8cy4EgqT+s/SbdSWbp9Pn24NbZ1MnGw7CDbvT6+lL1CXVh++hcH56umDT9vOviL/grQ6srHjE57uLHdQn+dtO9x2v94WN6+eXm0HWlZOzta3tUDp1JWjymsiD8r0ViWGkC+n4GeH5aODSM+9COnilpdfdZsRIvMerLmS0uICTplrOnb99LT3NkJNeajPfpDznblq6bXH8efBjlPIUxhQcX+U0qEdt4bjxy6rMdOkbEn0/3mlvrXZL60ysxdwcn/qKLJ/82pnzGS61z5rBeGmrxf33ZXN/IBWUvb8KSvnttbwwq+YTkweZHue0M0+c0ssZGY/Rs+aVF8+3GaW07CkvLC/KcBvP8c2uGpsdm0THlazwlPE22Kdi9ZK4Hdsmtw9eHVQwPjG0p33Q7tGMJ6TUJ2VK1MMw6ftI6qPPtruCvEPmLZqiHcj1Aw3Rup/sdzj+lt/w3f5TrAHgx++nD7A+8xaD4CL8m60Q+KWYO7CgUY3gTFl+OwUBHKteh00BoWmGDIYm301frAJwKAg+BTEoPCpA41OPNNh2sET0g8NnCkI61M6PKKBzREwANBtGIOS6BEU2D0CT6xvSYP+Apdg/cOT6DyErI68W0RzbqhmYOFixuRNLFqoRi839Zh+A2KqYWJH1CTC7hM04My0j664HDVgXY+xtYhbnBBNGVVzH7geKQrHOqA0sPK2Fc70oPZ2UPSTNQlVUjQEmHLDCzDphEgtKQ9zCPP16DwBRK4UJAyKfyBg7jaeaxzKlyQAg6xkaKO9M2tu1EWXhOEL3IxhKhdWpMqCYDgrTy7vZAAsuTUsLm65IOlWIQBlp47PUS9wAhBgHOFGixYgVJx7+dtqutZuY1eXTvXYncJOkOF1Wicd+CnBACA==') format('woff2'),
url('iconfont.woff?t=1689233106339') format('woff'),
url('iconfont.ttf?t=1689233106339') format('truetype'),
url('iconfont.svg?t=1689233106339#iconfont') format('svg');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-downward:before {
content: "\e604";
}
.icon-upward:before {
content: "\e605";
}
.icon-detail:before {
content: "\e601";
}
.icon-edit:before {
content: "\e602";
}
.icon-delete:before {
content: "\e603";
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,44 @@
{
"id": "3821755",
"name": "component",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "封装的组件中的icon",
"glyphs": [
{
"icon_id": "36426261",
"name": "downward",
"font_class": "downward",
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "36426301",
"name": "upward",
"font_class": "upward",
"unicode": "e605",
"unicode_decimal": 58885
},
{
"icon_id": "33347867",
"name": "detail",
"font_class": "detail",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "33347918",
"name": "edit",
"font_class": "edit",
"unicode": "e602",
"unicode_decimal": 58882
},
{
"icon_id": "33347930",
"name": "delete",
"font_class": "delete",
"unicode": "e603",
"unicode_decimal": 58883
}
]
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Created by iconfont</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024">
<font-face
font-family="iconfont"
font-weight="400"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="downward" unicode="&#58884;" d="M556.942222 144.099556l363.064889 401.806222c24.860444 21.617778 24.860444 56.263111 0 77.880889a68.437333 68.437333 0 0 1-44.942222 16.156444c-16.896 0-33.052444-5.859556-44.885333-16.156444L512 260.949333l-318.236444 362.951111a68.437333 68.437333 0 0 1-44.942223 16.099556c-16.896 0-33.109333-5.802667-44.942222-16.156444-24.746667-21.617778-24.746667-56.206222 0-77.824l363.121778-401.749334c5.973333-5.290667 13.141333-9.443556 21.048889-12.231111 23.722667-8.305778 51.029333-3.527111 68.892444 12.060445z" horiz-adv-x="1024" />
<glyph glyph-name="upward" unicode="&#58885;" d="M556.942222 623.900444l363.064889-401.806222c24.860444-21.617778 24.860444-56.263111 0-77.880889a68.437333 68.437333 0 0 0-44.942222-16.156444c-16.896 0-33.052444 5.859556-44.885333 16.156444L512 507.050667l-318.236444-362.951111a68.437333 68.437333 0 0 0-44.942223-16.099556c-16.896 0-33.109333 5.802667-44.942222 16.156444-24.746667 21.617778-24.746667 56.206222 0 77.824L467.057778 623.729778c5.973333 5.290667 13.141333 9.443556 21.048889 12.231111 23.722667 8.305778 51.029333 3.527111 68.892444-12.060445z" horiz-adv-x="1024" />
<glyph glyph-name="detail" unicode="&#58881;" d="M902.428444 705.251556H332.401778a7.964444 7.964444 0 0 1-7.793778-8.021334v-56.206222a7.964444 7.964444 0 0 1 7.793778-8.078222h570.026666A7.964444 7.964444 0 0 1 910.222222 641.024v56.206222a7.964444 7.964444 0 0 1-7.793778 8.021334z m0-285.127112H332.401778a7.964444 7.964444 0 0 1-7.793778-7.964444v-56.32a7.964444 7.964444 0 0 1 7.793778-7.964444h570.026666a7.964444 7.964444 0 0 1 7.793778 7.964444v56.32a7.964444 7.964444 0 0 1-7.793778 7.964444z m0-285.070222H332.401778a7.964444 7.964444 0 0 1-7.793778-8.078222v-56.206222a7.964444 7.964444 0 0 1 7.793778-8.021334h570.026666a7.964444 7.964444 0 0 1 7.793778 8.021334v56.206222a7.964444 7.964444 0 0 1-7.793778 8.078222zM113.777778 669.127111c0-20.081778 10.410667-38.684444 27.306666-48.696889a53.361778 53.361778 0 0 1 54.670223 0 56.547556 56.547556 0 0 1 27.306666 48.696889 56.547556 56.547556 0 0 1-27.306666 48.696889 53.361778 53.361778 0 0 1-54.613334 0A56.547556 56.547556 0 0 1 113.777778 669.127111zM113.777778 384c0-20.081778 10.410667-38.684444 27.306666-48.696889a53.361778 53.361778 0 0 1 54.670223 0A56.547556 56.547556 0 0 1 223.061333 384a56.547556 56.547556 0 0 1-27.306666 48.696889 53.361778 53.361778 0 0 1-54.613334 0A56.547556 56.547556 0 0 1 113.777778 384z m0-285.127111c0-20.081778 10.410667-38.684444 27.306666-48.696889a53.361778 53.361778 0 0 1 54.670223 0 56.547556 56.547556 0 0 1 27.306666 48.696889 56.547556 56.547556 0 0 1-27.306666 48.696889 53.361778 53.361778 0 0 1-54.613334 0 56.547556 56.547556 0 0 1-27.363555-48.696889z" horiz-adv-x="1024" />
<glyph glyph-name="edit" unicode="&#58882;" d="M873.016889 395.264a32.824889 32.824889 0 0 0 65.649778 0v-273.806222a164.124444 164.124444 0 0 0-164.124445-164.124445h-525.084444A164.124444 164.124444 0 0 0 85.333333 121.457778v525.084444A164.124444 164.124444 0 0 0 249.457778 810.666667h312.32a32.824889 32.824889 0 1 0 0-65.649778h-312.32a98.417778 98.417778 0 0 1-98.474667-98.417778v-525.141333c0-54.385778 44.088889-98.474667 98.417778-98.474667h525.141333a98.417778 98.417778 0 0 1 98.474667 98.417778V395.320889z m-14.222222 362.097778a32.824889 32.824889 0 0 0 48.014222-44.771556L548.750222 328.533333a32.824889 32.824889 0 1 0-48.014222 44.771556l358.115556 384.056889z" horiz-adv-x="1024" />
<glyph glyph-name="delete" unicode="&#58883;" d="M601.024 146.24a29.632 29.632 0 0 0-29.696 29.696V503.04a29.632 29.632 0 1 0 59.456 0v-326.848a29.76 29.76 0 0 0-29.76-29.888z m-178.24 0a29.632 29.632 0 0 0-29.696 29.696V503.04a29.632 29.632 0 1 0 59.392 0v-326.848a29.76 29.76 0 0 0-29.696-29.888z m475.52 505.216h-148.544v59.456c0 49.152-39.616 89.088-88.512 89.088H363.392c-49.216 0-89.152-39.936-89.152-89.088v-59.456H125.696a29.632 29.632 0 1 1 0-59.392h772.608a29.632 29.632 0 1 1 0 59.392z m-564.608 59.456c0 16.256 13.44 29.696 29.696 29.696h297.856c16.32 0 29.056-13.12 29.056-29.696v-59.456H333.696v59.456zM720-32h-416a89.152 89.152 0 0 0-89.088 89.088V503.232a29.632 29.632 0 1 0 59.456 0v-446.08c0-16.512 13.44-29.76 29.696-29.76h416.064a29.632 29.632 0 0 1 29.696 29.696V502.144a29.632 29.632 0 1 0 59.456 0v-445.056A89.536 89.536 0 0 0 720-32z" horiz-adv-x="1024" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,488 @@
<!--
filename: MaintainRecord.vue
author: DY
date: 2023-12-12 13:54:53
description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<WaitingListTable
ref="waiting-list-table"
:table-data="list"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
@edit="handleEdit"
@detail="handleDetail"
@delete="handleDelete"
@confirm="handleConfirm" />
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
</div>
</template>
<script>
import AddOrUpdate from './add-or-updata';
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import {
exportCheckOrderExcel,
} from '@/api/equipment/base/maintain/record';
import WaitingListTable from './WaitingListTable.vue';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = {
name: 'tableBtn',
props: ['injectData'],
data() {
return {};
},
methods: {
handleClick() {
this.$emit('emitData', {
action: this.injectData.label,
value: this.injectData,
});
},
},
render: function (h) {
return (
<el-button type="text" onClick={this.handleClick}>
{this.injectData.name}
</el-button>
);
},
};
export default {
name: 'Confirm',
components: {
WaitingListTable,
AddOrUpdate
},
mixins: [basicPageMixin],
data() {
return {
addOrUpdateVisible: false,
recordDetailVisible: false,
searchBarKeys: [
'name'
],
tobeConfirmedIdList: [],
searchBarFormConfig: [
{
type: 'input',
label: '巡检单名称',
placeholder: '请输入巡检单名称',
param: 'name',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
{
type: 'button',
btnName: '批量确认',
name: 'batchConfirm',
color: 'primary',
plain: true,
},
{
type: 'button',
btnName: '导出',
name: 'export',
plain: true,
color: 'primary',
},
// {
// type: this.$auth.hasPermi('equipment:maintain-record:create')
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintainPlanId: null,
startTime: null,
special: false,
status: 1,
},
//
form: {},
basePath: '/base/equipment-check-order',
mode: null,
allSpecialEquipments: [],
openPlannedDrawer: false,
openUnplannedDrawer: false,
openPlannedDrawer: false,
};
},
watch: {
tobeConfirmedIdList: {
handler(val) {
if (val.length == this.list.length) {
this.$refs['table'].toggleAllSelection();
}
},
},
},
created() {
this.getList();
},
methods: {
/** 批量确认 */
async searchBarClicked(btn) {
switch (btn.btnName) {
case 'batchConfirm':
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备巡检单');
return;
}
this.$modal
.confirm('是否确认所有选中巡检单"?')
.then(() => {
return this.$axios({
url: '/base/equipment-check-order/confirm?confirmPerson=' + this.$store.getters.userId,
method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
),
});
})
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break;
}
},
handleSelectionChange(list) {
if (this.tobeConfirmedIdList.length) {
this.tobeConfirmedIdList = [];
this.list.forEach((item) => {
this.handleEmitFun({
action: 'row-selected',
value: { row: item, selected: false },
});
});
console.log(
'清空选择列表',
this.list.map((item) => item._selection)
);
} else {
this.tobeConfirmedIdList = list.map((item) => item.id);
this.list.forEach((item) => {
this.handleEmitFun({
action: 'row-selected',
value: { row: item, selected: true },
});
});
console.log(
'全选',
this.list.map((item) => item._selection)
);
}
},
handleEmitFun({ action, value }) {
switch (action) {
case '详情':
this.recordDetailVisible = true;
this.$nextTick(() => {
this.$refs.recordDetailDrawer.show({
id: value.id,
planMaintainWorker: value.planMaintainWorker,
maintainWorker: value.maintainWorker,
});
});
break;
case 'row-selected':
if (value.selected) {
this.tobeConfirmedIdList.push(value.row.id);
value.row._selection = 0b11;
} else {
const index = this.tobeConfirmedIdList.indexOf(value.row.id);
if (index != -1) {
this.tobeConfirmedIdList.splice(index, 1);
}
}
console.log('tobeConfirmedIdList', this.tobeConfirmedIdList);
break;
}
},
handleSearchBarChange({ param, value }) {
console.log('122', param)
// if ('specialType' === param) {
// if (!value) {
// this.setSearchBarEquipmentList(this.allSpecialEquipments);
// return;
// }
// this.setSearchBarEquipmentList(
// this.allSpecialEquipments.filter((item) => item.specialType == value)
// );
// }
},
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv({
...this.queryParams
}).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.mode = null;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
relatePlan: null,
maintainWorker: [],
maintainOrderNumber: null,
departmentId: null,
lineId: null,
startTime: null,
endTime: null,
planStartTime: null,
planEndTime: null,
confirmed: false,
remark: null,
special: false,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
// this.open = true;
// this.title = '';
// this.addOrEditTitle = '';
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init();
});
},
// /
// addOrUpdateHandle(id) {
// this.addOrUpdateVisible = true;
// this.$nextTick(() => {
// this.$refs.addOrUpdate.init(id);
// });
// },
getConfirmed() {
return this.$confirm('是否直接确认巡检记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.getConfirmed()
.then((confirmed) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: true,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
})
.catch((err) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: false,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
});
},
/** 确认 */
async handleConfirm(row) {
this.$modal
.confirm('是否确认巡检单"' + row.name + '"?')
.then(() => {
return this.$axios({
url:
'/base/equipment-check-order/confirm?confirmPerson=' +
this.$store.getters.userId,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put',
data: [row.id],
});
})
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
},
/** 编辑 */
async handleEdit(row) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row.id);
});
// this.reset();
// if (row.relatePlan == 1) {
// //
// // const res = await this.info({ id: row.id });
// // this.form = res.data;
// // this.form.maintainWorker = res.data.maintainWorker.split(',');
// this.openPlannedDrawer = true;
// this.$nextTick(() => {
// this.$refs.planned.init(row);
// });
// } else {
// this.openUnplannedDrawer = true;
// this.$nextTick(() => {
// this.$refs.unplanned.init(row);
// });
// }
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm(
'是否确认删除巡检单名称为"' + row.name + '"的数据项?'
)
.then(() => {
return this.$axios({
url: '/base/equipment-check-order/delete?id=' + row.id,
method: 'delete',
});
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(console.error);
},
handleDetail(row) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(row.id, true);
});
// this.recordDetailVisible = true;
// this.$nextTick(() => {
// this.$refs.recordDetailDrawer.show({
// id: row.id,
// planMaintainWorker: row.planMaintainWorker,
// maintainWorker: row.maintainWorker,
// });
// });
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有巡检单?')
.then(() => {
this.exportLoading = true;
return exportCheckOrderExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备巡检单.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,312 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-26 09:25:10
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ '设备巡检记录详情' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">巡检单名称</div>
<div class="lightTip">{{ dataForm.name }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">部门</div>
<div class="lightTip">{{ dataForm.department }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">班次</div>
<div class="lightTip">{{ dataForm.groupClass }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">巡检人</div>
<div class="lightTip">{{ dataForm.checkPerson }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">巡检时间</div>
<div class="lightTip">{{ parseTime(dataForm.actualCheckTime) }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">确认人</div>
<div class="lightTip">{{ dataForm.confirmPerson }}</div>
</el-col>
</el-row>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
巡检内容
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="planList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<!-- <attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:plan-id="dataForm.id"
@refreshDataList="getList" /> -->
</el-drawer>
</template>
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { getEqCheckOrder, deleteCheckOrderDet, getCheckOrderDetPage } from '@/api/equipment/base/inspection/record';
// import { listData } from "@/api/system/dict/data";
import SmallTitle from '../../maintain/PlanConfig/SmallTitle.vue';
import { parseTime } from '../../../../core/mixins/code-filter';
// import attrAdd from './attr-add';
// import { getDictDatas } from "@/utils/dict";
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
}
];
export default {
mixins: [basicAdd],
components: { SmallTitle },
data() {
return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: {
isGetCode: false,
infoURL: getEqCheckOrder
},
listQuery: {
pageSize: 99,
pageNo: 1,
total: 0
},
dataForm: {},
planList: [],
visible: false,
isdetail: false,
idAttrShow: false
};
},
mounted() {},
methods: {
initData() {
this.planList.splice(0);
this.listQuery.total = 0;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除保养项目名为"${raw.data.program}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteCheckOrderDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getCheckOrderDetPage({
...this.listQuery,
orderId: this.dataForm.id,
}).then((response) => {
this.planList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => {
if (this.dataForm.id) {
//
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data;
});
//
this.getList();
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 18vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
/* height: 16px; */
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;
}
</style>

View File

@ -50,6 +50,11 @@
v-if="addOrUpdateVisible" v-if="addOrUpdateVisible"
ref="addOrUpdate" ref="addOrUpdate"
@refreshDataList="getList" /> @refreshDataList="getList" />
<add-content
v-if="addContent"
ref="addContent"
@refreshDataList="addContent = false" />
</div> </div>
</template> </template>
@ -57,68 +62,99 @@
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addRecord from './addRecord.vue'; import addRecord from './addRecord.vue';
import { exportCheckLogExcel, deleteEqCheckLog } from '@/api/equipment/base/inspection/record' import AddContent from './addContent.vue';
import { exportCheckOrderExcel, deleteEqCheckLog } from '@/api/equipment/base/inspection/record'
import { parseTime } from '../../../../core/mixins/code-filter'; import { parseTime } from '../../../../core/mixins/code-filter';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); // const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = {
name: 'tableBtn',
props: ['injectData'],
data() {
return {};
},
methods: {
handleClick() {
this.$emit('emitData', { action: this.injectData.label, value: this.injectData });
},
},
render: function (h) {
return (
<el-button type="text" onClick={this.handleClick}>
{this.injectData.name}
</el-button>
);
},
};
export default { export default {
name: 'EquipmentRepair', name: 'EquipmentInspectionRecord',
components: { addRecord }, components: { addRecord, AddContent },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
addOrUpdateVisible: false, addOrUpdateVisible: false,
searchBarKeys: ['equipmentId', 'actualTime'], addContent: false,
searchBarKeys: ['name', 'actualCheckTime'],
tableBtn: [ tableBtn: [
this.$auth.hasPermi('equipment:check-record:detail') // this.$auth.hasPermi('equipment:check-record:detail')
? { // ? {
type: 'detail', // type: 'detail',
btnName: '详情', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:check-record:update') // this.$auth.hasPermi('equipment:check-record:update')
? { // ? {
type: 'edit', // type: 'edit',
btnName: '修改', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:check-record:delete') // this.$auth.hasPermi('equipment:check-record:delete')
? { // ? {
type: 'delete', // type: 'delete',
btnName: '删除', // btnName: '',
} // }
: undefined, // : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'configName', label: '配置名称' }, { prop: 'name', label: '巡检单名称' },
{ prop: 'equipmentName', label: '设备名称' }, { prop: 'department', label: '部门' },
{ prop: 'origin', label: '数据来源', filter: (val) => ['', '手动', 'PDA'][val] }, { prop: 'actualCheckTime', label: '巡检时间', filter: parseTime },
{ prop: 'groupClass', label: '班次' },
{ prop: 'opt', label: '巡检内容', name: '详情', subcomponent: btn },
{ prop: 'remark', label: '备注' }
// { prop: 'origin', label: '', filter: (val) => ['', '', 'PDA'][val] },
// { prop: 'sectionName', label: '' }, // { prop: 'sectionName', label: '' },
{ prop: 'actualTime', label: '实际巡检时间', filter: parseTime },
// { prop: 'maintenanceDetail', label: '' }, // { prop: 'maintenanceDetail', label: '' },
{ prop: 'responsible', label: '巡检人' }, // { prop: 'responsible', label: '' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'name',
// filterable: true
// },
{ {
type: 'select', type: 'input',
label: '设备', label: '巡检单名称',
placeholder: '请选择设备', placeholder: '请输入巡检单',
param: 'equipmentId', param: 'name'
filterable: true
}, },
// //
{ {
type: 'datePicker', type: 'datePicker',
label: '时间', label: '巡检时间',
dateType: 'daterange', // datetimerange dateType: 'datetimerange', // datetimerange
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-', rangeSeparator: '-',
startPlaceholder: '开始日期', startPlaceholder: '开始日期',
endPlaceholder: '结束日期', endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'], defaultTime: ['00:00:00', '23:59:59'],
param: 'actualTime', param: 'actualCheckTime',
// width: 350, // width: 350,
}, },
{ {
@ -138,16 +174,16 @@ export default {
name: 'export', name: 'export',
plain: true, plain: true,
color: 'primary', color: 'primary',
}, }
{ // {
type: this.$auth.hasPermi('equipment:check-record:create') // type: this.$auth.hasPermi('equipment:check-record:create')
? 'button' // ? 'button'
: '', // : '',
btnName: '新增', // btnName: '',
name: 'add', // name: 'add',
plain: true, // plain: true,
color: 'success', // color: 'success',
}, // },
], ],
rows: [ rows: [
[ [
@ -216,37 +252,54 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
special: false, special: false,
maintenanceStatus: null, name: null,
createTime: null, actualCheckTime: null,
equipmentId: null, status: 2
}, },
// //
form: {}, form: {},
basePath: '/base/equipment-check-log', basePath: '/base/equipment-check-order',
mode: null, mode: null,
}; };
}, },
created() { created() {
this.initSearchBar(); let end = moment().format('YYYY-MM-DD 08:00:00')
const current = new Date()
let start = parseTime(new Date(current.getFullYear(), current.getMonth(), current.getDate() - 3, 8, 0, 0))
this.searchBarFormConfig[1].defaultSelect = [start, end]
this.queryParams.actualCheckTime = [start, end]
// this.initSearchBar();
this.getList(); this.getList();
}, },
methods: { methods: {
initSearchBar() { handleEmitFun({action, value}) {
this.http('/base/core-equipment/page', 'get', { switch (action) {
special: false, //
pageNo: 1, case '巡检内容':
pageSize: 99, this.addContent = true;
}).then(({ data }) => { this.$nextTick(() => {
this.$set( this.$refs.addContent.init(value.id, true);
this.searchBarFormConfig[0],
'selectOptions',
(data?.list || []).map((item) => ({
name: item.name,
id: item.id,
}))
);
}); });
break;
}
}, },
// initSearchBar() {
// this.http('/base/equipment-check-order/page', 'get', {
// special: false,
// pageNo: 1,
// pageSize: 99,
// status: 2
// }).then(({ data }) => {
// this.$set(
// this.searchBarFormConfig[0],
// 'selectOptions',
// (data?.list || []).map((item) => ({
// name: item.name,
// id: item.id,
// }))
// );
// });
// },
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;
@ -378,7 +431,7 @@ export default {
.confirm('是否确认导出所有设备巡检记录?') .confirm('是否确认导出所有设备巡检记录?')
.then(() => { .then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportCheckLogExcel(params); return exportCheckOrderExcel(params);
}) })
.then((response) => { .then((response) => {
this.$download.excel(response, '设备巡检记录.xls'); this.$download.excel(response, '设备巡检记录.xls');

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-12-01 11:02:43 * @LastEditTime: 2024-02-26 08:40:22
* @Description: * @Description:
--> -->
<template> <template>
@ -13,34 +13,25 @@
class="drawer" class="drawer"
size="50%"> size="50%">
<small-title slot="title" :no-padding="true"> <small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : '添加巡检' }} <!-- {{ isdetail ? '详情' : '添加巡检' }} -->
{{ '添加内容' }}
</small-title> </small-title>
<div class="content"> <div class="content">
<div class="visual-part"> <div class="visual-part">
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="100px"
label-position="top">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName"> <div class="blodTip">巡检单名称</div>
<el-input v-model="dataForm.equipmentName" disabled clearable placeholder="请输入设备名称" /> <div class="lightTip">{{ dataForm.name }}</div>
</el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="8">
<el-form-item label="设备编码" prop="equipmentCode"> <div class="blodTip">部门</div>
<el-input <div class="lightTip">{{ dataForm.department }}</div>
v-model="dataForm.equipmentCode" </el-col>
clearable <el-col :span="8">
disabled <div class="blodTip">巡检时间</div>
placeholder="请输入设备编码" /> <div class="lightTip">{{ parseTime(dataForm.planCheckTime) }}</div>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form>
</div> </div>
<el-divider /> <el-divider />
@ -49,7 +40,7 @@
<small-title <small-title
style="margin: 16px 0; padding-left: 8px" style="margin: 16px 0; padding-left: 8px"
:no-padding="true"> :no-padding="true">
巡检项目 巡检内容
</small-title> </small-title>
<div v-if="!isdetail" class="action_btn"> <div v-if="!isdetail" class="action_btn">
@ -90,16 +81,18 @@
<attr-add <attr-add
v-if="addOrUpdateVisible" v-if="addOrUpdateVisible"
ref="addOrUpdate" ref="addOrUpdate"
:config-id="dataForm.id" :order-id="dataForm.id"
@refreshDataList="getList" /> @refreshDataList="getList" />
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import { getEqCheck, getCheckDetPage, deleteCheckDet } from "@/api/equipment/base/inspection/settings"; import { getCheckOrder } from "@/api/equipment/base/inspection/settings";
import { deleteCheckOrderDet, getCheckOrderDetPage } from '@/api/equipment/base/inspection/record';
import SmallTitle from './SmallTitle'; import SmallTitle from './SmallTitle';
import attrAdd from './attr-add'; import attrAdd from './attr-add';
import {DICT_TYPE, getDictDatas} from "@/utils/dict"; import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import { parseTime } from '../../../../core/mixins/code-filter';
const tableBtn = [ const tableBtn = [
{ {
@ -112,22 +105,14 @@ const tableBtn = [
}, },
]; ];
const tableProps = [ const tableProps = [
{
prop: 'equipmentName',
label: '设备名称',
},
{ {
prop: 'program', prop: 'program',
label: '巡检项目', label: '检查项目',
}, }
{
prop: 'content',
label: '巡检内容',
},
{
prop: 'code',
label: '巡检内容编码',
},
{
prop: 'description',
label: '备注',
},
]; ];
export default { export default {
@ -138,7 +123,7 @@ export default {
tableProps, tableProps,
addOrUpdateVisible: false, addOrUpdateVisible: false,
urlOptions: { urlOptions: {
infoURL: getEqCheck, infoURL: getCheckOrder,
}, },
listQuery: { listQuery: {
pageSize: 10, pageSize: 10,
@ -147,26 +132,13 @@ export default {
}, },
dataForm: { dataForm: {
id: undefined, id: undefined,
code: undefined, name: undefined,
name: '', department: undefined,
materialType: undefined, planCheckTime: undefined
productType: undefined,
area: undefined,
specifications: undefined,
processTime: 0,
remark: undefined,
unit: undefined
}, },
checkDetList: [], checkDetList: [],
visible: false, visible: false,
isdetail: false, isdetail: false
dataRule: {
code: [{ required: true, message: "物料编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "物料名称不能为空", trigger: "blur" }],
materialType: [{ required: true, message: "物料类型不能为空", trigger: "change" }],
productType: [{ required: true, message: "产品类型不能为空", trigger: "change" }],
processTime: [{ required: true, message: "产线生产单位用时不能为空", trigger: "blur" }]
}
}; };
}, },
mounted() {}, mounted() {},
@ -187,7 +159,7 @@ export default {
} }
) )
.then(() => { .then(() => {
deleteCheckDet(raw.data.id).then(({ data }) => { deleteCheckOrderDet(raw.data.id).then(({ data }) => {
this.$message({ this.$message({
message: '操作成功', message: '操作成功',
type: 'success', type: 'success',
@ -205,9 +177,9 @@ export default {
}, },
getList() { getList() {
// //
getCheckDetPage({ getCheckOrderDetPage({
...this.listQuery, ...this.listQuery,
configId: this.dataForm.id, orderId: this.dataForm.id,
}).then((response) => { }).then((response) => {
this.checkDetList = response.data.list; this.checkDetList = response.data.list;
this.listQuery.total = response.data.total; this.listQuery.total = response.data.total;
@ -220,7 +192,7 @@ export default {
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); // this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
// //
@ -287,7 +259,7 @@ export default {
.drawer >>> .visual-part { .drawer >>> .visual-part {
flex: 1 auto; flex: 1 auto;
max-height: 16vh; max-height: 10vh;
overflow: hidden; overflow: hidden;
overflow-y: scroll; overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */ padding-right: 10px; /* 调整滚动条样式 */
@ -311,4 +283,18 @@ export default {
.add { .add {
color: #0b58ff; color: #0b58ff;
} }
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
/* height: 16px; */
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;
}
</style> </style>

View File

@ -2,7 +2,7 @@
* @Author: zwq * @Author: zwq
* @Date: 2021-11-18 14:16:25 * @Date: 2021-11-18 14:16:25
* @LastEditors: DY * @LastEditors: DY
* @LastEditTime: 2023-11-25 16:23:13 * @LastEditTime: 2024-02-29 14:58:37
* @Description: * @Description:
--> -->
<template> <template>
@ -11,43 +11,83 @@
:rules="dataRule" :rules="dataRule"
ref="dataForm" ref="dataForm"
@keyup.enter.native="dataFormSubmit()" @keyup.enter.native="dataFormSubmit()"
label-width="80px"> label-width="120px">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="配置名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
<el-input <el-input
v-model="dataForm.name" v-model="dataForm.name"
placeholder="请输入配置名称" /> placeholder="请输入巡检单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="配置编码" prop="code"> <el-form-item label="巡检单编码" prop="code">
<el-input <el-input
v-model="dataForm.code" v-model="dataForm.code"
placeholder="请输入配置编码" /> placeholder="请输入巡检单编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备名称" prop="equipmentId"> <el-form-item
label="部门"
prop="departmentId"
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
<el-select <el-select
v-model="dataForm.equipmentId" v-model="dataForm.departmentId"
filterable :placeholder="`请选择部门`"
style="width: 100%" style="width: 100%">
placeholder="请选择设备名称"
@change="setCode">
<el-option <el-option
v-for="dict in eqList" v-for="opt in departmentOptions"
:key="dict.id" :key="opt.id"
:label="dict.name" :label="opt.name"
:value="dict.id" /> :value="opt.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode"> <el-form-item label="计划巡检时间" prop="planCheckTime">
<el-input v-model="dataForm.equipmentCode" disabled placeholder="请输入设备编码" /> <el-date-picker
v-model="dataForm.planCheckTime"
type="datetime"
:placeholder="`请选择计划巡检时间`"
value-format="timestamp"
:default-time="'8:00:00'"
style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit">
<el-input
v-model="dataForm.confirmTimeLimit"
:placeholder="`请输入确认时限`" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="班次" prop="groupClass">
<el-select
v-model="dataForm.groupClass"
filterable
clearable
multiple
style="width: 100%"
placeholder="请选择班次">
<el-option
v-for="d in groupOptions"
:key="d.id"
:label="d.label"
:value="d.label" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -56,8 +96,11 @@
<script> <script>
import basicAdd from '../../../../core/mixins/basic-add'; import basicAdd from '../../../../core/mixins/basic-add';
import { getEqCheck, getCode, createCheckConfig, updateCheckConfig } from "@/api/equipment/base/inspection/settings"; import { getCheckOrder, getOrderCode, createCheckOrder, updateCheckOrder } from "@/api/equipment/base/inspection/settings";
import { getEquipmentAll } from '@/api/base/equipment' import { getCoreDepartmentList } from "@/api/base/coreDepartment";
import { groupClassesListAll } from '@/api/monitoring/teamProduction'
import { getDictDataLabel } from '@/utils/dict';
// import { getEquipmentAll } from '@/api/base/equipment'
export default { export default {
mixins: [basicAdd], mixins: [basicAdd],
@ -65,41 +108,117 @@ export default {
return { return {
urlOptions: { urlOptions: {
isGetCode: true, isGetCode: true,
codeURL: getCode, codeURL: getOrderCode,
createURL: createCheckConfig, createURL: createCheckOrder,
updateURL: updateCheckConfig, updateURL: updateCheckOrder,
infoURL: getEqCheck, infoURL: getCheckOrder,
}, },
dataForm: { dataForm: {
id: undefined, id: null,
code: undefined, code: null,
name: undefined, name: null,
equipmentId: undefined, departmentId: null,
equipmentCode: undefined planCheckTime: null,
confirmTimeLimit: null,
groupClass: null,
remark: null
}, },
eqList: [], groupOptions: [],
departmentOptions: [],
dataRule: { dataRule: {
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }], confirmTimeLimit: [
code: [{ required: true, message: "配置编码不能为空", trigger: "blur" }], { required: true, message: '确认时限不能为空', trigger: 'blur' }
name: [{ required: true, message: "配置名称不能为空", trigger: "blur" }], ],
code: [
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' }
],
name: [
{ required: true, message: '巡检单名称不能为空', trigger: 'blur' }
],
planCheckTime: [
{ required: true, message: '计划巡检时间不能为空', trigger: 'blur' }
]
} }
}; };
}, },
created() {
const currenttime = new Date()
this.dataForm.planCheckTime = new Date(currenttime.getFullYear(), currenttime.getMonth(), currenttime.getDate(), 8, 0, 0).getTime()
console.log('11', this.dataForm.planCheckTime, currenttime)
},
mounted() { mounted() {
this.getDict() this.getDict()
}, },
methods: { methods: {
async getDict() { init(id) {
// this.dataForm.id = id || "";
const res = await getEquipmentAll() this.visible = true;
this.eqList = res.data if (this.urlOptions.getOption) {
}, this.getArr()
setCode() {
const chooseM = this.eqList.filter(item => {
return item.id === this.dataForm.equipmentId
})
this.dataForm.equipmentCode = chooseM[0].code
} }
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
this.dataForm = response.data
if (response.data.groupClass === '') {
this.dataForm.groupClass = []
} else {
this.dataForm.groupClass = response.data?.groupClass.split(',') || undefined
}
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
async getDict() {
//
const res = await getCoreDepartmentList();
this.departmentOptions = res.data || [];
const res1 = await groupClassesListAll();
this.groupOptions = res1.data.map((item) => {
item.label = item.name + ' - ' + getDictDataLabel('workshop', item.roomNameDict)
return item
}) || [];
// const res = await getEquipmentAll()
// this.eqList = res.data
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass.join(',')
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL({
...this.dataForm,
special: false,
status: 0,
groupClass: this.dataForm.groupClass.join(',')
}).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
}, },
}; };
</script> </script>

View File

@ -17,18 +17,32 @@
ref="dataForm" ref="dataForm"
:model="dataForm" :model="dataForm"
:rules="dataRule" :rules="dataRule"
label-width="60px" label-width="90px"
@keyup.enter.native="dataFormSubmit()"> @keyup.enter.native="dataFormSubmit()">
<el-form-item label="巡检" prop="checkId"> <el-form-item label="设备名称" prop="equipmentId">
<el-select v-model="dataForm.checkId" filterable placeholder="请选择巡检" style="width: 100%"> <el-select
<el-option v-for="dict in checkList" :key="dict.id" :label="dict.content" v-model="dataForm.equipmentId"
filterable
clearable
placeholder="请选择设备名称"
style="width: 100%">
<el-option
v-for="dict in equipmentOptions"
:key="dict.id"
:label="dict.name"
:value="dict.id" /> :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="备注" prop="description"> <el-form-item label="巡检项目" prop="program">
<el-input <el-input
v-model="dataForm.description" v-model="dataForm.program"
placeholder="请输入备注" placeholder="请输入巡检项目"
clearable />
</el-form-item>
<el-form-item label="巡检结果" prop="checkResult">
<el-input
v-model="dataForm.checkResult"
placeholder="请输入巡检结果"
clearable /> clearable />
</el-form-item> </el-form-item>
</el-form> </el-form>
@ -41,11 +55,12 @@
</template> </template>
<script> <script>
import { getCheckDet, createCheckDet, updateCheckDet, getcheckList } from "@/api/equipment/base/inspection/settings"; import { getCheckOrderDet, createCheckOrderDet, updateCheckOrderDet } from "@/api/equipment/base/inspection/settings";
import { getEquipmentPage } from '@/api/base/equipment'
export default { export default {
props: { props: {
configId: { orderId: {
type: String, type: String,
default: '', default: '',
}, },
@ -54,14 +69,22 @@ export default {
return { return {
visible: false, visible: false,
dataForm: { dataForm: {
id: undefined, id: null,
checkId: undefined, equipmentId: null,
configId: undefined, program: null,
description: '' checkResult: null
}, },
checkList: [], equipmentOptions: [],
dataRule: { 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' }
]
}, },
}; };
}, },
@ -70,8 +93,12 @@ export default {
}, },
methods: { methods: {
async getDict() { async getDict() {
const res = await getcheckList() const res = await getEquipmentPage({
this.checkList = res.data pageNo: 1,
pageSize: 100,
special: false
})
this.equipmentOptions = res.data.list
}, },
init(id) { init(id) {
this.dataForm.id = id || ''; this.dataForm.id = id || '';
@ -79,7 +106,7 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['dataForm'].resetFields(); this.$refs['dataForm'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
getCheckDet(this.dataForm.id).then((res) => { getCheckOrderDet(this.dataForm.id).then((res) => {
// const { name, value } = res.data; // const { name, value } = res.data;
// this.dataForm.name = name; // this.dataForm.name = name;
// this.dataForm.value = value; // this.dataForm.value = value;
@ -94,9 +121,9 @@ export default {
if (valid) { if (valid) {
// //
if (this.dataForm.id) { if (this.dataForm.id) {
updateCheckDet({ updateCheckOrderDet({
...this.dataForm, ...this.dataForm,
configId: this.configId orderId: this.orderId
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess('修改成功'); this.$modal.msgSuccess('修改成功');
this.visible = false; this.visible = false;
@ -105,9 +132,9 @@ export default {
return; return;
} }
// //
createCheckDet({ createCheckOrderDet({
...this.dataForm, ...this.dataForm,
configId: this.configId, orderId: this.orderId,
}).then((response) => { }).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.visible = false; this.visible = false;

View File

@ -53,6 +53,7 @@
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import addOrUpdata from './add-or-updata.vue'; import addOrUpdata from './add-or-updata.vue';
import add from './add.vue' import add from './add.vue'
import { parseTime } from '../../../../core/mixins/code-filter';
// import { publicFormatter } from '@/utils/dict'; // import { publicFormatter } from '@/utils/dict';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); // const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
@ -79,12 +80,12 @@ export default {
btnName: '修改', btnName: '修改',
} }
: undefined, : undefined,
this.$auth.hasPermi('equipment:check-setting:update') // this.$auth.hasPermi('equipment:check-setting:update')
? { // ? {
type: 'detail', // type: 'detail',
btnName: '查看详情', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:check-setting:delete') this.$auth.hasPermi('equipment:check-setting:delete')
? { ? {
type: 'delete', type: 'delete',
@ -93,29 +94,31 @@ export default {
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ prop: 'name', label: '配置名', width: 110, showOverflowtooltip: true }, { prop: 'name', label: '巡检单名称', width: 110, showOverflowtooltip: true },
{ prop: 'code', label: '编码', minWidth: 150, showOverflowtooltip: true }, { prop: 'code', label: '巡检单编码', minWidth: 150, showOverflowtooltip: true },
{ prop: 'lineName', label: '产线', showOverflowtooltip: true }, { prop: 'department', label: '部门', showOverflowtooltip: true },
{ prop: 'sectionName', label: '工段', showOverflowtooltip: true }, { prop: 'planCheckTime', label: '计划巡检时间', width: 150, filter: parseTime },
{ prop: 'equipmentName', label: '设备', showOverflowtooltip: true }, { prop: 'confirmTimeLimit', label: '确认时限', showOverflowtooltip: true },
{ prop: 'equipmentCode', label: '设备编码', minWidth: 150, showOverflowtooltip: true }, { prop: 'groupClass', label: '班次', showOverflowtooltip: true },
{ prop: 'creator', label: '创建人', showOverflowtooltip: true },
{ prop: 'createTime', label: '创建时间', width: 150, filter: parseTime },
// { prop: 'responsible', label: '' }, // { prop: 'responsible', label: '' },
{ prop: 'checkNumber', label: '巡检条数' }, // TODO: { prop: 'remark', label: '备注' } // TODO:
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'input', type: 'input',
label: '配置名称', label: '巡检单名称',
placeholder: '请输入配置名称', placeholder: '请输入巡检单名称',
param: 'name', param: 'name',
}, },
{ // {
type: 'select', // type: 'select',
label: '设备名称', // label: '',
placeholder: '请选择设备', // placeholder: '',
param: 'equipmentId', // param: 'equipmentId',
filterable: true, // filterable: true,
}, // },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -133,7 +136,7 @@ export default {
name: 'add', name: 'add',
plain: true, plain: true,
color: 'success', color: 'success',
}, }
// { // {
// type: this.$auth.hasPermi('equipment:check-setting:export') // type: this.$auth.hasPermi('equipment:check-setting:export')
// ? 'button' // ? 'button'
@ -192,16 +195,20 @@ export default {
pageSize: 10, pageSize: 10,
equipmentId: null, equipmentId: null,
name: null, name: null,
special: false,
status: 0
}, },
// //
form: {}, form: {},
basePath: '/base/equipment-check-config', basePath: '/base/equipment-check-order',
mode: null, mode: null,
groupList: []
}; };
}, },
created() { created() {
this.initSearchBar(); this.initSearchBar();
this.getList(); this.getList();
this.getGroup();
}, },
methods: { methods: {
handleConfirm() { handleConfirm() {
@ -223,6 +230,11 @@ export default {
); );
}); });
}, },
getGroup() {
groupClassesListAll().then(res => {
this.groupList = res.data || []
})
},
/** 查询列表 */ /** 查询列表 */
getList() { getList() {
this.loading = true; this.loading = true;

View File

@ -0,0 +1,444 @@
<!--
filename: PlanConfig--addContent.vue
author: liubin
date: 2024-02-04 09:40:04
description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="true"
class="drawer"
custom-class="mes-drawer"
size="60%">
<SmallTitle slot="title">
{{
mode.includes('detail')
? '详情'
: mode.includes('edit')
? '编辑'
: '新增'
}}
</SmallTitle>
<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
v-else
ref="form"
:model="form"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">计划保养人员</div>
<div class="lightTip">{{ form.planMaintainWorker }}</div>
<!-- <el-form-item label="计划保养人员" prop="planMaintainWorker">
<span>{{ form.planMaintainWorker }}</span>
</el-form-item> -->
</el-col>
<el-col :span="8">
<div class="blodTip">实际保养人员</div>
<div class="lightTip">{{ form.maintainWorker }}</div>
<!-- <el-form-item label="实际保养人员" prop="maintainWorker">
<span>{{ form.maintainWorker }}</span>
</el-form-item> -->
</el-col>
</el-row>
</el-form>
</div>
</section>
<el-divider />
<section>
<SmallTitle>保养详情</SmallTitle>
<div style="margin-top: 12px; position: relative">
<base-table
v-loading="detailLoading"
:table-props="detailTableProps"
:page="detailTableQuery.pageNo || 1"
:limit="detailTableQuery.pageSize || 10"
:table-data="detailList"
@emitFun="handleDetailTableAction">
<!-- <method-btn
slot="handleBtn"
label="操作"
width="100"
:method-list="detailTableBtns"
@clickBtn="handleDetailTableBtnClicked" /> -->
</base-table>
<!-- 分页组件 -->
<pagination
v-show="detailTotal > 0"
:total="detailTotal"
:page.sync="detailTableQuery.pageNo"
:limit.sync="detailTableQuery.pageSize"
@pagination="refreshDetailList" />
</div>
</section>
</div>
</div>
<!-- <div class="drawer-body__footer"> -->
<!-- <el-button style="" @click="cancel">返回</el-button> -->
<!-- <el-button v-if="mode == 'detail'" type="primary" @click="toggleEdit">
编辑
</el-button>
<el-button v-else type="primary" @click="confirm">保存</el-button> -->
<!-- </div> -->
<!-- 属性对话框 -->
<base-dialog
dialogTitle="保养详情"
:dialogVisible="detailAddVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeDetailForm"
@cancel="closeDetailForm"
@confirm="submitDetailForm">
<DialogForm
v-if="detailAddVisible"
ref="detailForm"
v-model="detailForm"
:rows="detailRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '@/components/DialogForm';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
name: 'PlanConfig--addContent',
components: { SmallTitle, DialogForm },
props: ['maintainData'],
data() {
return {
visible: false,
mode: 'detail',
showForm: false,
form: {
id: null,
maintainWorker: null,
planMaintainWorker: null,
},
formLoading: false,
equipmentOptions: [],
detailList: [],
detailAddVisible: false,
detailPageProps: ['equipmentName', 'program'],
detailForm: {
planId: null,
equipmentId: null,
program: '',
maintenanceDes: '',
remark: '',
},
detailRows: [
[
{
select: true,
label: '设备',
prop: 'equipmentId',
options: [],
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '保养项目',
prop: 'program',
rules: [
{ required: true, message: '保养项目不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '保养描述',
prop: 'maintenanceDes',
rules: [
{ required: true, message: '包养描述不能为空', trigger: 'blur' },
],
},
],
],
detailLoading: false,
detailTableProps: [
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'program', label: '保养项目' },
{ prop: 'maintenanceDes', label: '保养描述' },
// { prop: 'remark', label: '' },
],
detailTableQuery: {
pageNo: 1,
pageSize: 10,
},
detailTableBtns: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
],
detailTotal: 0,
detailList: [],
equipmentList: [],
};
},
computed: {},
mounted() {
this.loadEquipments();
},
methods: {
handleColse() {},
show({ planMaintainWorker, id, maintainWorker }) {
this.form = Object.assign(
{},
{
planMaintainWorker,
id,
maintainWorker,
}
);
this.$nextTick(() => {
this.refreshDetailList();
});
this.visible = true;
this.showForm = true;
},
cancel() {
this.visible = false;
setTimeout(() => {
this.$emit('closed');
}, 500);
},
confirm() {
this.cancel();
},
toggleEdit() {
this.mode == 'edit' ? 'detail' : 'edit';
},
async loadEquipments() {
// TODO: //100...
const res = await this.$axios('/base/core-equipment/page', {
params: {
pageNo: 1,
pageSize: 100,
special: false,
},
});
this.equipmentList = res.data?.list || [];
this.detailRows[0][0].options = (res.data?.list || []).map((item) => ({
label: item.name,
value: item.id,
}));
},
closeDetailForm() {
this.detailAddVisible = false;
},
async submitDetailForm() {
// validation
this.$refs.detailForm.validate(async (valid) => {
if (!valid) return;
const res = await this.$axios[this.detailForm.id ? 'put' : 'post'](
`/base/equipment-maintain-log-det/create/${
this.detailForm.id ? 'update' : 'create'
}`,
{
...this.detailForm,
logId: this.form.id,
}
);
if (res.code == 0) {
this.detailAddVisible = false;
this.$message.success('添加成功');
this.refreshDetailList();
} else {
this.detailAddVisible = false;
this.$message.error('出错');
}
});
},
async refreshDetailList() {
this.detailLoading = true;
if (!this.form.id) {
this.$message.info('没有找到保养计划相关信息...');
this.detailLoading = false;
}
try {
const res = await this.$axios(
'/base/equipment-maintain-log-det/page',
{
params: {
pageNo: this.detailTableQuery.pageNo,
pageSize: this.detailTableQuery.pageSize,
// planId: this.form.id,
logId: this.form.id,
},
}
);
this.detailList = res.data?.list || [];
this.detailTotal = res.data?.total || 0;
this.detailLoading = false;
} catch (err) {
this.detailLoading = false;
}
},
//
handleDetailTableAction() {},
handleDetailTableBtnClicked({ data, type }) {
switch (type) {
case 'edit':
const { id, equipmentId, planId, program, maintenanceDes, remark } =
data;
this.detailAddVisible = true;
this.$nextTick(() => {
this.detailForm = Object.assign(
{},
{
id,
equipmentId,
planId,
program,
maintenanceDes,
remark,
}
);
});
break;
case 'delete':
if (!data.id) return;
this.$confirm('确认移除该详情吗?', '提示', {
confirmButtonText: '确 认',
cancelButtonText: '取 消',
})
.then(async () => {
const res = await this.$axios.delete(
'/base/equipment-maintain-plan-det/delete',
{
params: {
id: data.id,
},
}
);
if (res.code == 0) {
this.$message.success('删除成功!');
this.refreshDetailList();
}
})
.catch(console.error);
break;
case 'detail':
this.handleDetail(data);
break;
default:
this.handleTableActions({ data, type });
}
},
handleAddDetail() {
this.detailAddVisible = true;
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: calc(100% - 72px);
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
/* height: 16px; */
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;
}
</style>

View File

@ -0,0 +1,368 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-15 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form
ref="form"
:model="form"
:size="size"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item
label="设备保养单号"
prop="maintainOrderNumber"
:rules="[
{ required: true, message: '请输入设备保养单号', trigger: 'blur' },
]">
<el-input
v-model="form.maintainOrderNumber"
@change="$emit('update', form)"
:placeholder="`请输入保养计划单号`"
:disabled="disabled" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保养计划名称" prop="name">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="部门"
prop="departmentId"
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
<el-select
v-model="form.departmentId"
:placeholder="`请选择部门`"
:disabled="disabled"
clearable
filterable
@change="$emit('update', form)">
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
<!-- <el-form-item
label="设备大类"
prop="equipmentCategory"
:rules="[
{ required: true, message: '请选择设备大类', trigger: 'blur' },
]">
<el-select
v-model="form.equipmentCategory"
:placeholder="`请选择设备大类`"
:disabled="disabled"
@change="handleEqTypeChange">
<el-option
v-for="opt in equipmentTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item> -->
</el-col>
<el-col :span="12">
<el-form-item
label="产线"
prop="lineId"
:rules="[{ required: true, message: '请选择产线', trigger: 'blur' }]">
<el-select
v-model="form.lineId"
:placeholder="`请选择产线`"
:disabled="disabled"
clearable
filterable
@change="$emit('update', form)">
<el-option
v-for="opt in lineOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划保养人员" prop="maintainer">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划开始时间" prop="planStartTime">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="计划结束时间" prop="planEndTime">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="实际开始时间"
prop="startTime"
:rules="[
{ required: true, message: '请选择实际开始时间', trigger: 'blur' },
]">
<el-date-picker
v-model="form.startTime"
type="datetime"
:disabled="edit"
placeholder="请选择实际开始时间"
@change="$emit('update', form)"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="实际结束时间"
prop="endTime"
:rules="[
{ required: true, message: '请选择实际结束时间', trigger: 'blur' },
]">
<el-date-picker
v-model="form.endTime"
type="datetime"
:disabled="edit"
placeholder="请选择实际结束时间"
@change="$emit('update', form)"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item
label="实际保养人员"
prop="maintainWorker"
:rules="[
{ required: true, message: '请选择实际保养人员', trigger: 'blur' },
]">
<el-select
v-model="form.maintainWorker"
:placeholder="`请选择实际保养人员`"
:disabled="disabled"
multiple
clearable
filterable
@change="$emit('update', form)">
<el-option
v-for="opt in maintainerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
@change="$emit('update', form)"
:placeholder="`请输入备注`"
:disabled="disabled" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: {},
props: {
rows: {
type: Array,
default: () => [],
},
dataForm: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
edit: {
type: Boolean,
default: false,
},
hasFiles: {
type: Boolean | Array,
default: false,
},
labelPosition: {
type: String,
default: 'right',
},
size: {
type: String,
default: '',
},
},
data() {
return {
form: {},
formLoading: true,
lineList: [],
maintainerList: [],
departmentList: [],
};
},
watch: {
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
if (typeof val.maintainer == 'string')
this.form.maintainer = val.maintainer.split(',');
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 ?? [];
} else if (Array.isArray(this.hasFiles)) {
this.hasFiles.forEach((prop) => {
this.form[prop] = this.form[prop] ?? [];
});
}
}
},
deep: true,
immediate: true,
},
},
mounted() {
// !this.edit && this.getCode('/base/equipment-maintain-log/getCode');
this.getList('maintainer');
this.getList('department');
this.getList('line');
},
computed: {
departmentOptions() {
return (this.departmentList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
lineOptions() {
return (this.lineList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
maintainerOptions() {
return (this.maintainerList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.name,
}));
},
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
async getCode(url) {
this.formLoading = true;
const response = await this.$axios(url);
this.formLoading = false;
this.form.maintainOrderNumber = response.data || '';
},
// initialize
async getEquipmentList() {
this.formLoading = true;
const response = await this.$axios('/base/core-equipment/listAll');
this.equipmentList = response.data || [];
this.equipmentOptions = (response.data || []).map((item) => ({
label: item.name,
value: item.id,
}));
this.formLoading = false;
},
async getList(source = 'department') {
const urls = [
'/base/core-production-line/listAll',
'/base/core-department/listAll',
'/base/core-worker/listAll',
];
let res;
switch (source) {
case 'department':
res = await this.$axios(urls[1]);
this.departmentList = res.data || [];
break;
case 'maintainer':
res = await this.$axios(urls[2]);
this.maintainerList = res.data || [];
break;
case 'line':
res = await this.$axios(urls[0]);
this.lineList = res.data || [];
break;
}
this.formLoading = false;
},
// handlers
handleEqTypeChange(type) {
this.form.equipmentId = null;
if (type) {
this.equipmentOptions = this.equipmentList
.filter((item) => item.special)
.filter((item) => item.specialType === type)
.map((item) => ({ label: item.name, value: item.id }));
} else
this.equipmentOptions = this.equipmentList.map((item) => ({
label: item.name,
value: item.id,
}));
// this.$emit('update', this.form)
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
</style>

View File

@ -0,0 +1,758 @@
<!--
filename: WaitingListUnplanned--edit.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">编辑</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<div class="form-part" style="margin-bottom: 32px">
<!-- <el-skeleton v-if="!showForm" animated /> -->
<el-form
class="equipment-info-form"
ref="form"
:model="form"
label-width="200px"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="保养计划单号" prop="maintainOrderNumber">
<!-- :rules="[
{
required: true,
message: '请输入保养计划单号',
trigger: 'blur',
},
]" -->
<el-input
v-model="form.maintainOrderNumber"
disabled
:placeholder="`请输入保养计划单号`" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="保养计划名称" prop="planName">
<el-input
v-model="form.planName"
placeholder="请输入保养计划名称"
disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="部门" prop="departmentId">
<!-- :rules="[
{ required: true, message: '请选择部门', trigger: 'blur' },
]" -->
<el-select
v-model="form.departmentId"
:placeholder="`请选择部门`"
clearable
disabled
filterable>
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<!-- :rules="[
{ required: true, message: '请选择产线', trigger: 'blur' },
]" -->
<el-select
v-model="form.lineId"
:placeholder="`请选择产线`"
disabled
clearable
filterable>
<el-option
v-for="opt in lineOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划保养人员" prop="maintainer">
<el-select
v-model="form.planMaintainWorker"
placeholder="请选择计划保养人员"
disabled
clearable
filterable />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划开始时间" prop="planStartTime">
<el-date-picker
v-model="form.planStartTime"
type="datetime"
disabled
placeholder="请选择计划开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划结束时间" prop="planEndTime">
<el-date-picker
v-model="form.planEndTime"
type="datetime"
disabled
placeholder="请选择计划结束时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际开始时间"
prop="startTime"
:rules="[
{
required: true,
message: '请选择实际开始时间',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.startTime"
type="datetime"
placeholder="请选择实际开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际结束时间"
prop="endTime"
:rules="[
{
required: true,
message: '请选择实际结束时间',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.endTime"
type="datetime"
placeholder="请选择实际结束时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际保养人员"
prop="maintainWorker"
:rules="[
{
required: true,
message: '请选择实际保养人员',
trigger: 'blur',
},
]">
<el-select
v-model="form.maintainWorker"
:placeholder="`请选择实际保养人员`"
multiple
clearable
filterable>
<el-option
v-for="opt in maintainerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" :placeholder="`请输入备注`" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加属性
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="attrTotal > 0"
:total="attrTotal"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<el-button type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '../../../../../components/DialogForm/index.vue';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id
data() {
return {
visible: false,
btnLoading: false,
form: {},
formLoading: false,
lineList: [],
maintainerList: [],
departmentList: [],
attrTableProps: [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
{
prop: 'maintenanceDes',
label: '保养描述',
},
],
attrList: [],
attrTotal: 0,
attrTitle: '',
attrForm: {
id: null,
logId: null,
program: null,
maintenanceDes: null,
remark: null,
},
attrFormVisible: false,
attrRows: [
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=false',
// method: 'post',
// queryParams: {
// pageNo: 1,
// pageSize: 100,
// special: true,
// },
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '保养项目',
prop: 'program',
},
],
[
{
input: true,
label: '保养描述',
prop: 'maintenanceDes',
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
},
}, //
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
attrFormSubmitting: false,
attrListLoading: false,
// syncFileListFlag: null,
tableBtn: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
],
row: null,
};
},
computed: {
departmentOptions() {
return (this.departmentList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
lineOptions() {
return (this.lineList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
maintainerOptions() {
return (this.maintainerList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.name,
}));
},
},
mounted() {
this.getList('maintainer');
this.getList('department');
this.getList('line');
},
methods: {
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.attrQuery.params.equipmentName = btn.equipmentName;
this.getAttrList();
break;
}
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
async handleConfirm() {
this.btnLoading = true;
this.$nextTick(async () => {
const { code, data } = await this.$axios({
url: '/base/equipment-maintain-log/update',
method: 'put',
data: {
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
planMaintainWorker: this.form.planMaintainWorker?.join(','),
},
});
if (code == 0) {
this.$modal.msgSuccess('更新成功');
}
this.btnLoading = false;
this.$emit('refreshDataList');
this.handleCancel();
});
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row) {
this.visible = true;
this.row = row;
this.getInfo(row);
this.getAttrList(row);
},
async getInfo(row) {
this.formLoading = true;
const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + row.id
);
if (res.code == 0) {
this.form = res.data;
this.form.maintainWorker = res.data.maintainWorker.split(',');
this.form.planMaintainWorker = res.data.planMaintainWorker?.split(',');
this.formLoading = false;
}
this.formLoading = false;
},
async getAttrList(row, condition = {}) {
if (!row) row = this.row;
this.attrListLoading = true;
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page',
method: 'get',
params: {
...this.attrQuery.params,
logId: row.id,
...condition,
},
});
if (res.code == 0) {
this.attrList = res.data.list;
this.attrTotal = res.data.total;
}
this.attrListLoading = false;
},
async getList(source = 'department') {
const urls = [
'/base/core-production-line/listAll',
'/base/core-department/listAll',
'/base/core-worker/listAll',
];
let res;
switch (source) {
case 'department':
res = await this.$axios(urls[1]);
this.departmentList = res.data || [];
break;
case 'maintainer':
res = await this.$axios(urls[2]);
this.maintainerList = res.data || [];
break;
case 'line':
res = await this.$axios(urls[0]);
this.lineList = res.data || [];
break;
}
this.formLoading = false;
},
//
handleSave() {
this.$refs.form.validate(async (valid) => {
if (valid) {
await this.$axios({
url: '/urlupdate', // this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: 'post', // isEdit ? 'put' : 'post',
data: this.form,
});
this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
this.visible = false;
this.$emit('refreshDataList');
}
});
},
handleCancel() {
this.visible = false;
},
resetAttrform() {
this.attrForm = {
id: null,
logId: this.row.id,
maintenanceDes: '',
program: null,
remark: null,
};
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加属性';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/get',
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑属性';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该保养内容?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/delete?id=' + attrId,
method: 'delete',
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? '/base/equipment-maintain-log-det/update'
: '/base/equipment-maintain-log-det/create',
method: isEdit ? 'put' : 'post',
data: this.attrForm,
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-date-editor,
.drawer >>> .el-select {
width: 100%;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -0,0 +1,307 @@
<!--
filename: WaitingListTable.vue
author: liubin
date: 2024-02-05 16:12:55
description:
-->
<template>
<el-table
:data="tableDataWithIndex"
:border="true"
@selection-change="handleSelectionChange"
style="width: 100%"
:header-cell-style="{
background: '#f2f4f9',
color: '#606266',
}"
class="waiting-list-table">
<el-table-column
type="selection"
:width="50"
:selectable="checkSelectable" />
<el-table-column prop="_pageIndex" width="80" align="center">
<template slot="header">
<el-popover placement="bottom-start" width="300" trigger="click">
<div class="setting-box" style="max-height: 400px; overflow-y: auto">
<el-checkbox
v-for="(item, index) in tablePropsLabelList"
:key="'cb' + index"
v-model="selectedBox[index]"
:label="item.label" />
</div>
<i slot="reference" class="el-icon-s-tools" />
</el-popover>
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[0]"
width="128"
label="设备保养单号"
prop="maintainOrderNumber"></el-table-column>
<el-table-column v-if="selectedBox[1]" width="128" label="保养计划名称" prop="planName">
<template slot-scope="scope">
{{ scope.row.planName || '---' }}
</template>
</el-table-column>
<el-table-column v-if="selectedBox[2]" label="部门" prop="departmentName">
<template slot-scope="scope">
{{ scope.row.departmentName || '---' }}
</template>
</el-table-column>
<el-table-column v-if="selectedBox[3]" label="产线名" prop="lineName">
<template slot-scope="scope">
{{ scope.row.lineName || '---' }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[4]"
width="150"
label="计划开始时间"
prop="planStartTime">
<template slot-scope="scope">
{{ scope.row.planStartTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[5]"
width="150"
label="计划结束时间"
prop="planEndTime">
<template slot-scope="scope">
{{ scope.row.planEndTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[6]"
width="150"
label="实际开始时间"
prop="startTime">
<template slot-scope="scope">
{{ scope.row.startTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[7]"
width="150"
label="实际结束时间"
prop="endTime">
<template slot-scope="scope">
{{ scope.row.endTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[8]"
width="150"
label="确认截止时间"
prop="confirmDueTime">
<template slot-scope="scope">
{{ scope.row.confirmDueTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[9]"
width="150"
label="保养计划类型"
prop="relatePlan">
<template slot-scope="scope">
{{ scope.row.relatePlan | relatePlanFilter }}
</template>
</el-table-column>
<!-- <el-table-column v-if="selectedBox[10]" width="60" label="详情">
<template slot-scope="scope">
<el-button type="text" @click="handelDetail(scope.row)">详情</el-button>
</template>
</el-table-column> -->
<!-- btns -->
<el-table-column width="188" label="操作">
<template slot-scope="scope">
<el-tooltip content="确认" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
:disabled="!checkSelectable(scope.row)"
@click="$emit('confirm', scope.row)">
确认
</el-button>
</el-tooltip>
<!-- line -->
<span style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip content="查看详情" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
@click="$emit('detail', scope.row)">
<i class="iconfont icon-detail primary-color" />
</el-button>
</el-tooltip>
<!-- line -->
<span style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip content="编辑" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
@click="$emit('edit', scope.row)">
<i class="iconfont icon-edit primary-color" />
</el-button>
</el-tooltip>
<!-- line -->
<span style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip content="删除" placement="top">
<el-button
type="text"
style="margin: 5px 0; padding: 0"
@click="$emit('delete', scope.row)">
<i class="iconfont icon-delete delete-color" />
</el-button>
</el-tooltip>
</template>
</el-table-column>
</el-table>
</template>
<script>
import moment from 'moment';
export default {
name: 'WaitingListTable',
components: {},
props: ['tableData', 'page', 'limit'],
filters: {
timeFilter: (val) =>
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---',
relatePlanFilter: (val) =>
val != null ? ['-', '计划型', '非计划型'][val] : '-',
},
data() {
return {
tablePropsLabelList: [
{
label: '设备保养单号',
},
{
label: '保养计划名称',
},
{
label: '部门',
},
{
label: '产线名',
},
{
label: '计划开始时间',
},
{
label: '计划结束时间',
},
{
label: '实际开始时间',
},
{
label: '实际结束时间',
},
{
label: '确认截止时间',
},
{
label: '保养计划类型',
},
{
label: '详情',
},
],
selectedBox: [
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
],
selectedPlan: [],
};
},
computed: {
tableDataWithIndex() {
return this.tableData.map((item, index) => ({
...item,
_pageIndex: (this.page - 1) * this.limit + index + 1,
}));
},
},
methods: {
checkSelectable(row, index) {
return (
row.relatePlan == 2 ||
(row.relatePlan == 1 &&
(!row.confirmDueTime || +row.confirmDueTime >= new Date().getTime()))
);
},
handleSelectionChange(val) {
this.selectedPlan = val;
},
handleDelete(row) {},
handleDetail(row) {},
handleEdit(row) {},
handleConfirm(row) {},
},
};
</script>
<style scoped>
@import './iconfont/iconfont.css';
.delete-color {
color: #ff5454;
}
.primary-color {
color: #0b58ff;
}
.baseTable .show-col-btn {
margin-right: 5px;
line-height: inherit;
cursor: pointer;
}
.baseTable .el-icon-refresh {
cursor: pointer;
}
</style>
<style>
.waiting-list-table .el-table__body tr.current-row > td.el-table__cell {
background-color: #eaf1fc;
}
.waiting-list-table.el-table .el-table__cell {
padding: 0;
height: 35px;
}
.waiting-list-table .addButton {
width: 100%;
height: 35px;
border-top: none;
color: #0b58ff;
border-color: #ebeef5;
border-radius: 0;
}
.waiting-list-table .addButton:hover {
color: #0b58ff;
border-color: #ebeef5;
background-color: #fff;
}
.waiting-list-table .addButton:focus {
border-color: #ebeef5;
background-color: #fff;
}
.el-tooltip__popper.is-dark {
background: rgba(0, 0, 0, 0.6) !important;
}
.el-tooltip__popper .popper__arrow,
.el-tooltip__popper .popper__arrow::after {
border-top-color: rgba(0, 0, 0, 0.4) !important;
}
</style>

View File

@ -0,0 +1,838 @@
<!--
filename: WaitingListUnplanned--edit.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">{{ showTable ? '编辑' : '新增' }}</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<div class="form-part" style="margin-bottom: 32px">
<!-- <el-skeleton v-if="!showForm" animated /> -->
<el-form
class="equipment-info-form"
ref="form"
:model="form"
label-width="200px"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item
label="保养计划单号"
prop="maintainOrderNumber"
:rules="[
{
required: true,
message: '请输入保养计划单号',
trigger: 'blur',
},
]">
<el-input
v-model="form.maintainOrderNumber"
:placeholder="`请输入保养计划单号`" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="保养计划名称" prop="name">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="部门"
prop="departmentId"
:rules="[
{ required: true, message: '请选择部门', trigger: 'blur' },
]">
<el-select
v-model="form.departmentId"
:placeholder="`请选择部门`"
clearable
filterable>
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="产线"
prop="lineId"
:rules="[
{ required: true, message: '请选择产线', trigger: 'blur' },
]">
<el-select
v-model="form.lineId"
:placeholder="`请选择产线`"
clearable
filterable>
<el-option
v-for="opt in lineOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划保养人员" prop="maintainer">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划开始时间" prop="planStartTime">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划结束时间" prop="planEndTime">
<el-input value="---" disabled />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际开始时间"
prop="startTime"
:rules="[
{
required: true,
message: '请选择实际开始时间',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.startTime"
type="datetime"
placeholder="请选择实际开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际结束时间"
prop="endTime"
:rules="[
{
required: true,
message: '请选择实际结束时间',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.endTime"
type="datetime"
placeholder="请选择实际结束时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item
label="实际保养人员"
prop="maintainWorker"
:rules="[
{
required: true,
message: '请选择实际保养人员',
trigger: 'blur',
},
]">
<el-select
v-model="form.maintainWorker"
:placeholder="`请选择实际保养人员`"
multiple
clearable
filterable>
<el-option
v-for="opt in maintainerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" :placeholder="`请输入备注`" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div v-if="showTable">
<SmallTitle>保养内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加属性
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
slot="handleBtn"
label="操作"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="attrTotal > 0"
:total="attrTotal"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">取消</el-button>
<!-- 新增可确认 -->
<el-button v-if="isAdd" type="primary" @click="addConfirm">保存</el-button>
<el-button v-else type="primary" @click="handleConfirm">保存</el-button>
<!-- sections的第二项必须是 属性列表 -->
<!-- <el-button
v-if="sections[1].allowAdd"
type="primary"
@click="handleAddAttr">
添加属性
</el-button> -->
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '../../../../../components/DialogForm/index.vue';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id
data() {
return {
visible: false,
btnLoading: false,
showTable: false,
isAdd: false,
form: {},
formLoading: false,
lineList: [],
maintainerList: [],
departmentList: [],
attrTableProps: [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
{
prop: 'maintenanceDes',
label: '保养描述',
},
],
attrList: [],
attrTotal: 0,
attrTitle: '',
attrForm: {
id: null,
logId: null,
program: null,
maintenanceDes: null,
remark: null,
},
attrFormVisible: false,
attrRows: [
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=false',
// method: 'post',
// queryParams: {
// pageNo: 1,
// pageSize: 100,
// special: true,
// },
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '保养项目',
prop: 'program',
},
],
[
{
input: true,
label: '保养描述',
prop: 'maintenanceDes',
},
],
[
{
input: true,
label: '备注',
prop: 'remark',
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
},
}, //
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
attrFormSubmitting: false,
attrListLoading: false,
// syncFileListFlag: null,
tableBtn: [],
row: {},
};
},
computed: {
departmentOptions() {
return (this.departmentList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
lineOptions() {
return (this.lineList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
maintainerOptions() {
return (this.maintainerList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.name,
}));
},
},
mounted() {
!this.edit && this.getCode('/base/equipment-maintain-plan/getCode');
this.getList('maintainer');
this.getList('department');
this.getList('line');
},
methods: {
// getCode
async getCode(url) {
this.formLoading = true;
const response = await this.$axios(url);
this.formLoading = false;
this.form.maintainOrderNumber = response.data || '';
},
handleSearchBarBtnClick(btn) {
console.log('btn', btn);
switch (btn.btnName) {
case 'search':
this.attrQuery.params.equipmentName = btn.equipmentName;
this.getAttrList();
break;
}
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
async addConfirm() {
console.log('11', this.showTable)
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
this.$nextTick(() => {
this.getConfirmed().then(confirm => {
console.log('111', confirm)
this.$axios({
url:
'/base/equipment-maintain-log/confirm?confirmPerson=' +
this.$store.getters.userId,
method: 'put',
data: [this.form.id],
}).then(res =>{
if (res.code == 0) {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('已确认');
}
})
}).catch(() => {
this.visible = false;
this.$emit("refreshDataList");
this.$message.success('取消确认');
})
})
});
},
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() {
this.btnLoading = true;
// this.$nextTick(async () => {
// const { code, data } = await this.$axios({
// url: '/base/equipment-maintain-log/update',
// method: 'put',
// data: {
// ...this.form,
// maintainWorker: this.form.maintainWorker.join(',')
// },
// });
// if (code == 0) {
// this.$modal.msgSuccess('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.$axios({
url: '/base/equipment-maintain-log/update',
method: 'put',
data: {
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2
}
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.btnLoading = false;
this.$emit('refreshDataList');
this.handleCancel();
});
return;
}
//
this.$axios({
url: '/base/equipment-maintain-log/create',
method: 'post',
data: {
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: false,
}
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.btnLoading = false;
this.form.id = response.data
this.row.id = response.data
this.showTable = true
this.isAdd = true
this.$emit('refreshDataList');
// this.handleCancel();
});
});
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row) {
this.visible = true;
if (row) {
this.row = row;
this.showTable = row ? true : false;
this.$nextTick(() => {
if (row.id) {
this.getInfo(row.id);
this.getAttrList(row.id);
}
})
}
},
async getInfo(id) {
this.formLoading = true;
const res = await this.$axios(
'/base/equipment-maintain-log/get?id=' + id
);
if (res.code == 0) {
this.form = res.data;
this.form.maintainWorker = res.data.maintainWorker.split(',');
this.formLoading = false;
}
this.formLoading = false;
},
async getAttrList(id, condition = {}) {
if (!id) id = this.row.id;
this.attrListLoading = true;
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/page',
method: 'get',
params: {
...this.attrQuery.params,
logId: id,
...condition,
},
});
if (res.code == 0) {
this.attrList = res.data.list;
this.attrTotal = res.data.total;
}
this.attrListLoading = false;
},
async getList(source = 'department') {
const urls = [
'/base/core-production-line/listAll',
'/base/core-department/listAll',
'/base/core-worker/listAll',
];
let res;
switch (source) {
case 'department':
res = await this.$axios(urls[1]);
this.departmentList = res.data || [];
break;
case 'maintainer':
res = await this.$axios(urls[2]);
this.maintainerList = res.data || [];
break;
case 'line':
res = await this.$axios(urls[0]);
this.lineList = res.data || [];
break;
}
this.formLoading = false;
},
//
handleSave() {
this.$refs.form.validate(async (valid) => {
if (valid) {
await this.$axios({
url: '/urlupdate', // this.sections[0][isEdit ? 'urlUpdate' : 'urlCreate'],
method: 'post', // isEdit ? 'put' : 'post',
data: this.form,
});
this.$modal.msgSuccess(`${isEdit ? '更新' : '创建'}成功`);
this.visible = false;
this.$emit('refreshDataList');
}
});
},
handleCancel() {
this.visible = false;
},
resetAttrform() {
this.attrForm = {
id: null,
logId: this.row.id,
maintenanceDes: '',
program: null,
remark: null,
};
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加设备属性';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: '/base/equipment-maintain-log-det/get',
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑设备属性';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该属性?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: 'url delete', // this.sections[1].urlDelete,
method: 'delete',
params: { id: attrId },
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? '/base/equipment-maintain-log-det/update'
: '/base/equipment-maintain-log-det/create',
method: isEdit ? 'put' : 'post',
data: this.attrForm,
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`确定对${
raw.data.name
? '[名称=' + raw.data.name + ']'
: '[序号=' + raw.data._pageIndex + ']'
}进行删除操作?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteProductAttr(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-date-editor,
.drawer >>> .el-select {
width: 100%;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -0,0 +1,539 @@
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'),
url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
.icon_lists li .name,
.icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p,
.markdown>blockquote,
.markdown>.highlight,
.markdown>ol,
.markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li,
.markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p,
.markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li,
.markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong,
.markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th,
.markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor,
.markdown h2:hover .anchor,
.markdown h3:hover .anchor,
.markdown h4:hover .anchor,
.markdown h5:hover .anchor,
.markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br,
.markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment,
.hljs-meta {
color: #969896;
}
.hljs-string,
.hljs-variable,
.hljs-template-variable,
.hljs-strong,
.hljs-emphasis,
.hljs-quote {
color: #df5000;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-type {
color: #a71d5d;
}
.hljs-literal,
.hljs-symbol,
.hljs-bullet,
.hljs-attribute {
color: #0086b3;
}
.hljs-section,
.hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title,
.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection,
pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection,
code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection,
pre[class*="language-"] ::selection,
code[class*="language-"]::selection,
code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function,
.token.class-name {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}

View File

@ -0,0 +1,38 @@
@font-face {
font-family: "iconfont"; /* Project id 3821755 */
src: url('iconfont.eot?t=1689233106339'); /* IE9 */
src: url('iconfont.eot?t=1689233106339#iefix') format('embedded-opentype'), /* IE6-IE8 */
url('data:application/x-font-woff2;charset=utf-8;base64,d09GMgABAAAAAARgAAsAAAAACcAAAAQUAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDKAqGSIUsATYCJAMYCw4ABCAFhGcHVBtUCMiuMG7hiaIkox1FaBhxvd1fpwAN4YKo1v7tWTr8hBRkBQgO7yqKUJKPUKzDjkixjn7/q0vlANCkEHCJtsMvx2eQn04h5rHEE8593TK2y1SC5nbvNG5gqgZBNEWTqFUQLGVFNnVu1TjyMm3SafEsC3y0myW12KdEh2x+deP/zzHTJeG3AVBm4lrnAxpQN0US7s3ijuSE6Jbh1UGv08cgQEivMg5z6m49Qj77TVxDEZww6gXicNkviSbkxgswNeGCj+CgMw1yFRpAnUNegSv+8+UfU/igsBpjnRV3rRV9+Su8Fk1Agv6CW4eAeyvAAhronJlI1tcrVnIMHZ0cCcsUTrRTnQ0CP50B4KfgEub9Lw80BougQBwGI8bYJU4LPwUbBw0/HXAw8NORUM90wsT9JeIMFACux9QckHyQ9FDYTobcGi+FLSjwMxDe3L5s+w9THFYeEs8H303FWMnZ1JuBWFgNPh3bd5wOvJmKI9aTqXeD8eJ66HnfnV1dJPE8cy4EgqT+s/SbdSWbp9Pn24NbZ1MnGw7CDbvT6+lL1CXVh++hcH56umDT9vOviL/grQ6srHjE57uLHdQn+dtO9x2v94WN6+eXm0HWlZOzta3tUDp1JWjymsiD8r0ViWGkC+n4GeH5aODSM+9COnilpdfdZsRIvMerLmS0uICTplrOnb99LT3NkJNeajPfpDznblq6bXH8efBjlPIUxhQcX+U0qEdt4bjxy6rMdOkbEn0/3mlvrXZL60ysxdwcn/qKLJ/82pnzGS61z5rBeGmrxf33ZXN/IBWUvb8KSvnttbwwq+YTkweZHue0M0+c0ssZGY/Rs+aVF8+3GaW07CkvLC/KcBvP8c2uGpsdm0THlazwlPE22Kdi9ZK4Hdsmtw9eHVQwPjG0p33Q7tGMJ6TUJ2VK1MMw6ftI6qPPtruCvEPmLZqiHcj1Aw3Rup/sdzj+lt/w3f5TrAHgx++nD7A+8xaD4CL8m60Q+KWYO7CgUY3gTFl+OwUBHKteh00BoWmGDIYm301frAJwKAg+BTEoPCpA41OPNNh2sET0g8NnCkI61M6PKKBzREwANBtGIOS6BEU2D0CT6xvSYP+Apdg/cOT6DyErI68W0RzbqhmYOFixuRNLFqoRi839Zh+A2KqYWJH1CTC7hM04My0j664HDVgXY+xtYhbnBBNGVVzH7geKQrHOqA0sPK2Fc70oPZ2UPSTNQlVUjQEmHLDCzDphEgtKQ9zCPP16DwBRK4UJAyKfyBg7jaeaxzKlyQAg6xkaKO9M2tu1EWXhOEL3IxhKhdWpMqCYDgrTy7vZAAsuTUsLm65IOlWIQBlp47PUS9wAhBgHOFGixYgVJx7+dtqutZuY1eXTvXYncJOkOF1Wicd+CnBACA==') format('woff2'),
url('iconfont.woff?t=1689233106339') format('woff'),
url('iconfont.ttf?t=1689233106339') format('truetype'),
url('iconfont.svg?t=1689233106339#iconfont') format('svg');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-downward:before {
content: "\e604";
}
.icon-upward:before {
content: "\e605";
}
.icon-detail:before {
content: "\e601";
}
.icon-edit:before {
content: "\e602";
}
.icon-delete:before {
content: "\e603";
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,44 @@
{
"id": "3821755",
"name": "component",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "封装的组件中的icon",
"glyphs": [
{
"icon_id": "36426261",
"name": "downward",
"font_class": "downward",
"unicode": "e604",
"unicode_decimal": 58884
},
{
"icon_id": "36426301",
"name": "upward",
"font_class": "upward",
"unicode": "e605",
"unicode_decimal": 58885
},
{
"icon_id": "33347867",
"name": "detail",
"font_class": "detail",
"unicode": "e601",
"unicode_decimal": 58881
},
{
"icon_id": "33347918",
"name": "edit",
"font_class": "edit",
"unicode": "e602",
"unicode_decimal": 58882
},
{
"icon_id": "33347930",
"name": "delete",
"font_class": "delete",
"unicode": "e603",
"unicode_decimal": 58883
}
]
}

View File

@ -0,0 +1,29 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Created by iconfont</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1024">
<font-face
font-family="iconfont"
font-weight="400"
font-stretch="normal"
units-per-em="1024"
ascent="896"
descent="-128"
/>
<missing-glyph />
<glyph glyph-name="downward" unicode="&#58884;" d="M556.942222 144.099556l363.064889 401.806222c24.860444 21.617778 24.860444 56.263111 0 77.880889a68.437333 68.437333 0 0 1-44.942222 16.156444c-16.896 0-33.052444-5.859556-44.885333-16.156444L512 260.949333l-318.236444 362.951111a68.437333 68.437333 0 0 1-44.942223 16.099556c-16.896 0-33.109333-5.802667-44.942222-16.156444-24.746667-21.617778-24.746667-56.206222 0-77.824l363.121778-401.749334c5.973333-5.290667 13.141333-9.443556 21.048889-12.231111 23.722667-8.305778 51.029333-3.527111 68.892444 12.060445z" horiz-adv-x="1024" />
<glyph glyph-name="upward" unicode="&#58885;" d="M556.942222 623.900444l363.064889-401.806222c24.860444-21.617778 24.860444-56.263111 0-77.880889a68.437333 68.437333 0 0 0-44.942222-16.156444c-16.896 0-33.052444 5.859556-44.885333 16.156444L512 507.050667l-318.236444-362.951111a68.437333 68.437333 0 0 0-44.942223-16.099556c-16.896 0-33.109333 5.802667-44.942222 16.156444-24.746667 21.617778-24.746667 56.206222 0 77.824L467.057778 623.729778c5.973333 5.290667 13.141333 9.443556 21.048889 12.231111 23.722667 8.305778 51.029333 3.527111 68.892444-12.060445z" horiz-adv-x="1024" />
<glyph glyph-name="detail" unicode="&#58881;" d="M902.428444 705.251556H332.401778a7.964444 7.964444 0 0 1-7.793778-8.021334v-56.206222a7.964444 7.964444 0 0 1 7.793778-8.078222h570.026666A7.964444 7.964444 0 0 1 910.222222 641.024v56.206222a7.964444 7.964444 0 0 1-7.793778 8.021334z m0-285.127112H332.401778a7.964444 7.964444 0 0 1-7.793778-7.964444v-56.32a7.964444 7.964444 0 0 1 7.793778-7.964444h570.026666a7.964444 7.964444 0 0 1 7.793778 7.964444v56.32a7.964444 7.964444 0 0 1-7.793778 7.964444z m0-285.070222H332.401778a7.964444 7.964444 0 0 1-7.793778-8.078222v-56.206222a7.964444 7.964444 0 0 1 7.793778-8.021334h570.026666a7.964444 7.964444 0 0 1 7.793778 8.021334v56.206222a7.964444 7.964444 0 0 1-7.793778 8.078222zM113.777778 669.127111c0-20.081778 10.410667-38.684444 27.306666-48.696889a53.361778 53.361778 0 0 1 54.670223 0 56.547556 56.547556 0 0 1 27.306666 48.696889 56.547556 56.547556 0 0 1-27.306666 48.696889 53.361778 53.361778 0 0 1-54.613334 0A56.547556 56.547556 0 0 1 113.777778 669.127111zM113.777778 384c0-20.081778 10.410667-38.684444 27.306666-48.696889a53.361778 53.361778 0 0 1 54.670223 0A56.547556 56.547556 0 0 1 223.061333 384a56.547556 56.547556 0 0 1-27.306666 48.696889 53.361778 53.361778 0 0 1-54.613334 0A56.547556 56.547556 0 0 1 113.777778 384z m0-285.127111c0-20.081778 10.410667-38.684444 27.306666-48.696889a53.361778 53.361778 0 0 1 54.670223 0 56.547556 56.547556 0 0 1 27.306666 48.696889 56.547556 56.547556 0 0 1-27.306666 48.696889 53.361778 53.361778 0 0 1-54.613334 0 56.547556 56.547556 0 0 1-27.363555-48.696889z" horiz-adv-x="1024" />
<glyph glyph-name="edit" unicode="&#58882;" d="M873.016889 395.264a32.824889 32.824889 0 0 0 65.649778 0v-273.806222a164.124444 164.124444 0 0 0-164.124445-164.124445h-525.084444A164.124444 164.124444 0 0 0 85.333333 121.457778v525.084444A164.124444 164.124444 0 0 0 249.457778 810.666667h312.32a32.824889 32.824889 0 1 0 0-65.649778h-312.32a98.417778 98.417778 0 0 1-98.474667-98.417778v-525.141333c0-54.385778 44.088889-98.474667 98.417778-98.474667h525.141333a98.417778 98.417778 0 0 1 98.474667 98.417778V395.320889z m-14.222222 362.097778a32.824889 32.824889 0 0 0 48.014222-44.771556L548.750222 328.533333a32.824889 32.824889 0 1 0-48.014222 44.771556l358.115556 384.056889z" horiz-adv-x="1024" />
<glyph glyph-name="delete" unicode="&#58883;" d="M601.024 146.24a29.632 29.632 0 0 0-29.696 29.696V503.04a29.632 29.632 0 1 0 59.456 0v-326.848a29.76 29.76 0 0 0-29.76-29.888z m-178.24 0a29.632 29.632 0 0 0-29.696 29.696V503.04a29.632 29.632 0 1 0 59.392 0v-326.848a29.76 29.76 0 0 0-29.696-29.888z m475.52 505.216h-148.544v59.456c0 49.152-39.616 89.088-88.512 89.088H363.392c-49.216 0-89.152-39.936-89.152-89.088v-59.456H125.696a29.632 29.632 0 1 1 0-59.392h772.608a29.632 29.632 0 1 1 0 59.392z m-564.608 59.456c0 16.256 13.44 29.696 29.696 29.696h297.856c16.32 0 29.056-13.12 29.056-29.696v-59.456H333.696v59.456zM720-32h-416a89.152 89.152 0 0 0-89.088 89.088V503.232a29.632 29.632 0 1 0 59.456 0v-446.08c0-16.512 13.44-29.76 29.696-29.76h416.064a29.632 29.632 0 0 1 29.696 29.696V502.144a29.632 29.632 0 1 0 59.456 0v-445.056A89.536 89.536 0 0 0 720-32z" horiz-adv-x="1024" />
</font>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@ -0,0 +1,582 @@
<!--
filename: MaintainRecord.vue
author: DY
date: 2023-12-12 13:54:53
description:
-->
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@select-changed="handleSearchBarChange"
@headBtnClick="handleSearchBarBtnClick" />
<WaitingListTable
ref="waiting-list-table"
:table-data="list"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
@edit="handleEdit"
@detail="handleDetail"
@delete="handleDelete"
@confirm="handleConfirm" />
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="60%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogFormUnplanned
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'" />
<el-row v-if="mode === 'detail'" slot="footer" type="flex" justify="end">
<el-col :span="12">
<el-button size="small" class="btnTextStyle" @click="cancel">
关闭
</el-button>
</el-col>
</el-row>
</base-dialog>
<!-- 编辑 -->
<UnplannedEditDrawer
ref="unplanned"
v-if="openUnplannedDrawer"
@refreshDataList="getList"
@destroy="openUnplannedDrawer = false" />
<PlannedEditDrawer
ref="planned"
v-if="openPlannedDrawer"
@refreshDataList="getList"
@destroy="openPlannedDrawer = false" />
<RecordDetail
v-if="recordDetailVisible"
ref="recordDetailDrawer"
@destroy="recordDetailVisible = false" />
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import DialogFormUnplanned from './WaitingList--add--unplanned.vue';
import UnplannedEditDrawer from './WaitingListUnplanned--edit.vue';
import PlannedEditDrawer from './WaitingListPlanned--edit.vue';
import {
exportMaintainLogExcel,
} from '@/api/equipment/base/maintain/record';
import WaitingListTable from './WaitingListTable.vue';
import RecordDetail from './Record--detail.vue';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = {
name: 'tableBtn',
props: ['injectData'],
data() {
return {};
},
methods: {
handleClick() {
this.$emit('emitData', {
action: this.injectData.label,
value: this.injectData,
});
},
},
render: function (h) {
return (
<el-button type="text" onClick={this.handleClick}>
{this.injectData.name}
</el-button>
);
},
};
export default {
name: 'Confirm',
components: {
DialogFormUnplanned,
WaitingListTable,
RecordDetail,
UnplannedEditDrawer,
PlannedEditDrawer
},
mixins: [basicPageMixin],
data() {
return {
recordDetailVisible: false,
searchBarKeys: [
'maintainPlanId',
'startTime',
],
tobeConfirmedIdList: [],
searchBarFormConfig: [
{
type: 'select',
label: '保养计划名称',
placeholder: '请选择保养计划名称',
param: 'maintainPlanId',
defaultSelect: null,
},
//
{
type: 'datePicker',
label: '实际开始时间',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'startTime',
defaultSelect: null,
// width: 350,
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: 'button',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
{
type: 'button',
btnName: '批量确认',
name: 'batchConfirm',
color: 'primary',
plain: true,
},
{
type: this.$auth.hasPermi('equipment:maintain-record:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
plain: true,
color: 'primary',
},
// {
// type: this.$auth.hasPermi('equipment:maintain-record:create')
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintainPlanId: null,
startTime: null,
special: false,
confirmed: false,
},
//
form: {},
basePath: '/base/equipment-maintain-log',
mode: null,
allSpecialEquipments: [],
openPlannedDrawer: false,
openUnplannedDrawer: false,
openPlannedDrawer: false,
};
},
watch: {
tobeConfirmedIdList: {
handler(val) {
if (val.length == this.list.length) {
this.$refs['table'].toggleAllSelection();
}
},
},
},
created() {
this.initSearchBar();
// if (this.$route.query) {
// this.queryParams.specialType =
// this.$route.query?.specialType ?? undefined;
// this.queryParams.equipmentId =
// this.$route.query?.equipmentId ?? undefined;
// this.queryParams.maintainPlanId =
// this.$route.query?.maintainPlanId ?? undefined;
// this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined;
// this.queryParams.startTime = this.$route.query?.createTime ?? undefined;
// this.searchBarFormConfig[0].defaultSelect =
// this.$route.query.specialType ?? undefined;
// this.searchBarFormConfig[1].defaultSelect =
// this.$route.query.equipmentId ?? undefined;
// this.searchBarFormConfig[2].defaultSelect =
// this.$route.query.maintainPlanId ?? undefined;
// this.searchBarFormConfig[3].defaultSelect =
// this.$route.query?.createTime ?? undefined;
// this.searchBarFormConfig[4].defaultSelect =
// Number(this.$route.query.relatePlan) ?? undefined;
// }
this.getList();
// if (this.$route.query.addRecord) {
// this.handleAdd();
// }
},
methods: {
/** 批量确认 */
async searchBarClicked(btn) {
switch (btn.btnName) {
case 'batchConfirm':
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备保养记录');
return;
}
this.$modal
.confirm('是否确认所有选中保养单"?')
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/confirm',
method: 'put',
data: this.$refs['waiting-list-table'].selectedPlan.map(
(item) => item.id
),
});
// if (res.code == 0) {
// this.$message.success('');
// this.getList();
// }
})
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
break;
}
},
handleSelectionChange(list) {
if (this.tobeConfirmedIdList.length) {
this.tobeConfirmedIdList = [];
this.list.forEach((item) => {
this.handleEmitFun({
action: 'row-selected',
value: { row: item, selected: false },
});
});
console.log(
'清空选择列表',
this.list.map((item) => item._selection)
);
} else {
this.tobeConfirmedIdList = list.map((item) => item.id);
this.list.forEach((item) => {
this.handleEmitFun({
action: 'row-selected',
value: { row: item, selected: true },
});
});
console.log(
'全选',
this.list.map((item) => item._selection)
);
}
},
handleEmitFun({ action, value }) {
switch (action) {
case '详情':
this.recordDetailVisible = true;
this.$nextTick(() => {
this.$refs.recordDetailDrawer.show({
id: value.id,
planMaintainWorker: value.planMaintainWorker,
maintainWorker: value.maintainWorker,
});
});
break;
case 'row-selected':
if (value.selected) {
this.tobeConfirmedIdList.push(value.row.id);
value.row._selection = 0b11;
} else {
const index = this.tobeConfirmedIdList.indexOf(value.row.id);
if (index != -1) {
this.tobeConfirmedIdList.splice(index, 1);
}
}
console.log('tobeConfirmedIdList', this.tobeConfirmedIdList);
break;
}
},
handleSearchBarChange({ param, value }) {
console.log('122', param)
// if ('specialType' === param) {
// if (!value) {
// this.setSearchBarEquipmentList(this.allSpecialEquipments);
// return;
// }
// this.setSearchBarEquipmentList(
// this.allSpecialEquipments.filter((item) => item.specialType == value)
// );
// }
},
initSearchBar() {
// this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
// this.allSpecialEquipments = data.filter((item) => item.special);
// this.setSearchBarEquipmentList(data.filter((item) => item.special));
// });
this.http('/base/equipment-maintain-plan/page', 'get', {
pageNo: 1,
pageSize: 100,
special: false,
}).then(({ data }) => {
this.$set(
this.searchBarFormConfig[0],
// this.searchBarFormConfig[2],
'selectOptions',
(data?.list || []).map((item) => ({
name: item.name,
id: item.id,
}))
);
});
},
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv({
...this.queryParams,
special: false,
// relatePlan: 2,
confirmed: false,
}).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.mode = null;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
id: null,
relatePlan: null,
maintainWorker: [],
maintainOrderNumber: null,
departmentId: null,
lineId: null,
startTime: null,
endTime: null,
planStartTime: null,
planEndTime: null,
confirmed: false,
remark: null,
special: false,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
// this.reset();
// this.open = true;
// this.title = '';
this.openUnplannedDrawer = true;
this.$nextTick(() => {
this.$refs.unplanned.init();
});
},
getConfirmed() {
return this.$confirm('是否直接确认保养记录', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.getConfirmed()
.then((confirmed) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: true,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
})
.catch((err) => {
this.post({
...this.form,
maintainWorker: this.form.maintainWorker.join(','),
special: false,
relatePlan: 2,
confirmed: false,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
});
},
/** 确认 */
async handleConfirm(row) {
this.$modal
.confirm('是否确认保养单"' + row.maintainOrderNumber + '"?')
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/confirm',
method: 'put',
data: [row.id],
});
// if (res.code == 0) {
// this.$message.success('');
// this.getList();
// }
})
.then((res) => {
this.getList();
res.code == 0 && this.$modal.msgSuccess('确认成功');
res.code != 0 && this.$modal.msgError('确认失败');
})
.catch(() => {});
},
/** 编辑 */
async handleEdit(row) {
this.reset();
if (row.relatePlan == 1) {
//
// const res = await this.info({ id: row.id });
// this.form = res.data;
// this.form.maintainWorker = res.data.maintainWorker.split(',');
this.openPlannedDrawer = true;
this.$nextTick(() => {
this.$refs.planned.init(row);
});
} else {
this.openUnplannedDrawer = true;
this.$nextTick(() => {
this.$refs.unplanned.init(row);
});
}
},
/** 删除按钮操作 */
handleDelete(row) {
this.$modal
.confirm(
'是否确认删除设备保养单号为"' + row.maintainOrderNumber + '"的数据项?'
)
.then(() => {
return this.$axios({
url: '/base/equipment-maintain-log/delete?id=' + row.id,
method: 'delete',
});
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(console.error);
},
handleDetail(row) {
this.recordDetailVisible = true;
this.$nextTick(() => {
this.$refs.recordDetailDrawer.show({
id: row.id,
planMaintainWorker: row.planMaintainWorker,
maintainWorker: row.maintainWorker,
});
});
},
/** 导出按钮操作 */
handleExport() {
//
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal
.confirm('是否确认导出所有待确认的保养记录?')
.then(() => {
this.exportLoading = true;
return exportMaintainLogExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备保养待确认记录.xls');
this.exportLoading = false;
})
.catch(() => {});
},
},
};
</script>

View File

@ -31,7 +31,7 @@
@pagination="getList" /> @pagination="getList" />
<!-- 对话框(添加 / 修改) --> <!-- 对话框(添加 / 修改) -->
<base-dialog <!-- <base-dialog
:dialogTitle="title" :dialogTitle="title"
:dialogVisible="open" :dialogVisible="open"
@close="cancel" @close="cancel"
@ -43,7 +43,12 @@
v-model="form" v-model="form"
:has-files="false" :has-files="false"
:rows="rows" /> :rows="rows" />
</base-dialog> </base-dialog> -->
<add-content
v-if="addContent"
ref="addContent"
:plan="true"
@refreshDataList="addContent = false" />
</div> </div>
</template> </template>
@ -53,6 +58,7 @@ import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { exportMaintainMonitorExcel } from '@/api/equipment/base/maintain/record' import { exportMaintainMonitorExcel } from '@/api/equipment/base/maintain/record'
import { parseTime } from '@/utils/ruoyi' import { parseTime } from '@/utils/ruoyi'
import AddContent from '../PlanConfig/addContent.vue';
const remainBox = { const remainBox = {
name: 'RemainBox', name: 'RemainBox',
@ -107,11 +113,12 @@ const btn = {
}; };
export default { export default {
name: 'PlanConfig', name: 'Monitor',
components: {}, components: { AddContent },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
addContent: false,
searchBarKeys: ['planId', 'equipmentId'], searchBarKeys: ['planId', 'equipmentId'],
tableProps: [ tableProps: [
// { // {
@ -121,46 +128,53 @@ export default {
// width: 180, // width: 180,
// filter: parseTime(createTime), // filter: parseTime(createTime),
// }, // },
{ prop: 'name', label: '保养计划' }, { prop: 'code', label: '保养计划单号' },
{ prop: 'name', label: '保养计划名称' },
{ prop: 'departmentName', label: '部门' },
{ prop: 'lineName', label: '产线名' }, { prop: 'lineName', label: '产线名' },
{ prop: 'sectionName', label: '工段名' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'maintenancePeriod', label: '保养频率' },
{ {
prop: 'maintainType', prop: 'lastPlanMaintainTime',
label: '保养类型', label: '上次计划保养时间',
filter: publicFormatter(this.DICT_TYPE.MAINTAIN_TYPE), filter: parseTime,
}, },
{ {
prop: 'lastMaintainTime', prop: 'lastMaintainTime',
label: '上次保养时间', label: '上次实际保养时间',
filter: parseTime, filter: parseTime,
}, },
{ prop: 'nextMaintainTime', label: '计划下次保养时间', filter: parseTime }, { prop: 'nextPlanMaintainTime', label: '下次计划保养时间', filter: parseTime },
{ prop: 'maintainer', label: '计划保养人员' },
// { prop: 'equipmentName', label: '' },
// { prop: 'equipmentCode', label: '' },
// { prop: 'maintenancePeriod', label: '' },
// {
// prop: 'maintainType',
// label: '',
// filter: publicFormatter(this.DICT_TYPE.MAINTAIN_TYPE),
// },
// { prop: 'opt1', label: '', name: '', subcomponent: btn },
{ prop: 'opt2', label: '保养内容', name: '详情', subcomponent: btn },
{ {
prop: 'remainDays', prop: 'remainDays',
label: '距离保养时间(天)', label: '距离下次保养剩余时间(天)',
subcomponent: remainBox, subcomponent: remainBox,
}, }
{ prop: 'opt1', label: '设备保养', name: '操作', subcomponent: btn },
{ prop: 'opt2', label: '保养记录', name: '查看详情', subcomponent: btn },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
type: 'select', type: 'select',
label: '保养计划', label: '保养计划名称',
placeholder: '请选择保养计划', placeholder: '请选择保养计划',
param: 'planId', param: 'planId',
filterable: true, filterable: true,
}, },
{ // {
type: 'select', // type: 'select',
label: '设备名', // label: '',
placeholder: '请选择设备', // placeholder: '',
param: 'equipmentId', // param: 'equipmentId',
filterable: true, // filterable: true,
}, // },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -206,13 +220,13 @@ export default {
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
this.$modal this.$modal
.confirm('是否确认导出所有设备保养监控数据项?') .confirm('是否确认导出所有设备保养计划数据项?')
.then(() => { .then(() => {
this.exportLoading = true; this.exportLoading = true;
return exportMaintainMonitorExcel(params); return exportMaintainMonitorExcel(params);
}) })
.then((response) => { .then((response) => {
this.$download.excel(response, '设备保养监控.xls'); this.$download.excel(response, '设备保养计划.xls');
this.exportLoading = false; this.exportLoading = false;
}) })
.catch(() => { }); .catch(() => { });
@ -255,13 +269,18 @@ export default {
row: value row: value
} }) } })
break; break;
case '保养记录': case '保养内容':
const queryData = { //
equipmentId: value.equipmentId, this.addContent = true;
maintainPlanId: value.id, this.$nextTick(() => {
relatePlan: value.lastMaintainTime ? 1 : 2 this.$refs.addContent.init(value.id, true);
} });
this.$router.push({ path: '/equipment/base/maintain/record',query: queryData }) // const queryData = {
// equipmentId: value.equipmentId,
// maintainPlanId: value.id,
// relatePlan: value.lastMaintainTime ? 1 : 2
// }
// this.$router.push({ path: '/equipment/base/maintain/record',query: queryData })
break; break;
} }
}, },

View File

@ -0,0 +1,65 @@
<!--
* @Author: zwq
* @Date: 2023-08-01 15:27:31
* @LastEditors: zwq
* @LastEditTime: 2023-08-01 16:25:54
* @Description:
-->
<template>
<div :class="[className, { 'p-0': noPadding }]">
<slot />
</div>
</template>
<script>
export default {
props: {
size: {
// : xl lg md sm
type: String,
default: 'de',
validator: function (val) {
return ['xl', 'lg', 'de', 'md', 'sm'].indexOf(val) !== -1;
},
},
noPadding: {
type: Boolean,
default: false,
},
},
computed: {
className: function () {
return `${this.size}-title`;
},
},
};
</script>
<style lang="scss" scoped>
$pxls: (xl, 28px) (lg, 24px) (de, 20px) (md, 18px) (sm, 16px);
$mgr: 8px;
@each $size, $height in $pxls {
.#{$size}-title {
font-size: 18px;
line-height: $height;
color: #000;
font-weight: 500;
font-family: '微软雅黑', 'Microsoft YaHei', Arial, Helvetica, sans-serif;
&::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: $height + 2px;
border-radius: 1px;
margin-right: $mgr;
background-color: #0b58ff;
}
}
}
.p-0 {
padding: 0;
}
</style>

View File

@ -0,0 +1,299 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-28 19:52:13
* @Description:
-->
<template>
<!-- <el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : !dataForm.id ? '新增' : '编辑' }}
</small-title> -->
<div class="content">
<div class="visual-part">
<el-form
:model="dataForm"
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-position="top">
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="保养计划名称" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入保养计划名称" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="保养计划编码" prop="code">
<el-input
v-model="dataForm.code"
clearable
:disabled="isdetail"
placeholder="请输入保养计划编码" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="部门" prop="departmentId">
<treeselect v-model="dataForm.departmentId" :options="menuOptions" :normalizer="normalizer" :show-count="true" placeholder="选择部门"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线名" prop="lineId">
<el-select
v-model="dataForm.lineId"
filterable
placeholder="请选择产线"
style="width: 100%">
<el-option
v-for="dict in proLineList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="保养频率(天/次)" prop="maintenancePeriod">
<el-input-number v-model="dataForm.maintenancePeriod" :min="0" controls-position="right" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入保养频率" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="确认时限(h)" prop="confirmTimeLimit">
<el-input-number v-model="dataForm.confirmTimeLimit" :min="0" controls-position="right" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入单位平方数" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="保养时长(h)" prop="maintainDuration">
<el-input-number v-model="dataForm.maintainDuration" :min="0" controls-position="right" style="width: 100%" :disabled="isdetail" clearable placeholder="请输入保养时长" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="首次保养时间" prop="firstMaintenanceTime">
<el-date-picker
v-model="dataForm.firstMaintenanceTime"
type="date"
format='yyyy-MM-dd'
:disabled="isedit"
value-format='timestamp'
placeholder="选择首次保养时间"
style="width: 100%" />
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="计划保养人员" prop="maintainer">
<el-select v-model="dataForm.maintainer" placeholder="请选择计划保养人员" style="width: 100%;" :disabled="isdetail" multiple filterable>
<el-option
v-for="item in personList"
:key="item.id"
:label="item.name"
:value="item.name">
</el-option>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" :disabled="isdetail" clearable placeholder="请输入备注" />
</el-form-item>
</el-form>
</div>
</div>
</template>
<script>
import basicAdd from '../../../../core/mixins/basic-add';
// import { getCoreProductAttrPage, deleteCoreProductAttr } from "@/api/base/coreProduct";
import { getWorkerList } from '@/api/base/worker'
import { getCoreDepartmentList } from "@/api/base/coreDepartment";
import { createPlan, updatePlan, getCode, getPlan } from '@/api/equipment/base/maintain/planconfig';
import { getCorePLList } from '@/api/base/coreProductionLine';
import { parseTime } from '../../../../core/mixins/code-filter';
import attrAdd from './attr-add';
// import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import Treeselect from "@riophae/vue-treeselect";
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
export default {
mixins: [basicAdd],
components: { attrAdd, Treeselect },
data() {
return {
addOrUpdateVisible: false,
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createPlan,
updateURL: updatePlan,
infoURL: getPlan
},
dataForm: {
id: undefined,
code: undefined,
name: '',
departmentId: undefined,
lineId: undefined,
maintenancePeriod: undefined,
confirmTimeLimit: undefined,
maintainDuration: undefined,
remark: undefined,
firstMaintenanceTime: undefined,
maintainer: undefined
},
menuOptions: [],
proLineList: [],
personList: [],
visible: false,
isdetail: false,
isedit: false,
dataRule: {
code: [{ required: true, message: "保养计划编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "保养计划名称不能为空", trigger: "blur" }],
departmentId: [{ required: true, message: "部门不能为空", trigger: "change" }],
lineId: [{ required: true, message: "产线不能为空", trigger: "change" }],
maintenancePeriod: [{ required: true, message: "保养频率不能为空", trigger: "blur" }],
confirmTimeLimit: [{ required: true, message: "确认时限不能为空", trigger: "blur" }],
maintainDuration: [{ required: true, message: "保养时长不能为空", trigger: "blur" }],
firstMaintenanceTime: [{ required: true, message: "首次保养时间不能为空", trigger: "blur" }],
maintainer: [{ required: true, message: "计划保养人员不能为空", trigger: "blur" }]
}
};
},
mounted() {
this.getDict()
},
methods: {
async getDict() {
//
this.menuOptions = []
const res = await getCoreDepartmentList();
this.departmentlList = res.data.map(item => {
item.parentId = item.parentId ? item.parentId : 0
return item
});
// const menu = { id: 0, name: '', children: [] };
// menu.children = this.handleTree(this.departmentlList, "id")
this.menuOptions = this.handleTree(this.departmentlList, "id")
// 线
const resline = await getCorePLList();
this.proLineList = resline.data;
//
const personres = await getWorkerList()
this.personList = personres.data || []
},
getList() {
//
// getCoreProductAttrPage({
// ...this.listQuery,
// productId: this.dataForm.id,
// }).then((response) => {
// this.productAttrList = response.data.list;
// this.listQuery.total = response.data.total;
// });
},
init(id, isdetail) {
// this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.isedit = id ? true : false;
this.visible = true;
// if (id) {
// this.idAttrShow = true
// } else {
// this.idAttrShow = false
// }
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
this.urlOptions.infoURL({ id: this.dataForm.id }).then(response => {
this.dataForm = response.data
if (response.data?.maintainer) {
this.dataForm.maintainer = response.data?.maintainer.split(',') || undefined
} else {
this.$set(this.dataForm, 'maintainer', undefined)
this.dataForm.maintainer = undefined
}
});
//
// this.getList();
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
this.initData();
},
goEdit() {
this.isdetail = false;
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
/** 转换菜单数据结构 */
normalizer(node) {
if (node.children && !node.children.length) {
delete node.children;
}
return {
id: node.id,
label: node.name,
children: node.children
};
},
//
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
//
if (this.dataForm.id) {
this.urlOptions.updateURL({
...this.dataForm,
maintainer: this.dataForm.maintainer.join(',')
}).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
//
this.urlOptions.createURL({
...this.dataForm,
maintainer: this.dataForm.maintainer.join(',')
}).then(response => {
this.$modal.msgSuccess("新增成功");
// this.idAttrShow = true
this.dataForm.id = response.data
this.visible = false;
this.$emit("refreshDataList");
});
});
}
}
};
</script>
<style scoped>
</style>

View File

@ -0,0 +1,330 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-28 19:37:19
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ plan ? '详情' : '添加内容' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">保养计划名称</div>
<div class="lightTip">{{ dataForm.name }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">部门</div>
<div class="lightTip">{{ dataForm.departmentName }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">产线名</div>
<div class="lightTip">{{ dataForm.lineName }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">保养频率</div>
<div class="lightTip">{{ dataForm.maintenancePeriod }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">保养时长</div>
<div class="lightTip">{{ dataForm.maintainDuration }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">计划保养人员</div>
<div class="lightTip">{{ dataForm.maintainer }}</div>
</el-col>
</el-row>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
保养内容
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table
:table-props="plan ? tableProps1 : tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="planList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="goback()">确定</el-button>
</div>
</div>
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:plan-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { getPlan, deletePlanDet, getPlanDetPage } from '@/api/equipment/base/maintain/planconfig';
// import { listData } from "@/api/system/dict/data";
import SmallTitle from './SmallTitle';
// import { parseTime } from '../../../../core/mixins/code-filter';
import attrAdd from './attr-add';
// import { getDictDatas } from "@/utils/dict";
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
];
const tableProps1 = [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
{
prop: 'maintenanceDes',
label: '保养描述',
},
];
export default {
mixins: [basicAdd],
components: { SmallTitle, attrAdd },
props: {
plan: {
type: Boolean,
default: false
}
},
data() {
return {
tableBtn,
tableProps,
tableProps1,
addOrUpdateVisible: false,
urlOptions: {
isGetCode: false,
infoURL: getPlan
},
listQuery: {
pageSize: 99,
pageNo: 1,
total: 0
},
dataForm: {},
planList: [],
visible: false,
isdetail: false,
idAttrShow: false
};
},
mounted() {},
methods: {
initData() {
this.planList.splice(0);
this.listQuery.total = 0;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除保养项目名为"${raw.data.program}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deletePlanDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getPlanDetPage({
...this.listQuery,
planId: this.dataForm.id,
}).then((response) => {
this.planList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => {
if (this.dataForm.id) {
//
this.urlOptions.infoURL({ id: id}).then(response => {
this.dataForm = response.data;
});
//
this.getList();
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 18vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
/* height: 16px; */
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;
}
</style>

View File

@ -0,0 +1,167 @@
<template>
<el-dialog
:visible.sync="visible"
:width="'35%'"
:append-to-body="true"
:close-on-click-modal="false"
class="dialog">
<template #title>
<slot name="title">
<div class="titleStyle">
{{ !dataForm.id ? '新增' : '编辑' }}
</div>
</slot>
</template>
<el-form
ref="dataForm"
:model="dataForm"
:rules="dataRule"
label-width="100px"
@keyup.enter.native="dataFormSubmit()">
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
filterable
style="width: 100%"
placeholder="请选择设备">
<el-option
v-for="dict in eqList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
</el-select>
</el-form-item>
<el-form-item label="保养项目" prop="program">
<el-input
v-model="dataForm.program"
placeholder="请输入保养项目"
clearable />
</el-form-item>
<el-form-item label="保养描述" prop="maintenanceDes">
<el-input
v-model="dataForm.maintenanceDes"
placeholder="请输入保养描述"
clearable />
</el-form-item>
</el-form>
<el-row style="text-align: right">
<el-button @click="visible = false">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</el-row>
</el-dialog>
</template>
<script>
import { createPlanDet, updatePlanDet, getPlanDet } from '@/api/equipment/base/maintain/planconfig';
import { getEquipmentPage } from '@/api/base/equipment'
export default {
props: {
planId: {
type: String,
default: '',
},
},
data() {
return {
visible: false,
eqList: [],
dataForm: {
id: undefined,
equipmentId: '',
program: '',
maintenanceDes: ''
},
dataRule: {
equipmentId: [{ required: true, message: '设备不能为空', trigger: 'change' }],
program: [{ required: true, message: '保养项目不能为空', trigger: 'blur' }],
maintenanceDes: [{ required: true, message: '保养描述不能为空', trigger: 'blur' }]
},
};
},
created() {
this.getDict()
},
methods: {
async getDict() {
const res = await getEquipmentPage({
pageNo: 1,
pageSize: 100,
special: false
})
this.eqList = res.data.list
},
init(id) {
this.dataForm.id = id || '';
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
getPlanDet({
id: this.dataForm.id
}).then((res) => {
const { equipmentId, program, maintenanceDes } = res.data;
this.dataForm.equipmentId = equipmentId;
this.dataForm.program = program;
this.dataForm.maintenanceDes = maintenanceDes;
});
}
});
},
//
dataFormSubmit() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
//
if (this.dataForm.id) {
updatePlanDet({
...this.dataForm,
planId: this.planId,
}).then((response) => {
this.$modal.msgSuccess('修改成功');
this.visible = false;
this.$emit('refreshDataList');
});
return;
}
//
createPlanDet({
...this.dataForm,
planId: this.planId,
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.visible = false;
this.$emit('refreshDataList');
});
}
});
},
},
};
</script>
<style scoped>
.dialog >>> .el-dialog__body {
padding: 30px 24px;
}
.dialog >>> .el-dialog__header {
font-size: 16px;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
padding: 13px 24px;
border-bottom: 1px solid #e9e9e9;
}
.dialog >>> .el-dialog__header .titleStyle::before {
content: '';
display: inline-block;
width: 4px;
height: 16px;
background-color: #0b58ff;
border-radius: 1px;
margin-right: 8px;
position: relative;
top: 2px;
}
</style>

View File

@ -1,143 +1,150 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <search-bar
<SearchBar :formConfigs="formConfig"
:formConfigs="searchBarFormConfig" ref="searchBarForm"
ref="search-bar" @headBtnClick="buttonClick" />
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table <base-table
v-loading="dataListLoading"
:table-props="tableProps" :table-props="tableProps"
:page="queryParams.pageNo" :page="listQuery.pageNo"
:limit="queryParams.pageSize" :limit="listQuery.pageSize"
:table-data="list" :table-data="tableData">
@emitFun="handleEmitFun">
<method-btn <method-btn
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
:width="150"
label="操作" label="操作"
:width="120"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleClick" />
</base-table> </base-table>
<!-- 分页组件 -->
<pagination <pagination
v-show="total > 0" :limit.sync="listQuery.pageSize"
:total="total" :page.sync="listQuery.pageNo"
:page.sync="queryParams.pageNo" :total="listQuery.total"
:limit.sync="queryParams.pageSize" @pagination="getDataList" />
@pagination="getList" /> <!-- <add-or-update
v-if="addOrUpdateVisible"
<!-- 对话框(添加 / 修改) --> ref="addOrUpdate"
@refreshDataList="getDataList" /> -->
<base-dialog <base-dialog
:dialogTitle="title" :dialogTitle="addOrEditTitle"
:dialogVisible="open" :dialogVisible="addOrUpdateVisible"
@close="cancel" @cancel="handleCancel"
@cancel="cancel" @confirm="handleConfirm"
@confirm="submitForm"> :before-close="handleCancel"
<DialogForm width="55%">
v-if="open" <add-or-update
ref="form" ref="addOrUpdate"
v-model="form" @refreshDataList="successSubmit"></add-or-update>
:has-files="false"
:rows="rows" />
</base-dialog> </base-dialog>
<add-content
v-if="addContent"
ref="addContent"
@refreshDataList="addContent = false" />
</div> </div>
</template> </template>
<script> <script>
import moment from 'moment'; import AddOrUpdate from './add-or-updata';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import AddContent from './addContent';
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record' import basicPage from '../../../../core/mixins/basic-page';
import { parseTime, toDay } from '../../../../core/mixins/code-filter';
import { publicFormatter } from '@/utils/dict'; import { publicFormatter } from '@/utils/dict';
import { getPlanPage } from '@/api/equipment/base/maintain/planconfig';
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record';
const tableProps = [
// {
// prop: 'createTime',
// label: '',
// filter: parseTime
// },
{
prop: 'name',
label: '保养计划名称'
},
{
prop: 'departmentName',
label: '部门'
},
{
prop: 'lineName',
label: '产线名'
},
{
prop: 'maintenancePeriod',
label: '保养频率(天/次)'
},
{
prop: 'firstMaintenanceTime',
label: '首次保养时间',
filter: parseTime
},
{
prop: 'maintainDuration',
label: '保养时长'
},
{
prop: 'maintainer',
label: '计划保养人员'
},
{
prop: 'confirmTimeLimit',
label: '确认时限',
filter: toDay
},
{
prop: 'remark',
label: '备注'
}
];
export default { export default {
name: 'PlanConfig', mixins: [basicPage],
components: {},
mixins: [basicPageMixin],
data() { data() {
const t = new Date();
const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()];
return { return {
searchBarKeys: ['equipmentName', 'createTime'], urlOptions: {
tableBtn: [ getDataListURL: getPlanPage,
{ deleteURL: deleteEqMaintainPlan
type: 'detail',
btnName: '保养记录',
}, },
this.$auth.hasPermi('equipment:plan-config:update') tableProps,
addContent: false,
listQuery: {
pageSize: 10,
pageNo: 1,
total: 0,
special: false,
planName: undefined
},
tableBtn: [
this.$auth.hasPermi(`equipment:plan-config:add`)
? { ? {
type: 'edit', type: 'add',
btnName: '修改', btnName: '添加内容',
} }
: undefined, : undefined,
this.$auth.hasPermi('equipment:plan-config:delete') this.$auth.hasPermi(`equipment:plan-config:update`)
? {
type: 'edit',
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi(`equipment:plan-config:delete`)
? { ? {
type: 'delete', type: 'delete',
btnName: '删除', btnName: '删除',
} }
: undefined, : undefined,
].filter((v) => v), ].filter((v)=>v),
tableProps: [ tableData: [],
{ formConfig: [
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '计划名称' },
{ prop: 'code', label: '计划编号' },
{ prop: 'enabled', label: '启用状态', filter: (val) => ['停用', '启用'][val] },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'maintainDuration', label: '计划保养用时(h)' },
{ prop: 'maintenancePeriod', label: '保养频率(天/次)' },
{ prop: 'maintainType', label: '保养类型', filter: publicFormatter('maintain_type') },
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
{ {
type: 'input', type: 'input',
label: '设备名', label: '保养计划名称',
placeholder: '请输入设备名称', placeholder: '保养计划名称',
param: 'equipmentName', param: 'planName'
}, },
//
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
// // valueFormat: 'timestamp',
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// defaultTime: ['00:00:00', '23:59:59'],
// param: 'createTime',
// // defaultSelect: [
// // new Date(y, m, d)
// // .toLocaleString()
// // .split('/')
// // .map((item, index) => {
// // if (index == 1 || index == 2) return item.padStart(2, '0');
// // return item;
// // })
// // .join('-'),
// // new Date(y, m, d, 23, 59, 59)
// // .toLocaleString()
// // .split('/')
// // .map((item, index) => {
// // if (index == 1 || index == 2) return item.padStart(2, '0');
// // return item;
// // })
// // .join('-'),
// // ],
// },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -148,228 +155,81 @@ export default {
type: 'separate', type: 'separate',
}, },
{ {
type: this.$auth.hasPermi('equipment:plan-config:create') type: this.$auth.hasPermi('equipment:plan-config:create') ? 'button' : '',
? 'button'
: '',
btnName: '新增', btnName: '新增',
name: 'add', name: 'add',
plain: true,
color: 'success', color: 'success',
}, plain: true
// {
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '计划名称',
prop: 'name',
rules: [{ required: true, message: '计划名称不能为空', trigger: 'blur' }],
},
{
input: true,
label: '计划编号',
prop: 'code',
url: '/base/equipment-maintain-plan/getCode',
rules: [{ required: true, message: '计划编号不能为空', trigger: 'blur' }],
}, },
], ],
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
// url: '/base/core-equipment/listAll?special=false',
url: '/base/core-equipment/page?special=false&pageNo=1&pageSize=99',
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
},
{
select: true,
label: '保养类型',
prop: 'maintainType',
options: this.getDictDatas(this.DICT_TYPE.MAINTAIN_TYPE),
},
],
[
{
input: true,
label: '保养时长(h)',
prop: 'maintainDuration',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
},
{
input: true,
label: '保养频率(天/次)',
prop: 'maintenancePeriod',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
rules: [{ required: true, message: '保养频率不能为空', trigger: 'blur' }],
},
],
[
{
switch: true,
label: '启用状态',
prop: 'enabled',
bind: {
'active-value': 1,
'inactive-value': 0,
},
}
],
[{ input: true, label: '备注', prop: 'remark' }],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
special: false,
equipmentName: null,
createTime: null,
},
//
form: {},
basePath: '/base/equipment-maintain-plan',
}; };
}, },
created() { components: {
if (this.$route.query) { AddOrUpdate,
this.queryParams.equipmentId = this.$route.query?.equipmentId ?? undefined AddContent
this.searchBarFormConfig[0].defaultSelect = this.$route.query.equipmentName ?? undefined
}
this.getList();
}, },
created() {},
methods: { methods: {
/** 查询列表 */ //
getList() { deleteHandle(id, name, index) {
this.loading = true; this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
// confirmButtonText: "确定",
this.recv(this.queryParams).then((response) => { cancelButtonText: "取消",
this.list = response.data.list; type: "warning",
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
code: null,
name: null,
equipmentId: null,
enabled: null,
maintenancePeriod: null,
maintainDuration: null,
maintainType: null,
remark: null,
enabled: 1
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加保养计划';
},
handleDetail(row){
// alert(' ')
// console.log(row)
const queryData = {
equipmentId: row.equipmentId,
maintainPlanId: row.id,
isAdd: 1
// relatePlan: row.enabled
}
if (this.queryParams.createTime) {
queryData.createTime = this.queryParams.createTime
}
console.log('你好', queryData)
this.$router.push({ path: '/equipment/base/maintain/record',query: queryData })
// this.$router.push({ path: '/equipment/base/maintain/record', query: { orderNo: row.orderNo }})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
this.info({ id }).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改保养计划';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除计划名称为"' + row.name + '"的数据项?')
.then(function () {
return deleteEqMaintainPlan(id);
}) })
.then(() => { .then(() => {
this.getList(); this.urlOptions.deleteURL(id).then(({ data }) => {
this.$modal.msgSuccess('删除成功'); this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
}) })
.catch(() => {}); .catch(() => { });
},
//
otherMethods(val) {
if (val.type === 'add') {
this.addContent = true;
// this.addOrEditTitle = '';
this.$nextTick(() => {
this.$refs.addContent.init(val.data.id);
});
}
},
buttonClick(val) {
switch (val.btnName) {
case 'search':
// this.listQuery.pageNo = 1;
// this.listQuery.pageSize = 10;
this.listQuery.planName = val.planName ? val.planName : undefined;
this.listQuery.code = val.code ? val.code : undefined;
this.getDataList();
break;
case 'reset':
this.$refs.searchBarForm.resetForm();
this.listQuery = {
pageSize: 10,
pageNo: 1,
total: 1,
};
this.getDataList();
break;
case 'add':
this.addOrEditTitle = '新增';
this.addOrUpdateVisible = true;
this.addOrUpdateHandle();
break;
case 'export':
this.handleExport();
break;
default:
console.log(val);
}
}, },
}, },
}; };

View File

@ -0,0 +1,376 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
<DialogForm
v-if="open"
ref="form"
v-model="form"
:has-files="false"
:rows="rows" />
</base-dialog>
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record'
import { publicFormatter } from '@/utils/dict';
export default {
name: 'PlanConfig',
components: {},
mixins: [basicPageMixin],
data() {
const t = new Date();
const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()];
return {
searchBarKeys: ['equipmentName', 'createTime'],
tableBtn: [
{
type: 'detail',
btnName: '保养记录',
},
this.$auth.hasPermi('equipment:plan-config:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:plan-config:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'name', label: '计划名称' },
{ prop: 'code', label: '计划编号' },
{ prop: 'enabled', label: '启用状态', filter: (val) => ['停用', '启用'][val] },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'maintainDuration', label: '计划保养用时(h)' },
{ prop: 'maintenancePeriod', label: '保养频率(天/次)' },
{ prop: 'maintainType', label: '保养类型', filter: publicFormatter('maintain_type') },
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
{
type: 'input',
label: '设备名',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
//
// {
// type: 'datePicker',
// label: '',
// dateType: 'daterange', // datetimerange
// format: 'yyyy-MM-dd',
// valueFormat: 'yyyy-MM-dd HH:mm:ss',
// // valueFormat: 'timestamp',
// rangeSeparator: '-',
// startPlaceholder: '',
// endPlaceholder: '',
// defaultTime: ['00:00:00', '23:59:59'],
// param: 'createTime',
// // defaultSelect: [
// // new Date(y, m, d)
// // .toLocaleString()
// // .split('/')
// // .map((item, index) => {
// // if (index == 1 || index == 2) return item.padStart(2, '0');
// // return item;
// // })
// // .join('-'),
// // new Date(y, m, d, 23, 59, 59)
// // .toLocaleString()
// // .split('/')
// // .map((item, index) => {
// // if (index == 1 || index == 2) return item.padStart(2, '0');
// // return item;
// // })
// // .join('-'),
// // ],
// },
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:plan-config:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
// {
// type: this.$auth.hasPermi('base:quality-inspection-type:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
{
input: true,
label: '计划名称',
prop: 'name',
rules: [{ required: true, message: '计划名称不能为空', trigger: 'blur' }],
},
{
input: true,
label: '计划编号',
prop: 'code',
url: '/base/equipment-maintain-plan/getCode',
rules: [{ required: true, message: '计划编号不能为空', trigger: 'blur' }],
},
],
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
// url: '/base/core-equipment/listAll?special=false',
url: '/base/core-equipment/page?special=false&pageNo=1&pageSize=99',
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
},
{
select: true,
label: '保养类型',
prop: 'maintainType',
options: this.getDictDatas(this.DICT_TYPE.MAINTAIN_TYPE),
},
],
[
{
input: true,
label: '保养时长(h)',
prop: 'maintainDuration',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
},
{
input: true,
label: '保养频率(天/次)',
prop: 'maintenancePeriod',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
rules: [{ required: true, message: '保养频率不能为空', trigger: 'blur' }],
},
],
[
{
switch: true,
label: '启用状态',
prop: 'enabled',
bind: {
'active-value': 1,
'inactive-value': 0,
},
}
],
[{ input: true, label: '备注', prop: 'remark' }],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
special: false,
equipmentName: null,
createTime: null,
},
//
form: {},
basePath: '/base/equipment-maintain-plan',
};
},
created() {
if (this.$route.query) {
this.queryParams.equipmentId = this.$route.query?.equipmentId ?? undefined
this.searchBarFormConfig[0].defaultSelect = this.$route.query.equipmentName ?? undefined
}
this.getList();
},
methods: {
/** 查询列表 */
getList() {
this.loading = true;
//
this.recv(this.queryParams).then((response) => {
this.list = response.data.list;
this.total = response.data.total;
this.loading = false;
});
},
/** 取消按钮 */
cancel() {
this.open = false;
this.reset();
},
/** 表单重置 */
reset() {
this.form = {
code: null,
name: null,
equipmentId: null,
enabled: null,
maintenancePeriod: null,
maintainDuration: null,
maintainType: null,
remark: null,
enabled: 1
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '添加保养计划';
},
handleDetail(row){
// alert(' ')
// console.log(row)
const queryData = {
equipmentId: row.equipmentId,
maintainPlanId: row.id,
isAdd: 1
// relatePlan: row.enabled
}
if (this.queryParams.createTime) {
queryData.createTime = this.queryParams.createTime
}
console.log('你好', queryData)
this.$router.push({ path: '/equipment/base/maintain/record',query: queryData })
// this.$router.push({ path: '/equipment/base/maintain/record', query: { orderNo: row.orderNo }})
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id;
this.info({ id }).then((response) => {
this.form = response.data;
this.open = true;
this.title = '修改保养计划';
});
},
/** 提交按钮 */
submitForm() {
this.$refs['form'].validate((valid) => {
if (!valid) {
return;
}
//
if (this.form.id != null) {
this.put(this.form).then((response) => {
this.$modal.msgSuccess('修改成功');
this.open = false;
this.getList();
});
return;
}
//
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除计划名称为"' + row.name + '"的数据项?')
.then(function () {
return deleteEqMaintainPlan(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,294 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-02-24 16:59:05
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ '设备保养记录详情' }}
</small-title>
<div class="content">
<div class="visual-part">
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">计划保养人员</div>
<div class="lightTip">{{ dataForm.planMaintainWorker }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">实际保养人员</div>
<div class="lightTip">{{ dataForm.maintainWorker }}</div>
</el-col>
</el-row>
</div>
<div class="attr-list" v-if="idAttrShow">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
保养内容
</small-title>
<div v-if="!isdetail" class="action_btn">
<template>
<span style="display: inline-block;">
<el-button type="text" @click="addNew()" icon="el-icon-plus">新增</el-button>
</span>
</template>
</div>
<base-table
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="planList">
<method-btn
v-if="!isdetail"
slot="handleBtn"
:width="120"
label="操作"
:method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
<pagination
v-show="listQuery.total > 0"
:total="listQuery.total"
:page.sync="listQuery.pageNo"
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</div>
<!-- <attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:plan-id="dataForm.id"
@refreshDataList="getList" /> -->
</el-drawer>
</template>
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { getLog, deleteLogDet, getLogDetPage } from '@/api/equipment/base/maintain/record';
// import { listData } from "@/api/system/dict/data";
import SmallTitle from '../PlanConfig/SmallTitle';
// import { parseTime } from '../../../../core/mixins/code-filter';
// import attrAdd from './attr-add';
// import { getDictDatas } from "@/utils/dict";
const tableBtn = [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
];
const tableProps = [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '保养项目',
},
{
prop: 'maintenanceDes',
label: '保养描述',
}
];
export default {
mixins: [basicAdd],
components: { SmallTitle },
data() {
return {
tableBtn,
tableProps,
addOrUpdateVisible: false,
urlOptions: {
isGetCode: false,
infoURL: getLog
},
listQuery: {
pageSize: 99,
pageNo: 1,
total: 0
},
dataForm: {},
planList: [],
visible: false,
isdetail: false,
idAttrShow: false
};
},
mounted() {},
methods: {
initData() {
this.planList.splice(0);
this.listQuery.total = 0;
},
handleClick(raw) {
if (raw.type === 'delete') {
this.$confirm(
`是否确认删除保养项目名为"${raw.data.program}"的数据项?`,
'提示',
{
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
}
)
.then(() => {
deleteLogDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getList();
},
});
});
})
.catch(() => {});
} else {
this.addNew(raw.data.id);
}
},
getList() {
//
getLogDetPage({
...this.listQuery,
logId: this.dataForm.id,
}).then((response) => {
this.planList = response.data.list;
this.listQuery.total = response.data.total;
});
},
init(id, isdetail) {
this.initData();
this.isdetail = isdetail || false;
this.dataForm.id = id || undefined;
this.visible = true;
if (id) {
this.idAttrShow = true
} else {
this.idAttrShow = false
}
this.$nextTick(() => {
if (this.dataForm.id) {
//
this.urlOptions.infoURL({ id: id}).then(response => {
this.dataForm = response.data;
});
//
this.getList();
}
});
},
goback() {
this.$emit('refreshDataList');
this.visible = false;
// this.initData();
},
// /
addNew(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
}
}
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
display: flex;
flex-direction: column;
}
.drawer >>> .el-form-item__label {
padding: 0;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
}
.drawer >>> .el-drawer__body {
flex: 1;
height: 1px;
display: flex;
flex-direction: column;
}
.drawer >>> .content {
padding: 30px 24px;
flex: 1;
display: flex;
flex-direction: column;
/* height: 100%; */
}
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 10vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
}
.drawer >>> .el-form,
.drawer >>> .attr-list {
padding: 0 16px;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
margin: -40px 15px;
font-size: 14px;
}
.add {
color: #0b58ff;
}
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
/* height: 16px; */
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;
}
</style>

View File

@ -51,6 +51,10 @@
</el-col> </el-col>
</el-row> </el-row>
</base-dialog> </base-dialog>
<add-content
v-if="addContent"
ref="addContent"
@refreshDataList="addContent = false" />
</div> </div>
</template> </template>
@ -59,15 +63,37 @@ import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import Editor from '@/components/Editor'; import Editor from '@/components/Editor';
import { deleteEqMaintainLog, exportMaintainLogExcel } from '@/api/equipment/base/maintain/record'; import { deleteEqMaintainLog, exportMaintainLogExcel } from '@/api/equipment/base/maintain/record';
import AddContent from './addContent.vue';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = {
name: 'tableBtn',
props: ['injectData'],
data() {
return {};
},
methods: {
handleClick() {
this.$emit('emitData', { action: this.injectData.label, value: this.injectData });
},
},
render: function (h) {
return (
<el-button type="text" onClick={this.handleClick}>
{this.injectData.name}
</el-button>
);
},
};
export default { export default {
name: 'EquipmentMaintainRecord', name: 'EquipmentMaintainRecord',
components: {}, components: { AddContent },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
addContent: false,
searchBarKeys: [ searchBarKeys: [
'maintainPlanId', 'maintainPlanId',
'startTime', 'startTime',
@ -75,65 +101,71 @@ export default {
'equipmentId', 'equipmentId',
], ],
tableBtn: [ tableBtn: [
this.$auth.hasPermi('equipment:maintain-record:update') // this.$auth.hasPermi('equipment:maintain-record:update')
? { // ? {
type: 'detail', // type: 'detail',
btnName: '详情', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:maintain-record:update') // this.$auth.hasPermi('equipment:maintain-record:update')
? { // ? {
type: 'edit', // type: 'edit',
btnName: '修改', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:maintain-record:delete') // this.$auth.hasPermi('equipment:maintain-record:delete')
? { // ? {
type: 'delete', // type: 'delete',
btnName: '删除', // btnName: '',
} // }
: undefined, // : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
{ // {
prop: 'createTime', // prop: 'createTime',
label: '添加时间', // label: '',
fixed: true, // fixed: true,
width: 180, // width: 180,
filter: timeFilter, // filter: timeFilter,
}, // },
{ prop: 'maintainOrderNumber', label: '设备保养单号' }, { prop: 'maintainOrderNumber', label: '设备保养单号' },
{ prop: 'startTime', label: '开始时间', filter: timeFilter }, { prop: 'planName', label: '保养计划名称' },
{ prop: 'endTime', label: '结束时间', filter: timeFilter }, { prop: 'departmentName', label: '部门' },
{ prop: 'equipmentName', label: '设备名称' }, { prop: 'lineName', label: '产线名' },
{ prop: 'maintainWorker', label: '保养人员' }, { prop: 'planStartTime', label: '计划开始时间', filter: timeFilter },
{ prop: 'planEndTime', label: '计划结束时间', filter: timeFilter },
{ prop: 'startTime', label: '实际开始时间', filter: timeFilter },
{ prop: 'endTime', label: '实际结束时间', filter: timeFilter },
// { prop: 'equipmentName', label: '' },
// { prop: 'maintainWorker', label: '' },
{ {
prop: 'relatePlan', prop: 'relatePlan',
label: '是否计划保养', label: '保养计划类型',
filter: (v) => (v != null ? ['', '是', '否'][v] : ''), filter: (v) => (v != null ? ['', '计划型', '非计划型'][v] : ''),
}, },
{ prop: 'planName', label: '保养计划名称' }, { prop: 'opt', label: '详情', name: '详情', subcomponent: btn }
{ prop: 'maintainDuration', label: '计划保养用时(h)' }, // { prop: 'maintainDuration', label: '(h)' },
{ prop: 'timeUsed', label: '实际保养用时(h)' }, // { prop: 'timeUsed', label: '(h)' },
{ prop: 'remark', label: '备注' }, // { prop: 'remark', label: '' },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'equipmentId',
// },
{ {
type: 'select', type: 'select',
label: '设备', label: '保养计划名称',
placeholder: '请选择设备',
param: 'equipmentId',
},
{
type: 'select',
label: '计划名称',
placeholder: '请选择计划名称', placeholder: '请选择计划名称',
param: 'maintainPlanId', param: 'maintainPlanId',
filterable: true
}, },
// //
{ {
type: 'datePicker', type: 'datePicker',
label: '保养开始时间', label: '实际开始时间',
dateType: 'daterange', // datetimerange dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd', format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss', valueFormat: 'yyyy-MM-dd HH:mm:ss',
@ -144,15 +176,15 @@ export default {
param: 'startTime', param: 'startTime',
// width: 350, // width: 350,
}, },
{ // {
type: 'select', // type: 'select',
label: '是否计划保养', // label: '',
selectOptions: [ // selectOptions: [
{ name: '是', id: 1 }, // { name: '', id: 1 },
{ name: '否', id: 2 }, // { name: '', id: 2 },
], // ],
param: 'relatePlan', // param: 'relatePlan',
}, // },
{ {
type: 'button', type: 'button',
btnName: '查询', btnName: '查询',
@ -170,24 +202,24 @@ export default {
name: 'export', name: 'export',
plain: true, plain: true,
color: 'primary', color: 'primary',
}, }
{ // {
type: this.$auth.hasPermi('equipment:maintain-record:create') // type: this.$auth.hasPermi('equipment:maintain-record:create')
? 'button' // ? 'button'
: '', // : '',
btnName: '新增', // btnName: '',
name: 'add', // name: 'add',
plain: true, // plain: true,
color: 'success', // color: 'success',
}, // },
{ // {
type: this.$auth.hasPermi('equipment:maintain-record:export') // type: this.$auth.hasPermi('equipment:maintain-record:export')
? 'button' // ? 'button'
: '', // : '',
btnName: '导出', // btnName: '',
name: 'export', // name: 'export',
color: 'warning', // color: 'warning',
}, // },
], ],
rows: [ rows: [
[ [
@ -308,6 +340,7 @@ export default {
startTime: null, startTime: null,
relatePlan: null, relatePlan: null,
equipmentId: null, equipmentId: null,
confirmed: true
}, },
// //
form: {}, form: {},
@ -318,20 +351,20 @@ export default {
created() { created() {
this.initSearchBar(); this.initSearchBar();
if (this.$route.query) { if (this.$route.query) {
this.queryParams.equipmentId = // this.queryParams.equipmentId =
this.$route.query?.equipmentId ?? undefined; // this.$route.query?.equipmentId ?? undefined;
this.queryParams.maintainPlanId = this.queryParams.maintainPlanId =
this.$route.query?.maintainPlanId ?? undefined; this.$route.query?.maintainPlanId ?? undefined;
this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined; // this.queryParams.relatePlan = this.$route.query?.relatePlan ?? undefined;
this.queryParams.startTime = this.$route.query?.createTime ?? undefined; this.queryParams.startTime = this.$route.query?.createTime ?? undefined;
// this.searchBarFormConfig[0].defaultSelect =
// this.$route.query.equipmentId ?? undefined;
this.searchBarFormConfig[0].defaultSelect = this.searchBarFormConfig[0].defaultSelect =
this.$route.query.equipmentId ?? undefined;
this.searchBarFormConfig[1].defaultSelect =
this.$route.query.maintainPlanId ?? undefined; this.$route.query.maintainPlanId ?? undefined;
this.searchBarFormConfig[2].defaultSelect = this.searchBarFormConfig[1].defaultSelect =
this.$route.query?.createTime ?? undefined; this.$route.query?.createTime ?? undefined;
this.searchBarFormConfig[3].defaultSelect = // this.searchBarFormConfig[3].defaultSelect =
Number(this.$route.query.relatePlan) ?? undefined; // Number(this.$route.query.relatePlan) ?? undefined;
} }
this.getList(); this.getList();
if (this.$route.query.addRecord) { if (this.$route.query.addRecord) {
@ -339,27 +372,40 @@ export default {
} }
}, },
methods: { methods: {
initSearchBar() { handleEmitFun({action, value}) {
this.http('/base/core-equipment/page', 'get', { switch (action) {
special: false, //
pageNo: 1, case '详情':
pageSize: 99 // this.handleDetail({ id: value.id })
}).then(({ data }) => { this.addContent = true;
this.$set( this.$nextTick(() => {
this.searchBarFormConfig[0], this.$refs.addContent.init(value.id, true);
'selectOptions',
(data?.list || []).map((item) => ({
name: item.name,
id: item.id,
}))
);
}); });
break;
}
},
initSearchBar() {
// this.http('/base/core-equipment/page', 'get', {
// special: false,
// pageNo: 1,
// pageSize: 99
// }).then(({ data }) => {
// this.$set(
// this.searchBarFormConfig[0],
// 'selectOptions',
// (data?.list || []).map((item) => ({
// name: item.name,
// id: item.id,
// }))
// );
// });
this.http('/base/equipment-maintain-plan/page', 'get', { this.http('/base/equipment-maintain-plan/page', 'get', {
pageNo: 1, pageNo: 1,
pageSize: 100, pageSize: 100,
special: false
}).then(({ data }) => { }).then(({ data }) => {
this.$set( this.$set(
this.searchBarFormConfig[1], this.searchBarFormConfig[0],
'selectOptions', 'selectOptions',
(data?.list || []).map((item) => ({ (data?.list || []).map((item) => ({
name: item.name, name: item.name,
@ -501,6 +547,7 @@ export default {
let params = { ...this.queryParams }; let params = { ...this.queryParams };
params.pageNo = undefined; params.pageNo = undefined;
params.pageSize = undefined; params.pageSize = undefined;
params.confirmed = true;
this.$modal this.$modal
.confirm('是否确认导出所有保养记录?') .confirm('是否确认导出所有保养记录?')
.then(() => { .then(() => {

View File

@ -1,40 +1,3 @@
首页
工单管理
合并请求
里程碑
探索
通知469
创建
个人信息和配置
mt-fe-group / yudao-dev
取消关注
11
点赞
0
派生
0
代码
工单
0
合并请求
0
版本发布
0
百科
动态
559 提交
25 分支
145 MiB
分支: projects/mes-test
yudao-dev/src/views/equipment/base/repair/CustomDialogForm.vue
346
8.9 KiB
原始文件
永久链接
Blame
文件历史
<!-- <!--
filename: dialogForm.vue filename: dialogForm.vue
author: liubin author: liubin
@ -44,53 +7,74 @@ Blame
<template> <template>
<el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="disabled" class="drawer" <el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="disabled" class="drawer"
custom-class="mes-drawer" size="65%" @closed="$emit('destroy')"> custom-class="mes-drawer" size="50%" @closed="$emit('destroy')">
<small-title slot="title" :no-padding="true"> <small-title slot="title" :no-padding="true">
{{ disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成' }} {{ disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成' }}
</small-title> </small-title>
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
<el-form ref="form" :model="dataForm" label-width="100px" label-position="top" v-loading="formLoading"> <div>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="维修单号" prop="repairOrderNumber"> <div class="blodTip">故障发生时间</div>
<span>{{ dataForm.repairOrderNumber }}</span> <div class="lightTip">{{ parseTime(dataForm.faultTime) }}</div>
</el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName"> <div class="blodTip">故障级别</div>
<span>{{ dataForm.equipmentName }}</span> <div class="lightTip">{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</div>
</el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="维修工" prop="repairman"> <div class="blodTip">故障类型</div>
<span>{{ dataForm.repairman }}</span> <div class="lightTip">{{ getDictDataLabel('fault-type', dataForm.faultType) }}</div>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="故障发生时间" prop="faultTime"> <div class="blodTip">维修工</div>
<span>{{ parseTime(dataForm.faultTime) }}</span> <div class="lightTip">{{ dataForm.repairman }}</div>
</el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="故障级别" prop="faultLevel"> <div class="blodTip">联系方式</div>
<span>{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</span> <div class="lightTip">{{ dataForm.repairmanPhone }}</div>
</el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="联系方式" prop="repairmanPhone"> <div class="blodTip">维修方式</div>
<span>{{ dataForm.repairmanPhone }}</span> <div class="lightTip">{{ getDictDataLabel('repair-mode', dataForm.repairMode) }}</div>
</el-form-item>
</el-col> </el-col>
</el-row> </el-row>
<el-row>
<el-divider style="margin-top: -10px" /> <div class="blodTip">维修附件</div>
<div v-if="dataForm.files && dataForm.files.length > 0">
<uploadedFile
class="file"
v-for="file in dataForm.files"
:file="file"
:key="file.fileUrl"
:disabled="disabled"
@delete="!disabled && handleDeleteFile(file, col.prop)" />
</div>
<p v-else>暂无附件</p>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">创建时间</div>
<div class="lightTip">{{ parseTime(dataForm.createTime) }}</div>
</el-col>
<el-col :span="8">
<div class="blodTip">创建人</div>
<div class="lightTip">{{ dataForm.creator }}</div>
</el-col>
</el-row>
<el-row>
<div class="blodTip">备注</div>
<div class="lightTip">{{ dataForm.remark }}</div>
</el-row>
</div>
<!-- <el-divider style="margin-top: -10px" />
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true"> <small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
{{ '设备维修信息' }} {{ '设备维修信息' }}
</small-title> </small-title> -->
<!-- <el-form ref="form" :model="dataForm" label-width="100px" label-position="top" v-loading="formLoading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="6"> <el-col :span="6">
<el-form-item label="维修开始时间" prop="maintenanceStartTime" <el-form-item label="维修开始时间" prop="maintenanceStartTime"
@ -129,7 +113,6 @@ Blame
<el-col> <el-col>
<el-form-item label="故障明细" prop="faultDetail" <el-form-item label="故障明细" prop="faultDetail"
:rules="[{ required: true, message: '故障明细不能为空', trigger: 'blur' }]"> :rules="[{ required: true, message: '故障明细不能为空', trigger: 'blur' }]">
<!-- // -->
<editor v-model="dataForm.faultDetail" :read-only="disabled" :min-height="150" /> <editor v-model="dataForm.faultDetail" :read-only="disabled" :min-height="150" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -138,7 +121,6 @@ Blame
<el-row :gutter="20"> <el-row :gutter="20">
<el-col> <el-col>
<el-form-item label="维修记录" prop="maintenanceDetail"> <el-form-item label="维修记录" prop="maintenanceDetail">
<!-- // -->
<editor v-model="dataForm.maintenanceDetail" :read-only="disabled" :min-height="150" /> <editor v-model="dataForm.maintenanceDetail" :read-only="disabled" :min-height="150" />
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -159,7 +141,7 @@ Blame
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
</el-form> </el-form> -->
<div v-if="!disabled" class="drawer-body__footer"> <div v-if="!disabled" class="drawer-body__footer">
<el-button style="" @click="goback()">取消</el-button> <el-button style="" @click="goback()">取消</el-button>
@ -174,11 +156,73 @@ Blame
import SmallTitle from '../../base/alarm/Record/SmallTitle.vue'; import SmallTitle from '../../base/alarm/Record/SmallTitle.vue';
import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair' import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair'
import Editor from "@/components/Editor"; import Editor from "@/components/Editor";
import FileUpload from "@/components/FileUpload"; // import FileUpload from "@/components/FileUpload";
import { getDictDatas } from "@/utils/dict"; import { getDictDatas } from "@/utils/dict";
import { parseTime } from '@/utils/ruoyi' import { parseTime } from '@/utils/ruoyi'
import { getDictDataLabel } from '@/utils/dict'; import { getDictDataLabel } from '@/utils/dict';
const uploadedFile = {
name: 'UploadedFile',
props: ['file', 'disabled'],
data() {
return {};
},
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
async handleDownload() {
const data = await this.$axios({
url: this.file.fileUrl,
method: 'get',
responseType: 'blob',
});
await this.$message.success('开始下载');
// create download link
const url = window.URL.createObjectURL(data);
const link = document.createElement('a');
link.href = url;
link.download = this.file.fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
},
mounted() {
},
render: function (h) {
return (
<div
title={this.file.fileName}
onClick={this.handleDownload}
style={{
background: `url(${tupleImg}) no-repeat`,
backgroundSize: '14px',
backgroundPosition: '0 55%',
paddingLeft: '20px',
paddingRight: '24px',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
cursor: 'pointer',
display: 'inline-block',
}}>
{this.file.fileName}
{!this.disabled && (
<el-button
type="text"
icon="el-icon-close"
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
class="dialog__upload_component__close"
onClick={this.handleDelete}
/>
)}
</div>
);
},
};
export default { export default {
name: 'DialogForm', name: 'DialogForm',
model: { model: {
@ -186,7 +230,7 @@ export default {
event: 'update', event: 'update',
}, },
emits: ['update'], emits: ['update'],
components: { SmallTitle, Editor, FileUpload }, components: { SmallTitle, Editor, uploadedFile },
props: { props: {
// dataForm: { // dataForm: {
// type: Object, // type: Object,
@ -237,18 +281,18 @@ export default {
this.visible = true; this.visible = true;
this.$nextTick(() => { this.$nextTick(() => {
this.$refs['form'].resetFields(); // this.$refs['form'].resetFields();
if (this.dataForm.id) { if (this.dataForm.id) {
// //
getEqRepair(this.dataForm.id).then(response => { getEqRepair(this.dataForm.id).then(response => {
this.formLoading = false this.formLoading = false
this.dataForm = response.data; this.dataForm = response.data;
this.dataForm.maintenanceStatus = row.maintenanceStatus || 0 // this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
if (this.dataForm.files.length > 0) { // if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl // this.file = this.dataForm.files[0].fileUrl
this.fileName = this.dataForm.files[0].fileName // this.fileName = this.dataForm.files[0].fileName
} // }
}); });
} else { } else {
// if (this.urlOptions.isGetCode) { // if (this.urlOptions.isGetCode) {
@ -337,4 +381,18 @@ export default {
justify-content: flex-end; justify-content: flex-end;
padding: 18px; padding: 18px;
} }
.blodTip {
height: 16px;
font-size: 14px;
font-weight: 600;
color: rgba(0,0,0,0.85);
margin-bottom: 8px;
}
.lightTip {
/* height: 16px; */
font-size: 14px;
font-weight: 400;
color: rgba(102,102,102,0.75);
margin-bottom: 12px;
}
</style> </style>

View File

@ -0,0 +1,800 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-15 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form
ref="form"
:model="form"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20">
<!-- 维修单号 -->
<el-col :span="8">
<el-form-item
label="维修单号"
prop="repairOrderNumber"
:rules="[
{ required: true, message: '维修单号不能为空', trigger: 'blur' },
]">
<el-input
v-model="form.repairOrderNumber"
@change="$emit('update', form)"
placeholder="请输入维修单号"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 产线名 -->
<el-col :span="8">
<el-form-item label="产线名" prop="lineId">
<el-select
v-model="formFilters.lineId"
:placeholder="`请选择产线`"
:disabled="disabled"
clearable
filterable
@change="initSections">
<el-option
v-for="opt in lineOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 工段名 -->
<el-col :span="8">
<el-form-item label="工段名" prop="sectionId">
<el-select
v-model="formFilters.sectionId"
:placeholder="`请选择工段`"
:disabled="disabled"
clearable
filterable
@change="handleEqTypeChange">
<el-option
v-for="opt in sectionOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 设备名称 -->
<el-col :span="8">
<el-form-item
label="设备名称"
prop="equipmentId"
:rules="[
{ required: true, message: '设备不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.equipmentId"
:placeholder="`请选择设备`"
:disabled="disabled"
filterable
clearable
@change="$emit('update', form)">
<el-option
v-for="opt in equipmentOptions"
:key="opt.id"
:label="opt.name"
:value="opt.id" />
</el-select>
</el-form-item>
</el-col>
<!-- 故障发生时间 -->
<el-col :span="8">
<el-form-item
label="故障发生时间"
prop="faultTime"
:rules="[
{
required: true,
message: '故障发生时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.faultTime"
type="datetime"
:disabled="disabled"
:placeholder="`请选择故障发生时间`"
value-format="timestamp"
format="yyyy-MM-dd HH:mm:ss"
clearable
@change="$emit('update', form)" />
</el-form-item>
</el-col>
<!-- 故障级别 -->
<el-col :span="8">
<el-form-item
label="故障级别"
prop="faultLevel"
:rules="[
{
required: true,
message: '故障级别不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.faultLevel"
placeholder="故障级别"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.FAULT_LEVEL)"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 故障类型 - 数据字典 -->
<el-col :span="8">
<el-form-item
label="故障类型"
prop="faultType"
:rules="[
{
required: true,
message: '故障类型不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.faultType"
placeholder="故障类型"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.FAULT_TYPE)"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 维修开始时间 -->
<el-col :span="8">
<el-form-item
label="维修开始时间"
prop="maintenanceStartTime"
:rules="[
{
required: true,
message: '维修开始时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.maintenanceStartTime"
type="datetime"
:disabled="disabled"
:placeholder="`请选择维修开始时间`"
value-format="timestamp"
format="yyyy-MM-dd HH:mm:ss"
clearable
@change="$emit('update', form)" />
</el-form-item>
</el-col>
<!-- 维修结束时间 -->
<el-col :span="8">
<el-form-item
label="维修结束时间"
prop="maintenanceFinishTime"
:rules="[
{
required: true,
message: '维修结束时间不能为空',
trigger: 'blur',
},
]">
<el-date-picker
v-model="form.maintenanceFinishTime"
type="datetime"
:disabled="disabled"
:placeholder="`请选择维修结束时间`"
value-format="timestamp"
format="yyyy-MM-dd HH:mm:ss"
clearable
@change="$emit('update', form)" />
</el-form-item>
</el-col>
<!-- 维修工 -->
<el-col :span="8">
<el-form-item
label="维修工"
prop="repairman"
:rules="[
{ required: true, message: '维修工不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.repairman"
@change="$emit('update', form)"
placeholder="请选择维修工"
filterable
clearable
multiple
:disabled="disabled">
<el-option
v-for="opt in workerOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 联系方式 -->
<el-col :span="8">
<el-form-item
label="联系方式"
prop="repairmanPhone"
:rules="[
{ required: false, message: '联系方式不能为空', trigger: 'blur' },
]">
<el-input
v-model="form.repairmanPhone"
@change="$emit('update', form)"
placeholder="请输入联系方式"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 维修方式 - 数据字典 -->
<el-col :span="8">
<el-form-item
label="维修方式"
prop="repairMode"
:rules="[
{
required: true,
message: '维修方式不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.repairMode"
placeholder="维修方式"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.REPAIR_MODE)"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 维修结果 - 数据字典 -->
<el-col :span="8">
<el-form-item
label="维修结果"
prop="maintenanceResult"
:rules="[
{
required: true,
message: '维修结果不能为空',
trigger: 'blur',
},
]">
<el-select
v-model="form.maintenanceResult"
placeholder="维修结果"
:disabled="disabled"
@change="$emit('update', form)">
<el-option
v-for="opt in getDictDatas(DICT_TYPE.REPAIR_RESULT)"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<!-- 备注 -->
<el-col :span="24">
<el-form-item label="备注" prop="remark">
<el-input
v-model="form.remark"
@change="$emit('update', form)"
placeholder="请输入备注"
:disabled="disabled" />
</el-form-item>
</el-col>
<!-- 故障明细 -->
<el-col :span="24">
<el-form-item
label="故障明细"
prop="faultDetail"
:rules="[
{
required: true,
message: '故障明细不能为空',
trigger: 'blur',
},
]">
<Editor
key="fault-detail"
:height="200"
v-model="form.faultDetail"
@on-change="$emit('update', form)" />
</el-form-item>
</el-col>
<!-- 维修描述 -->
<el-col :span="24">
<el-form-item label="维修描述" prop="maintenanceDetail">
<Editor
key="maintenance-detail"
:height="200"
v-model="form.maintenanceDetail"
@on-change="$emit('update', form)" />
</el-form-item>
</el-col>
<!-- 维修附件 -->
<el-col :span="24">
<el-form-item label="维修附件" prop="files">
<div
class="upload-area"
:class="uploadOpen ? '' : 'height-48'"
ref="uploadArea">
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
<el-button
type="text"
icon="el-icon-arrow-right"
@click="uploadOpen = !uploadOpen" />
</span>
<!-- :file-list="uploadedFileList" -->
<el-upload
class="upload-in-dialog"
:action="uploadUrl"
:headers="uploadHeaders"
:show-file-list="false"
icon="el-icon-upload2"
:disabled="disabled"
:before-upload="beforeUpload"
:on-success="
(response, file, fileList) => {
handleUploadSuccess(response, file, 'files');
}
">
<el-button size="mini" :disabled="disabled || false">
<svg-icon
icon-class="icon-upload"
style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip">
只能上传jpg/png文件, 大小不超过2MB
</div>
</el-upload>
<uploadedFile
class="file"
v-for="file in form.files"
:file="file"
:key="file.fileUrl"
:disabled="disabled"
@delete="!disabled && handleDeleteFile(file, col.prop)" />
</div>
</el-form-item>
</el-col>
<!-- 设备大类 -->
<!-- <el-col :span="8">
<el-form-item
label="设备大类"
prop="equipmentCategory"
:rules="[
{ required: true, message: '设备大类不能为空', trigger: 'blur' },
]">
<el-select
v-model="form.equipmentCategory"
:placeholder="`请选择设备大类`"
:disabled="disabled"
clearable
filterable
@change="handleEqTypeChange">
<el-option
v-for="opt in equipmentTypeOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col> -->
</el-row>
</el-form>
</template>
<script>
import Editor from '@/components/Editor';
import { getAccessToken } from '@/utils/auth';
import tupleImg from '@/assets/images/tuple.png';
const uploadedFile = {
name: 'UploadedFile',
props: ['file', 'disabled'],
data() {
return {};
},
methods: {
handleDelete() {
this.$emit('delete', this.file);
},
async handleDownload() {
const data = await this.$axios({
url: this.file.fileUrl,
method: 'get',
responseType: 'blob',
});
await this.$message.success('开始下载');
// create download link
const url = window.URL.createObjectURL(data);
const link = document.createElement('a');
link.href = url;
link.download = this.file.fileName;
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
},
},
mounted() {},
render: function (h) {
return (
<div
title={this.file.fileName}
onClick={this.handleDownload}
style={{
background: `url(${tupleImg}) no-repeat`,
backgroundSize: '14px',
backgroundPosition: '0 55%',
paddingLeft: '20px',
paddingRight: '24px',
textOverflow: 'ellipsis',
whiteSpace: 'nowrap',
overflow: 'hidden',
cursor: 'pointer',
display: 'inline-block',
}}>
{this.file.fileName}
{!this.disabled && (
<el-button
type="text"
icon="el-icon-close"
style="float: right; position: relative; top: 2px; left: 8px; z-index: 100"
class="dialog__upload_component__close"
onClick={this.handleDelete}
/>
)}
</div>
);
},
};
export default {
name: 'DialogForm',
model: {
prop: 'dataForm',
event: 'update',
},
emits: ['update'],
components: { Editor, uploadedFile },
props: {
dataForm: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
labelPosition: {
type: String,
default: 'top',
},
},
data() {
return {
isInit: true,
// allSpeicalEquipments: [],
form: {},
formFilters: {
lineId: null,
sectionId: null,
},
formLoading: true,
dataLoaded: false,
equipmentList: [],
equipmentOptions: [],
workerOptions: [],
planOptions: [],
sectionOptions: [],
lineOptions: [],
uploadOpen: false,
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // headersurl
uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
};
},
watch: {
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.hasFiles) {
if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
this.form.files = this.form.files ?? [];
} else if (Array.isArray(this.hasFiles)) {
this.hasFiles.forEach((prop) => {
this.form[prop] = this.form[prop] ?? [];
});
}
}
},
deep: true,
immediate: true,
},
},
mounted() {
this.initOptions();
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
async getCode() {
const response = await this.$axios('/base/equipment-repair-log/getCode');
this.form.repairOrderNumber = response.data || '';
},
// initialize
async initOptions() {
this.formLoading = true;
await this.getCode();
await this.initEquipment();
await this.initLines();
await this.initWorker();
await this.initSections();
this.formLoading = false;
this.isInit = false;
this.setInitWorker();
},
/** 设置默认维修工为用户自己 */
setInitWorker() {
/** 获取用户自身id */
const userId = this.$store.getters.userId;
this.$nextTick(() => {
this.form.repairman = [userId];
});
},
/** 获取产线 */
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 initEquipment() {
const response = await this.$axios('/base/core-equipment/listAll');
this.equipmentList = response.data || [];
this.equipmentOptions = response.data || [];
// this.allSpeicalEquipments = equipmentOptions;
},
/** 获取维修工 - 同时从用户表和员工表拉取数据 */
async initWorker() {
let list = [];
/** user */
const userList = await this.$axios({
url: '/system/user/page',
params: {
pageNo: 1,
pageSize: 100,
},
});
list = list.concat(
(userList.data?.list || []).map((item) => ({
label: item.username,
value: item.id,
}))
);
/** worker */
const workerList = await this.$axios({
url: '/base/core-worker/listAll',
});
list = list.concat(
(workerList.data || []).map((item) => ({
label: item.name,
value: item.id,
}))
);
/** setting */
this.workerOptions = list;
},
beforeUpload(file) {
const checkFileSize = () => {
const isLt2M = file.size / 1024 / 1024 < 2;
if (!isLt2M) {
this.$modal.msgError('上传文件大小不能超过 2MB!');
}
return isLt2M;
};
const checkFileType = () => {
const isJPG =
file.type === 'image/jpeg' ||
file.type === 'image/png' ||
file.type === 'image/jpg';
return isJPG;
};
return checkFileSize();
// return checkFileSize() && checkFileType();
},
// handlers
handleEqTypeChange(type) {
this.form.equipmentId = null;
console.log('111', type)
this.equipmentOptions = this.equipmentList
// if (type) {
// this.equipmentOptions = this.equipmentList
// .filter((item) => item.special)
// .filter((item) => item.specialType === type)
// .map((item) => ({ label: item.name, value: item.id }));
// } else
// this.equipmentOptions = this.equipmentList.map((item) => ({
// label: item.name,
// value: item.id,
// }));
// this.$emit('update', this.form)
},
handleEqChange() {
this.$emit('update', this.form);
},
//
handlePlanChange(val) {
console.log('handlePlanChange', val);
// this.form.equipmentCategory = null;
this.form.equipmentId = null;
this.$emit('update', { ...this.form, relatePlan: val });
this.initEquipment(val == 1 ? 'special-equipment' : null);
},
handleEditorInput(html) {
this.$emit('update', {
...this.form,
maintenanceDes: html,
});
},
// upload
handleFilesOpen() {},
handleUploadSuccess(response, file, prop) {
console.log('response', response);
if (response.code != 0) {
this.$modal.msgError('上传失败: ', response.msg || '-');
return;
}
this.form.files.push({
fileName: file.name,
fileUrl: response.data,
fileType: prop == 'files' ? 2 : 1,
});
this.$modal.msgSuccess('上传成功');
this.$emit('update', this.form);
},
handleDeleteFile(file, prop) {
this.form.files = this.form.files.filter(
(item) => item.fileUrl != file.fileUrl
);
this.$emit('update', this.form);
},
},
};
</script>
<style scoped lang="scss">
.el-date-editor,
.el-select {
width: 100%;
}
.upload-area {
position: relative;
overflow: hidden;
transition: height 0.3s ease-out;
}
.upload-in-dialog {
margin-right: 24px;
position: relative;
float: left;
}
.close-icon {
position: absolute;
top: 0;
right: 12px;
z-index: 100;
transition: transform 0.3s ease-out;
}
.close-icon.open {
transform: rotateZ(90deg);
}
.dialog__upload_component__close {
color: #ccc;
}
.dialog__upload_component__close:hover {
/* color: #777; */
color: red;
}
.height-48 {
height: 35px !important;
}
:deep(.record-add__editor) {
.ql-picker-label {
display: flex;
}
}
</style>

View File

@ -17,7 +17,7 @@
v-if="tableBtn.length" v-if="tableBtn.length"
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
:width="180" :width="90"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -41,9 +41,7 @@
v-if="open" v-if="open"
ref="form" ref="form"
v-model="form" v-model="form"
:disabled="mode == 'detail'" :disabled="mode == 'detail'" />
:has-files="true"
:rows="rows" />
</base-dialog> </base-dialog>
<CustomDialogForm <CustomDialogForm
v-if="addOrUpdateVisible" v-if="addOrUpdateVisible"
@ -59,16 +57,17 @@ import CustomDialogForm from './CustomDialogForm.vue';
import { deleteRepair, exportRepairLogExcel } from '@/api/equipment/base/repair' import { deleteRepair, exportRepairLogExcel } from '@/api/equipment/base/repair'
import { parseTime } from '@/utils/ruoyi' import { parseTime } from '@/utils/ruoyi'
import htmls from './htmls.vue' import htmls from './htmls.vue'
import DialogForm from './Repair--add.vue';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'); // const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default { export default {
name: 'EquipmentRepair', name: 'EquipmentRepair',
components: { CustomDialogForm }, components: { CustomDialogForm, DialogForm },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
addOrUpdateVisible: false, addOrUpdateVisible: false,
searchBarKeys: ['maintenanceStatus', 'createTime', 'equipmentId'], searchBarKeys: ['maintenanceResult', 'createTime', 'equipmentId'],
tableBtn: [ tableBtn: [
this.$auth.hasPermi('equipment:repair:update') this.$auth.hasPermi('equipment:repair:update')
? { ? {
@ -76,18 +75,18 @@ export default {
btnName: '详情', btnName: '详情',
} }
: undefined, : undefined,
this.$auth.hasPermi('equipment:repair:finish') // this.$auth.hasPermi('equipment:repair:finish')
? { // ? {
type: 'finish', // type: 'finish',
btnName: '完成', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:repair:update') // this.$auth.hasPermi('equipment:repair:update')
? { // ? {
type: 'edit', // type: 'edit',
btnName: '修改', // btnName: '',
} // }
: undefined, // : undefined,
this.$auth.hasPermi('equipment:repair:delete') this.$auth.hasPermi('equipment:repair:delete')
? { ? {
type: 'delete', type: 'delete',
@ -96,33 +95,42 @@ export default {
: undefined, : undefined,
].filter((v) => v), ].filter((v) => v),
tableProps: [ tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: parseTime,
// },
{ prop: 'repairOrderNumber', label: '维修单号' },
{ prop: 'lineName', label: '产线名' },
{ prop: 'sectionName', label: '工段名' },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'faultDetail', label: '故障明细', subcomponent: htmls },
// { prop: 'maintenanceDetail', label: '', subcomponent: htmls, minWidth: 100, showOverflowtooltip: true },
{ {
prop: 'createTime', prop: 'maintenanceStartTime',
label: '添加时间', label: '维修开始时间',
fixed: true, width: 150,
width: 180,
filter: parseTime, filter: parseTime,
}, },
{ prop: 'repairOrderNumber', label: '设备维修单号' },
{ prop: 'maintenanceStartTime', label: '开始时间', filter: parseTime },
{ {
prop: 'maintenanceFinishTime', prop: 'maintenanceFinishTime',
label: '结束时间', label: '维修结束时间',
width: 150,
filter: parseTime, filter: parseTime,
}, },
// { prop: 'maintenanceStartTime', label: '', filter: parseTime },
{ {
prop: 'maintenanceStatus', prop: 'maintenanceResult',
label: '维修状态', label: '维修结果',
filter: (v) => (v != null ? ['未完成', '完成', '进行中'][v] : ''), filter: (v) => (v != null ? ['成功', '失败'][v] : ''),
}, },
{ prop: 'maintenanceDuration', label: '维修时长(h)' }, // { prop: 'maintenanceDuration', label: '(h)' },
{ prop: 'lineName', label: '产线' }, { prop: 'maintenanceDetail', label: '维修描述', subcomponent: htmls }, //
{ prop: 'sectionName', label: '工段' }, // { prop: 'repairman', label: '', minWidth: 100, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true }, // { prop: 'repairmanPhone', label: '', minWidth: 100, showOverflowtooltip: true },
{ prop: 'maintenanceDetail', label: '维修明细', subcomponent: htmls, minWidth: 100, showOverflowtooltip: true }, { prop: 'remark', label: '备注', minWidth: 90, showOverflowtooltip: true }
{ prop: 'repairman', label: '维修工', minWidth: 100, showOverflowtooltip: true },
{ prop: 'repairmanPhone', label: '联系方式', minWidth: 100, showOverflowtooltip: true },
{ prop: 'remark', label: '备注', minWidth: 120, showOverflowtooltip: true },
], ],
searchBarFormConfig: [ searchBarFormConfig: [
{ {
@ -134,13 +142,12 @@ export default {
}, },
{ {
type: 'select', type: 'select',
label: '状态', label: '维修结果',
placeholder: '请选择状态', placeholder: '请选择状态',
param: 'maintenanceStatus', param: 'maintenanceResult',
selectOptions: [ selectOptions: [
{ name: '未完成', id: '0' }, { name: '成功', id: '0' },
{ name: '完成', id: '1' }, { name: '失败', id: '1' }
{ name: '进行中', id: '2' },
], ],
}, },
// //
@ -181,71 +188,6 @@ export default {
color: 'success', color: 'success',
}, },
], ],
rows: [
[
{
input: true,
label: '维修单号',
prop: 'repairOrderNumber',
rules: [{ required: true, message: '维修单号不能为空', trigger: 'blur' }],
},
{
select: true,
label: '设备名称',
prop: 'equipmentId',
// url: '/base/core-equipment/listAll',
url: '/base/core-equipment/page?special=false&pageNo=1&pageSize=99',
bind: {
filterable: true,
clearable: true,
},
rules: [{ required: true, message: '设备名称不能为空', trigger: 'blur' }],
},
],
[
{
// TODO:
// select: true,
input: true,
label: '维修工',
prop: 'repairman',
// url: '/base/core-worker/listAll',
// valueKey: 'name',
bind: {
filterable: true,
clearable: true,
// multiple: true,
},
// options: [{ label: 'test', value: 'test' }],
rules: [{ required: true, message: '维修工不能为空', trigger: 'blur' }],
},
{
input: true,
label: '联系方式',
prop: 'repairmanPhone',
},
],
[
{
datetime: true,
label: '故障发生时间',
prop: 'faultTime',
rules: [{ required: true, message: '故障发生时间不能为空', trigger: 'blur' }],
bind: {
format: 'yyyy-MM-dd HH:mm:ss',
'value-format': 'timestamp',
// 'value-format': 'yyyy-MM-dd HH:mm:ss',
clearable: true,
},
},
{
select: true,
label: '故障级别',
prop: 'faultLevel', //
options: this.getDictDatas(this.DICT_TYPE.FAULT_LEVEL),
},
],
],
// //
open: false, open: false,
// //
@ -253,9 +195,10 @@ export default {
pageNo: 1, pageNo: 1,
pageSize: 10, pageSize: 10,
special: false, special: false,
maintenanceStatus: null, maintenanceResult: null,
createTime: null, createTime: null,
equipmentId: null, equipmentId: null,
special: false
}, },
// //
form: {}, form: {},
@ -381,7 +324,10 @@ export default {
// } // }
// //
if (this.form.id != null) { if (this.form.id != null) {
this.put(this.form).then((response) => { this.put({
...this.form,
repairman: this.form.repairman.join(',')
}).then((response) => {
this.$modal.msgSuccess('修改成功'); this.$modal.msgSuccess('修改成功');
this.open = false; this.open = false;
this.getList(); this.getList();
@ -389,7 +335,10 @@ export default {
return; return;
} }
// //
this.post(this.form).then((response) => { this.post({
...this.form,
repairman: this.form.repairman.join(',')
}).then((response) => {
this.$modal.msgSuccess('新增成功'); this.$modal.msgSuccess('新增成功');
this.open = false; this.open = false;
this.getList(); this.getList();

View File

@ -136,11 +136,11 @@ export default {
params.teamId = val.data.id params.teamId = val.data.id
params.teamName = val.data.name params.teamName = val.data.name
this.workOrderList.map(item => { this.workOrderList.map(item => {
if (this.queryParams.workOrderId === item.id) { if (val.data.workOrderId === item.id) {
this.workOrderName = item.name this.workOrderName = item.name
} }
}) })
params.workOrderId = this.queryParams.workOrderId params.workOrderId = val.data.workOrderId
params.workOrderName = this.workOrderName params.workOrderName = this.workOrderName
params.roomNameDict = val.data.roomNameDict params.roomNameDict = val.data.roomNameDict
this.$nextTick(() => { this.$nextTick(() => {

View File

@ -0,0 +1,97 @@
<template>
<el-form :inline="true" class="demo-form-inline">
<span class="blue-block"></span>
<el-form-item label="班次信息">
<el-select v-model="queryParams.classesId" placeholder="班次信息" style="width: 200px;" size="small" clearable>
<el-option
v-for="item in classesArr"
:key="item.id"
:label="(item.roomName?item.roomName:'')+'-'+item.name"
:value="item.id">
<span>{{ item.roomName }}-{{item.name}}</span>
</el-option>
</el-select>
</el-form-item>
<el-form-item label="班组信息">
<el-input v-model="queryParams.teamName" placeholder="班组信息" style="width: 200px;" clearable></el-input>
</el-form-item>
<el-form-item label="上班时间">
<el-date-picker
v-model="queryParams.tiemStr"
type="daterange"
format='yyyy-MM-dd'
value-format='yyyy-MM-dd'
range-separator='-'
style="width: 250px;"
size="small">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" size="small" @click="search">查询</el-button>
</el-form-item>
</el-form>
</template>
<script>
import { groupClassesListAll } from '@/api/monitoring/teamProduction'
export default {
name: 'searchArea',
data() {
return {
//
queryParams: {
classesId: '',
teamName: '',
tiemStr: ''
},
classesArr: [],
}
},
mounted() {
this.getGroupClass()
},
methods: {
getGroupClass() {
groupClassesListAll().then(res => {
this.classesArr = res.data || []
})
},
//
search() {
console.log(this.queryParams)
this.$emit('submit', this.queryParams)
}
}
}
</script>
<style lang="scss">
.demo-form-inline {
.el-date-editor .el-range__icon {
font-size: 16px;
color: #0B58FF;
}
.el-input__prefix .el-icon-date {
font-size: 16px;
color: #0B58FF;
}
}
</style>
<style lang="scss" scoped>
.separateStyle {
display: inline-block;
width: 1px;
height: 24px;
background: #E8E8E8;
vertical-align: middle;
}
.demo-form-inline {
.blue-block {
display: inline-block;
width: 4px;
height: 16px;
background-color: #0B58FF;
border-radius: 1px;
margin-right: 8px;
margin-top: 10px;
}
}
</style>

View File

@ -1,11 +1,12 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<!-- 搜索工作栏 --> <!-- 搜索工作栏 -->
<search-bar <search-area @submit="buttonClick"/>
<!-- <search-bar
:formConfigs="formConfig" :formConfigs="formConfig"
ref="searchBarForm" ref="searchBarForm"
@headBtnClick="buttonClick" @headBtnClick="buttonClick"
/> /> -->
<!-- 列表 --> <!-- 列表 -->
<base-table <base-table
:page="queryParams.pageNo" :page="queryParams.pageNo"
@ -34,10 +35,11 @@
</div> </div>
</template> </template>
<script> <script>
import { groupTeamSchedulingPage, groupClassesListAll } from '@/api/monitoring/teamProduction' import { groupTeamSchedulingPage } from '@/api/monitoring/teamProduction'
import { parseTime } from '@/utils/ruoyi' import { parseTime } from '@/utils/ruoyi'
import TeamProductionDetail from './components/teamProductionDetail' import TeamProductionDetail from './components/teamProductionDetail'
import { publicFormatter } from '@/utils/dict' import { publicFormatter } from '@/utils/dict'
import SearchArea from './components/searchArea'
const tableProps = [ const tableProps = [
{ {
prop: 'roomNameDict', prop: 'roomNameDict',
@ -139,12 +141,11 @@ export default {
paramVisible: false paramVisible: false
} }
}, },
components: { TeamProductionDetail }, components: { TeamProductionDetail, SearchArea },
mounted() { mounted() {
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260) this.tableH = this.tableHeight(260)
}) })
this.getGroupClass()
this.getList() this.getList()
}, },
methods: { methods: {
@ -163,11 +164,6 @@ export default {
this.total = res.data.total || 0 this.total = res.data.total || 0
}) })
}, },
getGroupClass() {
groupClassesListAll().then(res => {
this.formConfig[0].selectOptions = res.data || []
})
},
handleClick(val) { handleClick(val) {
console.log(val) console.log(val)
this.paramVisible = true this.paramVisible = true

View File

@ -236,13 +236,8 @@ export default {
btnName: '终止', btnName: '终止',
showTip: '终止', showTip: '终止',
showParam: { showParam: {
type: '|', type: '&',
data: [ data: [
{
type: 'equal',
name: 'status',
value: 2
},
{ {
type: 'equal', type: 'equal',
name: 'status', name: 'status',
@ -283,7 +278,7 @@ export default {
{ {
type: 'less', type: 'less',
name: 'status', name: 'status',
value: 3 value: 2
} }
] ]
} }
@ -383,9 +378,9 @@ export default {
}, },
// , // ,
handleEditStatus(val, tip, status) { handleEditStatus(val, tip, status) {
console.log(val) let _this = this
if (val.orderIdNum > 0) {// if (val.orderIdNum > 0) {//
this.$confirm('是否将"'+tip+'"操作同步至下级订单和工单?','确认信息', { _this.$confirm('是否将"'+tip+'"操作同步至下级订单和工单?','确认信息', {
type: 'warning', type: 'warning',
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
confirmButtonText: '同步', confirmButtonText: '同步',
@ -393,26 +388,26 @@ export default {
}).then(function() { }).then(function() {
console.log('同步') console.log('同步')
groupOrderStatusSet({ id: val.id, status: status, isSync: true}).then(() => { groupOrderStatusSet({ id: val.id, status: status, isSync: true}).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("操作成功"); _this.$modal.msgSuccess("操作成功");
}) })
}).catch(action => { }).catch(action => {
if (action === 'cancel') { if (action === 'cancel') {
console.log('不同步') console.log('不同步')
groupOrderStatusSet({ id: val.id, status: status, isSync: false}).then(() => { groupOrderStatusSet({ id: val.id, status: status, isSync: false}).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("操作成功"); _this.$modal.msgSuccess("操作成功");
}) })
}else { }else {
return console.log('关闭') return console.log('关闭')
} }
}) })
}else{// }else{//
this.$modal.confirm('是否确认"'+tip+'"集团订单名称为"' + val.name + '"的数据项?').then(function() { _this.$modal.confirm('是否确认"'+tip+'"集团订单名称为"' + val.name + '"的数据项?').then(function() {
return groupOrderStatusSet({ id: val.id, status: status}) return groupOrderStatusSet({ id: val.id, status: status})
}).then(() => { }).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("操作成功"); _this.$modal.msgSuccess("操作成功");
}).catch(() => {}); }).catch(() => {});
} }
}, },

View File

@ -44,7 +44,7 @@
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">加工平方数(平方米)</div> <div class="blodTip">加工平方数(平方米)</div>
<div class="lightTip">{{orderGroupMsg.actualArea}}</div> <div class="lightTip">{{orderGroupMsg.planArea}}</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">状态</div> <div class="blodTip">状态</div>
@ -70,7 +70,7 @@
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">废片数量</div> <div class="blodTip">废片数量</div>
<div class="lightTip">该字段未绑定</div> <div class="lightTip">{{orderGroupMsg.nokQuantity}}</div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -114,7 +114,7 @@
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">加工平方数(平方米)</div> <div class="blodTip">加工平方数(平方米)</div>
<div class="lightTip">{{item.actualArea}}</div> <div class="lightTip">{{item.planArea}}</div>
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">预计用时()</div> <div class="blodTip">预计用时()</div>
@ -144,7 +144,7 @@
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">废片数量</div> <div class="blodTip">废片数量</div>
<div class="lightTip">该字段未绑定</div> <div class="lightTip">{{item.nokQuantity}}</div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>
@ -247,7 +247,7 @@ export default {
orderGroupId: '', orderGroupId: '',
tableProps, tableProps,
orderMsg: [], orderMsg: [],
tableH: this.tableHeight(510) / 2, tableH: 150,
// //
queryParams: { queryParams: {
pageNo: 1, pageNo: 1,
@ -257,9 +257,6 @@ export default {
} }
}, },
mounted() { mounted() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(510) / 2
})
this.orderGroupId = location.href.split('?')[1].split('=')[1] this.orderGroupId = location.href.split('?')[1].split('=')[1]
this.getMsg() this.getMsg()
}, },

View File

@ -202,8 +202,8 @@ export default {
processFlowList: [], processFlowList: [],
productLineList: [], productLineList: [],
workOrderTypeList: [ workOrderTypeList: [
{id: 1,name:'标准工单'}, {id: 1,name:'普通'},
{id: 2, name:'特殊工单'} {id: 2, name:'特殊'}
], ],
planStartTime: '', planStartTime: '',
planFinishTime: '', planFinishTime: '',
@ -291,12 +291,12 @@ export default {
_this.$modal.msgSuccess("操作成功") _this.$modal.msgSuccess("操作成功")
let name = this.form.name let name = this.form.name
_this.$emit('addWorkOrderSubmit') _this.$emit('addWorkOrderSubmit')
// 使 // // 使
_this.$modal.confirm('是否添加预使用主原料信息?').then(function() { // _this.$modal.confirm('使?').then(function() {
_this.$router.push({ // _this.$router.push({
path: '/core/core-work-order?workOrderName='+encodeURI(name) // path: '/core/core-work-order?workOrderName='+encodeURI(name)
}) // })
}) // })
} }
}) })
} else { } else {

View File

@ -175,16 +175,38 @@ export default {
} }
if (this.isEdit) { if (this.isEdit) {
// //
orderUpdate({ ...this.form }).then((res) => { orderUpdate({
code: this.form.code,
name: this.form.name,
planQuantity: this.form.planQuantity,
planProductId: this.form.planProductId,
priority: this.form.priority,
planStartTime: this.form.planStartTime,
planFinishTime: this.form.planFinishTime,
remark: this.form.remark,
id: this.form.id,
specifications: this.form.specifications
}).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit') this.$emit('successSubmit')
} }
}) })
} else { } else {
this.form.status = 1 orderCreate({
this.form.triggerOrigin = 1 code: this.form.code,
orderCreate({ ...this.form }).then((res) => { name: this.form.name,
planQuantity: this.form.planQuantity,
planProductId: this.form.planProductId,
priority: this.form.priority,
planStartTime: this.form.planStartTime,
planFinishTime: this.form.planFinishTime,
remark: this.form.remark,
id: this.form.id,
specifications: this.form.specifications,
status: 1,
triggerOrigin: 1
}).then((res) => {
if (res.code === 0) { if (res.code === 0) {
this.$modal.msgSuccess("操作成功"); this.$modal.msgSuccess("操作成功");
this.$emit('successSubmit') this.$emit('successSubmit')

View File

@ -244,13 +244,8 @@ export default {
btnName: '终止', btnName: '终止',
showTip: '终止', showTip: '终止',
showParam: { showParam: {
type: '|', type: '&',
data: [ data: [
{
type: 'equal',
name: 'status',
value: 2
},
{ {
type: 'equal', type: 'equal',
name: 'status', name: 'status',
@ -293,7 +288,7 @@ export default {
{ {
type: 'less', type: 'less',
name: 'status', name: 'status',
value: 3 value: 2
} }
] ]
} }
@ -401,9 +396,9 @@ export default {
}, },
// , // ,
handleEditStatus(val, tip, status) { handleEditStatus(val, tip, status) {
console.log(val) let _this = this
if (val.workOrderNum > 0) {// if (val.workOrderNum > 0) {//
this.$confirm('是否将"'+tip+'"操作同步至下级工单?','确认信息', { _this.$confirm('是否将"'+tip+'"操作同步至下级工单?','确认信息', {
type: 'warning', type: 'warning',
distinguishCancelAndClose: true, distinguishCancelAndClose: true,
confirmButtonText: '同步', confirmButtonText: '同步',
@ -411,26 +406,26 @@ export default {
}).then(function() { }).then(function() {
console.log('同步') console.log('同步')
orderStatusSet({ id: val.id, status: status, isSync: true}).then(() => { orderStatusSet({ id: val.id, status: status, isSync: true}).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("操作成功"); _this.$modal.msgSuccess("操作成功");
}) })
}).catch(action => { }).catch(action => {
if (action === 'cancel') { if (action === 'cancel') {
console.log('不同步') console.log('不同步')
orderStatusSet({ id: val.id, status: status, isSync: false}).then(() => { orderStatusSet({ id: val.id, status: status, isSync: false}).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("操作成功"); _this.$modal.msgSuccess("操作成功");
}) })
}else { }else {
return console.log('关闭') return console.log('关闭')
} }
}) })
}else{// }else{//
this.$modal.confirm('是否确认"'+tip+'"厂务订单名称为"' + val.name + '"的数据项?').then(function() { _this.$modal.confirm('是否确认"'+tip+'"厂务订单名称为"' + val.name + '"的数据项?').then(function() {
return orderStatusSet({ id: val.id, status: status}) return orderStatusSet({ id: val.id, status: status})
}).then(() => { }).then(() => {
this.getList(); _this.getList();
this.$modal.msgSuccess("操作成功"); _this.$modal.msgSuccess("操作成功");
}).catch(() => {}); }).catch(() => {});
} }
}, },

View File

@ -74,7 +74,7 @@
</el-col> </el-col>
<el-col :span='4'> <el-col :span='4'>
<div class="blodTip">废片数量</div> <div class="blodTip">废片数量</div>
<div class="lightTip">该字段未绑定</div> <div class="lightTip">{{orderMsg.nokQuantity}}</div>
</el-col> </el-col>
</el-row> </el-row>
</div> </div>

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-06 15:15:30 * @Date: 2023-11-06 15:15:30
* @LastEditTime: 2024-02-18 14:07:08 * @LastEditTime: 2024-02-28 09:58:34
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -15,35 +15,11 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="班组" prop="teamId">
<el-select v-model="dataForm.teamId" placeholder="请选择班组">
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="数量" prop="num"> <el-form-item label="数量" prop="num">
<el-input v-model="dataForm.num" placeholder="请输入数量" /> <el-input v-model="dataForm.num" placeholder="请输入数量" />
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线">
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因">
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="报废时间" prop="logTime"> <el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" <el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
@ -54,12 +30,28 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="来源" prop="source"> <el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.source" placeholder="请选择来源"> <el-select v-model="dataForm.lineId" placeholder="请选择产线" @change="getWorksectionById">
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="工段" prop="sectionId">
<el-select v-model="dataForm.sectionId" placeholder="请选择工段">
<el-option v-for="dict in sectionList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" multiple>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="描述" prop="description"> <el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" /> <el-input v-model="dataForm.description" placeholder="请输入描述" />
@ -76,7 +68,7 @@
</template> </template>
<script> <script>
import basicAdd from '../../../core/mixins/basic-add'; import basicAdd from './basic-add';
import { import {
createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList, createQualityScrapLog, updateQualityScrapLog, getQualityScrapLog, getWorkOrderList,
getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog"; getTeamList, getDetList,getLineList } from "@/api/base/qualityScrapLog";
@ -99,6 +91,7 @@ export default {
workOrderList: [], workOrderList: [],
detList:[], detList:[],
teamList: [], teamList: [],
sectionList:[],
sourceList: [ sourceList: [
{ {
id: 1, id: 1,
@ -117,6 +110,7 @@ export default {
workOrderId: null, workOrderId: null,
teamId: undefined, teamId: undefined,
num: undefined, num: undefined,
sectionId:undefined,
lineId:undefined, lineId:undefined,
description:undefined, description:undefined,
// description: undefined, // description: undefined,
@ -137,6 +131,7 @@ export default {
this.getDict() this.getDict()
console.log('我看看', this.dataForm) console.log('我看看', this.dataForm)
this.getCurrentTime() this.getCurrentTime()
this.getWorksectionById()
}, },
methods: { methods: {
getCurrentTime() { getCurrentTime() {
@ -197,6 +192,42 @@ export default {
// console.log(this.formConfig[0].selectOptions); // console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}) })
},
async getWorksectionById(lineId) {
if (lineId) {
const { code, data } = await this.$axios({
url: '/base/core-workshop-section/listByParentId',
method: 'get',
params: {
id: lineId,
},
});
if (code == 0) {
console.log(data)
this.sectionList = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
} else {
this.$axios({
url: '/base/core-workshop-section/listAll',
method: 'get',
// params: {
// id: lineId,
// },
}).then((res) => {
// console.log(data)
this.sectionList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
})
}
}, },
// setMaterialCode() { // setMaterialCode() {
// const chooseM = this.materialList.filter(item => { // const chooseM = this.materialList.filter(item => {

View File

@ -0,0 +1,106 @@
/*
* @Author: zhp
* @Date: 2024-02-28 09:51:25
* @LastEditTime: 2024-02-28 10:05:00
* @LastEditors: zhp
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
createURL: '',
updateURL: '',
infoURL: '',
codeURL: '',
getOption: false,
isGetCode: false,
optionArrUrl: [],
optionArr: {}
},
visible: false,
setData: false
}
},
created() {
},
activated() {
},
methods: {
init(id) {
this.dataForm.id = id || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(id).then(response => {
console.log(response)
this.dataForm = response.data
this.dataForm.detId = response.data.detIdList
this.dataForm.logTime = new Date(response.data.createTime)
// if (this.setData) {
// this.setDataForm()
// }
});
} else {
if (this.urlOptions.isGetCode) {
this.getCode()
}
}
});
},
getCode() {
this.urlOptions.codeURL()
.then(({ data: res }) => {
this.dataForm.code = res;
})
.catch(() => {});
},
getArr() {
const params = {
pageSize: 100,
pageNo: 1,
}
this.urlOptions.optionArrUrl.forEach((item, index) => {
item(params).then(({ data: res }) => {
this.$set(this.urlOptions.optionArr, `arr${index}`, res.list)
})
.catch(() => {
});
});
},
// 表单提交
dataFormSubmit() {
this.$refs["dataForm"].validate((valid) => {
if (!valid) {
return false;
}
// 修改的提交
let str = this.dataForm.detId.join(',')
this.dataForm.detId = str
if (this.dataForm.id) {
this.urlOptions.updateURL(this.dataForm).then(response => {
this.$modal.msgSuccess("修改成功");
this.visible = false;
this.$emit("refreshDataList");
});
return;
}
// 添加的提交
this.urlOptions.createURL(this.dataForm).then(response => {
this.$modal.msgSuccess("新增成功");
this.visible = false;
this.$emit("refreshDataList");
});
});
},
formClear() {
this.$refs.dataForm.resetFields()
}
}
}

View File

@ -1,7 +1,7 @@
<!-- <!--
* @Author: zhp * @Author: zhp
* @Date: 2023-11-06 15:15:30 * @Date: 2023-11-06 15:15:30
* @LastEditTime: 2023-12-01 10:58:25 * @LastEditTime: 2024-02-28 10:13:10
* @LastEditors: zhp * @LastEditors: zhp
* @Description: * @Description:
--> -->
@ -15,43 +15,19 @@
<el-row :gutter="24"> <el-row :gutter="24">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="工单号" prop="workOrderId"> <el-form-item label="工单号" prop="workOrderId">
<el-select v-model="dataForm.workOrderId" placeholder="请选择工单号" disabled> <el-select disabled v-model="dataForm.workOrderId" placeholder="请选择工单号">
<el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in workOrderList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="班组" prop="teamId"> <el-form-item label="数量" prop="num">
<el-select v-model="dataForm.teamId" placeholder="请选择班组" disabled> <el-input disabled v-model="dataForm.num" placeholder="请输入数量" />
<el-option v-for="dict in teamList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="数量" prop="sum">
<el-input v-model="dataForm.sum" placeholder="请输入数量" disabled />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.lineId" placeholder="请选择产线" disabled>
<el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" disabled>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="报废时间" prop="logTime"> <el-form-item label="报废时间" prop="logTime">
<el-date-picker v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss" disabled <el-date-picker disabled v-model="dataForm.logTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
placeholder="选择日期"> placeholder="选择日期">
</el-date-picker> </el-date-picker>
</el-form-item> </el-form-item>
@ -59,12 +35,28 @@
</el-row> </el-row>
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="来源" prop="source"> <el-form-item label="产线" prop="lineId">
<el-select v-model="dataForm.source" placeholder="请选择来源" disabled> <el-select disabled v-model="dataForm.lineId" placeholder="请选择产线" @change="getWorksectionById">
<el-option v-for="dict in sourceList" :key="dict.id" :label="dict.name" :value="dict.id" /> <el-option v-for="dict in lineList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8">
<el-form-item label="工段" prop="sectionId">
<el-select v-model="dataForm.sectionId" placeholder="请选择工段" disabled>
<el-option v-for="dict in sectionList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="报废原因" prop="detId">
<el-select v-model="dataForm.detId" placeholder="请选择报废原因" multiple disabled>
<el-option v-for="dict in detList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="描述" prop="description"> <el-form-item label="描述" prop="description">
<el-input v-model="dataForm.description" placeholder="请输入描述" disabled /> <el-input v-model="dataForm.description" placeholder="请输入描述" disabled />
@ -147,6 +139,7 @@ export default {
this.getDict() this.getDict()
console.log('我看看', this.dataForm) console.log('我看看', this.dataForm)
this.getCurrentTime() this.getCurrentTime()
// this.getWorksectionById()
}, },
methods: { methods: {
// init() { // init() {
@ -198,6 +191,7 @@ export default {
// console.log(this.formConfig[0].selectOptions); // console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}) })
getTeamList().then((res) => { getTeamList().then((res) => {
console.log(res); console.log(res);
// console.log(response); // console.log(response);
@ -207,15 +201,45 @@ export default {
id: item.id id: item.id
} }
}) })
this.$axios({
url: '/base/core-workshop-section/listAll',
method: 'get',
// params: {
// id: lineId,
// },
}).then((res) => {
// console.log(data)
this.sectionList = res.data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
})
// if (code == 0) {
// }
// console.log(this.formConfig[0].selectOptions); // console.log(this.formConfig[0].selectOptions);
// this.listQuery.total = response.data.total; // this.listQuery.total = response.data.total;
}) })
}, },
setMaterialCode() { async getWorksectionById(lineId) {
const chooseM = this.materialList.filter(item => { const { code, data } = await this.$axios({
return item.id === this.dataForm.materialId url: '/base/core-workshop-section/listByParentId',
}) method: 'get',
this.dataForm.materialCode = chooseM[0].code params: {
id: lineId,
},
});
if (code == 0) {
console.log(data)
this.sectionList = data.map((item) => {
return {
name: item.name,
id: item.id,
};
});
}
} }
}, },
}; };

View File

@ -30,31 +30,40 @@ import {
} from '@/api/base/qualityScrapLog'; } from '@/api/base/qualityScrapLog';
const tableProps = [ const tableProps = [
{ // {
prop: 'createTime', // prop: 'createTime',
label: '添加时间', // label: '',
filter: parseTime // filter: parseTime
}, // },
{
prop: 'workOrderName',
label: '工单'
},
{
prop: 'teamName',
label: '班组'
},
{
prop: 'detContent',
label: '报废原因'
},
{ {
prop: 'logTime', prop: 'logTime',
label: '报废时间', label: '报废时间',
filter: parseTime filter: parseTime
}, },
{
prop: 'lineName',
label: '产线名称'
},
{
prop: 'sectionName',
label: '工段'
},
{
prop: 'workOrderName',
label: '工单名称'
},
{ {
prop: 'num', prop: 'num',
label: '数量' label: '数量'
},
{
prop: 'detContent',
label: '报废原因'
},
{
prop: 'source',
label: '来源',
filter: (val) => val == 1 ? '平板端' : '网页端'
}, },
]; ];

View File

@ -286,6 +286,7 @@ export default {
// this.searchBarFormConfig[0].defaultSelect = []; // this.searchBarFormConfig[0].defaultSelect = [];
// } // }
this.getList() this.getList()
this.getDict()
}, },
methods: { methods: {
/** 获取搜索栏的产线列表 */ /** 获取搜索栏的产线列表 */
@ -320,7 +321,7 @@ export default {
// }, // },
getList() { getList() {
this.getDataList() this.getDataList()
this.getDict() // this.getDict()
}, },
/** 查询列表 */ /** 查询列表 */
async getDataList() { async getDataList() {
@ -330,7 +331,7 @@ export default {
const { const {
data: { data, otherList, otherMap, nameData }, data: { data, otherList, otherMap, nameData },
} = await getStatisticalDataPage(this.queryParams) } = await getStatisticalDataPage(this.queryParams)
console.log(this.queryParams); // console.log(this.queryParams);
this.dynamicProps = this.filterNameData(nameData) this.dynamicProps = this.filterNameData(nameData)
this.list = this.filterData(data); this.list = this.filterData(data);
}, },
@ -373,7 +374,7 @@ export default {
this.getList() this.getList()
} }
console.log(val); // console.log(val);
} }
/** 搜索按钮操作 */ /** 搜索按钮操作 */
// handleQuery() { // handleQuery() {

View File

@ -51,10 +51,7 @@
{{ scope.row.planCheckTime | timeFilter }} {{ scope.row.planCheckTime | timeFilter }}
</template> </template>
</el-table-column> </el-table-column>
<el-table-column <el-table-column v-if="selectedBox[3]" label="班次" prop="groupClass">
v-if="selectedBox[3]"
label="班次"
prop="groupClass">
<template slot-scope="scope"> <template slot-scope="scope">
{{ scope.row.groupClass || '---' }} {{ scope.row.groupClass || '---' }}
</template> </template>
@ -129,7 +126,7 @@ import moment from 'moment';
export default { export default {
name: 'CheckOrderListTable', name: 'CheckOrderListTable',
components: {}, components: {},
props: ['tableData', 'page', 'limit'], props: ['tableData', 'page', 'limit', 'permissionGuard'],
filters: { filters: {
timeFilter: (val) => timeFilter: (val) =>
val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---', val ? moment(val).format('yyyy-MM-DD HH:mm:ss') : '---',
@ -170,12 +167,7 @@ export default {
}, },
methods: { methods: {
checkSelectable(row, index) { checkSelectable(row, index) {
return true; return this.permissionGuard(row);
// return (
// row.relatePlan == 2 ||
// (row.relatePlan == 1 &&
// (!row.confirmDueTime || +row.confirmDueTime >= new Date().getTime()))
// );
}, },
handleSelectionChange(val) { handleSelectionChange(val) {
this.selectedOrder = val; this.selectedOrder = val;

View File

@ -121,6 +121,11 @@ export default {
showOverflowtooltip: true, showOverflowtooltip: true,
filter: parseTime, filter: parseTime,
}, },
{
prop: 'checkPeriod',
label: '巡检频率(天/次)',
showOverflowtooltip: true,
},
{ {
width: 144, width: 144,
prop: 'confirmTimeLimit', prop: 'confirmTimeLimit',

View File

@ -50,6 +50,31 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col>
<el-form-item label="巡检人" prop="checkPerson">
<el-select
v-model="dataForm.checkPerson"
:placeholder="`请选择巡检人`"
multiple
clearable
filterable>
<el-option
v-for="opt in inspectorOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="巡检时间" prop="planCheckTime">
<el-date-picker
v-model="dataForm.planCheckTime"
type="datetime"
placeholder="请选择计划开始时间"
value-format="timestamp"></el-date-picker>
</el-form-item>
</el-col>
<!-- <el-col> <!-- <el-col>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" /> <el-input v-model="dataForm.remark" placeholder="请输入备注" />
@ -60,6 +85,8 @@
</template> </template>
<script> <script>
import { groupConnectWorkshop } from '@/utils/equipment-module';
export default { export default {
name: 'ContentAdd', name: 'ContentAdd',
data() { data() {
@ -69,7 +96,9 @@ export default {
id: null, id: null,
name: null, name: null,
departmentId: null, departmentId: null,
groupClass: null, groupClass: [],
checkPerson: [],
planCheckTime: null,
// special: true, // special: true,
}, },
dataRule: { dataRule: {
@ -80,6 +109,7 @@ export default {
equipmentOptions: [], equipmentOptions: [],
groupOptions: [], groupOptions: [],
departmentOptions: [], departmentOptions: [],
inspectorOptions: [],
}; };
}, },
mounted() { mounted() {
@ -91,7 +121,9 @@ export default {
id: null, id: null,
name: null, name: null,
departmentId: null, departmentId: null,
groupClass: null, groupClass: [],
checkPerson: [],
planCheckTime: null,
// special: true, // special: true,
}; };
}, },
@ -114,10 +146,35 @@ export default {
} }
if (grp.code == 0) { if (grp.code == 0) {
this.groupOptions = grp.data.map((item) => ({ this.groupOptions = grp.data.map((item) => ({
label: item.name, label: groupConnectWorkshop(item.name, item.roomNameDict),
value: item.id, value: item.id,
})); }));
} }
/** get user list and worker list */
let inspectorList = [];
const userlist = await this.$axios({
url: '/system/user/page',
params: { pageNo: 1, pageSize: 100 },
});
if (userlist.code == 0) {
inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({
label: item.nickname,
value: item.nickname,
}))
);
}
const workerlist = await this.$axios('/base/core-worker/listAll');
if (workerlist.code == 0) {
inspectorList = inspectorList.concat(
workerlist.data.map((item) => ({
label: item.name,
value: item.name,
}))
);
}
this.inspectorOptions = inspectorList;
/** endget */
this.formLoading = false; this.formLoading = false;
} catch (err) { } catch (err) {
this.formLoading = false; this.formLoading = false;
@ -127,6 +184,8 @@ export default {
async init(row) { async init(row) {
if (!row || !row.id) { if (!row || !row.id) {
/** 新增 */
this.dataForm.checkPerson = [this.$store.getters.nickname];
return; return;
} }
const res = await this.$axios({ const res = await this.$axios({
@ -157,12 +216,12 @@ export default {
} catch (err) {} } catch (err) {}
if (!valid) return; if (!valid) return;
let confirmed = false; // let confirmed = false;
try { // try {
confirmed = await this.getConfirmed(); // confirmed = await this.getConfirmed();
} catch (err) { // } catch (err) {
confirmed = false; // confirmed = false;
} // }
const res = await this.$axios({ const res = await this.$axios({
url: url:
'/base/equipment-check-order' + '/base/equipment-check-order' +
@ -171,15 +230,18 @@ export default {
data: { data: {
...this.dataForm, ...this.dataForm,
special: true, special: true,
status: confirmed ? 2 : 1, status: 1,
groupClass: this.dataForm.groupClass.join(','), // status: confirmed ? 2 : 1,
checkPerson: this.$store.getters.userId, groupClass: this.dataForm.groupClass?.join(','),
checkPerson: this.dataForm.checkPerson?.join(','),
}, },
}); });
if (res.code == 0) { if (res.code == 0) {
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.$message.success(this.dataForm.id ? '更新成功' : '创建成功'); this.$message.success(this.dataForm.id ? '更新成功' : '创建成功');
return res.data;
} }
return null;
}, },
}, },
}; };

View File

@ -0,0 +1,519 @@
<!--
filename: Content-edit.vue
author: liubin
date: 2024-2-24 11:38:56
description:
-->
<template>
<el-drawer
:visible="visible"
:show-close="false"
:wrapper-closable="false"
class="drawer"
custom-class="mes-drawer"
size="60%"
@closed="$emit('destroy')">
<SmallTitle slot="title">添加巡检内容</SmallTitle>
<div class="drawer-body flex">
<div class="drawer-body__content">
<SmallTitle>巡检内容</SmallTitle>
<div style="margin-top: 12px; position: relative">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
</div>
<div style="margin-top: 12px; position: relative">
<div
v-if="!disableEdit && !disableModifyDetail"
style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i>
添加内容
</el-button>
</div>
<base-table
v-loading="attrListLoading"
:table-props="attrTableProps"
:page="attrQuery?.params.pageNo || 1"
:limit="attrQuery?.params.pageSize || 10"
:table-data="attrList"
@emitFun="handleEmitFun">
<method-btn
slot="handleBtn"
label="操作"
v-if="!disableEdit"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="attrTotal > 0"
:total="attrTotal"
:page.sync="attrQuery.params.pageNo"
:limit.sync="attrQuery.params.pageSize"
@pagination="getAttrList" />
</div>
</div>
<div class="drawer-body__footer">
<el-button style="" @click="handleCancel">
{{ disableEdit ? '返回' : '取消' }}
</el-button>
<el-button
v-if="!disableEdit"
type="primary"
:loading="btnLoading"
@click="handleConfirm">
保存
</el-button>
</div>
</div>
<!-- 属性对话框 -->
<base-dialog
:dialogTitle="attrTitle"
:dialogVisible="attrFormVisible"
width="35%"
:append-to-body="true"
custom-class="baseDialog"
@close="closeAttrForm"
@cancel="closeAttrForm"
@confirm="submitAttrForm">
<DialogForm
v-if="attrFormVisible"
ref="attrForm"
v-model="attrForm"
:rows="attrRows" />
</base-dialog>
</el-drawer>
</template>
<script>
import DialogForm from '../../../components/DialogForm/index.vue';
const SmallTitle = {
name: 'SmallTitle',
props: ['size'],
components: {},
data() {
return {};
},
methods: {},
render: function (h) {
return h(
'span',
{
class: 'small-title',
style: {
fontSize: '18px',
lineHeight:
this.size == 'lg' ? '24px' : this.size == 'sm' ? '18px' : '20px',
fontWeight: 500,
fontFamily: '微软雅黑, Microsoft YaHei, Arial, Helvetica, sans-serif',
},
},
this.$slots.default
);
},
};
export default {
components: { SmallTitle, DialogForm },
props: ['dataId'], // dataId id
data() {
return {
visible: false,
btnLoading: false,
form: {},
formLoading: false,
departmentList: [],
inspectorOptions: [],
attrList: [],
attrTotal: 0,
attrTitle: '',
attrForm: {
id: null,
orderId: null,
program: null,
checkResult: null,
equipmentId: null,
},
attrFormVisible: false,
attrRows: [
[
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/page?pageNo=1&pageSize=100&special=true',
rules: [
{ required: true, message: '设备不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '巡检项目',
prop: 'program',
rules: [
{ required: true, message: '巡检项目不能为空', trigger: 'blur' },
],
},
],
[
{
input: true,
label: '巡检结果',
prop: 'checkResult',
rules: [
{ required: true, message: '巡检结果不能为空', trigger: 'blur' },
],
},
],
],
attrQuery: {
params: {
pageNo: 1,
pageSize: 10,
equipmentName: null,
},
}, //
searchBarFormConfig: [
{
type: 'input',
label: '设备',
placeholder: '请输入设备名称',
param: 'equipmentName',
},
{
type: 'button',
btnName: '查询',
name: 'search',
color: 'primary',
},
],
attrFormSubmitting: false,
attrListLoading: false,
// syncFileListFlag: null,
tableBtn: [
{
type: 'edit',
btnName: '编辑',
},
{
type: 'delete',
btnName: '删除',
},
],
row: null,
groupOptions: [],
disableEdit: false,
};
},
computed: {
departmentOptions() {
return (this.departmentList || []).map((item) => ({
id: item.id,
label: item.name,
value: item.id,
}));
},
disableModifyDetail() {
return this.form && this.form.confirmTimeLimit != undefined;
},
attrTableProps() {
return [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
},
];
},
},
mounted() {
this.formLoading = true;
},
methods: {
handleSearchBarBtnClick(btn) {
switch (btn.btnName) {
case 'search':
this.attrQuery.params.equipmentName = btn.equipmentName;
this.getAttrList();
break;
}
},
handleTableBtnClick({ type, data }) {
switch (type) {
case 'edit':
this.handleEditAttr(data.id);
break;
case 'delete':
this.handleDeleteAttr(data.id);
break;
}
},
getConfirmed(message = '是否直接确认巡检记录') {
return this.$confirm(message, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
});
},
async handleConfirm() {
if (this.attrList.length == 0) {
return this.$message.error('请添加巡检内容');
}
/** 询问 是否保存记录 */
try {
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('已确认');
}
}
this.$emit('refreshDataList');
this.handleCancel();
} catch (err) {
this.handleCancel();
}
}
} catch (err) {}
// 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('');
// }
// this.btnLoading = false;
// this.$emit('refreshDataList');
// this.handleCancel();
// });
},
handleEmitFun(val) {
console.log('handleEmitFun', val);
},
init(row, detail) {
if (detail) this.disableEdit = true;
this.visible = true;
this.row = row;
this.getAttrList(row);
},
async getAttrList(row, condition = {}) {
if (!row) row = this.row;
this.attrListLoading = true;
const res = await this.$axios({
url: '/base/equipment-check-order-det/page',
method: 'get',
params: {
...this.attrQuery.params,
orderId: row.id,
...condition,
},
});
if (res.code == 0) {
this.attrList = res.data.list;
this.attrTotal = res.data.total;
}
this.attrListLoading = false;
},
handleCancel() {
if (!this.attrList.length) {
return this.$message.error('请添加巡检内容');
}
this.visible = false;
},
resetAttrform() {
this.attrForm = {
id: null,
orderId: null,
equipmentId: null,
program: null,
checkResult: null,
};
},
//
handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform();
this.attrTitle = '添加巡检内容';
this.attrFormVisible = true;
},
//
async handleEditAttr(attrId) {
const res = await this.$axios({
url: '/base/equipment-check-order-det/get',
method: 'get',
params: { id: attrId },
});
if (res.code == 0) {
this.attrForm = res.data;
this.attrTitle = '编辑巡检单详情';
this.attrFormVisible = true;
}
},
//
handleDeleteAttr(attrId) {
this.$confirm('确定删除该巡检内容?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
})
.then(async () => {
const res = await this.$axios({
url: '/base/equipment-check-order-det/delete?id=' + attrId,
method: 'delete',
});
if (res.code == 0) {
this.$message({
message: '删除成功',
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
})
.catch(() => {});
},
//
submitAttrForm() {
this.$refs['attrForm'].validate(async (valid) => {
if (!valid) {
return;
}
try {
const isEdit = this.attrForm.id != null;
this.attrFormSubmitting = true;
const res = await this.$axios({
url: isEdit
? '/base/equipment-check-order-det/update'
: '/base/equipment-check-order-det/create',
method: isEdit ? 'put' : 'post',
data: { ...this.attrForm, orderId: this.row.id },
});
if (res.code == 0) {
this.closeAttrForm();
this.$message({
message: `${isEdit ? '更新' : '创建'}成功`,
type: 'success',
duration: 1500,
onClose: () => {
this.getAttrList();
},
});
}
this.attrFormSubmitting = false;
} catch (err) {
this.$message({
message: err,
type: 'error',
duration: 1500,
});
this.attrFormSubmitting = false;
}
});
},
closeAttrForm() {
this.attrFormVisible = false;
},
},
};
</script>
<style scoped>
.drawer >>> .el-drawer {
border-radius: 8px 0 0 8px;
}
.drawer >>> .el-date-editor,
.drawer >>> .el-select {
width: 100%;
}
.drawer >>> .el-drawer__header {
margin: 0;
padding: 32px 32px 24px;
border-bottom: 1px solid #dcdfe6;
margin-bottom: 0px;
}
.small-title::before {
content: '';
display: inline-block;
vertical-align: top;
width: 4px;
height: 22px;
border-radius: 1px;
margin-right: 8px;
background-color: #0b58ff;
}
.drawer-body {
display: flex;
flex-direction: column;
height: 100%;
}
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
overflow-y: auto;
}
.drawer-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
</style>

View File

@ -14,7 +14,7 @@
custom-class="mes-drawer" custom-class="mes-drawer"
size="60%" size="60%"
@closed="$emit('destroy')"> @closed="$emit('destroy')">
<SmallTitle slot="title">编辑</SmallTitle> <SmallTitle slot="title">{{ disableEdit ? '详情' : '编辑' }}</SmallTitle>
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
@ -29,7 +29,16 @@
v-loading="formLoading"> v-loading="formLoading">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检单名称" prop="name"> <el-form-item
label="巡检单名称"
prop="name"
:rules="[
{
required: true,
message: '巡检单名称不能为空',
trigger: 'blur',
},
]">
<el-input <el-input
v-model="form.name" v-model="form.name"
:disabled="disableEdit" :disabled="disableEdit"
@ -129,7 +138,7 @@
<div style="margin-top: 12px; position: relative"> <div style="margin-top: 12px; position: relative">
<div <div
v-if="!disableEdit" v-if="!disableEdit && !disableModifyDetail"
style="position: absolute; top: -40px; right: 0"> style="position: absolute; top: -40px; right: 0">
<el-button @click="handleAddAttr" type="text"> <el-button @click="handleAddAttr" type="text">
<i class="el-icon-plus"></i> <i class="el-icon-plus"></i>
@ -146,7 +155,7 @@
<method-btn <method-btn
slot="handleBtn" slot="handleBtn"
label="操作" label="操作"
v-if="!disableEdit" v-if="!disableEdit && !disableModifyDetail"
:method-list="tableBtn" :method-list="tableBtn"
@clickBtn="handleTableBtnClick" /> @clickBtn="handleTableBtnClick" />
</base-table> </base-table>
@ -196,6 +205,7 @@
<script> <script>
import DialogForm from '../../../components/DialogForm/index.vue'; import DialogForm from '../../../components/DialogForm/index.vue';
import { groupConnectWorkshop } from '@/utils/equipment-module';
const SmallTitle = { const SmallTitle = {
name: 'SmallTitle', name: 'SmallTitle',
@ -230,24 +240,18 @@ export default {
return { return {
visible: false, visible: false,
btnLoading: false, btnLoading: false,
form: {}, form: {
id: null,
name: null,
departmentId: null,
groupClass: null,
checkPerson: null,
planCheckTime: null,
remark: null,
},
formLoading: false, formLoading: false,
departmentList: [], departmentList: [],
inspectorOptions: [], inspectorOptions: [],
attrTableProps: [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
},
],
attrList: [], attrList: [],
attrTotal: 0, attrTotal: 0,
attrTitle: '', attrTitle: '',
@ -339,6 +343,66 @@ export default {
value: item.id, value: item.id,
})); }));
}, },
disableModifyDetail() {
return this.form && this.form.confirmTimeLimit != undefined;
},
attrTableProps() {
return [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'checkResult',
label: '巡检结果',
subcomponent: this.disableModifyDetail
? {
name: 'TableCellInput',
props: ['injectData'],
data() {
return {
inputvalue: null,
};
},
mounted() {
this.inputvalue = this.injectData.checkResult;
},
methods: {
async handleValueChange(newCheckResult) {
document.body.style.cursor = 'wait';
await this.$axios({
url: '/base/equipment-check-order-det/update',
method: 'put',
data: {
orderId: this.injectData.orderId,
equipmentId: this.injectData.equipmentId,
program: this.injectData.program,
id: this.injectData.id,
checkResult: newCheckResult,
},
});
document.body.style.cursor = 'default';
},
},
render: function (h) {
return (
<el-input
size="small"
key={this.injectData.id}
v-model={this.inputvalue}
onChange={this.handleValueChange}
/>
);
},
}
: null,
},
];
},
}, },
mounted() { mounted() {
this.formLoading = true; this.formLoading = true;
@ -365,16 +429,30 @@ export default {
break; break;
} }
}, },
resetForm() {
this.form = {
id: null,
name: null,
departmentId: null,
groupClass: null,
checkPerson: null,
planCheckTime: null,
remark: null,
};
},
async handleConfirm() { async handleConfirm() {
this.btnLoading = true; this.btnLoading = true;
this.$nextTick(async () => { this.$nextTick(async () => {
try {
const valid = await this.$refs['form'].validate();
if (!valid) return;
const { code, data } = await this.$axios({ const { code, data } = await this.$axios({
url: '/base/equipment-check-order/update', url: '/base/equipment-check-order/update',
method: 'put', method: 'put',
data: { data: {
...this.form, ...this.form,
groupClass: this.form.groupClass.join(','), groupClass: this.form.groupClass?.join(','),
checkPerson: this.form.checkPerson.join(','), checkPerson: this.form.checkPerson?.join(','),
}, },
}); });
if (code == 0) { if (code == 0) {
@ -383,6 +461,9 @@ export default {
this.btnLoading = false; this.btnLoading = false;
this.$emit('refreshDataList'); this.$emit('refreshDataList');
this.handleCancel(); this.handleCancel();
} catch (err) {
this.btnLoading = false;
}
}); });
}, },
@ -399,13 +480,25 @@ export default {
}, },
async getInfo(row) { async getInfo(row) {
this.resetForm();
const res = await this.$axios( const res = await this.$axios(
'/base/equipment-check-order/get?id=' + row.id '/base/equipment-check-order/get?id=' + row.id
); );
if (res.code == 0) { if (res.code == 0) {
this.form = res.data; Object.keys(this.form).forEach((key) => {
this.form.groupClass = res.data.groupClass.split(','); if (key == 'groupClass' || key == 'checkPerson') {
this.form.checkPerson = res.data.checkPerson?.split(','); this.form[key] =
(res.data[key] &&
res.data[key].trim() != '' &&
res.data[key].split(',')) ||
[];
} else {
this.form[key] = res.data[key];
}
});
if (!res.data.checkPerson || res.data.checkPerson.trim() == '') {
this.form.checkPerson = [this.$store.getters.nickname];
}
this.formLoading = false; this.formLoading = false;
} }
this.formLoading = false; this.formLoading = false;
@ -450,8 +543,8 @@ export default {
if (userlist.code == 0) { if (userlist.code == 0) {
inspectorList = inspectorList.concat( inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({ (userlist.data?.list || []).map((item) => ({
label: item.username, label: item.nickname,
value: item.id, value: item.nickname,
})) }))
); );
} }
@ -460,7 +553,7 @@ export default {
inspectorList = inspectorList.concat( inspectorList = inspectorList.concat(
workerlist.data.map((item) => ({ workerlist.data.map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.name,
})) }))
); );
} }
@ -469,7 +562,7 @@ export default {
case 'groupClass': case 'groupClass':
res = await this.$axios(urls[1]); res = await this.$axios(urls[1]);
this.groupOptions = (res.data || []).map((item) => ({ this.groupOptions = (res.data || []).map((item) => ({
label: item.name, label: groupConnectWorkshop(item.name, item.roomNameDict),
value: item.id, value: item.id,
})); }));
break; break;
@ -477,22 +570,6 @@ export default {
this.formLoading = false; 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() { handleCancel() {
this.visible = false; this.visible = false;
}, },
@ -511,7 +588,7 @@ export default {
handleAddAttr() { handleAddAttr() {
if (!this.row.id) return this.$message.error('请先选中保养记录'); if (!this.row.id) return this.$message.error('请先选中保养记录');
this.resetAttrform(); this.resetAttrform();
this.attrTitle = '添加设备属性'; this.attrTitle = '添加巡检内容';
this.attrFormVisible = true; this.attrFormVisible = true;
}, },

View File

@ -18,6 +18,7 @@
:table-data="list" :table-data="list"
:page="queryParams.pageNo" :page="queryParams.pageNo"
:limit="queryParams.pageSize" :limit="queryParams.pageSize"
:permissionGuard="checkConfirmPermission"
@edit="handleEdit" @edit="handleEdit"
@detail="handleDetail" @detail="handleDetail"
@delete="handleDelete" @delete="handleDelete"
@ -41,17 +42,17 @@
<add ref="add" @refreshDataList="successSubmit" /> <add ref="add" @refreshDataList="successSubmit" />
</base-dialog> </base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
<edit <edit
ref="content-edit" ref="content-edit"
v-if="editOpen" v-if="editOpen"
@refreshDataList="getList" @refreshDataList="getList"
@destroy="editOpen = false" /> @destroy="editOpen = false" />
<AddCheckDet
ref="content-detail"
v-if="detOpen"
@refreshDataList="getList"
@destroy="detOpen = false" />
</div> </div>
</template> </template>
@ -62,14 +63,16 @@ import add from './Content-add.vue';
import { parseTime } from '../../core/mixins/code-filter'; import { parseTime } from '../../core/mixins/code-filter';
import CheckOrderListTable from './CheckOrderListTable.vue'; import CheckOrderListTable from './CheckOrderListTable.vue';
import edit from './Content-edit.vue'; import edit from './Content-edit.vue';
import AddCheckDet from './Content-add_detail.vue';
export default { export default {
name: 'SpecialEquipmentCheckConfig', name: 'SpecialEquipmentCheckConfig',
components: { addOrUpdata, add, edit, CheckOrderListTable }, components: { addOrUpdata, add, edit, AddCheckDet, CheckOrderListTable },
mixins: [basicPageMixin], mixins: [basicPageMixin],
data() { data() {
return { return {
editOpen: false, editOpen: false,
detOpen: false,
addOrUpdateVisible: false, addOrUpdateVisible: false,
addOrEditTitle: '', addOrEditTitle: '',
searchBarKeys: ['name'], searchBarKeys: ['name'],
@ -175,6 +178,7 @@ export default {
pageSize: 10, pageSize: 10,
name: null, name: null,
status: 1, status: 1,
special: true,
}, },
// //
form: {}, form: {},
@ -188,8 +192,19 @@ export default {
this.getList(); this.getList();
}, },
methods: { methods: {
handleSubmit() { async handleSubmit() {
this.$refs.add.dataFormSubmit(); const id = await this.$refs.add.dataFormSubmit();
setTimeout(() => {
this.handleAddDetail(id);
}, 500);
},
handleAddDetail(id) {
this.detOpen = true;
this.$nextTick(() => {
this.$refs['content-detail'].init({ id });
});
}, },
successSubmit() { successSubmit() {
@ -242,10 +257,17 @@ export default {
this.$message.warning('请选择待确认的巡检单'); this.$message.warning('请选择待确认的巡检单');
return; return;
} }
const res = await this.$axios({ let checkPersonParam = '';
if (!row.checkPerson || row.checkPerson.trim() == '') {
/** 如有必要,更新巡检人 */
checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
}
const res = this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` +
this.$store.getters.userId, checkPersonParam,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
data: this.$refs['check-order-list-table'].selectedOrder.map( data: this.$refs['check-order-list-table'].selectedOrder.map(
(item) => item.id (item) => item.id
@ -268,7 +290,7 @@ export default {
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.open = true; this.open = true;
this.title = '添加待确认巡检设置'; this.title = '新增巡检单';
this.$nextTick(() => { this.$nextTick(() => {
this.$refs.add.init(); this.$refs.add.init();
}); });
@ -283,6 +305,16 @@ export default {
}); });
}, },
/** 按钮、选择权限 */
checkConfirmPermission(row) {
const isAdmin = false; //
return (
!row.confirmDueTime ||
row.confirmDueTime >= new Date().getTime() ||
isAdmin
);
},
/** 编辑 */ /** 编辑 */
handleEdit(row, detail) { handleEdit(row, detail) {
this.editOpen = true; this.editOpen = true;
@ -297,10 +329,16 @@ export default {
this.$modal this.$modal
.confirm('是否确认巡检单"' + row.name + '"?') .confirm('是否确认巡检单"' + row.name + '"?')
.then(() => { .then(() => {
let checkPersonParam = '';
if (!row.checkPerson || row.checkPerson.trim() == '') {
/** 如有必要,更新巡检人 */
checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
}
return this.$axios({ return this.$axios({
url: url:
'/base/equipment-check-order/confirm?confirmPerson=' + `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` +
this.$store.getters.userId, checkPersonParam,
// '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''), // '/base/equipment-check-order/confirm?ids=' + JSON.stringify([id]).replaceAll("\"", ''),
method: 'put', method: 'put',
data: [id], data: [id],
@ -336,16 +374,16 @@ export default {
/** 导出按钮操作 */ /** 导出按钮操作 */
handleExport() { handleExport() {
this.$modal this.$modal
.confirm('是否确认导出所有巡检设置?') .confirm('是否确认导出所有巡检?')
.then(() => { .then(() => {
this.exportLoading = true; this.exportLoading = true;
return this.$axios({ return this.$axios({
url: '/base/equipment-check-order/export-excel', url: '/base/equipment-check-order/export-excel',
// params: { params: {
// name: this.queryParams.name, name: this.queryParams.name,
// status: 1, status: 1,
// special: true, special: true,
// }, },
responseType: 'blob', responseType: 'blob',
}); });
}) })

View File

@ -30,37 +30,37 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
{{ form.name }} <div style="">{{ form.name }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="部门" prop="department"> <el-form-item label="部门" prop="department">
{{ form.department }} <div style="">{{ form.department }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="班次" prop="groupClass"> <el-form-item label="班次" prop="groupClass">
{{ form.groupClass }} <div style="">{{ form.groupClass || '---' }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检人" prop="checkPerson"> <el-form-item label="巡检人" prop="checkPerson">
{{ form.checkPerson }} <div style="">{{ form.checkPerson || '---' }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="巡检时间" prop="planCheckTime"> <el-form-item label="巡检时间" prop="planCheckTime">
{{ form.planCheckTime | parseTime }} <div style="">{{ form.planCheckTime | parseTime }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="确认人" prop="confirmPerson"> <el-form-item label="确认人" prop="confirmPerson">
{{ form.confirmPerson }} <div style="">{{ form.confirmPerson || '---' }}</div>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -324,8 +324,8 @@ export default {
method: 'put', method: 'put',
data: { data: {
...this.form, ...this.form,
groupClass: this.form.groupClass.join(','), groupClass: this.form.groupClass?.join(','),
checkPerson: this.form.checkPerson.join(','), checkPerson: this.form.checkPerson?.join(','),
}, },
}); });
if (code == 0) { if (code == 0) {
@ -401,8 +401,8 @@ export default {
if (userlist.code == 0) { if (userlist.code == 0) {
inspectorList = inspectorList.concat( inspectorList = inspectorList.concat(
(userlist.data?.list || []).map((item) => ({ (userlist.data?.list || []).map((item) => ({
label: item.username, label: item.nickname,
value: item.id, value: item.nickname,
})) }))
); );
} }

View File

@ -15,33 +15,17 @@
v-loading="formLoading" v-loading="formLoading"
label-position="top"> label-position="top">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col> <el-col :span="12">
<el-form-item label="巡检单名称" prop="name"> <el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" /> <el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col> <el-col :span="12">
<el-form-item label="巡检单编码" prop="code"> <el-form-item label="巡检单编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入巡检单编码" /> <el-input v-model="dataForm.code" placeholder="请输入巡检单编码" />
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col> <el-col :span="12">
<el-form-item
label="部门"
prop="departmentId"
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
<el-select
v-model="dataForm.departmentId"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col>
<el-form-item label="计划巡检时间" prop="planCheckTime"> <el-form-item label="计划巡检时间" prop="planCheckTime">
<el-date-picker <el-date-picker
v-model="dataForm.planCheckTime" v-model="dataForm.planCheckTime"
@ -51,15 +35,24 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit"> <el-form-item label="巡检频率(天/次)" prop="checkPeriod">
<el-input <el-input
v-model="dataForm.confirmTimeLimit" v-model="dataForm.checkPeriod"
:placeholder="`请输入确认时限`" /> placeholder="请输入巡检频率(天/次)" />
<!-- <el-date-picker </el-form-item>
v-model="dataForm.confirmTimeLimit" </el-col>
type="datetime"
:placeholder="`请选择确认时限`" <el-col :span="12">
value-format="timestamp" /> --> <el-form-item label="部门" prop="departmentId">
<el-select
v-model="dataForm.departmentId"
:placeholder="`请选择部门`">
<el-option
v-for="opt in departmentOptions"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
@ -79,6 +72,20 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="12">
<el-form-item label="确认时限 (时)" prop="confirmTimeLimit">
<el-input
v-model="dataForm.confirmTimeLimit"
:placeholder="`请输入确认时限`" />
<!-- <el-date-picker
v-model="dataForm.confirmTimeLimit"
type="datetime"
:placeholder="`请选择确认时限`"
value-format="timestamp" /> -->
</el-form-item>
</el-col>
<el-col> <el-col>
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" /> <el-input v-model="dataForm.remark" placeholder="请输入备注" />
@ -89,6 +96,8 @@
</template> </template>
<script> <script>
import { groupConnectWorkshop } from '@/utils/equipment-module';
export default { export default {
data() { data() {
return { return {
@ -107,6 +116,12 @@ export default {
dataRule: { dataRule: {
confirmTimeLimit: [ confirmTimeLimit: [
{ required: true, message: '确认时限不能为空', trigger: 'blur' }, { required: true, message: '确认时限不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字类型',
trigger: 'blur',
transform: (val) => Number(val),
},
], ],
code: [ code: [
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' }, { required: true, message: '巡检单编码不能为空', trigger: 'blur' },
@ -117,6 +132,15 @@ export default {
planCheckTime: [ planCheckTime: [
{ required: true, message: '计划巡检时间不能为空', trigger: 'blur' }, { required: true, message: '计划巡检时间不能为空', trigger: 'blur' },
], ],
checkPeriod: [
{ required: true, message: '巡检频率不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字类型',
trigger: 'blur',
transform: (val) => Number(val),
},
],
}, },
equipmentOptions: [], equipmentOptions: [],
groupOptions: [], groupOptions: [],
@ -137,6 +161,7 @@ export default {
confirmTimeLimit: null, confirmTimeLimit: null,
groupClass: null, groupClass: null,
remark: null, remark: null,
checkPeriod: null
// special: true, // special: true,
}; };
}, },
@ -160,7 +185,7 @@ export default {
} }
if (grp.code == 0) { if (grp.code == 0) {
this.groupOptions = grp.data.map((item) => ({ this.groupOptions = grp.data.map((item) => ({
label: item.name, label: groupConnectWorkshop(item.name, item.roomNameDict),
value: item.id, value: item.id,
})); }));
} }
@ -186,7 +211,10 @@ export default {
Object.keys(this.dataForm).forEach((key) => { Object.keys(this.dataForm).forEach((key) => {
this.dataForm[key] = res.data[key]; this.dataForm[key] = res.data[key];
if (key == 'groupClass') { if (key == 'groupClass') {
this.dataForm.groupClass = res.data.groupClass.split(',') this.dataForm.groupClass =
res.data.groupClass &&
res.data.groupClass.trim() != '' &&
res.data.groupClass.split(',');
} }
}); });
} }

View File

@ -23,7 +23,7 @@
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"> <el-col :span="8">
<el-form-item label="故障发生时间" prop="faultTime"> <el-form-item label="故障发生时间" prop="faultTime">
<span>{{ parseTime(dataForm.faultTime) }}</span> <span style="color: #000a;">{{ parseTime(dataForm.faultTime) }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
@ -43,7 +43,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="故障级别" prop="faultLevel"> <el-form-item label="故障级别" prop="faultLevel">
<span> <span style="color: #000a;">
{{ getDictDataLabel('fault-level', dataForm.faultLevel) }} {{ getDictDataLabel('fault-level', dataForm.faultLevel) }}
</span> </span>
</el-form-item> </el-form-item>
@ -51,7 +51,7 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="故障类型" prop="faultType"> <el-form-item label="故障类型" prop="faultType">
<span> <span style="color: #000a;">
{{ getDictDataLabel('fault-type', dataForm.faultType) }} {{ getDictDataLabel('fault-type', dataForm.faultType) }}
</span> </span>
</el-form-item> </el-form-item>
@ -59,19 +59,19 @@
<el-col :span="8"> <el-col :span="8">
<el-form-item label="维修工" prop="repairman"> <el-form-item label="维修工" prop="repairman">
<span>{{ dataForm.repairman }}</span> <span style="color: #000a;">{{ dataForm.repairman }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="联系方式" prop="repairmanPhone"> <el-form-item label="联系方式" prop="repairmanPhone">
<span>{{ dataForm.repairmanPhone }}</span> <span style="color: #000a;">{{ dataForm.repairmanPhone }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="维修方式" prop="repairMode"> <el-form-item label="维修方式" prop="repairMode">
<span> <span style="color: #000a;">
{{ getDictDataLabel('repair-mode', dataForm.repairMode) }} {{ getDictDataLabel('repair-mode', dataForm.repairMode) }}
</span> </span>
</el-form-item> </el-form-item>
@ -88,25 +88,25 @@
:disabled="disabled" :disabled="disabled"
@delete="!disabled && handleDeleteFile(file, col.prop)" /> @delete="!disabled && handleDeleteFile(file, col.prop)" />
</div> </div>
<p v-else>暂无附件</p> <p v-else style="color: #000a;">暂无附件</p>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="创建时间" prop="createTime"> <el-form-item label="创建时间" prop="createTime">
<span>{{ parseTime(dataForm.createTime) }}</span> <span style="color: #000a;">{{ parseTime(dataForm.createTime) }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="创建人" prop="creator"> <el-form-item label="创建人" prop="creator">
<span>{{ dataForm.creator }}</span> <span style="color: #000a;">{{ dataForm.creator }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="24"> <el-col :span="24">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<span>{{ dataForm.remark }}</span> <span style="color: #000a;">{{ dataForm.remark || '- 无 -' }}</span>
</el-form-item> </el-form-item>
</el-col> </el-col>
</el-row> </el-row>
@ -159,8 +159,7 @@ const uploadedFile = {
document.body.removeChild(link); document.body.removeChild(link);
}, },
}, },
mounted() { mounted() {},
},
render: function (h) { render: function (h) {
return ( return (
<div <div
@ -338,6 +337,10 @@ export default {
overflow-y: auto; overflow-y: auto;
} }
.drawer-body__content >>> .el-form-item__label {
font-weight: 700;
}
.drawer-body__footer { .drawer-body__footer {
display: flex; display: flex;
justify-content: flex-end; justify-content: flex-end;

View File

@ -27,7 +27,6 @@
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
<section> <section>
<SmallTitle>保养信息</SmallTitle>
<div class="form-part" style="margin-bottom: 32px"> <div class="form-part" style="margin-bottom: 32px">
<el-skeleton v-if="!showForm" animated /> <el-skeleton v-if="!showForm" animated />
<el-form <el-form

View File

@ -44,10 +44,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item label="部门" prop="departmentId">
label="部门"
prop="departmentId"
:rules="[{ required: true, message: '请选择部门', trigger: 'blur' }]">
<el-select <el-select
v-model="form.departmentId" v-model="form.departmentId"
:placeholder="`请选择部门`" :placeholder="`请选择部门`"
@ -84,10 +81,7 @@
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<el-form-item <el-form-item label="产线" prop="lineId">
label="产线"
prop="lineId"
:rules="[{ required: true, message: '请选择产线', trigger: 'blur' }]">
<el-select <el-select
v-model="form.lineId" v-model="form.lineId"
:placeholder="`请选择产线`" :placeholder="`请选择产线`"
@ -183,6 +177,7 @@
label="保养时长(h)" label="保养时长(h)"
prop="maintainDuration" prop="maintainDuration"
:rules="[ :rules="[
{ required: true, message: '保养时长不能为空', trigger: 'blur' },
{ {
type: 'number', type: 'number',
message: '请输入正确的数字', message: '请输入正确的数字',

View File

@ -27,7 +27,6 @@
<div class="drawer-body flex"> <div class="drawer-body flex">
<div class="drawer-body__content"> <div class="drawer-body__content">
<section> <section>
<SmallTitle>保养信息</SmallTitle>
<div class="form-part" style="margin-bottom: 32px"> <div class="form-part" style="margin-bottom: 32px">
<el-skeleton v-if="!showForm" animated /> <el-skeleton v-if="!showForm" animated />
<el-form <el-form
@ -130,8 +129,8 @@
width="35%" width="35%"
:append-to-body="true" :append-to-body="true"
custom-class="baseDialog" custom-class="baseDialog"
@close="closeDetailForm" @close="detailAddVisible = false"
@cancel="closeDetailForm" @cancel="detailAddVisible = false"
@confirm="submitDetailForm"> @confirm="submitDetailForm">
<DialogForm <DialogForm
v-if="detailAddVisible" v-if="detailAddVisible"
@ -238,7 +237,7 @@ export default {
detailTableProps: [ detailTableProps: [
{ prop: 'equipmentName', label: '设备名称' }, { prop: 'equipmentName', label: '设备名称' },
{ prop: 'program', label: '保养项目' }, { prop: 'program', label: '保养项目' },
{ prop: 'remark', label: '备注' }, // { prop: 'remark', label: '' },
], ],
detailTableQuery: { detailTableQuery: {
pageNo: 1, pageNo: 1,
@ -318,9 +317,21 @@ export default {
value: item.id, value: item.id,
})); }));
}, },
resetForm() {
this.detailForm = {
planId: null,
equipmentId: null,
program: '',
maintenanceDes: '',
remark: '',
};
},
closeDetailForm() { closeDetailForm() {
this.detailAddVisible = false; this.detailAddVisible = false;
}, },
async submitDetailForm() { async submitDetailForm() {
// validation // validation
this.$refs.detailForm.validate(async (valid) => { this.$refs.detailForm.validate(async (valid) => {
@ -411,7 +422,10 @@ export default {
} }
}, },
handleAddDetail() { handleAddDetail() {
this.resetForm();
this.$nextTick(() => {
this.detailAddVisible = true; this.detailAddVisible = true;
});
}, },
}, },
}; };

View File

@ -63,7 +63,6 @@
import moment from 'moment'; import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin'; import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record'; import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record';
import { publicFormatter } from '@/utils/dict';
import PlanConfigAdd from './PlanConfig--add.vue'; import PlanConfigAdd from './PlanConfig--add.vue';
import PlanConfigAddContent from './PlanConfig--addContent.vue'; import PlanConfigAddContent from './PlanConfig--addContent.vue';
@ -102,8 +101,13 @@ export default {
{ prop: 'name', label: '计划名称' }, { prop: 'name', label: '计划名称' },
{ prop: 'departmentName', label: '部门' }, { prop: 'departmentName', label: '部门' },
{ width: 144, prop: 'lineName', label: '产线名' }, { width: 144, prop: 'lineName', label: '产线名' },
{ width: 144, prop: 'maintenancePeriod', label: '保养频率(天/次)' }, { width: 132, prop: 'maintenancePeriod', label: '保养频率(天/次)' },
{ width: 144, prop: 'firstMaintenanceTime', label: '首次保养时间' }, {
width: 180,
prop: 'firstMaintenanceTime',
label: '首次保养时间',
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ width: 144, prop: 'maintainDuration', label: '保养时长' }, { width: 144, prop: 'maintainDuration', label: '保养时长' },
{ prop: 'maintainer', label: '计划保养人员' }, { prop: 'maintainer', label: '计划保养人员' },
{ {

View File

@ -29,7 +29,7 @@
</el-col> </el-col>
<!-- 产线名 --> <!-- 产线名 -->
<el-col :span="8"> <!-- <el-col :span="8">
<el-form-item label="产线名" prop="lineId"> <el-form-item label="产线名" prop="lineId">
<el-select <el-select
v-model="formFilters.lineId" v-model="formFilters.lineId"
@ -45,10 +45,10 @@
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<!-- 工段名 --> <!-- 工段名 -->
<el-col :span="8"> <!-- <el-col :span="8">
<el-form-item label="工段名" prop="sectionId"> <el-form-item label="工段名" prop="sectionId">
<el-select <el-select
v-model="formFilters.sectionId" v-model="formFilters.sectionId"
@ -64,7 +64,7 @@
:value="opt.value" /> :value="opt.value" />
</el-select> </el-select>
</el-form-item> </el-form-item>
</el-col> </el-col> -->
<!-- 设备名称 --> <!-- 设备名称 -->
<el-col :span="8"> <el-col :span="8">
@ -116,16 +116,7 @@
<!-- 故障级别 --> <!-- 故障级别 -->
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="故障级别" prop="faultLevel">
label="故障级别"
prop="faultLevel"
:rules="[
{
required: true,
message: '故障级别不能为空',
trigger: 'blur',
},
]">
<el-select <el-select
v-model="form.faultLevel" v-model="form.faultLevel"
placeholder="故障级别" placeholder="故障级别"
@ -216,12 +207,7 @@
<!-- 维修工 --> <!-- 维修工 -->
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="维修工" prop="repairman">
label="维修工"
prop="repairman"
:rules="[
{ required: true, message: '维修工不能为空', trigger: 'blur' },
]">
<el-select <el-select
v-model="form.repairman" v-model="form.repairman"
@change="$emit('update', form)" @change="$emit('update', form)"
@ -241,12 +227,7 @@
<!-- 联系方式 --> <!-- 联系方式 -->
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="联系方式" prop="repairmanPhone">
label="联系方式"
prop="repairmanPhone"
:rules="[
{ required: true, message: '联系方式不能为空', trigger: 'blur' },
]">
<el-input <el-input
v-model="form.repairmanPhone" v-model="form.repairmanPhone"
@change="$emit('update', form)" @change="$emit('update', form)"
@ -257,16 +238,7 @@
<!-- 维修方式 - 数据字典 --> <!-- 维修方式 - 数据字典 -->
<el-col :span="8"> <el-col :span="8">
<el-form-item <el-form-item label="维修方式" prop="repairMode">
label="维修方式"
prop="repairMode"
:rules="[
{
required: true,
message: '维修方式不能为空',
trigger: 'blur',
},
]">
<el-select <el-select
v-model="form.repairMode" v-model="form.repairMode"
placeholder="维修方式" placeholder="维修方式"
@ -308,7 +280,7 @@
</el-col> </el-col>
<!-- 备注 --> <!-- 备注 -->
<el-col :span="24"> <el-col :span="8">
<el-form-item label="备注" prop="remark"> <el-form-item label="备注" prop="remark">
<el-input <el-input
v-model="form.remark" v-model="form.remark"
@ -544,16 +516,16 @@ export default {
dataForm: { dataForm: {
handler(val) { handler(val) {
this.form = JSON.parse(JSON.stringify(val)); this.form = JSON.parse(JSON.stringify(val));
if (this.form.equipmentCategory != null) { // if (this.form.equipmentCategory != null) {
setTimeout(() => { // setTimeout(() => {
this.equipmentOptions = this.equipmentList // this.equipmentOptions = this.equipmentList
.filter((item) => item.special) // .filter((item) => item.special)
.filter( // .filter(
(item) => item.specialType === this.form.equipmentCategory // (item) => item.specialType === this.form.equipmentCategory
) // )
.map((item) => ({ label: item.name, value: item.id })); // .map((item) => ({ label: item.name, value: item.id }));
}, 1000); // }, 1000);
} // }
if (this.hasFiles) { if (this.hasFiles) {
if (typeof this.hasFiles == 'boolean' && this.hasFiles) { if (typeof this.hasFiles == 'boolean' && this.hasFiles) {
this.form.files = this.form.files ?? []; this.form.files = this.form.files ?? [];
@ -591,9 +563,9 @@ export default {
this.formLoading = true; this.formLoading = true;
await this.getCode(); await this.getCode();
await this.initEquipment(); await this.initEquipment();
await this.initLines(); // await this.initLines();
await this.initWorker(); await this.initWorker();
await this.initSections(); // await this.initSections();
this.formLoading = false; this.formLoading = false;
this.isInit = false; this.isInit = false;
this.setInitWorker(); this.setInitWorker();
@ -602,36 +574,37 @@ export default {
/** 设置默认维修工为用户自己 */ /** 设置默认维修工为用户自己 */
setInitWorker() { setInitWorker() {
/** 获取用户自身id */ /** 获取用户自身id */
const userId = this.$store.getters.userId; const nickname = this.$store.getters.nickname;
this.$nextTick(() => { this.$nextTick(() => {
this.form.repairman = [userId]; this.form.repairman = [nickname];
}); });
}, },
/** 获取产线 */ /** 获取产线 */
async initLines() { // async initLines() {
const res = await this.$axios('/base/core-production-line/listAll'); // const res = await this.$axios('/base/core-production-line/listAll');
this.lineOptions = (res.data || []).map((item) => ({ // this.lineOptions = (res.data || []).map((item) => ({
label: item.name, // label: item.name,
value: item.id, // 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') { async initEquipment(type = 'special-equipment') {
const response = await this.$axios('/base/core-equipment/listAll'); const response = await this.$axios('/base/core-equipment/listAll');
@ -642,8 +615,8 @@ export default {
label: item.name, label: item.name,
value: item.id, value: item.id,
})); }));
this.equipmentOptions = equipmentOptions; this.equipmentOptions = [...equipmentOptions];
this.allSpeicalEquipments = equipmentOptions; this.allSpeicalEquipments = [...equipmentOptions];
}, },
/** 获取维修工 - 同时从用户表和员工表拉取数据 */ /** 获取维修工 - 同时从用户表和员工表拉取数据 */
async initWorker() { async initWorker() {
@ -658,8 +631,8 @@ export default {
}); });
list = list.concat( list = list.concat(
(userList.data?.list || []).map((item) => ({ (userList.data?.list || []).map((item) => ({
label: item.username, label: item.nickname,
value: item.id, value: item.nickname,
})) }))
); );
/** worker */ /** worker */
@ -669,7 +642,7 @@ export default {
list = list.concat( list = list.concat(
(workerList.data || []).map((item) => ({ (workerList.data || []).map((item) => ({
label: item.name, label: item.name,
value: item.id, value: item.name,
})) }))
); );
/** setting */ /** setting */

Some files were not shown because too many files have changed in this diff Show More