diff --git a/frontend/src/views/subjectMajor/major/index.vue b/frontend/src/views/subjectMajor/major/index.vue
index cb5546678..42409870d 100644
--- a/frontend/src/views/subjectMajor/major/index.vue
+++ b/frontend/src/views/subjectMajor/major/index.vue
@@ -248,9 +248,10 @@
+
-
-
+
+
@@ -356,7 +357,7 @@
{{ viewForm.pxlx || '-' }}
{{ viewForm.pxlx2 || '-' }}
{{ viewForm.xylb || '-' }}
- {{ viewForm.zgzy || '-' }}
+ {{ fmtBool(viewForm.zgzy) }}
{{ viewForm.zdyfl || '-' }}
{{ viewForm.jxgljgbh || '-' }}
{{ viewForm.xkzyxxbsh || '-' }}
@@ -537,6 +538,23 @@ export default {
return (this.pageNum - 1) * this.pageSize + index + 1
},
+ /** 宽松布尔归一:兼容后端 Boolean、数字 0/1、字符串 'true'/'false'/'1'/'0'/'是'/'否';无效值返回 null */
+ normBool(val) {
+ if (val === null || val === undefined || val === '') return null
+ if (typeof val === 'boolean') return val
+ if (typeof val === 'number') return val !== 0
+ const s = String(val).trim()
+ if (['是', 'true', '1', 'Y', 'y'].indexOf(s) >= 0) return true
+ if (['否', 'false', '0', 'N', 'n'].indexOf(s) >= 0) return false
+ return null
+ },
+
+ /** 布尔值展示为 是/否,空值显示 '-' */
+ fmtBool(val) {
+ const b = this.normBool(val)
+ return b === null ? '-' : (b ? '是' : '否')
+ },
+
/** 创建空表单 */
createEmptyForm() {
return {
@@ -678,7 +696,7 @@ export default {
jclb: data.jclb,
xtms: data.xtms,
jsonzd: data.jsonzd,
- zgzy: data.zgzy,
+ zgzy: this.normBool(data.zgzy),
gfmc: data.gfmc,
jxdgbh: data.jxdgbh,
rpbh: data.rpbh,
@@ -692,6 +710,12 @@ export default {
if (!valid) return
this.formSaving = true
const payload = { ...this.form }
+ // 布尔字段统一归一为布尔值:后端实体 ty / zgzy 均为 Boolean,库列为 BIT(1) 且非空
+ const zgzy = this.normBool(payload.zgzy)
+ payload.zgzy = zgzy === null ? false : zgzy
+ const ty = this.normBool(payload.ty)
+ payload.ty = ty === null ? false : ty
+
const request = this.isAdd ? addMajor(payload) : updateMajor(payload)
request.then(() => {
this.$message.success(this.isAdd ? '新增成功' : '修改成功')