| | |
| | | > |
| | | |
| | | <template slot="menuLeft" slot-scope="scope"> |
| | | <el-button icon="el-icon-plus" size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button> |
| | | <el-button icon="el-icon-plus" plain size="small" type="primary" @click="rowSaveHandlerClick">创建</el-button> |
| | | <el-button icon="el-icon-delete" plain size="small" type="danger" @click="allDelHandler">删除</el-button> |
| | | <el-button icon="el-icon-view" plain size="small" type="primary" @click="chekView">查看使用范围</el-button> |
| | | <el-button icon="el-icon-download" plain size="small" type="primary" @click="downloadTemplateHandler">下载导入模板 |
| | |
| | | </el-form> |
| | | |
| | | <span slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="rowSaveHandler">确 定</el-button> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | </span> |
| | | <el-button @click="dialogVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="rowSaveHandler">确 定</el-button> |
| | | </span> |
| | | </el-dialog> |
| | | |
| | | <!-- 查看使用范围 --> |
| | |
| | | append-to-body="true" |
| | | class="avue-dialog" |
| | | title="查看使用范围" |
| | | width="70%" |
| | | width="60%" |
| | | > |
| | | <avue-crud |
| | | ref="checkViewCrud" |
| | |
| | | dialogData: [], |
| | | dialogOption: { |
| | | ...basicOption, |
| | | calcHeight: 50, |
| | | refreshBtn: false, |
| | | selection: false, |
| | | column: [ |
| | |
| | | }, |
| | | tableLoading: false, |
| | | selectList: [], |
| | | searchParams: {} |
| | | searchParams: {}, |
| | | lastIndex: null |
| | | } |
| | | }, |
| | | computed: { |
| | |
| | | |
| | | // 选择框 |
| | | selectChange(row) { |
| | | console.log(row) |
| | | this.selectList = row; |
| | | }, |
| | | |
| | | // 点击行 |
| | | rowClickHandler(row) { |
| | | this.$refs.userCrud.toggleRowSelection(row); |
| | | func.rowClickHandler( |
| | | row, |
| | | this.$refs.userCrud, |
| | | this.lastIndex, |
| | | (newIndex) => { |
| | | this.lastIndex = newIndex; |
| | | }, |
| | | () => { |
| | | this.selectList = []; |
| | | } |
| | | ); |
| | | }, |
| | | |
| | | // 关闭对话框 |
| | |
| | | |
| | | // 对话框枚举保存 |
| | | rowSaveHandler() { |
| | | const lengthStatus = this.dialogData.some(item => item.value.length > this.form.length) |
| | | if (lengthStatus) { |
| | | this.$message.error('请检查枚举值是否超过最大长度!') |
| | | return; |
| | | } |
| | | |
| | | if (this.form.enumValueDataType === "Integer") { |
| | | // 判断是否包含非数字字符 |
| | | const integerStatus = this.dialogData.some(item => { |
| | | if (!/^\-?\d+$/.test(item.value)) { |
| | | return true; |
| | | const lengthStatus = this.dialogData.some(item => item.value.length > this.form.length); |
| | | this.$refs.form.validate((valid) => { |
| | | if (valid) { |
| | | if (lengthStatus) { |
| | | this.$message.error('请检查枚举值是否超过最大长度!') |
| | | return; |
| | | } |
| | | }) |
| | | |
| | | // 判断是否是integer格式 |
| | | const integerNumStatus = this.dialogData.some(item => { |
| | | let numValue = parseInt(item.value); |
| | | if (isNaN(numValue) || !Number.isInteger(numValue)) { |
| | | return true; |
| | | if (this.form.enumValueDataType === "Integer") { |
| | | // 判断是否包含非数字字符 |
| | | const integerStatus = this.dialogData.some(item => { |
| | | if (!/^\-?\d+$/.test(item.value)) { |
| | | return true; |
| | | } |
| | | }) |
| | | |
| | | // 判断是否是integer格式 |
| | | const integerNumStatus = this.dialogData.some(item => { |
| | | let numValue = parseInt(item.value); |
| | | if (isNaN(numValue) || !Number.isInteger(numValue)) { |
| | | return true; |
| | | } |
| | | }) |
| | | |
| | | if (integerStatus || integerNumStatus) { |
| | | this.$message.error('枚举值必须是Integer类型'); |
| | | return; |
| | | } |
| | | } |
| | | }) |
| | | |
| | | if (integerStatus || integerNumStatus) { |
| | | this.$message.error('枚举值必须是Integer类型'); |
| | | return; |
| | | if (this.dialogType === 'add') { |
| | | let params = { |
| | | ...this.form, |
| | | items: this.dialogData |
| | | } |
| | | addEnumType(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.dialogVisible = false; |
| | | this.getTableList(); |
| | | } |
| | | }) |
| | | } else if (this.dialogType === 'edit') { |
| | | let params = { |
| | | ...this.form, |
| | | items: this.dialogData, |
| | | oid: this.editRow.oid, |
| | | ts: this.editRow.ts |
| | | } |
| | | updateEnumType(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.dialogVisible = false; |
| | | this.getTableList(); |
| | | } |
| | | }) |
| | | } |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | if (this.dialogType === 'add') { |
| | | let params = { |
| | | ...this.form, |
| | | items: this.dialogData |
| | | } |
| | | addEnumType(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.dialogVisible = false; |
| | | this.getTableList(); |
| | | } |
| | | }) |
| | | } else if (this.dialogType === 'edit') { |
| | | let params = { |
| | | ...this.form, |
| | | items: this.dialogData, |
| | | oid: this.editRow.oid, |
| | | ts: this.editRow.ts |
| | | } |
| | | updateEnumType(params).then(res => { |
| | | if (res.data.code === 200) { |
| | | this.$message.success(res.data.obj); |
| | | this.dialogVisible = false; |
| | | this.getTableList(); |
| | | } |
| | | }) |
| | | } |
| | | }); |
| | | }, |
| | | |
| | | // 枚举项新增 |