|
|
@ -83,12 +83,13 @@ |
|
|
fixed="right" |
|
|
fixed="right" |
|
|
header-align="center" |
|
|
header-align="center" |
|
|
align="center" |
|
|
align="center" |
|
|
width="160" |
|
|
|
|
|
|
|
|
width="220" |
|
|
label="操作"> |
|
|
label="操作"> |
|
|
<template slot-scope="scope"> |
|
|
<template slot-scope="scope"> |
|
|
<a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a> |
|
|
<a v-if="!authUpdate" type="text" size="small" @click="updateModal(scope.row)">编辑</a> |
|
|
<a v-if="!authDetail" type="text" size="small" @click="detailModal(scope.row)">检验项目</a> |
|
|
|
|
|
<a v-if="!authDelete" type="text" size="small" @click="deleteModel(scope.row)">删除</a> |
|
|
|
|
|
|
|
|
<a v-if="!authUpdate" type="text" size="small" style="margin-left: 8px;" @click="copyTemplate(scope.row)">复制</a> |
|
|
|
|
|
<a v-if="!authDetail" type="text" size="small" style="margin-left: 8px;" @click="detailModal(scope.row)">检验项目</a> |
|
|
|
|
|
<a v-if="!authDelete" type="text" size="small" style="margin-left: 8px;" @click="deleteModel(scope.row)">删除</a> |
|
|
</template> |
|
|
</template> |
|
|
</el-table-column> |
|
|
</el-table-column> |
|
|
</el-table> |
|
|
</el-table> |
|
|
@ -192,7 +193,7 @@ |
|
|
</el-dialog> |
|
|
</el-dialog> |
|
|
|
|
|
|
|
|
<!-- 检验项目 --> |
|
|
<!-- 检验项目 --> |
|
|
<el-dialog title="检验项目清单" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="940px"> |
|
|
|
|
|
|
|
|
<el-dialog title="检验项目清单" @open="handleDetailDialogOpen" @close="closeDialog" :close-on-click-modal="false" v-drag :visible.sync="detailModelFlag" width="940px"> |
|
|
<el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()"> |
|
|
<el-form :inline="true" label-position="top" @keyup.enter.native="getDataList()"> |
|
|
<el-form-item :label="'检验模板编码'"> |
|
|
<el-form-item :label="'检验模板编码'"> |
|
|
<el-input v-model="detailData.templateId" readonly style="width: 120px"></el-input> |
|
|
<el-input v-model="detailData.templateId" readonly style="width: 120px"></el-input> |
|
|
@ -286,8 +287,13 @@ |
|
|
<!-- </el-autocomplete>--> |
|
|
<!-- </el-autocomplete>--> |
|
|
<!-- </template>--> |
|
|
<!-- </template>--> |
|
|
<!-- </el-table-column>--> |
|
|
<!-- </el-table-column>--> |
|
|
|
|
|
<!-- |
|
|
|
|
|
操作列在弹窗内取消 fixed="right": |
|
|
|
|
|
1) 弹窗宽度变化或首次渲染时,Element fixed-right 容易出现右侧留白失真; |
|
|
|
|
|
2) 当前“检验项目清单”列数固定且宽度可容纳,不需要固定列也能保证可用性; |
|
|
|
|
|
3) 取消固定后配合 doLayout 重排,避免操作列显示异常。 |
|
|
|
|
|
--> |
|
|
<el-table-column |
|
|
<el-table-column |
|
|
fixed="right" |
|
|
|
|
|
header-align="center" |
|
|
header-align="center" |
|
|
align="center" |
|
|
align="center" |
|
|
width="130" |
|
|
width="130" |
|
|
@ -508,6 +514,7 @@ |
|
|
templateSave, // 新增模板 |
|
|
templateSave, // 新增模板 |
|
|
templateUpdate, // 修改模板 |
|
|
templateUpdate, // 修改模板 |
|
|
templateDelete, // 删除模板 |
|
|
templateDelete, // 删除模板 |
|
|
|
|
|
templateCopy, // 复制模板 |
|
|
inspectionTypeSearch, // 搜索所有检验类型 |
|
|
inspectionTypeSearch, // 搜索所有检验类型 |
|
|
objectSearch, // 搜索所有设备 |
|
|
objectSearch, // 搜索所有设备 |
|
|
templateDetailsSearch, // 查询明细列表 |
|
|
templateDetailsSearch, // 查询明细列表 |
|
|
@ -1424,6 +1431,56 @@ |
|
|
this.modalFlag = true |
|
|
this.modalFlag = true |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @description 复制检验模板(主表 + 检验项目 + 判定标准) |
|
|
|
|
|
* 业务意图: |
|
|
|
|
|
* 1) 为模板维护提供“快速复制拓展”能力,减少重复录入; |
|
|
|
|
|
* 2) 复制后由后端生成新的模板编码,并将模板名称自动追加“_复制”; |
|
|
|
|
|
* 3) 复制结果需保持与源模板一致(检验项目与判定标准完整继承)。 |
|
|
|
|
|
* |
|
|
|
|
|
* 关键输入: |
|
|
|
|
|
* - row.site / row.buNo / row.templateId:定位被复制的源模板; |
|
|
|
|
|
* - 当前登录用户:作为复制动作的创建人与更新人。 |
|
|
|
|
|
* |
|
|
|
|
|
* 失败处理: |
|
|
|
|
|
* - 若后端校验失败(例如源模板不存在),弹框展示后端返回信息; |
|
|
|
|
|
* - 若网络异常,保持页面状态不变,便于用户重试。 |
|
|
|
|
|
*/ |
|
|
|
|
|
copyTemplate (row) { |
|
|
|
|
|
const sourceTemplateName = row && row.templateName ? String(row.templateName).trim() : '' |
|
|
|
|
|
const targetTemplateName = `${sourceTemplateName}_复制` |
|
|
|
|
|
this.$confirm(`确认复制模板【${row.templateId}】并生成新模板【${targetTemplateName}】吗?`, '提示', { |
|
|
|
|
|
confirmButtonText: '确定', |
|
|
|
|
|
cancelButtonText: '取消', |
|
|
|
|
|
type: 'warning' |
|
|
|
|
|
}).then(() => { |
|
|
|
|
|
const copyData = { |
|
|
|
|
|
site: row.site, |
|
|
|
|
|
buNo: row.buNo, |
|
|
|
|
|
templateId: row.templateId, |
|
|
|
|
|
createBy: this.$store.state.user.name, |
|
|
|
|
|
updateBy: this.$store.state.user.name |
|
|
|
|
|
} |
|
|
|
|
|
templateCopy(copyData).then(({data}) => { |
|
|
|
|
|
if (data && data.code === 0) { |
|
|
|
|
|
this.getDataList() |
|
|
|
|
|
const newTemplateId = data.templateId ? `,新模板编码:${data.templateId}` : '' |
|
|
|
|
|
this.$message({ |
|
|
|
|
|
message: `操作成功${newTemplateId}`, |
|
|
|
|
|
type: 'success', |
|
|
|
|
|
duration: 1500, |
|
|
|
|
|
onClose: () => {} |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.$alert(data.msg, '错误', { |
|
|
|
|
|
confirmButtonText: '确定' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}).catch(() => { |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 删除 |
|
|
// 删除 |
|
|
deleteModel (row) { |
|
|
deleteModel (row) { |
|
|
this.$confirm(`是否删除这个检验模板?`, '提示', { |
|
|
this.$confirm(`是否删除这个检验模板?`, '提示', { |
|
|
@ -1519,10 +1576,38 @@ |
|
|
templateDetailsSearch(this.detailData).then(({data}) => { |
|
|
templateDetailsSearch(this.detailData).then(({data}) => { |
|
|
this.detailList = data.rows |
|
|
this.detailList = data.rows |
|
|
//this.objectSearch() |
|
|
//this.objectSearch() |
|
|
|
|
|
// 明细数据回填后立刻重排表格,避免弹窗内列宽计算滞后导致操作列留白/错位。 |
|
|
|
|
|
this.refreshDetailTableLayout() |
|
|
}) |
|
|
}) |
|
|
this.detailModelFlag = true |
|
|
this.detailModelFlag = true |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @description 检验项目弹窗打开后,强制执行一次表格布局重算 |
|
|
|
|
|
* 业务意图: |
|
|
|
|
|
* 1) 解决 el-dialog 场景下 el-table 首次可见时列宽未正确计算的问题; |
|
|
|
|
|
* 2) 保证“操作列”与前置列边界对齐,避免出现右侧空白区或错位。 |
|
|
|
|
|
* 失败处理: |
|
|
|
|
|
* - 若 ref 尚未挂载,则静默跳过,不影响弹窗基础功能。 |
|
|
|
|
|
*/ |
|
|
|
|
|
handleDetailDialogOpen () { |
|
|
|
|
|
this.refreshDetailTableLayout() |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @description 统一封装明细表格重排逻辑 |
|
|
|
|
|
* 处理规则: |
|
|
|
|
|
* 1) 使用 $nextTick 等待 DOM 与数据同步完成后再调用 doLayout; |
|
|
|
|
|
* 2) 仅在 detailTable 实例存在时执行,避免空引用异常。 |
|
|
|
|
|
*/ |
|
|
|
|
|
refreshDetailTableLayout () { |
|
|
|
|
|
this.$nextTick(() => { |
|
|
|
|
|
if (this.$refs.detailTable && this.$refs.detailTable.doLayout) { |
|
|
|
|
|
this.$refs.detailTable.doLayout() |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
// 保存模板项目 |
|
|
// 保存模板项目 |
|
|
saveDetail () { |
|
|
saveDetail () { |
|
|
// for (let i = 0; i < this.detailList.length; i++) { |
|
|
// for (let i = 0; i < this.detailList.length; i++) { |
|
|
@ -1665,6 +1750,8 @@ |
|
|
refreshDetailList () { |
|
|
refreshDetailList () { |
|
|
templateDetailsSearch(this.detailData).then(({data}) => { |
|
|
templateDetailsSearch(this.detailData).then(({data}) => { |
|
|
this.detailList = data.rows |
|
|
this.detailList = data.rows |
|
|
|
|
|
// 快速新增弹窗关闭后,明细表数据会变化,需同步重排列宽避免显示失真。 |
|
|
|
|
|
this.refreshDetailTableLayout() |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|