|
|
|
@ -284,7 +284,10 @@ |
|
|
|
|
|
|
|
<!-- 巡检配置区域 --> |
|
|
|
<div class="form-section"> |
|
|
|
<div class="section-title">巡检配置</div> |
|
|
|
<div class="section-title" style="display: flex; justify-content: space-between; align-items: center;"> |
|
|
|
<span>巡检配置</span> |
|
|
|
<el-button type="primary" size="mini" @click="openPatrolConfigDialog" :disabled="modalDisableFlag">特殊巡检配置</el-button> |
|
|
|
</div> |
|
|
|
<el-row :gutter="20"> |
|
|
|
<el-col :span="8"> |
|
|
|
<el-form-item label="首次巡检时长(h)"> |
|
|
|
@ -311,6 +314,58 @@ |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 巡检特殊配置对话框 --> |
|
|
|
<el-dialog title="巡检特殊配置" :close-on-click-modal="false" v-drag :visible.sync="patrolConfigDialogFlag" width="900px" append-to-body> |
|
|
|
<div style="margin-bottom: 10px;"> |
|
|
|
<el-button type="primary" size="small" icon="el-icon-plus" @click="addPatrolConfig">新增</el-button> |
|
|
|
<el-button type="danger" size="small" icon="el-icon-delete" @click="deletePatrolConfig" :disabled="patrolConfigSelections.length === 0">删除</el-button> |
|
|
|
</div> |
|
|
|
<el-table |
|
|
|
:data="patrolConfigList" |
|
|
|
border |
|
|
|
height="400px" |
|
|
|
v-loading="patrolConfigLoading" |
|
|
|
@selection-change="patrolConfigSelectionChange" |
|
|
|
@row-click="patrolConfigRowClick" |
|
|
|
highlight-current-row |
|
|
|
style="width: 100%"> |
|
|
|
<el-table-column type="selection" width="50" align="center"></el-table-column> |
|
|
|
<el-table-column prop="operationDesc" label="工序" header-align="center" align="left" min-width="150"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input v-model="scope.row.operationDesc" size="small" placeholder="请输入工序"></el-input> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="firstInspectionDuration" label="首次巡检时长(h)" header-align="center" align="right" width="140"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input-number :controls="false" :step="0" v-model="scope.row.firstInspectionDuration" size="small" style="width: 100%"></el-input-number> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="nextInspectionDuration" label="下次巡检时长(h)" header-align="center" align="right" width="140"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input-number :controls="false" :step="0" v-model="scope.row.nextInspectionDuration" size="small" style="width: 100%"></el-input-number> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="totalInspectionDuration" label="累计巡检时长(h)" header-align="center" align="right" width="140"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-input-number :controls="false" :step="0" v-model="scope.row.totalInspectionDuration" size="small" style="width: 100%"></el-input-number> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column prop="defaultFlag" label="是否默认" header-align="center" align="center" width="100"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-switch v-model="scope.row.defaultFlag" active-value="Y" inactive-value="N" @change="handleDefaultFlagChange(scope.row)"></el-switch> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="操作" header-align="center" align="center" width="80"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-button type="text" size="small" @click="savePatrolConfigRow(scope.row)">保存</el-button> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<el-footer style="height:35px;margin-top: 15px;text-align:center"> |
|
|
|
<el-button @click="patrolConfigDialogFlag = false">关闭</el-button> |
|
|
|
</el-footer> |
|
|
|
</el-dialog> |
|
|
|
|
|
|
|
<!-- 页签 --> |
|
|
|
<el-tabs v-model="activeTable" style="width: 100%" :style="{height: secondHeight + 'px'}" type="border-card" @tab-click="tabClick" class="customer-tab"> |
|
|
|
<!-- BOM页签 --> |
|
|
|
@ -1235,6 +1290,10 @@ |
|
|
|
deleteLabelTemplate, // 删除标签模版设置 |
|
|
|
updateLabelTemplate, // 编辑标签模版设置 |
|
|
|
getCustomerList, // 查询客户列表 |
|
|
|
getPatrolConfigList, // 查询巡检特殊配置列表 |
|
|
|
savePatrolConfig, // 新增巡检特殊配置 |
|
|
|
updatePatrolConfig, // 更新巡检特殊配置 |
|
|
|
deletePatrolConfig, // 删除巡检特殊配置 |
|
|
|
} from "@/api/qc/qc.js" |
|
|
|
import {getTableDefaultListLanguage, getTableUserListLanguage} from "@/api/table.js" |
|
|
|
import Chooselist from '@/views/modules/common/Chooselist_eam' |
|
|
|
@ -1291,6 +1350,11 @@ |
|
|
|
totalPage: 0, |
|
|
|
modalFlag: false, |
|
|
|
modalDisableFlag: false, |
|
|
|
// 巡检特殊配置相关 |
|
|
|
patrolConfigDialogFlag: false, |
|
|
|
patrolConfigLoading: false, |
|
|
|
patrolConfigList: [], |
|
|
|
patrolConfigSelections: [], |
|
|
|
modalData: { |
|
|
|
site: '', |
|
|
|
bu: '', |
|
|
|
@ -2057,6 +2121,149 @@ |
|
|
|
}, |
|
|
|
|
|
|
|
methods: { |
|
|
|
// ================= 巡检特殊配置相关方法 ================= |
|
|
|
// 打开巡检特殊配置对话框 |
|
|
|
openPatrolConfigDialog() { |
|
|
|
this.patrolConfigDialogFlag = true |
|
|
|
this.getPatrolConfigList() |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取巡检特殊配置列表 |
|
|
|
getPatrolConfigList() { |
|
|
|
this.patrolConfigLoading = true |
|
|
|
const params = { |
|
|
|
site: this.modalData.site, |
|
|
|
buNo: this.modalData.buNo, |
|
|
|
partNo: this.modalData.partNo |
|
|
|
} |
|
|
|
getPatrolConfigList(params).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.patrolConfigList = data.rows || [] |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '获取巡检配置失败') |
|
|
|
} |
|
|
|
this.patrolConfigLoading = false |
|
|
|
}).catch(() => { |
|
|
|
this.patrolConfigLoading = false |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 巡检配置选择变化 |
|
|
|
patrolConfigSelectionChange(selections) { |
|
|
|
this.patrolConfigSelections = selections |
|
|
|
}, |
|
|
|
|
|
|
|
// 巡检配置行点击 |
|
|
|
patrolConfigRowClick(row) { |
|
|
|
// 可以在这里添加行点击逻辑 |
|
|
|
}, |
|
|
|
|
|
|
|
// 新增巡检配置 |
|
|
|
addPatrolConfig() { |
|
|
|
this.patrolConfigList.push({ |
|
|
|
site: this.modalData.site, |
|
|
|
buNo: this.modalData.buNo, |
|
|
|
partNo: this.modalData.partNo, |
|
|
|
operationDesc: '', |
|
|
|
firstInspectionDuration: 0, |
|
|
|
nextInspectionDuration: 0, |
|
|
|
totalInspectionDuration: 0, |
|
|
|
defaultFlag: 'N', |
|
|
|
isNew: true |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 保存单行巡检配置 |
|
|
|
savePatrolConfigRow(row) { |
|
|
|
if (!row.operationDesc) { |
|
|
|
this.$message.warning('请输入工序') |
|
|
|
return |
|
|
|
} |
|
|
|
const params = { |
|
|
|
site: row.site, |
|
|
|
buNo: row.buNo, |
|
|
|
partNo: row.partNo, |
|
|
|
operationDesc: row.operationDesc, |
|
|
|
firstInspectionDuration: row.firstInspectionDuration, |
|
|
|
nextInspectionDuration: row.nextInspectionDuration, |
|
|
|
totalInspectionDuration: row.totalInspectionDuration, |
|
|
|
defaultFlag: row.defaultFlag |
|
|
|
} |
|
|
|
if (row.isNew) { |
|
|
|
savePatrolConfig(params).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success('保存成功') |
|
|
|
this.getPatrolConfigList() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '保存失败') |
|
|
|
} |
|
|
|
}) |
|
|
|
} else { |
|
|
|
updatePatrolConfig(params).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success('更新成功') |
|
|
|
this.getPatrolConfigList() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '更新失败') |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 删除巡检配置 |
|
|
|
deletePatrolConfig() { |
|
|
|
if (this.patrolConfigSelections.length === 0) { |
|
|
|
this.$message.warning('请选择要删除的数据') |
|
|
|
return |
|
|
|
} |
|
|
|
this.$confirm('确定删除选中的配置吗?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|
}).then(() => { |
|
|
|
const deleteList = this.patrolConfigSelections.filter(item => !item.isNew) |
|
|
|
if (deleteList.length === 0) { |
|
|
|
// 只有新增的未保存数据,直接从列表中移除 |
|
|
|
this.patrolConfigSelections.forEach(item => { |
|
|
|
const index = this.patrolConfigList.indexOf(item) |
|
|
|
if (index > -1) { |
|
|
|
this.patrolConfigList.splice(index, 1) |
|
|
|
} |
|
|
|
}) |
|
|
|
this.patrolConfigSelections = [] |
|
|
|
return |
|
|
|
} |
|
|
|
const params = { |
|
|
|
list: deleteList.map(item => ({ |
|
|
|
site: item.site, |
|
|
|
buNo: item.buNo, |
|
|
|
partNo: item.partNo, |
|
|
|
operationDesc: item.operationDesc |
|
|
|
})) |
|
|
|
} |
|
|
|
deletePatrolConfig(params).then(({data}) => { |
|
|
|
if (data && data.code === 0) { |
|
|
|
this.$message.success('删除成功') |
|
|
|
this.getPatrolConfigList() |
|
|
|
} else { |
|
|
|
this.$message.error(data.msg || '删除失败') |
|
|
|
} |
|
|
|
}) |
|
|
|
}).catch(() => {}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 处理默认标识变化 |
|
|
|
handleDefaultFlagChange(row) { |
|
|
|
if (row.defaultFlag === 'Y') { |
|
|
|
// 如果设置为默认,将其他行的默认标识设为N |
|
|
|
this.patrolConfigList.forEach(item => { |
|
|
|
if (item !== row) { |
|
|
|
item.defaultFlag = 'N' |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// 获取用户的bu |
|
|
|
getSiteAndBuByUserName () { |
|
|
|
let tempData = { |
|
|
|
|