This commit is contained in:
‘937886381’ 2024-07-30 08:36:49 +08:00
parent 2a801bf834
commit dbe784cec6
84 changed files with 12688 additions and 1559 deletions

View File

@ -1,7 +1,7 @@
###
# @Author: Do not edit
# @Date: 2023-08-29 09:40:39
# @LastEditTime: 2024-07-22 08:48:47
# @LastEditTime: 2024-07-22 16:34:50
# @LastEditors: zhp
# @Description:
###

View File

@ -53,6 +53,7 @@
"crypto-js": "^4.0.0",
"diagram-js": "^12.3.0",
"echarts": "5.4.0",
"el-tree-transfer": "^2.4.7",
"element-ui": "2.15.12",
"file-saver": "^2.0.5",
"fuse.js": "6.6.2",

View File

@ -0,0 +1,61 @@
/*
* @Author: zhp
* @Date: 2024-07-23 13:44:00
* @LastEditTime: 2024-07-23 13:44:00
* @LastEditors: zhp
* @Description:
*/
/*
* @Author: zhp
* @Date: 2024-07-12 15:31:41
* @LastEditTime: 2024-07-22 09:33:20
* @LastEditors: zhp
* @Description:
*/
import request from '@/utils/request'
// 删除设备保养记录
export function deleteData(id) {
return request({
url: '/base/equipment-check-program/delete?id=' + id,
method: 'delete'
})
}
export function getItemPageData(data) {
return request({
url: '/base/equipment-check-program/page',
method: 'get',
data
})
}
export function getItemData(id) {
return request({
url: 'base/equipment-check-program/get?id=' + id,
method: 'get'
})
}
export function updateItemData(data) {
return request({
url: 'base/equipment-check-program/update',
method: 'put',
data
})
}
export function createItemData(data) {
return request({
url: 'base/equipment-check-program/create',
method: 'post',
data
})
}
export function deleteProgramTypeData(id) {
return request({
url: 'base/equipment-check-program-type/delete?id=' + id,
method: 'delete'
})
}

View File

