|
|
@@ -1001,7 +1001,12 @@
|
|
|
></el-input>
|
|
|
</template>
|
|
|
</el-table-column> -->
|
|
|
- <el-table-column label="操作" align="center" fixed="right">
|
|
|
+ <el-table-column
|
|
|
+ label="操作"
|
|
|
+ align="center"
|
|
|
+ fixed="right"
|
|
|
+ width="180"
|
|
|
+ >
|
|
|
<template slot-scope="scope">
|
|
|
<div class="table-actions">
|
|
|
<el-button
|
|
|
@@ -3817,6 +3822,79 @@
|
|
|
// 防止重复点击
|
|
|
if (this.contentSaving) return
|
|
|
|
|
|
+ // 表头“格式”必填校验(布尔值除外)
|
|
|
+ const validateHeaderFormatRequired = (headers, tableLabel = '') => {
|
|
|
+ if (!Array.isArray(headers) || headers.length === 0) return true
|
|
|
+
|
|
|
+ // 仅校验:字段类型非 boolean 时,格式相关字段必填
|
|
|
+ for (let i = 0; i < headers.length; i++) {
|
|
|
+ const h = headers[i] || {}
|
|
|
+ const fieldName = h.fieldName || `第${i + 1}行`
|
|
|
+ const fieldType = String(h.fieldType || '').trim()
|
|
|
+ if (fieldType === 'boolean') continue
|
|
|
+
|
|
|
+ let ok = true
|
|
|
+ let msg = ''
|
|
|
+
|
|
|
+ if (fieldType === 'string') {
|
|
|
+ ok = String(h.format || '').trim() !== ''
|
|
|
+ msg = `【${tableLabel}】字段“${fieldName}”的格式(长度)为必填`
|
|
|
+ } else if (fieldType === 'integer') {
|
|
|
+ ok = String(h.fieldTypelen || '').trim() !== ''
|
|
|
+ msg = `【${tableLabel}】字段“${fieldName}”的格式(整数位数)为必填`
|
|
|
+ } else if (fieldType === 'double') {
|
|
|
+ ok = String(h.fieldTypenointlen || '').trim() !== ''
|
|
|
+ msg = `【${tableLabel}】字段“${fieldName}”的格式(小数位数)为必填`
|
|
|
+ } else if (fieldType === 'datetime') {
|
|
|
+ ok = String(h.format || '').trim() !== ''
|
|
|
+ msg = `【${tableLabel}】字段“${fieldName}”的格式(日期格式)为必填`
|
|
|
+ } else {
|
|
|
+ // 兜底:其它类型(若后续扩展)统一要求 format
|
|
|
+ ok = String(h.format || '').trim() !== ''
|
|
|
+ msg = `【${tableLabel}】字段“${fieldName}”的格式为必填`
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!ok) {
|
|
|
+ this.$message && this.$message.error && this.$message.error(msg)
|
|
|
+ this.scrollToErrorRow && this.scrollToErrorRow(i)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true
|
|
|
+ }
|
|
|
+
|
|
|
+ // 仅在可编辑且保存表头时校验(内容维护“格式”列)
|
|
|
+ if (!this.viewDetail) {
|
|
|
+ if (type === '单记录') {
|
|
|
+ if (
|
|
|
+ !validateHeaderFormatRequired(
|
|
|
+ this.contentEditForm.tableHeaders,
|
|
|
+ '单记录'
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if (type === '固定表表头') {
|
|
|
+ if (
|
|
|
+ !validateHeaderFormatRequired(
|
|
|
+ this.contentEditForm.fixedTable.tableHeaders,
|
|
|
+ '固定表表头'
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if (type === '动态表表头') {
|
|
|
+ if (
|
|
|
+ !validateHeaderFormatRequired(
|
|
|
+ this.contentEditForm.dynamicTable.tableHeaders,
|
|
|
+ '动态表表头'
|
|
|
+ )
|
|
|
+ ) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
this.loading = true
|
|
|
this.contentSaving = true
|
|
|
let isValid = false
|
|
|
@@ -4336,8 +4414,8 @@
|
|
|
// 递归处理子节点 - 修复:按orderNum排序后再处理
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
// 按orderNum排序子项,确保发送给后端的数据顺序正确
|
|
|
- const sortedChildren = [...node.children].sort((a, b) =>
|
|
|
- (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
+ const sortedChildren = [...node.children].sort(
|
|
|
+ (a, b) => (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
)
|
|
|
sortedChildren.forEach((childNode) => {
|
|
|
processNode(childNode)
|
|
|
@@ -4430,8 +4508,8 @@
|
|
|
// 递归处理子节点 - 修复:按orderNum排序后再处理
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
// 按orderNum排序子项,确保发送给后端的数据顺序正确
|
|
|
- const sortedChildren = [...node.children].sort((a, b) =>
|
|
|
- (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
+ const sortedChildren = [...node.children].sort(
|
|
|
+ (a, b) => (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
)
|
|
|
sortedChildren.forEach((childNode) => {
|
|
|
processNode(childNode)
|
|
|
@@ -4677,9 +4755,7 @@
|
|
|
|
|
|
// 对子项进行排序 - 修复:启用子项排序
|
|
|
parentItems.forEach((parent) => {
|
|
|
- parent.children.sort(
|
|
|
- (a, b) => (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
- )
|
|
|
+ parent.children.sort((a, b) => (a.orderNum || 0) - (b.orderNum || 0))
|
|
|
treeData.push(parent)
|
|
|
})
|
|
|
|
|
|
@@ -4814,9 +4890,7 @@
|
|
|
|
|
|
// 对子项进行排序 - 修复:启用子项排序
|
|
|
parentItems.forEach((parent) => {
|
|
|
- parent.children.sort(
|
|
|
- (a, b) => (a.orderNum || 0) - (b.orderNum || 0)
|
|
|
- )
|
|
|
+ parent.children.sort((a, b) => (a.orderNum || 0) - (b.orderNum || 0))
|
|
|
treeData.push(parent)
|
|
|
})
|
|
|
|