@ -1,7 +1,7 @@
/*
* @Author: Do not edit
* @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-16 20:15:02
* @LastEditTime: 2024-02-28 18:16:56
* @LastEditors: DY
* @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) {
return request({
@ -68,3 +79,55 @@ export function deleteEqCheckLog(id) {
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
* @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-25 16:22:49
* @LastEditTime: 2024-02-25 22:23:54
* @LastEditors: DY
* @Description:
*/
@ -100,3 +100,63 @@ export function updateCheckConfig(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

@ -1,7 +1,7 @@
/*
* @Author: zhp
* @Date: 2024-07-12 15:31:41
* @LastEditTime: 2024-07-19 14:18:59
* @LastEditTime: 2024-07-22 09:33:20
* @LastEditors: zhp
* @Description:
*/
@ -45,3 +45,10 @@ export function createItemData(data) {
data
})
}
export function deleteProgramTypeData(id) {
return request({
url: 'base/equipment-maintain-program-type/delete?id=' + id,
method: 'delete'
})
}

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
* @Date: 2023-11-08 15:56:52
* @LastEditTime: 2023-11-23 19:10:07
* @LastEditTime: 2024-02-26 17:02:53
* @LastEditors: DY
* @Description:
*/
@ -42,3 +42,39 @@ export function exportMaintainLogExcel(query) {
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

@ -9,7 +9,8 @@
:table-props="tableProps"
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData">
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -33,54 +34,69 @@ import {
getEqAnalysis,
exportEqAnalysisExcel,
} from '@/api/equipment/analysis/statistics';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
{
prop: 'recordTime',
label: '时间段',
filter: (val) => {
if (val && val.length > 0) {
return (
moment(val[0]).format('YYYY-MM-DD HH:mm:ss') +
' ~ ' +
moment(val[1]).format('YYYY-MM-DD HH:mm:ss')
);
}
return '-';
},
},
// {
// prop: 'recordTime',
// label: '',
// filter: (val) => {
// if (val && val.length > 0) {
// return (
// moment(val[0]).format('YYYY-MM-DD HH:mm:ss') +
// ' ~ ' +
// moment(val[1]).format('YYYY-MM-DD HH:mm:ss')
// );
// }
// return '-';
// },
// },
{
prop: 'lineName',
label: '产线',
width: 150,
showOverflowtooltip: true
},
{
prop: 'sectionName',
label: '工段',
width: 150,
showOverflowtooltip: true
},
{
prop: 'equipmentName',
label: '设备名称',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'equipmentType',
label: '设备类型',
width: 150,
showOverflowtooltip: true
},
{
prop: 'workTime',
label: '工作时间累积(h)',
width: 160,
showOverflowtooltip: true
},
{
prop: 'repairCount',
label: '维修次数',
width: 120,
showOverflowtooltip: true
},
{
prop: 'maintainCount',
label: '保养次数',
width: 120,
showOverflowtooltip: true
},
];
export default {
mixins: [basicPage],
mixins: [basicPage, tableHeightMixin],
data() {
const today = new Date();
@ -110,7 +126,7 @@ export default {
tableBtn: [].filter((v) => v),
tableData: [],
listQuery: {
pageSize: 10,
pageSize: 20,
pageNo: 1,
total: 1,
recordTime: [
@ -158,7 +174,7 @@ export default {
: '',
btnName: '导出',
name: 'export',
color: 'warning',
color: 'primary',
plain: true,
},
],

View File

@ -27,20 +27,20 @@
<div class="legend">
<div class="legend-item">
<span class="icon blue"></span>
<span class="text">工作时长</span>
<span class="text">有效时长</span>
</div>
<div class="legend-item">
<span class="icon green"></span>
<span class="text">机时长</span>
<span class="text">机时长</span>
</div>
<div class="legend-item">
<span class="icon purple"></span>
<span class="text">故障时长</span>
<span class="text">中断时长</span>
</div>
<div class="legend-item">
<!-- <div class="legend-item">
<span class="icon yellow"></span>
<span class="text">速度开动率</span>
</div>
</div> -->
</div>
<div v-if="list.length" class="graph-grid">
<div class="bg-grid grid-line">
@ -389,14 +389,14 @@ export default {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
font-size: 18px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
height: 20px;
width: 4px;
border-radius: 1px;
background: #0b58ff;

View File

@ -16,23 +16,22 @@
<div class="data-view__item">
<!-- <div class="data-view__item__value">111</div> -->
<div class="data-view__item__value">{{ textData.workTime }}</div>
<div class="data-view__item__title blue">工作时长</div>
<div class="data-view__item__title blue">有效时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">22</div> -->
<div class="data-view__item__value">{{ textData.stopTime }}</div>
<div class="data-view__item__title green">机时长</div>
<div class="data-view__item__title green">机时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">10</div> -->
<div class="data-view__item__value">{{ textData.downTime }}</div>
<div class="data-view__item__title purple">故障时长</div>
<div class="data-view__item__title purple">中断时长</div>
</div>
<div class="data-view__item">
<!-- <div class="data-view__item__value">100%</div> -->
<!-- <div class="data-view__item">
<div class="data-view__item__value">{{ textData.peEfficiency }}</div>
<div class="data-view__item__title yellow">速度开动率</div>
</div>
</div> -->
</div>
</div>
</template>
@ -76,6 +75,12 @@ export default {
},
tooltip: {
trigger: 'item',
formatter: (v) => {
const num = String(v.value)?.split('.').length === 2 ? v.value?.toFixed(2) : v.value
return `<div>
<span>${v.name}: ${num}</span>
</div>`
}
},
legend: {
show: false,
@ -93,7 +98,7 @@ export default {
//
name: '',
type: 'pie',
radius: ['75%', '90%'],
radius: ['60%', '90%'],
center: ['50%', '48%'],
label: {
show: false,
@ -105,24 +110,24 @@ export default {
{ name: '故障时长', value: 580 },
],
},
{
//
name: '',
type: 'pie',
center: ['50%', '48%'],
radius: ['60%', '75%'],
itemStyle: {
borderRadius: 10,
},
label: {
show: false,
},
data: [
//<=========
{ name: '总', value: 3000 },
{ name: '', value: 1400 },
],
},
// {
// //
// name: '',
// type: 'pie',
// center: ['50%', '48%'],
// radius: ['60%', '75%'],
// itemStyle: {
// borderRadius: 10,
// },
// label: {
// show: false,
// },
// data: [
// //<=========
// { name: '', value: 3000 },
// { name: '', value: 1400 },
// ],
// },
// {
// name: this.value.equipmentName || 'Default',
// type: 'pie',
@ -196,22 +201,22 @@ export default {
this.config.title.text = lineName;
this.config.title.subtext = equipmentName;
this.config.series[0].data = [
{ name: '工作时长', value: workTime },
{ name: '机时长', value: stopTime },
{ name: '故障时长', value: downTime },
{ name: '有效时长', value: workTime },
{ name: '机时长', value: stopTime },
{ name: '中断时长', value: downTime }
];
this.config.series[1].data = [
{ name: '速度开动率', value: peEfficiency },
{ name: '', value: 100 },
// this.config.series[1].data = [
// { name: '', value: peEfficiency },
// { name: '', value: Math.ceil(peEfficiency) - peEfficiency },
];
// // { name: '', value: 100 },
// // { name: '', value: peEfficiency },
// // { name: '', value: Math.ceil(peEfficiency) - peEfficiency },
// ];
//
this.textData = {
workTime: +workTime.toFixed(2),
stopTime: +stopTime.toFixed(2),
downTime: +downTime.toFixed(2),
peEfficiency: +peEfficiency.toFixed(2),
workTime: +workTime?.toFixed(2),
stopTime: +stopTime?.toFixed(2),
downTime: +downTime?.toFixed(2),
// peEfficiency: +peEfficiency?.toFixed(2),
};
},
},
@ -259,7 +264,7 @@ export default {
}
.data-view__item__title {
font-size: 8px;
font-size: 14px;
line-height: 14px;
}

View File

@ -19,6 +19,7 @@
:page="1"
:limit="10"
:table-data="list"
height="65vh"
@emitFun="handleEmitFun" />
<!-- <el-row>
@ -122,23 +123,24 @@ export default {
// : undefined,
// ].filter((v) => v),
tableProps: [
{ prop: 'factoryName', label: '工厂' },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备' },
{ prop: 'factoryName', label: '工厂', showOverflowtooltip: true },
{ prop: 'lineName', label: '产线', showOverflowtooltip: true },
{ prop: 'sectionName', label: '工段', showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备', showOverflowtooltip: true },
{
label: '有效时间',
children: [
{
width: 128,
prop: 'workTime',
label: '工作时长[h]',
label: '工作时长(h)',
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
{
width: 128,
prop: 'workRate',
label: '百分比[%]',
filter: (val) => (val != null ? +Number(val).toFixed(3) : '-'),
label: '百分比(%)',
filter: (val) => (val != null ? +Number(val).toFixed(0) : '-'),
},
],
},
@ -148,9 +150,10 @@ export default {
{
width: 128,
prop: 'stopTime',
label: '停机时长[h]',
label: '停机时长(h)',
filter: (val) => (val != null ? +Number(val).toFixed(0) : '-'),
},
{ width: 128, prop: 'stopRate', label: '百分比[%]' },
{ width: 128, prop: 'stopRate', label: '百分比(%)', filter: (val) => (val != null ? +Number(val).toFixed(0) : '-'), },
],
},
{
@ -159,48 +162,52 @@ export default {
{
width: 128,
prop: 'downTime',
label: '故障时长[h]',
filter: (val) => (val != null ? +val.toFixed(3) : '-'),
label: '故障时长(h)',
filter: (val) => (val != null ? +val.toFixed(2) : '-'),
},
{ width: 128, prop: 'downRate', label: '百分比[%]' },
{ width: 128, prop: 'downRate', label: '百分比(%)', filter: (val) => (val != null ? +Number(val).toFixed(0) : '-'), },
{
width: 128,
prop: 'timeEfficiency',
label: '时间开动率',
filter: (val) => (val != null ? +Number(val).toFixed(3) : '-'),
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
],
},
{
label: '速度损失',
showOverflowtooltip: true,
children: [
{
width: 128,
prop: 'realProcSpeed',
label: '实际加工速度',
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
{
width: 128,
prop: 'designProcSpeed',
label: '理论加工速度',
showOverflowtooltip: true,
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
{
width: 128,
prop: 'peEfficiency',
label: '速度开动率',
filter: (val) => (val != null ? +Number(val).toFixed(3) : '-'),
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
],
},
{
prop: 'oee',
label: 'OEE',
filter: (val) => (val != null ? +Number(val).toFixed(3) : '-'),
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
{
prop: 'teep',
label: 'TEEP',
filter: (val) => (val != null ? +Number(val).toFixed(3) : '-'),
filter: (val) => (val != null ? +Number(val).toFixed(2) : '-'),
},
// {
// _action: 'view-trend',
@ -433,6 +440,9 @@ export default {
</script>
<style scoped lang="scss">
.app-container {
overflow: inherit;
}
.visualization {
display: grid;
grid-template-columns: repeat(3, minmax(240px, 1fr));

View File

@ -19,6 +19,7 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
:max-height="tableH"
@emitFun="handleEmitFun">
<!-- <method-btn
v-if="tableBtn.length"
@ -41,14 +42,16 @@
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'ExceptionAnalysis',
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
components: {},
props: {},
data() {
return {
heightNum: 220,
searchBarKeys: ['name', 'code'],
// tableBtn: [
// this.$auth.hasPermi('base:equipment-group:update')
@ -93,17 +96,29 @@ export default {
{ prop: 'downCount', label: '故障次数' },
],
searchBarFormConfig: [
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'month',
// selectOptions: Array(12)
// .fill(0)
// .map((v, i) => ({
// id: i + 1,
// name: `${i + 1}`,
// })),
// },
{
type: 'select',
label: '请选择月份',
placeholder: '请选择月份',
type: 'datePicker',
label: '时间',
dateType: 'month',
format: 'yyyy-MM',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始时间',
endPlaceholder: '结束时间',
width: 240,
param: 'month',
selectOptions: Array(12)
.fill(0)
.map((v, i) => ({
id: i + 1,
name: `${i + 1}`,
})),
},
{
__index: 'line',
@ -111,6 +126,7 @@ export default {
label: '产线',
placeholder: '请选择产线',
param: 'lineId',
filterable: true
},
{
type: 'button',
@ -164,7 +180,13 @@ export default {
},
});
if (code === 0) {
this.list = data;
this.list = data.map(item => {
item.mtbf = item.mtbf?.toFixed(2)
item.mttr = item.mttr?.toFixed(2)
item.workTime = item.workTime?.toFixed(2)
item.downTime = item.downTime?.toFixed(2)
return item
});
} else {
this.list.splice(0);
}
@ -174,12 +196,14 @@ export default {
switch (btn.btnName) {
case 'search':
if (btn.month) {
this.queryParams.recordTime = [
moment()
.month(btn.month - 1)
.format('YYYY-MM') + '-01 00:00:00',
moment().month(btn.month).format('YYYY-MM') + '-01 00:00:00',
];
// this.queryParams.recordTime = [
// moment()
// .month(btn.month - 1)
// .format('YYYY-MM') + '-01 00:00:00',
// moment().month(btn.month).format('YYYY-MM') + '-01 00:00:00',
// ];
this.queryParams.recordTime = [btn.month, moment().month(new Date(btn.month).getMonth() + 1).format('YYYY-MM') + '-01 00:00:00']
console.log(btn.month, moment().month(new Date(btn.month).getMonth() + 1).format('YYYY-MM') + '-01 00:00:00')
} else {
this.queryParams.recordTime = null;
}

View File

@ -26,7 +26,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun"></base-table>
@emitFun="handleEmitFun"
:max-height="tableH"></base-table>
</el-tab-pane>
<el-tab-pane :label="'\u3000柱状图\u3000'" name="graph">
<div
@ -47,9 +48,11 @@
<script>
import moment from 'moment';
import LineChart from './components/lineChart.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
export default {
name: 'QualityAnalysis',
mixins: [tableHeightMixin],
components: { LineChart },
props: {},
data() {
@ -155,12 +158,12 @@ export default {
},
{
// width: 160,
prop: 'inQuantity',
prop: 'totalQuantity',
label: '加工数量',
},
{
// width: 160,
prop: 'outQuantity',
prop: 'okQuantity',
label: '合格数量',
},
{
@ -252,6 +255,9 @@ export default {
this.fillProductOptions();
},
mounted() {
// window.addEventListener('resize', () => {
// this.tableH = this.tableHeight(260)
// })
this.$refs['search-bar'].headBtnClick('search');
},
methods: {
@ -280,7 +286,7 @@ export default {
async fillProductOptions() {
const { data } = await this.$axios({
url: '/base/core-product-material/listAll',
url: '/base/core-product/listAll',
method: 'get',
});
const cfg = this.searchBarFormConfig.find(

View File

@ -38,7 +38,7 @@
import SmallTitle from './SmallTitle';
import { getworkerAll } from '@/api/base/materialUseLog';
import Editor from '@/components/Editor';
import DialogForm from '@/components/DialogForm';
import DialogForm from './DialogForm';
export default {
name: 'AlarmHandle',

View File

@ -0,0 +1,520 @@
<!--
filename: dialogForm.vue
author: liubin
date: 2023-08-15 10:32:36
description: 弹窗的表单组件
-->
<template>
<el-form
ref="form"
:model="form"
:label-width="`${labelWidth}px`"
:size="size"
:label-position="labelPosition"
v-loading="formLoading">
<el-row :gutter="20" v-for="(row, rindex) in rows" :key="rindex">
<el-col v-for="col in row" :key="col.label" :span="24 / row.length">
<el-form-item :label="col.label" :prop="col.prop" :rules="col.rules">
<el-input
v-if="col.input"
v-model="form[col.prop]"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
:disabled="disabled"
v-bind="col.bind" />
<el-input
v-if="col.textarea"
type="textarea"
v-model="form[col.prop]"
:disabled="disabled"
@change="$emit('update', form)"
:placeholder="`请输入${col.label}`"
v-bind="col.bind" />
<el-select
v-if="col.select"
v-model="form[col.prop]"
:placeholder="`请选择${col.label}`"
:disabled="disabled"
@change="$emit('update', form)"
v-bind="col.bind">
<el-option
v-for="opt in optionListOf[col.prop]"
:key="opt.value"
:label="opt.label"
:value="opt.value" />
</el-select>
<el-date-picker
v-if="col.datetime"
v-model="form[col.prop]"
type="datetime"
:disabled="disabled"
:placeholder="`请选择${col.label}`"
value-format="timestamp"
@change="$emit('update', form)"
v-bind="col.bind"></el-date-picker>
<el-switch
v-if="col.switch"
v-model="form[col.prop]"
:disabled="disabled"
active-color="#0b58ff"
inactive-color="#e1e1e1"
@change="$emit('update', form)"
v-bind="col.bind"></el-switch>
<component
v-if="col.subcomponent"
:key="col.key"
:disabled="disabled"
:read-only="disabled"
:is="col.subcomponent"
v-model="form[col.prop]"
:inlineStyle="col.style"
@on-change="$emit('update', form)"
v-bind="col.bind"></component>
<div
class="upload-area"
:class="uploadOpen ? '' : 'height-48'"
ref="uploadArea"
:key="col.prop"
v-if="col.upload">
<span class="close-icon" :class="uploadOpen ? 'open' : ''">
<el-button
type="text"
icon="el-icon-arrow-right"
@click="handleFilesOpen" />
</span>
<!-- :file-list="uploadedFileList" -->
<el-upload
v-if="col.upload"
class="upload-in-dialog"
:key="col.prop + '__el-upload'"
: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, col.prop);
}
"
v-bind="col.bind">
<el-button
size="mini"
:disabled="disabled || col.bind?.disabled || false">
<svg-icon
icon-class="icon-upload"
style="color: inherit"></svg-icon>
上传文件
</el-button>
<div class="el-upload__tip" slot="tip" v-if="col.uploadTips">
{{ col.uploadTips || '只能上传jpg/png文件, 大小不超过2MB' }}
</div>
</el-upload>
<uploadedFile
class="file"
v-for="file in form[col.prop]"
:file="file"
:key="file.fileUrl"
:disabled="disabled"
@delete="!disabled && handleDeleteFile(file, col.prop)" />
</div>
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import { getAccessToken } from '@/utils/auth';
import tupleImg from '@/assets/images/tuple.png';
import cache from '@/utils/cache';
/**
* 找到最长的label
* @param {*} options
*/
function findMaxLabelWidth(rows) {
let max = 0;
rows.forEach((row) => {
row.forEach((opt) => {
// debugger;
if (!opt.label) return 0;
if (opt.label.length > max) {
max = opt.label.length;
if (opt.label.includes('(')) {
max = max - 3;
}
}
});
});
return max;
}
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: { uploadedFile },
props: {
rows: {
type: Array,
default: () => [],
},
dataForm: {
type: Object,
default: () => ({}),
},
disabled: {
type: Boolean,
default: false,
},
hasFiles: {
type: Boolean | Array,
default: false,
},
labelPosition: {
type: String,
default: 'right',
},
size: {
type: String,
default: '',
},
},
data() {
return {
uploadOpen: false,
form: {},
formLoading: true,
optionListOf: {},
uploadedFileList: [],
dataLoaded: false,
uploadHeaders: { Authorization: 'Bearer ' + getAccessToken() },
uploadUrl: process.env.VUE_APP_BASE_API + '/admin-api/infra/file/upload', // headersurl
};
},
computed: {
labelWidth() {
let max = findMaxLabelWidth(this.rows);
// 20px
return max * 20;
// return max * 20 + 'px';
},
},
watch: {
rows: {
handler() {
this.$nextTick(() => {
this.handleOptions('watch');
});
},
deep: true,
immediate: false,
},
dataForm: {
handler(val) {
this.form = JSON.parse(JSON.stringify(val));
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() {
// options
this.handleOptions();
},
methods: {
/** 模拟透传 ref */
validate(cb) {
return this.$refs.form.validate(cb);
},
resetFields(args) {
return this.$refs.form.resetFields(args);
},
// getCode
async getCode(url) {
const response = await this.$axios(url);
return response.data;
},
async handleOptions(trigger = 'monuted') {
console.log('[dialogForm:handleOptions]');
const promiseList = [];
this.rows.forEach((cols) => {
cols.forEach((opt) => {
if (opt.value && !this.form[opt.prop]) {
//
this.form[opt.prop] = opt.value;
}
if (opt.options) {
this.$set(this.optionListOf, opt.prop, opt.options);
} else if (opt.url) {
// dependswatcher
if (opt.depends) {
this.$watch(
() => this.form[opt.depends],
(id) => {
console.log('<', opt.depends, '>', 'changed', id);
if (id == null) return;
//
this.form[opt.prop] = null;
//
this.$axios({
url: `${opt.url}?id=${id}`,
}).then((res) => {
this.$set(
this.optionListOf,
opt.prop,
res.data.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
});
},
{
immediate: false,
}
);
return;
}
//
if (opt.select || (opt.input && !this.form?.id)) {
promiseList.push(async () => {
const response = await this.$axios(opt.url, {
method: opt.method ?? 'get',
// data: opt.method == 'post' ? opt.queryParams : null
});
// console.log('[dialogForm:handleOptions:response]', response);
if (opt.select) {
//
const list =
'list' in response.data
? response.data.list
: response.data;
if (opt.cache) {
cache.store(opt.cache, list);
}
this.$set(
this.optionListOf,
opt.prop,
list.map((item) => ({
label: item[opt.labelKey ?? 'name'],
value: item[opt.valueKey ?? 'id'],
}))
);
} else if (opt.input) {
console.log('setting code: ', response.data);
//
this.form[opt.prop] = response.data;
// dataFormcodebug
this.$emit('update', this.form);
}
});
}
}
});
});
console.log('[dialogForm:handleOptions] done!');
// watch
if (trigger == 'watch') {
this.formLoading = false;
return;
}
try {
await Promise.all(promiseList.map((fn) => fn()));
this.formLoading = false;
this.dataLoaded = true;
// console.log("[dialogForm:handleOptions:optionListOf]", this.optionListOf)
} catch (error) {
console.log('[dialogForm:handleOptions:error]', error);
this.formLoading = false;
}
if (!promiseList.length) this.formLoading = false;
},
//
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() && checkFileType();
return checkFileSize();
},
// bind
handleUploadSuccess(response, file, prop) {
console.log('[handleUploadSuccess]', response, file, prop);
this.form[prop].push({
fileName: file.name,
fileUrl: response.data,
fileType: prop == 'files' ? 2 : 1,
});
this.$modal.msgSuccess('上传成功');
this.$emit('update', this.form);
},
getFileName(fileUrl) {
return fileUrl.split('/').pop();
},
handleFilesOpen() {
this.uploadOpen = !this.uploadOpen;
},
handleDeleteFile(file, prop) {
this.form[prop] = this.form[prop].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 {
// background: #ccc;
// display: grid;
// grid-auto-rows: 34px;
// grid-template-columns: repeat(6, minmax(32px, max-content));
// gap: 8px;
// align-items: center;
position: relative;
overflow: hidden;
transition: height 0.3s ease-out;
}
.upload-in-dialog {
// display: inline-block;
margin-right: 24px;
// background: #ccc;
position: relative;
// top: -13px;
float: left;
}
.close-icon {
// background: #ccc;
position: absolute;
top: 0;
right: 12px;
z-index: 100;
transition: transform 0.3s ease-out;
}
.close-icon.open {
transform: rotateZ(90deg);
}
</style>
<style>
.dialog__upload_component__close {
color: #ccc;
}
.dialog__upload_component__close:hover {
/* color: #777; */
color: red;
}
.height-48 {
height: 35px !important;
}
</style>

View File

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -61,6 +62,8 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { publicFormatter } from '@/utils/dict';
import AddOrUpdate from './AddOrUpdate.vue';
import moment from 'moment';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
const btn = {
@ -89,7 +92,7 @@ const btn = {
export default {
name: 'Record',
components: { AddOrUpdate },
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
readOnly: false,
@ -116,19 +119,31 @@ export default {
// : undefined,
].filter((v) => v),
tableProps: [
{ prop: 'productionLine', label: '产线' },
{ prop: 'workshopSection', label: '工段' },
{ prop: 'equipment', label: '设备名称' },
{ prop: 'productionLine', label: '产线', width: 120, showOverflowtooltip: true },
{ prop: 'workshopSection', label: '工段', width: 120, showOverflowtooltip: true },
{ prop: 'equipment', label: '设备名称', width: 120, showOverflowtooltip: true },
{
prop: 'alarmGrade',
label: '报警级别',
filter: publicFormatter(this.DICT_TYPE.EQU_ALARM_LEVEL),
},
{ prop: 'createTime', label: '报警时间', filter: timeFilter },
{ prop: 'alarmCode', label: '设备报警码' },
{ prop: 'alarmContent', label: '报警内容' },
{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn },
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn },
{ prop: 'createTime', label: '报警时间', filter: timeFilter, width: 150, showOverflowtooltip: true },
{ prop: 'alarmCode', label: '设备报警码', width: 180, showOverflowtooltip: true },
{ prop: 'alarmContent', label: '报警内容', width: 150, showOverflowtooltip: true },
this.$auth.hasPermiAnd([
'monitoring:equipment-alarm-log:query',
'base:equipment-alarm-hand:query'
]) ?
{ prop: 'opt1', label: '处理记录', name: '查看', subcomponent: btn } : undefined,
this.$auth.hasPermiAnd([
'monitoring:equipment-alarm-log:query',
'base:equipment-alarm-hand:query',
// 'base:core-worker:query',
'base:equipment-alarm-hand:create',
'base:equipment-alarm-hand:update',
'monitoring:equipment-alarm-log:update'
]) ?
{ prop: 'opt2', label: '处理', name: '报警处理', subcomponent: btn } : undefined,
// { prop: 'remark', label: '' },
],
searchBarFormConfig: [
@ -203,7 +218,7 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
lineId: null,
equipmentId: null,
recordTime: [],

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,287 @@
<!--
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',
}"
:max-height="tableH"
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="巡检单名称"
:show-overflow-tooltip="true"
prop="name"></el-table-column>
<el-table-column v-if="selectedBox[1]" label="部门" :show-overflow-tooltip="true" prop="planName">
<template slot-scope="scope">
{{ scope.row.department || '---' }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[2]"
label="巡检时间"
width="150"
prop="actualCheckTime">
<template slot-scope="scope">
{{ scope.row.actualCheckTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[3]"
label="班次"
width="180"
:show-overflow-tooltip="true"
prop="groupClass">
<template slot-scope="scope">
{{ scope.row.groupClass || '---' }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[4]"
label="确认截止时间"
width="150"
prop="confirmDueTime">
<template slot-scope="scope">
{{ scope.row.confirmDueTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[5]"
width="150"
:show-overflow-tooltip="true"
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 v-if="$auth.hasPermi('equipment:check:update')" 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 v-if="$auth.hasPermi('equipment:check:query')" style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip v-if="$auth.hasPermi('equipment:check:query')" 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 v-if="$auth.hasPermiAnd([
'equipment:check:update',
'base:core-worker:query',
'base:group-classes:query',
'base:core-department:query',
'equipment:check:query',
'equipment:check:create',
'equipment:check:delete',
'base:core-equipment:query'
])" style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip v-if="$auth.hasPermiAnd([
'equipment:check:update',
'base:core-worker:query',
'base:group-classes:query',
'base:core-department:query',
'equipment:check:query',
'equipment:check:create',
'equipment:check:delete',
'base:core-equipment:query'
])" 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 v-if="$auth.hasPermi('equipment:check:delete')" style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip v-if="$auth.hasPermi('equipment:check:delete')" 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: [],
tableH: this.tableHeight(260)
};
},
computed: {
tableDataWithIndex() {
return this.tableData.map((item, index) => ({
...item,
_pageIndex: (this.page - 1) * this.limit + index + 1,
}));
},
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
},
destroyed() {
window.removeEventListener('resize', () => {
this.tableH = this.tableHeight(260)
});
},
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,563 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2024-04-22 15:04:40
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="true"
:before-close="beforeClose"
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="`请选择部门`"
style="width: 100%">
<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.label" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="8">
<el-form-item label="实际巡检时间" prop="actualCheckTime">
<el-date-picker
v-model="dataForm.actualCheckTime"
type="datetime"
:disabled="isdetail"
placeholder="请选择实际巡检时间"
value-format="timestamp"
style="width: 100%" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div v-if="idAttrShow">
<small-title>
巡检内容
</small-title>
<div v-if="!isdetail" style="display: flex">
<SearchBar
:formConfigs="searchBarFormConfig"
ref="attr-search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- <div class="action_btn"> -->
<el-button type="text" class="action_btn" @click="addNew()">
<span style="display: inline-block;">
<svg-icon style="width: 14px; height: 14px" class="item-icon" icon-class="table_add" />
<span class="add">添加内容</span>
</span>
</el-button>
<!-- </div> -->
</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 { getDepartmentList } 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: [],
actualCheckTime: 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: {
beforeClose(done) {
if (!this.isdetail) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
} else {
done()
}
},
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 getDepartmentList();
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.dataForm.checkPerson = [this.$store.getters.nickname]
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 => {
// let checkPersonParam = '';
// if (!this.dataForm.checkPerson || this.dataForm.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
// } else {
// checkPersonParam = `&checkPerson=${this.dataForm.checkPerson}`
// }
this.$axios({
url:
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
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-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-body__footer {
display: flex;
justify-content: flex-end;
padding: 18px;
}
.action_btn {
float: right;
/* margin: 0 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,553 @@
<!--
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: (this.$auth.hasPermiAnd([
'equipment:check-record:create',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
]) || this.$auth.hasPermi('equipment:check-record:update') || this.$auth.hasPermi('equipment:check-record:export')) ? 'separate' : '',
},
{
type: this.$auth.hasPermiAnd([
'equipment:check-record:create',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
])
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
{
type: this.$auth.hasPermi('equipment:check-record:update')
? 'button'
: '',
btnName: '巡检人批量确认',
name: 'batchConfirm',
color: 'primary',
plain: true,
},
{
type: this.$auth.hasPermi('equipment:check-record:update')
? 'button'
: '',
btnName: '确认人批量确认',
name: 'batchConfirm2',
color: 'primary',
plain: true,
},
// {
// type: this.$auth.hasPermi('equipment:check-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: 20,
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(() => {
// let checkPersonParam = '';
// if (!row.checkPerson || row.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
// }
return this.$axios({
// url: `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` + checkPersonParam,
url: `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
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(() => { });
case 'batchConfirm2':
if (this.$refs['waiting-list-table'].selectedPlan.length == 0) {
this.$message.warning('请选择待确认的设备巡检单');
return;
}
this.$modal
.confirm('是否确认所有选中巡检单"?')
.then(() => {
// let checkPersonParam = '';
// if (!row.checkPerson || row.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${this.$store.getters.nickname}`;
// }
return this.$axios({
// url: `/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}` + checkPersonParam,
url: `/base/equipment-check-order/confirm2?confirmPerson=${this.$store.getters.nickname}`,
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(() => {
// let checkPersonParam = '';
// const nickname = this.$store.getters.nickname;
// if (!row.checkPerson || row.checkPerson.trim() == '') {
// /** */
// checkPersonParam = `&checkPerson=${nickname}`;
// } else {
// checkPersonParam = `&checkPerson=${row.checkPerson}`
// }
return this.$axios({
url:
`/base/equipment-check-order/confirm?confirmPerson=${this.$store.getters.nickname}`,
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

@ -84,10 +84,10 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'program', label: '巡检项目' },
{ prop: 'content', label: '巡检内容' },
{ prop: 'code', label: '巡检内容编码' },
{ prop: 'remark', label: '备注' },
{ prop: 'program', label: '巡检项目', showOverflowtooltip: true },
{ prop: 'content', label: '巡检内容', minWidth: 150, showOverflowtooltip: true },
{ prop: 'code', label: '巡检内容编码', showOverflowtooltip: true },
{ prop: 'remark', label: '备注', showOverflowtooltip: true },
],
searchBarFormConfig: [
{

View File

@ -0,0 +1,312 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2024-07-23 13:41:04
* @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

@ -12,7 +12,7 @@
:show-close="false"
:wrapper-closable="isdetail"
class="drawer"
size="60%"
size="55%"
@closed="$emit('destroy')">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '查看详情' : !dataForm.id ? '新增' : '编辑' }}
@ -24,7 +24,7 @@
label-width="100px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentId">
<el-select
v-model="dataForm.equipmentId"
@ -41,7 +41,7 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<!-- <el-form-item label="物料名称" prop="name">
<el-input v-model="dataForm.name" :disabled="isdetail" clearable placeholder="请输入物料名称" />
</el-form-item> -->
@ -61,21 +61,19 @@
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="dataForm.equipmentCode" disabled clearable placeholder="请输入设备编码" />
</el-form-item>
</el-col>
<el-col :span="12">
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="巡检人" prop="responsible">
<el-input v-model="dataForm.responsible" :disabled="isdetail" clearable placeholder="请输入巡检人" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="8">
<el-form-item label="巡检时间" prop="actualTime">
<el-date-picker
v-model="dataForm.actualTime"
@ -86,7 +84,7 @@
placeholder="选择巡检时间" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="8">
<el-form-item label="数据来源" prop="origin">
<el-select
v-model="dataForm.origin"
@ -95,7 +93,7 @@
style="width: 100%"
placeholder="请选择数据来源">
<el-option key="1" label="手动" :value="1" />
<el-option key="2" label="自动" :value="2" />
<el-option key="2" label="PDA" :value="2" />
</el-select>
</el-form-item>
</el-col>
@ -108,7 +106,8 @@
:table-data="list" />
</el-form-item>
<el-form-item label="巡检详情" prop="description">
<editor v-model="dataForm.description" :read-only="isdetail" :min-height="150"/>
<editor v-if="!isdetail" v-model="dataForm.description" :min-height="150"/>
<div v-else v-html="dataForm.description" style="padding: 5px; margin-left: 5px; border: 1px solid #dfdfdf" />
</el-form-item>
<el-form-item label="附件">
<FileUpload v-model="file" :limit="1" :f-name="fileName" :disabled="isdetail" @name="setFileName" />
@ -117,7 +116,7 @@
</el-form>
<div v-if="!isdetail" class="drawer-body__footer">
<el-button type="primary" @click="goback()">取消</el-button>
<el-button @click="goback()">取消</el-button>
<el-button type="primary" @click="dataFormSubmit()">确定</el-button>
</div>
</el-drawer>
@ -126,7 +125,7 @@
<script>
import SmallTitle from '../../../base/alarm/Record/SmallTitle.vue';
import { createCheckLog, updateCheckLog, getcheckConfigByEqList, getEqCheckLog } from '@/api/equipment/base/inspection/record'
import { getEquipmentAll } from '@/api/base/equipment'
import { getEquipmentPage } from '@/api/base/equipment'
import Editor from "@/components/Editor";
import { getCheckDetPage } from "@/api/equipment/base/inspection/settings";
// import FileUpload from "@/components/FileUpload";
@ -185,7 +184,7 @@ export default {
actualTime: undefined,
responsible: undefined,
description: undefined,
origin: undefined,
origin: 1,
files: []
},
list: [],
@ -204,7 +203,7 @@ export default {
}
};
},
mounted() {
created() {
this.getDict()
},
methods: {
@ -212,17 +211,24 @@ export default {
this.fileName = val
},
async getDict() {
const res = await getEquipmentAll()
this.eqList = res.data
const res = await getEquipmentPage({
pageNo: 1,
pageSize: 100,
special: false
})
this.eqList = res.data.list
const configres = await getcheckConfigByEqList()
this.configList = configres.data
},
async setConfig() {
const configres = await getcheckConfigByEqList({equipmentId: this.dataForm.equipmentId})
this.configList = configres.data
this.dataForm.configId = this.configList.filter(it => {
return it.id === this.dataForm.configId
})[0]?.id ?? undefined
this.dataForm.equipmentCode = this.eqList.filter(item => {
return item.id === this.dataForm.equipmentId
})[0].code
})[0]?.code ?? undefined
},
goback() {
this.$emit('refreshDataList');
@ -265,8 +271,8 @@ export default {
this.file = this.dataForm.files[0].fileUrl
this.fileName = this.dataForm.files[0].fileName
}
this.dataForm.description = this.dataForm.description || '无'
this.setConfig()
this.setInspectionContet()
});
} else {
// if (this.urlOptions.isGetCode) {

View File

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -49,8 +50,12 @@
<addRecord
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList"
@destroy="addOrUpdateVisible = false" />
@refreshDataList="getList" />
<add-content
v-if="addContent"
ref="addContent"
@refreshDataList="addContent = false" />
</div>
</template>
@ -58,69 +63,114 @@
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
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 tableHeightMixin from '@/mixins/tableHeightMixin';
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.btnName}
</el-button>
);
},
};
export default {
name: 'EquipmentRepair',
components: { addRecord },
mixins: [basicPageMixin],
name: 'EquipmentInspectionRecord',
components: { addRecord, AddContent },
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
addOrUpdateVisible: false,
searchBarKeys: ['equipmentId', 'actualTime'],
addContent: false,
searchBarKeys: ['name', 'actualCheckTime'],
tableBtn: [
this.$auth.hasPermi('equipment:check-record:detail')
this.$auth.hasPermi('equipment:check:query')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi('equipment:check-record:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check-record:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
// this.$auth.hasPermi('equipment:check-record:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:check-record:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v),
tableProps: [
{ prop: 'configName', label: '配置名称' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'origin', label: '数据来源', filter: (val) => ['', '手动', '自动'][val] },
{ prop: 'name', label: '巡检单名称' },
{ prop: 'department', label: '部门' },
{ prop: 'actualCheckTime', label: '巡检时间', filter: parseTime },
{ prop: 'groupClass', label: '班次' },
{ prop: 'logType', label: '记录类型' },
{ prop: 'orderType', label: '巡检单类型' },
// { prop: 'op', label: '' },
{ prop: 'opt', label: '巡检内容', btnName: '详情', subcomponent: btn },
{ prop: 'remark', label: '备注' }
// { prop: 'origin', label: '', filter: (val) => ['', '', 'PDA'][val] },
// { prop: 'sectionName', label: '' },
{ prop: 'actualTime', label: '实际巡检时间', filter: parseTime },
// { prop: 'maintenanceDetail', label: '' },
{ prop: 'responsible', label: '巡检人' },
// { prop: 'responsible', label: '' },
],
searchBarFormConfig: [
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'name',
// filterable: true
// },
{
type: 'select',
label: '设备',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true
type: 'input',
label: '巡检单名称',
placeholder: '请输入巡检单',
param: 'name'
},
//
{
type: 'datePicker',
label: '时间',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
label: '巡检时间',
dateType: 'datetimerange', // datetimerange
format: 'yyyy-MM-dd HH:mm:ss',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
rangeSeparator: '-',
startPlaceholder: '开始日期',
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'actualTime',
param: 'actualCheckTime',
// width: 350,
},
{
type: 'select',
label: '记录类型',
selectOptions: [
{ name: '正常', id: 0 },
{ name: '异常,保养确认超时', id: 1 },
{ name: '其他异常', id: 2 },
],
param: 'logType',
},
{
type: 'button',
@ -129,28 +179,27 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('equipment:check:export')
? 'separate' : '',
},
{
type: this.$auth.hasPermi('equipment:check-record:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:check-record:export')
type: this.$auth.hasPermi('equipment:check:export')
? 'button'
: '',
btnName: '导出',
name: 'export',
color: 'warning',
},
plain: true,
color: 'primary',
}
// {
// type: this.$auth.hasPermi('equipment:check-record:create')
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
],
rows: [
[
@ -217,34 +266,56 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintenanceStatus: null,
createTime: null,
equipmentId: null,
pageSize: 20,
special: false,
name: null,
actualCheckTime: null,
status: 2
},
//
form: {},
basePath: '/base/equipment-check-log',
basePath: '/base/equipment-check-order',
mode: null,
};
},
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();
},
methods: {
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.$set(
this.searchBarFormConfig[0],
'selectOptions',
data.map((item) => ({
name: item.name,
id: item.id,
}))
);
handleEmitFun({action, value}) {
switch (action) {
//
case '巡检内容':
this.addContent = true;
this.$nextTick(() => {
this.$refs.addContent.init(value.id, true);
});
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() {
this.loading = true;
@ -361,10 +432,14 @@ export default {
.catch(() => {});
},
handleDetail({ id }) {
this.addOrUpdateVisible = true
this.addContent = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id, true);
this.$refs.addContent.init(id, true);
});
// this.addOrUpdateVisible = true
// this.$nextTick(() => {
// this.$refs.addOrUpdate.init(id, true);
// });
},
/** 导出按钮操作 */
handleExport() {
@ -376,7 +451,7 @@ export default {
.confirm('是否确认导出所有设备巡检记录?')
.then(() => {
this.exportLoading = true;
return exportCheckLogExcel(params);
return exportCheckOrderExcel(params);
})
.then((response) => {
this.$download.excel(response, '设备巡检记录.xls');

View File

@ -2,52 +2,45 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-27 10:48:55
* @LastEditTime: 2024-02-26 08:40:22
* @Description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
:wrapper-closable="true"
class="drawer"
size="50%">
<small-title slot="title" :no-padding="true">
{{ isdetail ? '详情' : '添加巡检' }}
<!-- {{ isdetail ? '详情' : '添加巡检' }} -->
{{ '添加内容' }}
</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="12">
<el-form-item label="设备名称" prop="equipmentName">
<el-input v-model="dataForm.equipmentName" disabled clearable placeholder="请输入设备名称" />
</el-form-item>
<el-col :span="8">
<div class="blodTip">巡检单名称</div>
<div class="lightTip">{{ dataForm.name }}</div>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input
v-model="dataForm.equipmentCode"
clearable
disabled
placeholder="请输入设备编码" />
</el-form-item>
<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">{{ parseTime(dataForm.planCheckTime) }}</div>
</el-col>
</el-row>
</el-form>
</div>
<el-divider />
<div class="attr-list">
<small-title
style="margin: 16px 0; padding-left: 8px"
:no-padding="true">
巡检项目
巡检内容
</small-title>
<div v-if="!isdetail" class="action_btn">
@ -78,9 +71,9 @@
:page-sizes="[5, 10, 15]"
@pagination="getList" />
<div class="drawer-body__footer">
<!-- <div class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button>
</div>
</div> -->
</div>
</div>
@ -88,16 +81,18 @@
<attr-add
v-if="addOrUpdateVisible"
ref="addOrUpdate"
:config-id="dataForm.id"
:order-id="dataForm.id"
@refreshDataList="getList" />
</el-drawer>
</template>
<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 attrAdd from './attr-add';
import {DICT_TYPE, getDictDatas} from "@/utils/dict";
import { parseTime } from '../../../../core/mixins/code-filter';
const tableBtn = [
{
@ -110,22 +105,14 @@ const tableBtn = [
},
];
const tableProps = [
{
prop: 'equipmentName',
label: '设备名称',
},
{
prop: 'program',
label: '巡检项目',
},
{
prop: 'content',
label: '巡检内容',
},
{
prop: 'code',
label: '巡检内容编码',
},
{
prop: 'description',
label: '备注',
},
label: '检查项目',
}
];
export default {
@ -136,7 +123,7 @@ export default {
tableProps,
addOrUpdateVisible: false,
urlOptions: {
infoURL: getEqCheck,
infoURL: getCheckOrder,
},
listQuery: {
pageSize: 10,
@ -145,26 +132,13 @@ export default {
},
dataForm: {
id: undefined,
code: undefined,
name: '',
materialType: undefined,
productType: undefined,
area: undefined,
specifications: undefined,
processTime: 0,
remark: undefined,
unit: undefined
name: undefined,
department: undefined,
planCheckTime: undefined
},
checkDetList: [],
visible: false,
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" }]
}
isdetail: false
};
},
mounted() {},
@ -185,7 +159,7 @@ export default {
}
)
.then(() => {
deleteCheckDet(raw.data.id).then(({ data }) => {
deleteCheckOrderDet(raw.data.id).then(({ data }) => {
this.$message({
message: '操作成功',
type: 'success',
@ -203,9 +177,9 @@ export default {
},
getList() {
//
getCheckDetPage({
getCheckOrderDetPage({
...this.listQuery,
configId: this.dataForm.id,
orderId: this.dataForm.id,
}).then((response) => {
this.checkDetList = response.data.list;
this.listQuery.total = response.data.total;
@ -218,7 +192,7 @@ export default {
this.visible = true;
this.$nextTick(() => {
this.$refs['dataForm'].resetFields();
// this.$refs['dataForm'].resetFields();
if (this.dataForm.id) {
//
@ -285,7 +259,7 @@ export default {
.drawer >>> .visual-part {
flex: 1 auto;
max-height: 16vh;
max-height: 10vh;
overflow: hidden;
overflow-y: scroll;
padding-right: 10px; /* 调整滚动条样式 */
@ -309,4 +283,18 @@ export default {
.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

@ -2,7 +2,7 @@
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: DY
* @LastEditTime: 2023-11-25 16:23:13
* @LastEditTime: 2024-04-22 14:56:03
* @Description:
-->
<template>
@ -11,43 +11,80 @@
:rules="dataRule"
ref="dataForm"
@keyup.enter.native="dataFormSubmit()"
label-width="80px">
label-width="150px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="配置名称" prop="name">
<el-input
v-model="dataForm.name"
placeholder="请输入配置名称" />
<el-form-item label="巡检单名称" prop="name">
<el-input v-model="dataForm.name" placeholder="请输入巡检单名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="配置编码" prop="code">
<el-input
v-model="dataForm.code"
placeholder="请输入配置编码" />
<el-form-item label="巡检单编码" prop="code">
<el-input v-model="dataForm.code" placeholder="请输入巡检单编码" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentId">
<el-form-item
label="部门"
prop="departmentId"
:rules="[{ required: false, message: '请选择部门', trigger: 'blur' }]">
<el-select
v-model="dataForm.equipmentId"
filterable
style="width: 100%"
placeholder="请选择设备名称"
@change="setCode">
v-model="dataForm.departmentId"
:placeholder="`请选择部门`"
style="width: 100%">
<el-option
v-for="dict in eqList"
:key="dict.id"
:label="dict.name"
:value="dict.id" />
v-for="opt in departmentOptions"
:key="opt.id"
:label="opt.name"
:value="opt.id" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备编码" prop="equipmentCode">
<el-input v-model="dataForm.equipmentCode" disabled placeholder="请输入设备编码" />
<el-form-item label="计划巡检时间" prop="planCheckTime">
<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-col :span="12">
<el-form-item label="巡检频率(天/次)" prop="checkPeriod">
<el-input
v-model="dataForm.checkPeriod"
placeholder="请输入巡检频率(天/次)" />
</el-form-item>
</el-col>
<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-col :span="12">
<el-form-item label="备注" prop="remark">
<el-input v-model="dataForm.remark" placeholder="请输入备注" />
</el-form-item>
</el-col>
</el-row>
@ -56,8 +93,16 @@
<script>
import basicAdd from '../../../../core/mixins/basic-add';
import { getEqCheck, getCode, createCheckConfig, updateCheckConfig } from "@/api/equipment/base/inspection/settings";
import { getEquipmentAll } from '@/api/base/equipment'
import {
getCheckOrder,
getOrderCode,
createCheckOrder,
updateCheckOrder,
} from '@/api/equipment/base/inspection/settings';
import { getDepartmentList } from '@/api/base/coreDepartment';
import { groupClassesListAll } from '@/api/monitoring/teamProduction';
import { getDictDataLabel } from '@/utils/dict';
// import { getEquipmentAll } from '@/api/base/equipment'
export default {
mixins: [basicAdd],
@ -65,41 +110,140 @@ export default {
return {
urlOptions: {
isGetCode: true,
codeURL: getCode,
createURL: createCheckConfig,
updateURL: updateCheckConfig,
infoURL: getEqCheck,
codeURL: getOrderCode,
createURL: createCheckOrder,
updateURL: updateCheckOrder,
infoURL: getCheckOrder,
},
dataForm: {
id: undefined,
code: undefined,
name: undefined,
equipmentId: undefined,
equipmentCode: undefined
id: null,
code: null,
name: null,
departmentId: null,
planCheckTime: null,
confirmTimeLimit: null,
groupClass: null,
remark: null,
checkPeriod: null
},
eqList: [],
groupOptions: [],
departmentOptions: [],
dataRule: {
equipmentId: [{ required: true, message: "设备不能为空", trigger: "blur" }],
code: [{ required: true, message: "配置编码不能为空", trigger: "blur" }],
name: [{ required: true, message: "配置名称不能为空", trigger: "blur" }],
confirmTimeLimit: [
{ required: true, message: '确认时限不能为空', trigger: 'blur' },
],
code: [
{ required: true, message: '巡检单编码不能为空', trigger: 'blur' },
],
name: [
{ required: true, message: '巡检单名称不能为空', trigger: 'blur' },
],
planCheckTime: [
{ required: true, message: '计划巡检时间不能为空', trigger: 'blur' }
],
checkPeriod: [
{ required: true, message: '巡检频率不能为空', trigger: 'blur' },
{
type: 'number',
message: '请输入正确的数字类型',
trigger: 'blur',
transform: (val) => Number(val),
}
]
}
};
},
created() {
const currenttime = new Date();
this.dataForm.planCheckTime = new Date(
currenttime.getFullYear(),
currenttime.getMonth(),
currenttime.getDate(),
8,
0,
0
).getTime();
},
mounted() {
this.getDict()
this.getDict();
},
methods: {
async getDict() {
//
const res = await getEquipmentAll()
this.eqList = res.data
},
setCode() {
const chooseM = this.eqList.filter(item => {
return item.id === this.dataForm.equipmentId
})
this.dataForm.equipmentCode = chooseM[0].code
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) => {
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 getDepartmentList();
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>

View File

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

View File

@ -12,12 +12,13 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="180"
:width="120"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -37,9 +38,7 @@
@close="cancel"
@cancel="cancel"
@confirm="handleConfirm">
<add
ref="add"
@refreshDataList="successSubmit" />
<add ref="add" @refreshDataList="successSubmit" />
</base-dialog>
<!-- 添加巡检查看详情 -->
<addOrUpdata
@ -52,39 +51,52 @@
<script>
import basicPageMixin from '@/mixins/lb/basicPageMixin';
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 { groupClassesListAll } from '@/api/monitoring/teamProduction';
import tableHeightMixin from '@/mixins/tableHeightMixin';
// import { publicFormatter } from '@/utils/dict';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default {
name: 'EquipmentCheckSetting',
components: { addOrUpdata, add },
mixins: [basicPageMixin],
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
addOrUpdateVisible: false,
addOrEditTitle: '',
searchBarKeys: ['equipmentId', 'name'],
tableBtn: [
this.$auth.hasPermi('equipment:check-setting:update')
this.$auth.hasPermiAnd([
'equipment:check:create',
'equipment:check:query',
'equipment:check:update',
'equipment:check:delete'
])
? {
type: 'add',
btnName: '添加',
showTip: '添加巡检',
}
: undefined,
this.$auth.hasPermiAnd([
'equipment:check:update',
'equipment:check:query',
'base:core-department:query'
])
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:update')
? {
type: 'detail',
btnName: '查看详情',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:addInsp')
? {
type: 'add',
btnName: '添加巡检',
}
: undefined,
this.$auth.hasPermi('equipment:check-setting:delete')
// this.$auth.hasPermi('equipment:check-setting:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:check:delete')
? {
type: 'delete',
btnName: '删除',
@ -92,29 +104,61 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'name', label: '配置名' },
{ prop: 'code', label: '编码' },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备' },
{ prop: 'equipmentCode', label: '设备编码' },
{
prop: 'name',
label: '巡检单名称',
width: 110,
showOverflowtooltip: true,
},
{
prop: 'code',
label: '巡检单编码',
minWidth: 170,
showOverflowtooltip: true,
},
{ prop: 'department', label: '部门', showOverflowtooltip: true },
{
prop: 'planCheckTime',
label: '计划巡检时间',
width: 150,
filter: parseTime,
},
{
prop: 'checkPeriod',
label: '巡检频率(天/次)',
width: 150,
showOverflowtooltip: true,
},
{
prop: 'confirmTimeLimit',
label: '确认时限',
showOverflowtooltip: true,
},
{ prop: 'groupClass', label: '班次', showOverflowtooltip: true },
{ prop: 'creator', label: '创建人', showOverflowtooltip: true },
{
prop: 'createTime',
label: '创建时间',
width: 150,
filter: parseTime,
},
// { prop: 'responsible', label: '' },
{ prop: 'checkNumber', label: '巡检条数' }, // TODO:
{ prop: 'remark', label: '备注' }, // TODO:
],
searchBarFormConfig: [
{
type: 'input',
label: '配置名称',
placeholder: '请输入配置名称',
label: '巡检单名称',
placeholder: '请输入巡检单名称',
param: 'name',
},
{
type: 'select',
label: '设备名称',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true,
},
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'equipmentId',
// filterable: true,
// },
{
type: 'button',
btnName: '查询',
@ -122,10 +166,17 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermiAnd([
'equipment:check:create',
'base:core-department:query'
])
? 'separate' : '',
},
{
type: this.$auth.hasPermi('equipment:check-setting:create')
type: this.$auth.hasPermiAnd([
'equipment:check:create',
'base:core-department:query'
])
? 'button'
: '',
btnName: '新增',
@ -173,7 +224,11 @@ export default {
clearable: true,
},
rules: [
{ required: true, message: '设备名称不能为空', trigger: 'change' },
{
required: true,
message: '设备名称不能为空',
trigger: 'change',
},
],
},
{
@ -188,27 +243,31 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
equipmentId: null,
name: null,
special: false,
status: 0,
},
//
form: {},
basePath: '/base/equipment-check-config',
basePath: '/base/equipment-check-order',
mode: null,
groupList: [],
};
},
created() {
this.initSearchBar();
this.getList();
this.getGroup();
},
methods: {
handleConfirm() {
this.$refs.add.dataFormSubmit()
this.$refs.add.dataFormSubmit();
},
successSubmit() {
this.cancel()
this.getList()
this.cancel();
this.getList();
},
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
@ -222,6 +281,11 @@ export default {
);
});
},
getGroup() {
groupClassesListAll().then((res) => {
this.groupList = res.data || [];
});
},
/** 查询列表 */
getList() {
this.loading = true;
@ -234,9 +298,9 @@ export default {
},
/** 取消按钮 */
cancel() {
this.$refs.add.formClear()
this.$refs.add.formClear();
this.open = false;
this.title = ''
this.title = '';
// this.reset();
},
/** 表单重置 */

View File

@ -0,0 +1,46 @@
<!--
* @Author: zhp
* @Date: 2024-07-12 13:41:41
* @LastEditTime: 2024-07-12 13:41:41
* @LastEditors: zhp
* @Description:
-->
<template>
<div class="tableInner">
<el-input-number v-model="list[itemProp]" @blur="changeInput" :min="0" :max="100000000" style="width: 100%"
:controls='false'></el-input-number>
</div>
</template>
<script>
export default {
name: 'InputArea',
props: {
injectData: {
type: Object,
default: () => ({})
},
itemProp: {
type: String
}
},
data() {
return {
list: this.injectData
}
},
methods: {
changeInput() {
console.log(this.list)
this.$emit('emitData', this.list)
}
}
}
</script>
<style lang="scss">
.tableInner .el-input__inner {
border: none;
padding: 0;
height: 33px;
}
</style>

View File

@ -0,0 +1,140 @@
<!--
* @Author: zhp
* @Date: 2024-07-18 14:56:21
* @LastEditTime: 2024-07-23 13:47:57
* @LastEditors: zhp
* @Description:
-->
<template>
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="auto">
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="巡检项目" prop="program">
<el-input v-model="dataForm.program" placeholder="请输入保养项目" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="24">
<el-form-item label="默认巡检结果" prop="resultType">
<el-select v-model="dataForm.resultType" placeholder="请选择默认保养结果">
<el-option v-for="dict in resultList" :key="dict.id" :label="dict.name" :value="dict.id" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row v-if="dataForm.resultType === 0" :gutter="24">
<el-col :span="24">
<el-form-item prop="checkResult">
<el-input v-model="dataForm.checkResult" placeholder="请输入文本内容" />
</el-form-item>
</el-col>
</el-row>
<el-row v-else-if="dataForm.resultType === 1" :gutter="24">
<el-col :span="24">
<el-form-item prop="checkResult">
<el-input oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.checkResult" placeholder="请输入数值" />
</el-form-item>
</el-col>
</el-row>
<el-row v-else-if="dataForm.resultType === 2" :gutter="24">
<el-col :span="12">
<el-form-item prop="minValue">
<el-input oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.minValue" placeholder="请输入最小值" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item prop="maxValue">
<el-input @change="handleChange" oninput="value=value.replace(/[^\-\d.]/g, '')" v-model="dataForm.maxValue"
placeholder="请输入最大值" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</template>
<script>
import basicAdd from './basic-add';
import {
createItemData,
getItemData,
updateItemData
} from '@/api/equipment/base/inspection/items';
import { getList,} from "@/api/base/qualityScrapType";
// import { getMaterialList } from "@/api/base/material";
export default {
mixins: [basicAdd],
data() {
return {
urlOptions: {
createURL: createItemData,
updateURL: updateItemData,
infoURL: getItemData,
},
typeList: [],
resultList: [
{
id: 0,
name:'文本'
},
{
id: 1,
name: '单一数值'
},
{
id: 2,
name: '数值范围'
}
],
dataForm: {
id: undefined,
program: undefined,
resultType: undefined,
equipmentTypeId: undefined,
minValue: undefined,
maxValue: undefined,
checkResult:undefined,
},
// materialList: [],
dataRule: {
// materialId: [{ required: true, message: "", trigger: "blur" }],
program: [{ required: true, message: "巡检项目不能为空", trigger: "blur" }],
checkResult: [{ required: true, message: "默认巡检结果不能为空", trigger: "blur" }],
minValue: [{ required: true, message: "最小值不能为空", trigger: "blur" }],
maxValue: [{ required: true, message: "最大值不能为空", trigger: "blur" }],
// typeId: [{ required: true, message: "", trigger: "change" }],
}
};
},
mounted() {
this.getDict()
console.log('我看看', this.dataForm)
},
methods: {
async getDict() {
//
const res = await getList();
this.typeList = res.data;
},
handleChange(val) {
if (val && this.dataForm.maxValue) {
if (parseFloat(this.dataForm.minValue) >= parseFloat(val)) {
return this.$message({
message: '最小值不能大于最大值',
type: 'warning'
});
}
}
}
// setMaterialCode() {
// const chooseM = this.materialList.filter(item => {
// return item.id === this.dataForm.materialId
// })
// this.dataForm.materialCode = chooseM[0].code
// }
},
};
</script>

View File

@ -0,0 +1,112 @@
/*
* @Author: zwq
* @Date: 2022-08-24 11:19:43
* @LastEditors: zhp
* @LastEditTime: 2024-07-23 13:49:00
* @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(obj) {
console.log(obj);
this.dataForm.id = obj.id || "";
this.dataForm.equipmentTypeId = obj.equipmentTypeId || "";
this.visible = true;
if (this.urlOptions.getOption) {
this.getArr()
}
this.$nextTick(() => {
this.$refs["dataForm"].resetFields();
if (this.dataForm.id) {
this.urlOptions.infoURL(this.dataForm.id).then(res => {
this.dataForm.id = res.data.id
this.dataForm.program = res.data.program
this.dataForm.resultType = res.data.resultType
// console.log(this.dataForm.maintainResult.search('~'))
if (res.data.resultType === 2 || res.data.checkResult.search('~') != -1) {
this.dataForm.minValue = res.data.checkResult.substring(0, res.data.checkResult.search('~'))
this.dataForm.maxValue = res.data.checkResult.substring(res.data.checkResult.search('~') + 1, res.data.checkResult.length)
this.dataForm.checkResult = undefined
// = this.dataForm.minValue + '-' + this.dataForm.maxValue
} else {
this.dataForm.minValue = undefined
this.dataForm.maxValue = undefined
this.dataForm.checkResult = res.data.checkResult
}
console.log(this.dataForm);
});
}
});
},
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 (this.dataForm.resultType === 2) {
this.dataForm.checkResult = this.dataForm.minValue + '~' + this.dataForm.maxValue
}
if (!valid) {
return false;
}
// 修改的提交
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

@ -0,0 +1,172 @@
/*
* @Author: zhp
* @Date: 2024-07-19 09:49:22
* @LastEditTime: 2024-07-22 09:17:31
* @LastEditors: zhp
* @Description:
*/
export default {
data() {
/* eslint-disable */
return {
urlOptions: {
getDataListURL: '',
deleteURL: '',
statusUrl: '',
exportURL: ''
},
tableData: [],
listQuery: {
pageSize: 10,
pageNo: 1,
total: 1,
},
exportLoading: false,
dataListLoading: false,
addOrEditTitle: '',
addOrUpdateVisible: false,
}
},
created() {
},
mounted() {
this.getDataList()
},
methods: {
// 获取数据列表
getDataList() {
this.dataListLoading = true;
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false;
});
},
// 每页数
sizeChangeHandle(val) {
this.listQuery.pageSize = val;
this.listQuery.pageNo = 1;
this.getDataList();
},
// 当前页
currentChangeHandle(val) {
this.listQuery.pageNo = val;
this.getDataList();
},
// 新增 / 修改
addOrUpdateHandle(id) {
this.addOrUpdateVisible = true;
this.$nextTick(() => {
this.$refs.addOrUpdate.init(id);
});
},
cancel(id) {
this.$refs["popover-" + id].showPopper = false;
},
//改变状态
changeStatus(id) {
this.$http
.post(this.urlOptions.statusUrl, { id })
.then(({ data: res }) => {
if (res.code !== 0) {
return this.$message.error(res.msg);
}
this.$refs["popover-" + id].showPopper = false;
this.$message({
message: this.$t("prompt.success"),
type: "success",
duration: 500,
onClose: () => {
this.getDataList();
},
});
})
.catch(() => { });
},
//tableBtn点击
handleClick(val) {
if (val.type === "edit") {
this.addOrUpdateVisible = true;
this.addOrEditTitle = "编辑"
let obj = {
id: val.data.id,
equipmentTypeId:val.data.equipmentTypeId
}
this.$nextTick(() => {
this.$refs.addOrUpdate.init(obj);
});
} else if (val.type === "delete") {
this.deleteHandle(val.data.id, val.data.program, val.data._pageIndex)
} else if (val.type === "change") {
this.changeStatus(val.data.id)
} else {
this.otherMethods(val)
}
},
// 删除
deleteHandle(id, name, index) {
this.$modal.delConfirm(`确定要删除${name}?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.catch(() => { });
},
//search-bar点击
buttonClick(val) {
switch (val.btnName) {
case "search":
this.listQuery.xm1 = val.xm1;
this.listQuery.xm2 = val.xm2;
this.listQuery.pageNo = 1;
this.getDataList();
break;
case "add":
this.addOrEditTitle = '新增'
this.addOrUpdateVisible = true;
this.addOrUpdateHandle()
break;
default:
console.log(val)
}
},
handleCancel() {
this.$refs.addOrUpdate.formClear()
this.addOrUpdateVisible = false
this.addOrEditTitle = ''
},
handleConfirm() {
this.$refs.addOrUpdate.dataFormSubmit()
},
successSubmit() {
this.handleCancel()
this.getDataList()
},
/** 导出按钮操作 */
handleExport() {
// 处理查询参数
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
this.$modal.confirm('是否确认导出所有数据项?').then(() => {
this.exportLoading = true;
return this.urlOptions.exportURL(params);
}).then(response => {
this.$download.excel(response, '工厂.xls');
this.exportLoading = false;
}).catch(() => { });
}
}
}

View File

@ -0,0 +1,260 @@
<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" width="20%"
@confirm="submitForm">
<DialogForm v-if="open" ref="form" v-model="form" :has-files="false" :rows="rows" />
</base-dialog>
<show-detail v-if="showDetailVisible" ref="showDetail"></show-detail>
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteProgramTypeData } from '@/api/equipment/base/maintain/items'
import showDetail from './showDetail.vue'
import { publicFormatter } from '@/utils/dict';
export default {
name: 'PlanConfig',
mixins: [basicPageMixin],
components: {
showDetail
},
data() {
const t = new Date();
const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()];
return {
searchBarKeys: ['equipmentName', 'createTime'],
equipmentTypeList:[],
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: 'equipmentType', label: '设备类型' },
{ prop: 'creator', label: '创建人' },
{
prop: 'createTime',
label: '创建时间',
// fixed: true,
width: 180,
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
],
searchBarFormConfig: [
{
type: 'select',
label: '设备类型',
placeholder: '请输入设备类型',
param: 'equipmentTypeId',
},
{
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',
},
],
rows: [
[
{
select: true,
label: '设备类型',
prop: 'equipmentTypeId',
url: '/base/core-equipment-type/listAll',
rules: [{ required: true, message: '设备类型不能为空', trigger: 'blur' }],
},
],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
equipmentTypeId: null,
},
showDetailVisible:false,
//
form: {},
basePath: 'base/equipment-check-program-type',
};
},
created() {
this.initSearchBar()
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 = {
equipmentTypeId: null,
id: null,
equipmentType:null,
};
this.resetForm('form');
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNo = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm('queryForm');
this.handleQuery();
},
initSearchBar() {
this.http('/base/core-equipment-type/listAll', 'get').then(({ data }) => {
this.$set(
this.searchBarFormConfig[0],
'selectOptions',
data.map((item) => ({
name: item.name,
id: item.id,
}))
);
this.equipmentTypeList = data
});
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = '巡检项目设置新增';
},
handleDetail(row) {
this.showDetailVisible = true
this.$nextTick(() => {
this.$refs.showDetail.init(row.equipmentTypeId)
})
// 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.equipmentTypeList.forEach(ele => {
if (this.form.equipmentTypeId === ele.id) {
this.form.equipmentType = ele.name
}
});
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()
this.showDetailVisible = true
this.$nextTick(() => {
this.$refs.showDetail.init(this.form.equipmentTypeId)
})
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal.delConfirm('是否确认删除' + row.equipmentType + '?')
.then(function () {
return deleteProgramTypeData(id);
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
})
.catch(() => {});
},
},
};
</script>

View File

@ -0,0 +1,131 @@
<!--
* @Author: zhp
* @Date: 2024-07-12 13:28:21
* @LastEditTime: 2024-07-23 13:44:46
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<el-drawer title="配置巡检项目" :visible.sync="drawer" :direction="direction" size="50%">
<div style="padding: 0px 16px;">
<el-form :inline="true" class="">
<el-form-item>
<el-button :plain='true' type="success" @click="handleAdd">新增</el-button>
</el-form-item>
</el-form>
<base-table v-loading="dataListLoading" :table-props="tableProps" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
</el-drawer>
<base-dialog :dialogTitle="addOrEditTitle" :dialogVisible="addOrUpdateVisible" @cancel="handleCancel"
@confirm="handleConfirm" :before-close="handleCancel" width="30%">
<add-or-update ref="addOrUpdate" @refreshDataList="successSubmit"></add-or-update>
</base-dialog>
</div>
</template>
<script>
const tableProps = [
{
prop: 'program',
label: '巡检项目',
align:'center',
},
{
prop: 'maintainResult',
label: '默认巡检结果',
align: 'center',
},
]
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
import AddOrUpdate from './components/add-or-updata';
import {
getItemPageData,
deleteData
} from '@/api/equipment/base/inspection/items';
import basicPage from './components/basic-page';
export default {
mixins: [basicPage],
components: {
AddOrUpdate,
},
data() {
return {
drawer: false,
urlOptions: {
getDataListURL: getItemPageData,
deleteURL: deleteData,
// exportURL: exportFactoryExcel,
},
direction: 'rtl',
dataListLoading:false,
addOrUpdateVisible: false,
addOrEditTitle: '',
queryParams: {
pageNo:1,
pageSize:10,
equipmentTypeId:null,
},
tableProps,
basePath: 'base/equipment-check-program',
tableData: [],
tableBtn: [
{
type: 'edit',
name: '编辑'
},
{
type: 'delete',
name: '删除'
}
],
addButtonShow: '新增'
}
},
methods: {
inputChange(val) {
// console.log('=======')
console.log(val)
this.tableData[val._pageIndex - 1][val.prop] = val[val.prop]
// console.log(this.tableData)
},
getDataList(id) {
this.dataListLoading = true;
this.queryParams.equipmentTypeId = id
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
this.listQuery.total = response.data.total;
this.dataListLoading = false
});
},
handleAdd() {
this.addOrUpdateVisible = true
this.addOrEditTitle = '新增'
let obj = {
equipmentTypeId: this.queryParams.equipmentTypeId
}
this.$nextTick(() => {
this.$refs.addOrUpdate.init(obj)
});
},
init(id) {
this.drawer = true
this.getDataList(id)
}
},
}
</script>
<style lang="scss" scoped>
</style>

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',
'/system/dept/list-all-simple',
'/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,769 @@
<!--
filename: WaitingListUnplanned--edit.vue
author: liubin
date: 2023-08-22 14:38:56
description:
-->
<template>
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="true"
class="drawer"
custom-class="mes-drawer"
size="60%"
:before-close="beforeClose"
@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',
bind: { clearable: true, filterable: true },
// 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: {
beforeClose(done) {
// if (!this.isdetail) {
this.$confirm('确认关闭?')
.then(_ => {
done();
})
.catch(_ => {});
// }
},
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',
'system/dept/list-all-simple',
'/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,334 @@
<!--
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',
}"
:max-height="tableH"
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]"
minWidth="160"
label="设备保养单号"
:show-overflow-tooltip="true"
prop="maintainOrderNumber"></el-table-column>
<el-table-column v-if="selectedBox[1]" minWidth="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]"
minWidth="150"
label="计划结束时间"
prop="planEndTime">
<template slot-scope="scope">
{{ scope.row.planEndTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[6]"
minWidth="150"
label="实际开始时间"
prop="startTime">
<template slot-scope="scope">
{{ scope.row.startTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[7]"
minWidth="150"
label="实际结束时间"
prop="endTime">
<template slot-scope="scope">
{{ scope.row.endTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[8]"
minWidth="150"
label="确认截止时间"
prop="confirmDueTime">
<template slot-scope="scope">
{{ scope.row.confirmDueTime | timeFilter }}
</template>
</el-table-column>
<el-table-column
v-if="selectedBox[9]"
minWidth="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 v-if="$auth.hasPermi('equipment:maintain-record:update')" 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 v-if="$auth.hasPermi('equipment:maintain-record:query')" style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip v-if="$auth.hasPermi('equipment:maintain-record:query')" 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 v-if="$auth.hasPermiAnd([
'equipment:maintain-record:update',
'base:core-production-line:query',
'base:core-department:query',
'equipment:maintain-record:create',
'equipment:maintain-record:query',
'equipment:maintain-record:delete'
])" style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip v-if="$auth.hasPermiAnd([
'equipment:maintain-record:update',
'base:core-production-line:query',
'base:core-department:query',
'equipment:maintain-record:create',
'equipment:maintain-record:query',
'equipment:maintain-record:delete'
])" 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 v-if="$auth.hasPermi('equipment:maintain-record:delete')" style="margin: 0 4px; font-size: 18px; color: #e5e7eb">|</span>
<el-tooltip v-if="$auth.hasPermi('equipment:maintain-record:delete')" 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: [],
tableH: this.tableHeight(260),
};
},
computed: {
tableDataWithIndex() {
return this.tableData.map((item, index) => ({
...item,
_pageIndex: (this.page - 1) * this.limit + index + 1,
}));
},
},
created() {
window.addEventListener('resize', () => {
this.tableH = this.tableHeight(260)
})
},
destroyed() {
window.removeEventListener('resize', () => {
this.tableH = this.tableHeight(260)
});
},
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,839 @@
<!--
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',
bind: { clearable: true, filterable: true },
// 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',
'/system/dept/list-all-simple',
'/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,631 @@
<!--
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: (this.$auth.hasPermiAnd([
'equipment:maintain-record:create',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
]) || this.$auth.hasPermi('equipment:maintain-record:update') || this.$auth.hasPermi('equipment:maintain-record:export')) ? 'separate' : '',
},
{
type: this.$auth.hasPermiAnd([
'equipment:maintain-record:create',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
])
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
{
type: this.$auth.hasPermi('equipment:maintain-record:update')
? 'button'
: '',
btnName: '保养人确认',
name: 'batchConfirm',
color: 'primary',
plain: true,
},
{
type: this.$auth.hasPermi('equipment:maintain-record:update')
? 'button'
: '',
btnName: '确认人确认',
name: 'batchConfirm2',
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: 20,
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(() => { });
case 'batchConfirm2':
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/confirm2',
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

@ -1,17 +1,10 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<SearchBar :formConfigs="searchBarFormConfig" ref="search-bar" @headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<base-table
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
<base-table :table-props="tableProps" :page="queryParams.pageNo" :limit="queryParams.pageSize" :table-data="list"
@emitFun="handleEmitFun">
<!-- <method-btn
v-if="tableBtn.length"
@ -23,27 +16,11 @@
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
<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>
<show-detail v-if="showDetailVisible" ref="showDetail"></show-detail>
</div>
</template>
@ -53,6 +30,7 @@ import { publicFormatter } from '@/utils/dict';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { exportMaintainMonitorExcel } from '@/api/equipment/base/maintain/record'
import { parseTime } from '@/utils/ruoyi'
import showDetail from './showDetail.vue'
const remainBox = {
name: 'RemainBox',
@ -67,7 +45,7 @@ const remainBox = {
color() {
if (this.value) {
const v = +this.value;
return v < 0 ? '#FF5454' : v >= 0 && v < 2 ? '#FFD767' : '#37D97F';
return v < 1 ? '#FF5454' : v >= 0 && v < 2 ? '#FFD767' : '#37D97F';
}
return 'unset';
},
@ -95,13 +73,14 @@ const btn = {
},
methods: {
handleClick() {
console.log(this.injectData);
this.$emit('emitData', { action: this.injectData.label, value: this.injectData });
},
},
render: function (h) {
return (
<el-button type="text" onClick={this.handleClick}>
{this.injectData.name}
{this.injectData.btnName}
</el-button>
);
},
@ -109,7 +88,9 @@ const btn = {
export default {
name: 'PlanConfig',
components: {},
components: {
showDetail,
},
mixins: [basicPageMixin],
data() {
return {
@ -122,26 +103,26 @@ export default {
// width: 180,
// filter: parseTime(createTime),
// },
{ prop: 'name', label: '保养计划', minWidth: 100, showOverflowtooltip: true },
{ prop: 'lineName', label: '产线名', minWidth: 100, showOverflowtooltip: true },
{ prop: 'sectionName', label: '工段名', minWidth: 100, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'equipmentCode', label: '设备编码', minWidth: 100, showOverflowtooltip: true },
{ prop: 'maintenancePeriod', label: '保养频率' },
{ prop: 'code', label: '保养计划单号', minWidth: 100, showOverflowtooltip: true },
{ prop: 'name', label: '保养计划名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'departmentName', label: '部门', minWidth: 100, showOverflowtooltip: true },
{
prop: 'maintainType',
label: '保养类型',
showOverflowtooltip: true,
filter: publicFormatter(this.DICT_TYPE.MAINTAIN_TYPE),
},
{
prop: 'lastMaintainTime',
label: '上次保养时间',
prop: 'lastPlanMaintainTime',
label: '上次计划保养时间',
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
{ prop: 'nextMaintainTime', label: '计划下次保养时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
{
prop: 'lastMaintainTime',
label: '上次实际保养时间',
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
{ prop: 'nextPlanMaintainTime', label: '计划下次保养时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
{ prop: 'opt1', label: '保养内容', btnName: '详情', subcomponent: btn, width: 100 },
// { prop: 'opt2', label: '', name: '', subcomponent: btn, width: 100 },
{
prop: 'remainDays',
label: '距离保养时间(天)',
@ -149,24 +130,22 @@ export default {
minWidth: 150,
// showOverflowtooltip: true
},
{ prop: 'opt1', label: '设备保养', name: '操作', subcomponent: btn, width: 100 },
{ prop: 'opt2', label: '保养记录', name: '查看详情', subcomponent: btn, width: 100 },
],
searchBarFormConfig: [
{
type: 'select',
label: '保养计划',
label: '保养计划名称',
placeholder: '请选择保养计划',
param: 'planId',
filterable: true,
},
{
type: 'select',
label: '设备名',
placeholder: '请选择设备',
param: 'equipmentId',
filterable: true,
},
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'equipmentId',
// filterable: true,
// },
{
type: 'button',
btnName: '查询',
@ -189,6 +168,7 @@ export default {
//
open: false,
//
showDetailVisible:false,
queryParams: {
pageNo: 1,
pageSize: 10,
@ -248,21 +228,15 @@ export default {
});
},
handleEmitFun({ action, value }) {
console.log(action, value);
switch (action) {
//
case '设备保养':
this.$router.push({ path: '/equipment/base/maintain/record',query: {
addRecord: 1,
row: value
} })
case '保养内容':
this.showDetailVisible = true
this.$nextTick(() => {
this.$refs.showDetail.init(value)
})
break;
case '保养记录':
const queryData = {
equipmentId: value.equipmentId,
maintainPlanId: value.id,
relatePlan: value.lastMaintainTime ? 1 : 2
}
this.$router.push({ path: '/equipment/base/maintain/record',query: queryData })
break;
}
},
@ -356,7 +330,7 @@ export default {
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除设备类型"' + row.name + '"?')
.delConfirm('是否确认删除设备类型"' + row.name + '"?')
.then(function () {
return this.del(id);
})

View File

@ -0,0 +1,174 @@
<!--
* @Author: zhp
* @Date: 2024-07-23 08:35:03
* @LastEditTime: 2024-07-23 09:21:32
* @LastEditors: zhp
* @Description:
-->
<template>
<div>
<el-drawer title="配置保养项目" :visible.sync="drawer" :direction="direction" size="50%">
<div style="padding: 0px 16px;">
<el-form :model="dataForm">
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="保养计划名称" prop="name">
<el-input disabled v-model="dataForm.name" placeholder="请输入保养计划名称" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="部门" prop="departmentName">
<el-input disabled v-model="dataForm.departmentName" placeholder="请输入保养计划名称" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="24">
<el-col :span="12">
<el-form-item label="保养频率" prop="maintenancePeriod">
<el-input disabled v-model="dataForm.maintenancePeriod" placeholder="请输入保养频率" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保养时长" prop="maintainDuration">
<el-input disabled v-model="dataForm.maintainDuration" placeholder="请输入保养时长" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div class="blue-title">保养内容</div>
<base-table v-loading="dataListLoading" :table-props="tableProps" :table-data="tableData">
<method-btn v-if="tableBtn.length" slot="handleBtn" :width="80" label="操作" :method-list="tableBtn"
@clickBtn="handleClick" />
</base-table>
</div>
</el-drawer>
</div>
</template>
<script>
const tableProps = [
{
prop: 'equipmentId',
label: '设备名称',
align: 'center',
},
{
prop: 'program',
label: '保养项目',
align:'center',
},
{
prop: 'maintenanceDes',
label: '默认保养结果',
align: 'center',
},
]
const topBtnConfig = [
{
type: 'add',
btnName: 'btn.add'
}
]
// import basicPageMixin from '@/mixins/lb/basicPageMixin';
// import AddOrUpdate from './components/add-or-updata';
import {
getEqMaintainPlanPageData
} from '@/api/equipment/base/maintain/record';
// import basicPage from './components/basic-page';
// import inputArea from './components/InputArea.vue'
export default {
// mixins: [basicPage],
// components: {
// AddOrUpdate,
// },
data() {
return {
drawer: false,
urlOptions: {
getDataListURL: getEqMaintainPlanPageData,
// deleteURL: deleteData,
// exportURL: exportFactoryExcel,
},
dataForm: {
name:undefined,
departmentName:undefined,
maintenancePeriod: undefined,
maintainDuration: undefined,
},
direction: 'rtl',
dataListLoading:false,
addOrUpdateVisible: false,
addOrEditTitle: '',
queryParams: {
pageNo:1,
pageSize:10,
planId:null,
},
tableProps,
basePath: 'base/equipment-maintain-program',
tableData: [],
tableBtn: [
{
type: 'edit',
name: '编辑'
},
{
type: 'delete',
name: '删除'
}
],
addButtonShow: '新增'
}
},
methods: {
getDataList(id) {
this.dataListLoading = true;
this.queryParams.planId = id
this.urlOptions.getDataListURL(this.listQuery).then(response => {
this.tableData = response.data.list;
// this.listQuery.total = response.data.total;
this.dataListLoading = false
});
},
handleClick() {
},
handleAdd() {
this.addOrUpdateVisible = true
this.addOrEditTitle = '新增'
let obj = {
equipmentTypeId: this.queryParams.equipmentTypeId
}
this.$nextTick(() => {
this.$refs.addOrUpdate.init(obj)
});
},
init(obj) {
this.drawer = true
this.dataForm = obj
this.getDataList(obj.id)
}
},
}
</script>
<style lang="scss" scoped>
.blue-title {
position: relative;
padding: 4px 0;
padding-left: 12px;
font-size: 14px;
&::before {
content: '';
position: absolute;
left: 0;
top: 6px;
height: 16px;
width: 4px;
border-radius: 1px;
background: #0b58ff;
}
}
</style>

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,287 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2024-07-23 10:12:39
* @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-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-row>
<el-row :gutter="20">
<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 { getDepartmentList } 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 getDepartmentList();
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,298 @@
<!--
* @Author: zwq
* @Date: 2021-11-18 14:16:25
* @LastEditors: zhp
* @LastEditTime: 2024-07-23 10:11:24
* @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="24">
<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.maintenancePeriod }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<div class="blodTip">保养时长</div>
<div class="lightTip">{{ dataForm.maintainDuration }}</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,146 +1,170 @@
<template>
<div class="app-container">
<!-- 搜索工作栏 -->
<SearchBar
:formConfigs="searchBarFormConfig"
ref="search-bar"
@headBtnClick="handleSearchBarBtnClick" />
<!-- 列表 -->
<search-bar
:formConfigs="formConfig"
ref="searchBarForm"
@headBtnClick="buttonClick" />
<base-table
v-loading="dataListLoading"
:table-props="tableProps"
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
:page="listQuery.pageNo"
:limit="listQuery.pageSize"
:table-data="tableData"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
:width="180"
label="操作"
:width="150"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
@clickBtn="handleClick" />
</base-table>
<!-- 分页组件 -->
<pagination
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNo"
:limit.sync="queryParams.pageSize"
@pagination="getList" />
<!-- 对话框(添加 / 修改) -->
:limit.sync="listQuery.pageSize"
:page.sync="listQuery.pageNo"
:total="listQuery.total"
@pagination="getDataList" />
<!-- <add-or-update
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getDataList" /> -->
<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" />
:dialogTitle="addOrEditTitle"
:dialogVisible="addOrUpdateVisible"
@cancel="handleCancel"
@confirm="handleConfirm"
:before-close="handleCancel"
width="55%">
<add-or-update
ref="addOrUpdate"
@refreshDataList="successSubmit"></add-or-update>
</base-dialog>
<add-content
v-if="addContent"
ref="addContent"
@refreshDataList="addContent = false" />
</div>
</template>
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record'
import AddOrUpdate from './add-or-updata';
import AddContent from './addContent';
import basicPage from '../../../../core/mixins/basic-page';
import { parseTime, toDay } from '../../../../core/mixins/code-filter';
import { publicFormatter } from '@/utils/dict';
import { getPlanPage } from '@/api/equipment/base/maintain/planconfig';
import { deleteEqMaintainPlan } from '@/api/equipment/base/maintain/record';
import tableHeightMixin from '@/mixins/tableHeightMixin';
const tableProps = [
// {
// prop: 'createTime',
// label: '',
// filter: parseTime
// },
{
prop: 'name',
label: '保养计划名称',
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'departmentName',
label: '部门',
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'maintenancePeriod',
label: '保养频率(天/次)',
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'firstMaintenanceTime',
label: '首次保养时间',
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
{
prop: 'maintainDuration',
label: '保养时长',
minWidth: 120,
showOverflowtooltip: true
},
{
prop: 'confirmTimeLimit',
label: '确认时限',
filter: toDay,
minWidth: 130,
showOverflowtooltip: true
},
{
prop: 'remark',
label: '备注',
minWidth: 150,
showOverflowtooltip: true
}
];
export default {
name: 'PlanConfig',
components: {},
mixins: [basicPageMixin],
mixins: [basicPage, tableHeightMixin],
data() {
const t = new Date();
const [y, m, d] = [t.getFullYear(), t.getMonth(), t.getDate()];
return {
searchBarKeys: ['equipmentName', 'createTime'],
tableBtn: [
{
type: 'content',
btnName: '添加内容',
urlOptions: {
getDataListURL: getPlanPage,
deleteURL: deleteEqMaintainPlan
},
this.$auth.hasPermi('equipment:plan-config:update')
tableProps,
addContent: false,
listQuery: {
pageSize: 20,
pageNo: 1,
total: 0,
special: false,
planName: undefined
},
tableBtn: [
this.$auth.hasPermiAnd([
'equipment:plan-config:query',
'equipment:plan-config:create',
'equipment:plan-config:update',
'equipment:plan-config:delete',
'base:core-equipment:query'
])
? {
type: 'edit',
btnName: '修改',
type: 'add',
btnName: '添加内容',
}
: undefined,
this.$auth.hasPermi('equipment:plan-config:delete')
this.$auth.hasPermiAnd([
'equipment:plan-config:update',
'equipment:plan-config:query',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
])
? {
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: 'departmentName', label: '部门' },
{ prop: 'maintenancePeriod', label: '保养频率(天/次)'},
// { prop: 'lineName', label: '线' },
{
prop: 'firstMaintenanceTime', label: '首次保养时间',
filter: (val) => moment(val).format('yyyy-MM-DD HH:mm:ss'),
},
{ prop: 'maintainDuration', label: '保养时长(时)' },
{ prop: 'confirmTimeLimit', label: '确认时限' },
// { prop: 'maintenancePeriod', label: '(/)' },
// { prop: 'maintainType', label: '', filter: publicFormatter('maintain_type') },
{ prop: 'remark', label: '备注' },
],
searchBarFormConfig: [
tableData: [],
formConfig: [
{
type: 'input',
label: '保养计划名称',
placeholder: '请输入保养计划名称',
param: 'equipmentName',
placeholder: '保养计划名称',
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',
btnName: '查询',
@ -148,255 +172,94 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermiAnd([
'equipment:plan-config:create',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
]) ? 'separate' : '',
},
{
type: this.$auth.hasPermi('equipment:plan-config:create')
? 'button'
: '',
type: this.$auth.hasPermiAnd([
'equipment:plan-config:create',
'base:core-worker:query',
'base:core-production-line:query',
'base:core-department:query'
]) ? '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' }],
plain: true
},
],
[
{
select: true,
label: '部门',
prop: 'departmentId',
url: '/system/dept/list-all-simple',
rules: [{ required: true, message: '部门不能为空', trigger: 'blur' }],
},
{
input: true,
label: '保养频率(天/次)',
prop: 'maintenancePeriod',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
rules: [{ required: true, message: '保养频率不能为空', trigger: 'blur' }],
},
// {
// select: true,
// label: '',
// prop: 'maintainType',
// options: this.getDictDatas(this.DICT_TYPE.MAINTAIN_TYPE),
// },
],
[
{
input: true,
label: '确认时限(h)',
prop: 'confirmTimeLimit',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
},
{
input: true,
label: '保养时长(h)',
prop: 'maintainDuration',
rules: [
{
type: 'number',
trigger: 'blur',
message: '请输入正确的数字',
transform: (val) => Number(val),
},
],
},
],
[
{
datetime: true,
label: '首次保养时间',
disabled: false,
prop: 'firstMaintenanceTime',
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,
},
},
],
[{ input: true, label: '备注', prop: 'remark' }],
],
//
open: false,
//
queryParams: {
pageNo: 1,
pageSize: 10,
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();
components: {
AddOrUpdate,
AddContent
},
created() {},
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,
departmentId: null,
enabled: null,
maintenancePeriod: null,
maintainDuration: null,
confirmTimeLimit: null,
firstMaintenanceTime: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.rows[3][0].disabled = false
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.$nextTick(() => {
this.form = response.data;
this.open = true
this.rows[3][0].disabled = true
console.log(this.rows[3].disabled)
this.title = '修改保养计划';
this.$forceUpdate()
})
});
},
/** 提交按钮 */
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);
//
deleteHandle(id, name, index) {
this.$confirm(`是否确认删除产品名称为"${name}"的数据项`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
})
.then(() => {
this.getList();
this.$modal.msgSuccess('删除成功');
this.urlOptions.deleteURL(id).then(({ data }) => {
this.$message({
message: "操作成功",
type: "success",
duration: 1500,
onClose: () => {
this.getDataList();
},
});
});
})
.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

@ -12,7 +12,8 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
@ -51,6 +52,10 @@
</el-col>
</el-row>
</base-dialog>
<add-content
v-if="addContent"
ref="addContent"
@refreshDataList="addContent = false" />
</div>
</template>
@ -59,82 +64,113 @@ import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import Editor from '@/components/Editor';
import { deleteEqMaintainLog, exportMaintainLogExcel } from '@/api/equipment/base/maintain/record';
import AddContent from './addContent.vue';
import { parseTime } from '../../../../core/mixins/code-filter';
import tableHeightMixin from '@/mixins/tableHeightMixin';
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 {
name: 'EquipmentMaintainRecord',
components: {},
mixins: [basicPageMixin],
components: { AddContent },
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
addContent: false,
searchBarKeys: [
'maintainPlanId',
'startTime',
'relatePlan',
'equipmentId',
'logType',
],
tableBtn: [
this.$auth.hasPermi('equipment:maintain-record:update')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
this.$auth.hasPermi('equipment:maintain-record:update')
? {
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:maintain-record:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
// this.$auth.hasPermi('equipment:maintain-record:update')
// ? {
// type: 'detail',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:maintain-record:update')
// ? {
// type: 'edit',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:maintain-record:delete')
// ? {
// type: 'delete',
// btnName: '',
// }
// : undefined,
].filter((v) => v),
tableProps: [
{
prop: 'createTime',
label: '添加时间',
fixed: true,
width: 150,
filter: timeFilter,
},
{ prop: 'maintainOrderNumber', label: '设备保养单号', width: 110, showOverflowtooltip: true },
{ prop: 'startTime', label: '开始时间', filter: timeFilter, minWidth: 150, showOverflowtooltip: true },
{ prop: 'endTime', label: '结束时间', filter: timeFilter, minWidth: 150, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'maintainWorker', label: '保养人员', minWidth: 100, showOverflowtooltip: true },
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: timeFilter,
// },
{ prop: 'maintainOrderNumber', label: '设备保养单号', minWidth: 170, showOverflowtooltip: true },
{ prop: 'planName', label: '保养计划名称', minWidth: 150, showOverflowtooltip: true },
{ prop: 'departmentName', label: '部门', minWidth: 120, showOverflowtooltip: true },
{ prop: 'lineName', label: '产线名', minWidth: 120, showOverflowtooltip: true },
{ prop: 'planStartTime', label: '计划开始时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
{ prop: 'planEndTime', label: '计划结束时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
{ prop: 'startTime', label: '实际开始时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
{ prop: 'endTime', label: '实际结束时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
// { prop: 'equipmentName', label: '' },
// { prop: 'maintainWorker', label: '' },
{
prop: 'relatePlan',
label: '是否计划保养',
width: 120,
filter: (v) => (v != null ? ['', '是', '否'][v] : ''),
label: '保养计划类型',
filter: (v) => (v != null ? ['', '计划型', '非计划型'][v] : ''),
minWidth: 170,
showOverflowtooltip: true
},
{ prop: 'planName', label: '保养计划名称', minWidth: 120, showOverflowtooltip: true },
{ prop: 'maintainDuration', label: '计划保养用时(h)', minWidth: 130, showOverflowtooltip: true },
{ prop: 'timeUsed', label: '实际保养用时(h)', minWidth: 130 },
{ prop: 'remark', label: '备注', minWidth: 100, showOverflowtooltip: true },
this.$auth.hasPermi('equipment:maintain-record:query') ?
{ prop: 'opt', label: '详情', name: '详情', subcomponent: btn } : undefined
// { prop: 'maintainDuration', label: '(h)' },
// { prop: 'timeUsed', label: '(h)' },
// { prop: 'remark', label: '' },
],
searchBarFormConfig: [
// {
// type: 'select',
// label: '',
// placeholder: '',
// param: 'equipmentId',
// },
{
type: 'select',
label: '设备',
placeholder: '请选择设备',
param: 'equipmentId',
},
{
type: 'select',
label: '计划名称',
label: '保养计划名称',
placeholder: '请选择计划名称',
param: 'maintainPlanId',
filterable: true
},
//
{
type: 'datePicker',
label: '保养开始时间',
label: '实际开始时间',
dateType: 'daterange', // datetimerange
format: 'yyyy-MM-dd',
valueFormat: 'yyyy-MM-dd HH:mm:ss',
@ -143,16 +179,18 @@ export default {
endPlaceholder: '结束日期',
defaultTime: ['00:00:00', '23:59:59'],
param: 'startTime',
defaultSelect: []
// width: 350,
},
{
type: 'select',
label: '是否计划保养',
label: '记录类型',
selectOptions: [
{ name: '是', id: 1 },
{ name: '否', id: 2 },
{ name: '正常', id: 0 },
{ name: '异常,保养确认超时', id: 1 },
{ name: '其他异常', id: 2 },
],
param: 'relatePlan',
param: 'logType',
},
{
type: 'button',
@ -161,7 +199,8 @@ export default {
color: 'primary',
},
{
type: 'separate',
type: this.$auth.hasPermi('equipment:maintain-record:export')
? 'separate' : '',
},
{
type: this.$auth.hasPermi('equipment:maintain-record:export')
@ -170,17 +209,25 @@ export default {
btnName: '导出',
name: 'export',
plain: true,
color: 'warning',
},
{
type: this.$auth.hasPermi('equipment:maintain-record:create')
? 'button'
: '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
color: 'primary',
}
// {
// type: this.$auth.hasPermi('equipment:maintain-record:create')
// ? 'button'
// : '',
// btnName: '',
// name: 'add',
// plain: true,
// color: 'success',
// },
// {
// type: this.$auth.hasPermi('equipment:maintain-record:export')
// ? 'button'
// : '',
// btnName: '',
// name: 'export',
// color: 'warning',
// },
],
rows: [
[
@ -188,7 +235,8 @@ export default {
select: true,
label: '保养设备',
prop: 'equipmentId',
url: '/base/core-equipment/listAll',
// url: '/base/core-equipment/listAll',
url: '/base/core-equipment/page?special=false&pageNo=1&pageSize=99',
bind: {
filterable: true,
clearable: true,
@ -215,29 +263,17 @@ export default {
},
],
[
// {
// switch: true,
// label: '',
// prop: 'relatePlan',
// bind: {
// 'active-value': 1,
// 'inactive-value': 2,
// },
// rules: [{ required: true, message: '', trigger: 'blur' }],
// },
{
select: true,
options: [
{ label: '是', value: 1 },
{ label: '否', value: 2 }
],
switch: true,
label: '是否计划保养',
prop: 'relatePlan',
bind: {
clearable: true, filterable: true
'active-value': 1,
'inactive-value': 2,
},
rules: [{ required: true, message: '是否计划保养不能为空', trigger: 'blur' }],
},
{},
{
select: true,
label: '所属计划',
@ -248,11 +284,6 @@ export default {
clearable: true,
},
},
{
input: true,
label: '保养用时',
prop: 'timeUsed',
},
],
[
{
@ -279,7 +310,11 @@ export default {
clearable: true,
},
},
{}
{
input: true,
label: '保养用时',
prop: 'timeUsed',
},
],
[
@ -306,12 +341,14 @@ export default {
//
queryParams: {
pageNo: 1,
pageSize: 10,
pageSize: 20,
special: false,
maintainPlanId: null,
maintainPlanId: null,
startTime: null,
relatePlan: null,
equipmentId: null,
confirmed: true
},
//
form: {},
@ -320,46 +357,68 @@ export default {
};
},
created() {
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.startTime = [start, end]
this.initSearchBar();
if (this.$route.query) {
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.equipmentId ?? undefined;
this.searchBarFormConfig[1].defaultSelect =
this.$route.query.maintainPlanId ?? undefined;
this.searchBarFormConfig[2].defaultSelect =
this.$route.query?.createTime ?? undefined;
this.searchBarFormConfig[3].defaultSelect =
Number(this.$route.query.relatePlan) ?? undefined;
}
// if (this.$route.query) {
// // 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.equipmentId ?? undefined;
// this.searchBarFormConfig[0].defaultSelect =
// this.$route.query.maintainPlanId ?? undefined;
// this.searchBarFormConfig[1].defaultSelect =
// this.$route.query?.createTime ?? undefined;
// // this.searchBarFormConfig[3].defaultSelect =
// // Number(this.$route.query.relatePlan) ?? undefined;
// }
this.getList();
if (this.$route.query.addRecord) {
this.handleAdd()
}
},
methods: {
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.$set(
this.searchBarFormConfig[0],
'selectOptions',
data.map((item) => ({
name: item.name,
id: item.id,
}))
);
handleEmitFun({action, value}) {
switch (action) {
//
case '详情':
// this.handleDetail({ id: value.id })
this.addContent = true;
this.$nextTick(() => {
this.$refs.addContent.init(value.id, true);
});
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', {
pageNo: 1,
pageSize: 100,
special: false
}).then(({ data }) => {
this.$set(
this.searchBarFormConfig[1],
this.searchBarFormConfig[0],
'selectOptions',
(data?.list || []).map((item) => ({
name: item.name,
@ -501,6 +560,7 @@ export default {
let params = { ...this.queryParams };
params.pageNo = undefined;
params.pageSize = undefined;
params.confirmed = true;
this.$modal
.confirm('是否确认导出所有保养记录?')
.then(() => {

View File

@ -1,7 +1,7 @@
/*
* @Author: zhp
* @Date: 2024-07-19 09:49:22
* @LastEditTime: 2024-07-19 14:17:27
* @LastEditTime: 2024-07-22 09:17:31
* @LastEditors: zhp
* @Description:
*/
@ -105,7 +105,7 @@ export default {
},
// 删除
deleteHandle(id, name, index) {
this.$confirm(`确定要删除${name}?`, "提示", {
this.$modal.delConfirm(`确定要删除${name}?`, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",

View File

@ -26,7 +26,7 @@
<script>
import moment from 'moment';
import basicPageMixin from '@/mixins/lb/basicPageMixin';
import { deleteData } from '@/api/equipment/base/maintain/items'
import { deleteProgramTypeData } from '@/api/equipment/base/maintain/items'
import showDetail from './showDetail.vue'
import { publicFormatter } from '@/utils/dict';
@ -53,7 +53,7 @@ export default {
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:plan-config:delete')
this.$auth.hasPermi('equipment:check-program-type:delete')
? {
type: 'delete',
btnName: '删除',
@ -88,7 +88,7 @@ export default {
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:plan-config:create')
type: this.$auth.hasPermi('equipment:check-program-type:add')
? 'button'
: '',
btnName: '新增',
@ -234,17 +234,20 @@ export default {
this.post(this.form).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();
this.getList()
this.showDetailVisible = true
this.$nextTick(() => {
this.$refs.showDetail.init(this.form.equipmentTypeId)
})
});
});
},
/** 删除按钮操作 */
handleDelete(row) {
const id = row.id;
this.$modal
.confirm('是否确认删除设备类型名称' + row.equipmentType + '?')
this.$modal.delConfirm('是否确认删除' + row.equipmentType + '?')
.then(function () {
return deleteData(id);
return deleteProgramTypeData(id);
})
.then(() => {
this.getList();

View File

@ -1,7 +1,7 @@
<!--
* @Author: zhp
* @Date: 2024-07-12 13:28:21
* @LastEditTime: 2024-07-19 14:59:05
* @LastEditTime: 2024-07-23 14:00:38
* @LastEditors: zhp
* @Description:
-->
@ -9,7 +9,7 @@
<div>
<el-drawer title="配置保养项目" :visible.sync="drawer" :direction="direction" size="50%">
<div style="padding: 0px 16px;">
<el-form :inline="true" class="">
<el-form v-if="this.$auth.hasPermi('equipment:check-program:add')" :inline="true" class="">
<el-form-item>
<el-button :plain='true' type="success" @click="handleAdd">新增</el-button>
</el-form-item>
@ -33,13 +33,11 @@ const tableProps = [
{
prop: 'program',
label: '保养项目',
subcomponent: inputArea,
align:'center',
},
{
prop: 'maintainResult',
label: '默认保养结果',
subcomponent: inputArea,
align: 'center',
},
]
@ -56,7 +54,6 @@ import {
deleteData
} from '@/api/equipment/base/maintain/items';
import basicPage from './components/basic-page';
import inputArea from './components/InputArea.vue'
export default {
mixins: [basicPage],
components: {
@ -83,14 +80,18 @@ export default {
basePath: 'base/equipment-maintain-program',
tableData: [],
tableBtn: [
{
this.$auth.hasPermi('equipment:check-program:edit')
? {
type: 'edit',
name: '编辑'
},
{
type: 'delete',
name: '删除'
btnName: '编辑',
}
: undefined,
this.$auth.hasPermi('equipment:check-program:delete')
? {
type: 'delete',
btnName: '删除',
}
: undefined,
],
addButtonShow: '新增'
}

View File

@ -6,119 +6,106 @@
-->
<template>
<el-drawer
<!-- <el-drawer :visible.sync="visible" :show-close="false" :wrapper-closable="disabled" class="drawer"
custom-class="mes-drawer" size="50%" @closed="$emit('destroy')"> -->
<el-dialog
:visible.sync="visible"
:show-close="false"
:wrapper-closable="disabled"
class="drawer"
custom-class="mes-drawer"
size="65%"
@closed="$emit('destroy')">
width="50%"
:before-close="closed">
<small-title slot="title" :no-padding="true">
{{ disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成' }}
详情
<!-- {{ disabled ? '查看详情' : !dataForm.maintenanceStatus ? '修改' : '完成' }} -->
</small-title>
<div class="drawer-body flex">
<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-col :span="8">
<el-form-item label="维修单号" prop="repairOrderNumber">
<span>{{ dataForm.repairOrderNumber }}</span>
</el-form-item>
<el-col :span="6">
<div class="blodTip">故障发生时间</div>
<div class="lightTip">{{ parseTime(dataForm.faultTime) }}</div>
</el-col>
<el-col :span="8">
<el-form-item label="设备名称" prop="equipmentName">
<span>{{ dataForm.equipmentName }}</span>
</el-form-item>
<el-col :span="6">
<div class="blodTip">故障级别</div>
<div class="lightTip">{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</div>
</el-col>
<el-col :span="8">
<el-form-item label="维修工" prop="repairman">
<span>{{ dataForm.repairman }}</span>
</el-form-item>
<el-col :span="6">
<div class="blodTip">故障类型</div>
<div class="lightTip">{{ getDictDataLabel('fault-type', dataForm.faultType) }}</div>
</el-col>
<el-col :span="6">
<div class="blodTip">维修工</div>
<div class="lightTip">{{ dataForm.repairman }}</div>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="8">
<el-form-item label="故障发生时间" prop="faultTime">
<span>{{ parseTime(dataForm.faultTime) }}</span>
</el-form-item>
<el-col :span="6">
<div class="blodTip">联系方式</div>
<div class="lightTip">{{ dataForm.repairmanPhone }}</div>
</el-col>
<el-col :span="8">
<el-form-item label="故障级别" prop="faultLevel">
<span>{{ getDictDataLabel('fault-level', dataForm.faultLevel) }}</span>
</el-form-item>
<el-col :span="6">
<div class="blodTip">维修方式</div>
<div class="lightTip">{{ getDictDataLabel('repair-mode', dataForm.repairMode) }}</div>
</el-col>
<el-col :span="8">
<el-form-item label="联系方式" prop="repairmanPhone">
<span>{{ dataForm.repairmanPhone }}</span>
</el-form-item>
<el-col :span="6">
<div class="blodTip">创建时间</div>
<div class="lightTip">{{ parseTime(dataForm.createTime) }}</div>
</el-col>
<el-col :span="6">
<div class="blodTip">创建人</div>
<div class="lightTip">{{ dataForm.creator }}</div>
</el-col>
</el-row>
<el-divider style="margin-top: -10px" />
<el-row>
<div class="blodTip">备注</div>
<div class="lightTip">{{ dataForm.remark }}</div>
</el-row>
<el-row>
<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>
</div>
<!-- <el-divider style="margin-top: -10px" />
<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-col :span="6">
<el-form-item
label="维修开始时间"
prop="maintenanceStartTime"
<el-form-item label="维修开始时间" prop="maintenanceStartTime"
:rules="[{ required: true, message: '维修开始时间不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="dataForm.maintenanceStartTime"
type="datetime"
:disabled="disabled"
placeholder="请选择维修开始时间"
value-format="timestamp" />
<el-date-picker v-model="dataForm.maintenanceStartTime" type="datetime" :disabled="disabled"
placeholder="请选择维修开始时间" value-format="timestamp" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="维修结束时间"
prop="maintenanceFinishTime"
<el-form-item label="维修结束时间" prop="maintenanceFinishTime"
:rules="[{ required: true, message: '维修结束时间不能为空', trigger: 'blur' }]">
<el-date-picker
v-model="dataForm.maintenanceFinishTime"
type="datetime"
:disabled="disabled"
placeholder="请选择维修开始时间"
value-format="timestamp" />
<el-date-picker v-model="dataForm.maintenanceFinishTime" type="datetime" :disabled="disabled"
placeholder="请选择维修开始时间" value-format="timestamp" />
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item
label="维修方式"
prop="repairMode"
<el-form-item label="维修方式" prop="repairMode"
:rules="[{ required: true, message: '维修方式不能为空', trigger: 'blur' }]">
<el-select
:disabled="disabled"
v-model="dataForm.repairMode"
placeholder="请选择维修方式">
<el-option
v-for="opt in getDictDatas('repair-mode')"
:key="opt.value"
:label="opt.label"
<el-select :disabled="disabled" v-model="dataForm.repairMode" placeholder="请选择维修方式">
<el-option v-for="opt in getDictDatas('repair-mode')" :key="opt.value" :label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="故障类型" prop="faultType">
<el-select
:disabled="disabled"
v-model="dataForm.faultType"
placeholder="请选择故障类型">
<el-option
v-for="opt in getDictDatas('fault-type')"
:key="opt.value"
:label="opt.label"
<el-select :disabled="disabled" v-model="dataForm.faultType" placeholder="请选择故障类型">
<el-option v-for="opt in getDictDatas('fault-type')" :key="opt.value" :label="opt.label"
:value="opt.value" />
</el-select>
</el-form-item>
@ -127,11 +114,8 @@
<el-row :gutter="20">
<el-col>
<el-form-item
label="故障明细"
prop="faultDetail"
<el-form-item label="故障明细" prop="faultDetail"
:rules="[{ required: true, message: '故障明细不能为空', trigger: 'blur' }]">
<!-- // -->
<editor v-model="dataForm.faultDetail" :read-only="disabled" :min-height="150" />
</el-form-item>
</el-col>
@ -140,7 +124,6 @@
<el-row :gutter="20">
<el-col>
<el-form-item label="维修记录" prop="maintenanceDetail">
<!-- // -->
<editor v-model="dataForm.maintenanceDetail" :read-only="disabled" :min-height="150" />
</el-form-item>
</el-col>
@ -157,32 +140,96 @@
<el-row :gutter="20">
<el-col>
<el-form-item label="备注" prop="remark">
<el-input
v-model="dataForm.remark"
:placeholder="`请输入备注`"
:disabled="disabled" />
<el-input v-model="dataForm.remark" :placeholder="`请输入备注`" :disabled="disabled" />
</el-form-item>
</el-col>
</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 type="primary" @click="dataFormSubmit()">确定</el-button>
</div> -->
</div>
</div>
</div>
</el-drawer>
<span slot="footer" class="dialog-footer">
<el-button @click="visible = false"> </el-button>
</span>
</el-dialog>
<!-- </el-drawer> -->
</template>
<script>
import SmallTitle from '../../base/alarm/Record/SmallTitle.vue';
import { getEqRepair, updateEqRepair } from '@/api/equipment/base/repair'
import Editor from "@/components/Editor";
import FileUpload from "@/components/FileUpload";
// import FileUpload from "@/components/FileUpload";
import { getDictDatas } from "@/utils/dict";
import { parseTime } from '@/utils/ruoyi'
import { getDictDataLabel } from '@/utils/dict';
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',
@ -191,7 +238,7 @@ export default {
event: 'update',
},
emits: ['update'],
components: { SmallTitle, Editor, FileUpload },
components: { SmallTitle, Editor, uploadedFile },
props: {
// dataForm: {
// type: Object,
@ -214,6 +261,9 @@ export default {
},
mounted() { },
methods: {
closed() {
this.$emit('destroy')
},
setFileName(val) {
this.fileName = val
},
@ -242,18 +292,18 @@ export default {
this.visible = true;
this.$nextTick(() => {
this.$refs['form'].resetFields();
// this.$refs['form'].resetFields();
if (this.dataForm.id) {
//
getEqRepair(this.dataForm.id).then(response => {
this.formLoading = false
this.dataForm = response.data;
this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
if (this.dataForm.files.length > 0) {
this.file = this.dataForm.files[0].fileUrl
this.fileName = this.dataForm.files[0].fileName
}
// this.dataForm.maintenanceStatus = row.maintenanceStatus || 0
// if (this.dataForm.files.length > 0) {
// this.file = this.dataForm.files[0].fileUrl
// this.fileName = this.dataForm.files[0].fileName
// }
});
} else {
// if (this.urlOptions.isGetCode) {
@ -333,7 +383,7 @@ export default {
.drawer-body__content {
flex: 1;
/* background: #eee; */
padding: 20px 30px;
padding: 5px 10px;
overflow-y: auto;
}
@ -342,4 +392,18 @@ export default {
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,706 @@
<!--
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="维修时长(h)" prop="maintenanceDuration">
<el-input-number v-model="dataForm.maintenanceDuration" :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="repairman" :rules="[
{ required: false, 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.label" />
</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: false,
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)" />
</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 nickname = this.$store.getters.nickname;
this.$nextTick(() => {
this.form.repairman = [nickname];
});
},
/** 获取产线 */
async initLines() {
const res = await this.$axios('/base/core-production-line/listAll');
this.lineOptions = (res.data || []).map((item) => ({
label: item.name,
value: item.id,
}));
},
/** 获取工段 */
async 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.filter(item => item.special === false) || [];
// this.equipmentOptions = response.data.filter(item => item.special === false) || [];
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';
if (!isJPG) {
this.$modal.msgError('只能上传jpg/png文件!');
}
return isJPG;
};
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

@ -0,0 +1,35 @@
<!--
* @Author: zhp
* @Date: 2023-11-08 14:00:52
* @LastEditTime: 2023-12-01 10:12:27
* @LastEditors: DY
* @Description:
-->
<template>
<div v-html="content" />
</template>
<script>
export default {
props: {
injectData: {
type: Object,
default: () => ({})
}
},
data() {
return {
content: ''
}
},
mounted() {
this.getContent()
},
methods: {
getContent() {
this.content = this.injectData[this.injectData.prop] ?? ''
}
}
}
</script>

View File

@ -12,12 +12,13 @@
:page="queryParams.pageNo"
:limit="queryParams.pageSize"
:table-data="list"
@emitFun="handleEmitFun">
@emitFun="handleEmitFun"
:max-height="tableH">
<method-btn
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="120"
:width="90"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -41,15 +42,12 @@
v-if="open"
ref="form"
v-model="form"
:disabled="mode == 'detail'"
:has-files="true"
:rows="rows" />
:disabled="mode == 'detail'" />
</base-dialog>
<CustomDialogForm
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList"
@destroy="addOrUpdateVisible = false" />
@refreshDataList="getList" />
</div>
</template>
@ -59,29 +57,32 @@ import basicPageMixin from '@/mixins/lb/basicPageMixin';
import CustomDialogForm from './CustomDialogForm.vue';
import { deleteRepair, exportRepairLogExcel } from '@/api/equipment/base/repair'
import { parseTime } from '@/utils/ruoyi'
import htmls from './htmls.vue'
import DialogForm from './Repair--add.vue';
import tableHeightMixin from '@/mixins/tableHeightMixin';
// const timeFilter = (val) => moment(val).format('yyyy-MM-DD HH:mm:ss');
export default {
name: 'EquipmentRepair',
components: { CustomDialogForm },
mixins: [basicPageMixin],
components: { CustomDialogForm, DialogForm },
mixins: [basicPageMixin, tableHeightMixin],
data() {
return {
addOrUpdateVisible: false,
searchBarKeys: ['maintenanceStatus', 'createTime', 'equipmentId'],
searchBarKeys: ['maintenanceResult', 'createTime', 'equipmentId'],
tableBtn: [
this.$auth.hasPermi('equipment:repair:finish')
? {
type: 'finish',
btnName: '完成',
}
: undefined,
this.$auth.hasPermi('equipment:repair:update')
this.$auth.hasPermi('equipment:repair:query')
? {
type: 'detail',
btnName: '详情',
}
: undefined,
// this.$auth.hasPermi('equipment:repair:finish')
// ? {
// type: 'finish',
// btnName: '',
// }
// : undefined,
// this.$auth.hasPermi('equipment:repair:update')
// ? {
// type: 'edit',
@ -96,35 +97,42 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
// {
// prop: 'createTime',
// label: '',
// fixed: true,
// width: 180,
// filter: parseTime,
// },
{ prop: 'repairOrderNumber', label: '维修单号', width: 180, showOverflowtooltip: true },
{ prop: 'lineName', label: '产线名', width: 120, showOverflowtooltip: true },
{ prop: 'sectionName', label: '工段名', width: 120, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'faultDetail', label: '故障明细', subcomponent: htmls, width: 180, showOverflowtooltip: true },
// { prop: 'maintenanceDetail', label: '', subcomponent: htmls, minWidth: 100, showOverflowtooltip: true },
{
prop: 'createTime',
label: '添加时间',
fixed: true,
prop: 'maintenanceStartTime',
label: '维修开始时间',
width: 150,
filter: parseTime,
},
{ prop: 'repairOrderNumber', label: '设备维修单号', minWidth: 100, showOverflowtooltip: true },
{ prop: 'maintenanceStartTime', label: '开始时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
{
prop: 'maintenanceFinishTime',
label: '结束时间',
label: '维修结束时间',
width: 150,
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
// { prop: 'maintenanceStartTime', label: '', filter: parseTime },
{
prop: 'maintenanceStatus',
label: '维修状态',
filter: (v) => (v != null ? ['未完成', '完成', '进行中'][v] : ''),
prop: 'maintenanceResult',
label: '维修结果',
filter: (v) => (v != null ? ['成功', '失败'][v] : ''),
},
{ prop: 'maintenanceDuration', label: '维修时长(h)', width: 110 },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'maintenanceDetail', label: '维修明细' },
{ prop: 'repairman', label: '维修工', minWidth: 100, showOverflowtooltip: true },
{ prop: 'repairmanPhone', label: '联系方式', minWidth: 100, showOverflowtooltip: true },
{ prop: 'remark', label: '备注', minWidth: 120, showOverflowtooltip: true },
// { prop: 'maintenanceDuration', label: '(h)' },
{ prop: 'maintenanceDetail', label: '维修描述', subcomponent: htmls }, //
// { prop: 'repairman', label: '', minWidth: 100, showOverflowtooltip: true },
// { prop: 'repairmanPhone', label: '', minWidth: 100, showOverflowtooltip: true },
{ prop: 'remark', label: '备注', minWidth: 90, showOverflowtooltip: true }
],
searchBarFormConfig: [
{
@ -136,13 +144,12 @@ export default {
},
{
type: 'select',
label: '状态',
label: '维修结果',
placeholder: '请选择状态',
param: 'maintenanceStatus',
param: 'maintenanceResult',
selectOptions: [
{ name: '未完成', id: '0' },
{ name: '完成', id: '1' },
{ name: '进行中', id: '2' },
{ name: '成功', id: '0' },
{ name: '失败', id: '1' }
],
},
//
@ -166,96 +173,43 @@ export default {
color: 'primary',
},
{
type: 'separate',
},
{
type: this.$auth.hasPermi('equipment:repair:create') ? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
type: (this.$auth.hasPermi('equipment:repair:export') ||
this.$auth.hasPermiAnd([
'equipment:repair:create',
'base:core-worker:query',
'system:user:list'
])) ? 'separate' : '',
},
{
type: this.$auth.hasPermi('equipment:repair:export') ? 'button' : '',
btnName: '导出',
name: 'export',
plain: true,
color: 'warning',
},
],
rows: [
[
{
input: true,
label: '维修单号',
prop: 'repairOrderNumber',
rules: [{ required: true, message: '维修单号不能为空', trigger: 'blur' }],
color: 'primary',
},
{
select: true,
label: '设备名称',
prop: 'equipmentId',
url: '/base/core-equipment/listAll',
bind: {
filterable: true,
clearable: true,
type: this.$auth.hasPermiAnd([
'equipment:repair:create',
'base:core-worker:query',
'system:user:list'
]) ? 'button' : '',
btnName: '新增',
name: 'add',
plain: true,
color: 'success',
},
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,
//
queryParams: {
pageNo: 1,
pageSize: 10,
maintenanceStatus: null,
pageSize: 20,
special: false,
maintenanceResult: null,
createTime: null,
equipmentId: null,
special: false
},
//
form: {},
@ -269,11 +223,15 @@ export default {
},
methods: {
initSearchBar() {
this.http('/base/core-equipment/listAll', 'get').then(({ data }) => {
this.http('/base/core-equipment/page', 'get', {
special: false,
pageNo: 1,
pageSize: 999,
}).then(({ data }) => {
this.$set(
this.searchBarFormConfig[0],
'selectOptions',
data.map((item) => ({
(data?.list || []).map((item) => ({
name: item.name,
id: item.id,
}))
@ -377,7 +335,10 @@ export default {
// }
//
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.open = false;
this.getList();
@ -385,7 +346,10 @@ export default {
return;
}
//
this.post(this.form).then((response) => {
this.post({
...this.form,
repairman: this.form.repairman.join(',')
}).then((response) => {
this.$modal.msgSuccess('新增成功');
this.open = false;
this.getList();

View File

@ -9,41 +9,47 @@
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
:wrapper-closable="disabled"
class="drawer"
size="60%">
size="60%"
@closed="$emit('destroy')">
<small-title slot="title" :no-padding="true">
{{ disabled ? '查看备件' : '添加备件' }}
</small-title>
<div class="content">
<el-form
ref="form"
:model="dataForm"
label-width="100px"
label-position="top"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="6">
<el-form-item label="配置名" prop="name">
<span>{{ dataForm.name }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-col :span="6">
<el-form-item label="设备名称" prop="equipmentName">
<span>{{ dataForm.equipmentName }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-col :span="6">
<el-form-item label="负责人" prop="responsible">
<span>{{ dataForm.responsible }}</span>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="描述" prop="faultTime">
<editor v-model="dataForm.description" read-only :min-height="200"/>
<el-form-item label="描述" prop="description">
<div v-html="dataForm.description" style="padding: 5px; margin: 0; border: 1px solid #dfdfdf" />
<!-- <editor v-model="dataForm.description" read-only :min-height="200"/> -->
</el-form-item>
</el-form>
<div>
<small-title style="margin: 16px 0; padding-left: 8px" :no-padding="true">
{{ '备品备件' }}
</small-title>
<div v-if="!disabled" class="action_btn">
<template>
<span style="display: inline-block;" @click="addNew()">
@ -72,10 +78,12 @@
:limit.sync="listQuery.pageSize"
:page-sizes="[5, 10, 15]"
@pagination="getList" />
</div>
<div class="drawer-body__footer">
<div v-if="!disabled" class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button>
</div>
</div>
<attr-add
v-if="addOrUpdateVisible"
@ -255,10 +263,10 @@ export default {
padding: 18px;
}
.action_btn {
/* float: right; */
float: right;
display: flex;
justify-content: right;
margin: 5px 15px;
margin: -35px 15px;
font-size: 14px;
}
.add {
@ -312,4 +320,7 @@ export default {
justify-content: flex-end;
padding: 18px;
}
.content {
padding: 0 20px;
}
</style>

View File

@ -17,7 +17,7 @@
v-if="tableBtn.length"
slot="handleBtn"
label="操作"
:width="250"
:width="180"
:method-list="tableBtn"
@clickBtn="handleTableBtnClick" />
</base-table>
@ -34,7 +34,7 @@
<base-dialog
:dialogTitle="title"
:dialogVisible="open"
width="35%"
width="50%"
@close="cancel"
@cancel="cancel"
@confirm="submitForm">
@ -44,12 +44,14 @@
v-model="form"
:disabled="mode == 'detail'"
:has-files="false"
:rows="rows" />
:rows="rows"
style="margin: 0 30px" />
</base-dialog>
<addSparts
v-if="addOrUpdateVisible"
ref="addOrUpdate"
@refreshDataList="getList" />
@refreshDataList="getList"
@destroy="addOrUpdateVisible = false" />
</div>
</template>
@ -79,22 +81,24 @@ export default {
// btnName: '',
// }
// : undefined,
this.$auth.hasPermi('equipment:spare-parts-config:update')
this.$auth.hasPermi('equipment:spare-parts-config:addParts')
? {
type: 'edit',
btnName: '修改',
type: 'addParts',
btnName: '添加',
showTip: '添加备件'
}
: undefined,
this.$auth.hasPermi('equipment:spare-parts-config:queryParts')
? {
type: 'queryParts',
btnName: '查看备件',
btnName: '查看',
showTip: '查看备件'
}
: undefined,
this.$auth.hasPermi('equipment:spare-parts-config:addParts')
this.$auth.hasPermi('equipment:spare-parts-config:update')
? {
type: 'addParts',
btnName: '添加备件',
type: 'edit',
btnName: '修改',
}
: undefined,
this.$auth.hasPermi('equipment:spare-parts-config:delete')
@ -105,15 +109,15 @@ export default {
: undefined,
].filter((v) => v),
tableProps: [
{ prop: 'name', label: '配置名' },
{ prop: 'lineName', label: '产线' },
{ prop: 'sectionName', label: '工段' },
{ prop: 'equipmentName', label: '设备名' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'responsible', label: '负责人' },
{ prop: 'name', label: '配置名', minWidth: 100, showOverflowtooltip: true },
{ prop: 'lineName', label: '产线', minWidth: 100, showOverflowtooltip: true },
{ prop: 'sectionName', label: '工段', minWidth: 100, showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名', minWidth: 120, showOverflowtooltip: true },
{ prop: 'equipmentCode', label: '设备编码', minWidth: 100, showOverflowtooltip: true },
{ prop: 'responsible', label: '负责人', minWidth: 150, showOverflowtooltip: true },
// { prop: 'unit', label: '', filter: publicFormatter('unit_dict') },
{ prop: 'description', label: '描述', subcomponent: htmls },
{ prop: 'sparePartNumber', label: '备品备件数量' },
{ prop: 'description', label: '描述', subcomponent: htmls, minWidth: 120, showOverflowtooltip: true },
{ prop: 'sparePartNumber', label: '备品备件数量', width: 130 },
// { prop: 'remark', label: '' },
],
searchBarFormConfig: [
@ -198,7 +202,7 @@ export default {
prop: 'description', // TODO:
subcomponent: Editor,
bind: {
'min-height': 192
'min-height': 150
}
},
],

View File

@ -9,34 +9,36 @@
<el-drawer
:visible.sync="visible"
:show-close="false"
:wrapper-closable="false"
:wrapper-closable="!isLog"
class="drawer"
size="60%">
<small-title slot="title" :no-padding="true">
{{ !isLog ? '操作页面' : '更换记录' }}
</small-title>
<div class="content">
<el-form
ref="form"
:model="dataForm"
label-width="100px"
label-width="90px"
v-loading="formLoading">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item v-if="!isLog" label="配置名" prop="name">
<span>{{ dataForm.name }}</span>
<span style="margin-left: 5px">{{ dataForm.name }}</span>
</el-form-item>
<el-form-item v-else label="产线名称" prop="lineName">
<span>{{ dataForm.lineName }}</span>
<span style="margin-left: 5px">{{ dataForm.lineName }}</span>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="设备名称" prop="equipmentName">
<span>{{ dataForm.equipmentName }}</span>
<span style="margin-left: 5px">{{ dataForm.equipmentName }}</span>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="描述" prop="faultTime">
<editor v-model="dataForm.description" read-only :min-height="200"/>
<el-form-item label="描述" prop="description">
<div v-html="dataForm.description" style="padding: 5px; margin-left: 5px; border: 1px solid #dfdfdf" />
<!-- <editor v-model="dataForm.description" :read-only="true" :min-height="200"/> -->
</el-form-item>
</el-form>
@ -82,8 +84,9 @@
:page-sizes="[5, 10, 15]"
@pagination="getList1" />
</div>
</div>
<div class="drawer-body__footer">
<div v-if="isLog" class="drawer-body__footer">
<el-button type="primary" @click="goback()">关闭</el-button>
</div>
@ -249,7 +252,7 @@ export default {
type: 'button',
btnName: '导出',
name: 'export',
color: 'warning',
color: 'primary',
plain: true
},
],
@ -429,4 +432,7 @@ export default {
justify-content: flex-end;
padding: 18px;
}
.content {
padding: 0 20px;
}
</style>

View File

@ -74,8 +74,7 @@ const remainBox = {
value() {
const temp = this.injectData[this.injectData.prop] || null;
if (temp) {
console.log('12', temp);
return temp === 'Green' ? 'green' : 'red';
return temp === 'Green' ? '未超期' : temp === 'Red' ? '已超期' : '即将超期';
}
return this.injectData[this.injectData.prop] || null;
},
@ -83,7 +82,7 @@ const remainBox = {
if (this.value) {
// const v = +this.value;
// return v < 0 ? 'red' : v >= 0 && v < 2 ? 'yellow' : 'green';
return this.value;
return this.value === '未超期' ? '#37D97F' : this.value === '已超期' ? '#FF5454' : '#FFD767';
}
return 'unset';
},
@ -95,9 +94,9 @@ const remainBox = {
this.color
// this.color == 'Green' ? 'green' : this.color == 'Red' ? 'red' : 'yellow'
}; position:absolute; inset: 0; padding: 0 10px; display: flex; align-items: center; color: ${
this.color == 'red' || this.color == 'green' ? '#fff' : 'unset'
'#fff'
}`}>
{this.injectData[this.injectData.prop] || ''}
{this.value}
</div>
);
},
@ -155,18 +154,19 @@ export default {
// : undefined,
].filter((v) => v),
tableProps: [
{ prop: 'name', label: '配置名' },
{ prop: 'lineName', label: '产线名称' },
{ prop: 'sectionName', label: '工段名' },
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'responsible', label: '负责人' },
{ prop: 'name', label: '配置名', showOverflowtooltip: true },
{ prop: 'lineName', label: '产线名称', showOverflowtooltip: true },
{ prop: 'sectionName', label: '工段名', showOverflowtooltip: true },
{ prop: 'equipmentName', label: '设备名称', showOverflowtooltip: true },
{ prop: 'responsible', label: '负责人', minWidth: 130, showOverflowtooltip: true },
{ prop: 'color', label: '是否超期', subcomponent: remainBox },
{ prop: 'opt1', label: '备件更换', name: '操作', subcomponent: btn },
{ prop: 'opt1', label: '备件更换', name: '操作', subcomponent: btn, width: 110 },
{
prop: 'opt2',
label: '更换记录',
name: '更新记录',
subcomponent: btn,
width: 110
}, // TODO:
// { prop: 'remark', label: '' },
],

View File

@ -92,11 +92,21 @@ export default {
});
if (code == 0) {
this.listLine = data;
} else {
this.listLine.splice(0);
}
//
const res = await this.$axios({
url: '/base/core-equipment/listAll',
});
if (res.code == 0) {
this.listEq = res.data;
return;
}
this.listLine.splice(0);
this.listEq.splice(0);
},
async getEquipmentByLineId(id) {
if (id) {
const { data, code } = await this.$axios({
url: '/base/core-equipment/listByLine',
params: {
@ -108,6 +118,7 @@ export default {
return;
}
this.listEq.splice(0);
}
},
handleSearch() {
this.$emit('action', {

View File

@ -83,33 +83,41 @@ export default {
data() {
return {
tableProps: [
{ prop: 'equipmentName', label: '设备名称' },
{ prop: 'equipmentCode', label: '设备编码' },
{ prop: 'inQuantity', label: '投入数' },
{ prop: 'outQuantity', label: '产出数' },
{ prop: 'equipmentName', label: '设备名称', minWidth: 100, showOverflowtooltip: true },
{ prop: 'equipmentCode', label: '设备编码', minWidth: 150, showOverflowtooltip: true },
{ prop: 'inQuantity', label: '投入数', minWidth: 80, showOverflowtooltip: true },
{ prop: 'outQuantity', label: '产出数', minWidth: 80, showOverflowtooltip: true },
{
prop: 'run',
label: '是否运行',
filter: (val) => (val != null ? (val ? '是' : '否') : ''),
minWidth: 100,
showOverflowtooltip: true
},
{
prop: 'status',
label: '状态',
filter: (val) =>
val != null ? ['正常', '计划停机', '故障'][val] : '',
minWidth: 90,
showOverflowtooltip: true
},
{
prop: 'error',
label: '是否故障',
filter: (val) => (val != null ? (val ? '是' : '否') : ''),
minWidth: 100,
showOverflowtooltip: true
},
{
prop: 'quantityRecordTime',
label: '生产量记录时间',
filter: parseTime,
minWidth: 150,
showOverflowtooltip: true
},
{ prop: 'statusRecordTime', label: '状态记录时间', filter: parseTime },
{ prop: 'opt1', label: '状态可视化', name: '查看', subcomponent: btn },
{ prop: 'statusRecordTime', label: '状态记录时间', filter: parseTime, minWidth: 150, showOverflowtooltip: true },
// { prop: 'opt1', label: '', name: '', subcomponent: btn },
{ prop: 'opt2', label: '参数监控', name: '查看', subcomponent: btn },
],
searchBarForm: {