You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
186 lines
5.7 KiB
186 lines
5.7 KiB
<template>
|
|
<div class="app-container">
|
|
|
|
<!--工具栏-->
|
|
<div class="head-container" style="padding:0 0 20px 0">
|
|
<crudOperation :permission="permission" />
|
|
</div>
|
|
<div class="container-wrap" style="min-height: calc(100vh - 241px);">
|
|
<span class="right-top-line" />
|
|
<span class="left-bottom-line" />
|
|
<!--表格渲染-->
|
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="width: 100%;" height="calc(100vh - 263px)" @selection-change="selectionChangeHandler" @row-click="clickRowHandler">
|
|
<el-table-column type="selection" width="55" />
|
|
<el-table-column type="index" label="序号" width="55" />
|
|
<el-table-column prop="fieldCnName" label="中文名称" />
|
|
<el-table-column prop="fieldName" label="字段标识" />
|
|
<el-table-column label="数据类型">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.isDataType === 1">字符</span>
|
|
<span v-if="scope.row.isDataType === 2">数字</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="isColumnLength" label="字段长度" />
|
|
<el-table-column label="默认值">
|
|
<template slot-scope="scope">
|
|
<span v-if="scope.row.isDefaultValue === ''">-</span>
|
|
<span v-else>{{ scope.row.isDefaultValue }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</div>
|
|
<!--表单渲染-->
|
|
<eForm ref="eform" />
|
|
<el-dialog title="关键提示" :visible.sync="verifyDialogVisible" :before-close="handleClose">
|
|
<span class="dialog-right-top" />
|
|
<span class="dialog-left-bottom" />
|
|
<div class="setting-dialog">
|
|
<div class="dialog-delt">
|
|
<p><span>这里为技术人员维护系统时使用,用户无需设置</span></p>
|
|
<p class="delt-tip"><span>注意:强行修改会导致系统数据异常或丢失!如因用户强行修改,本系统不负责因此导致的相关后果!</span></p>
|
|
</div>
|
|
<el-form :model="form" @submit.native.prevent>
|
|
<el-form-item label="技术维护验证码" :label-width="formLabelWidth">
|
|
<el-input v-model="form.verifyCode" />
|
|
</el-form-item>
|
|
</el-form>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click.native="handleConfirm">确定验证</el-button>
|
|
</div>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { add, edit, verifyMaintenance } from '@/api/archivesConfig/field'
|
|
import eForm from './module/form'
|
|
import { encrypt } from '@/utils/rsaEncrypt'
|
|
import CRUD, { presenter } from '@crud/crud'
|
|
import crudOperation from '@crud/CRUD.operation'
|
|
|
|
export default {
|
|
name: 'Field',
|
|
components: { eForm, crudOperation },
|
|
mixins: [presenter()],
|
|
cruds() {
|
|
return CRUD({
|
|
url: 'api/field/findGroupType',
|
|
crudMethod: { add, edit },
|
|
optShow: {
|
|
add: true,
|
|
edit: true,
|
|
del: false,
|
|
download: false,
|
|
group: false
|
|
},
|
|
queryOnPresenterCreated: false
|
|
})
|
|
},
|
|
props: {
|
|
isType: {
|
|
type: Number,
|
|
default: 1
|
|
},
|
|
title: {
|
|
type: String,
|
|
default: ''
|
|
},
|
|
permissionStr: {
|
|
type: String,
|
|
default: ''
|
|
}
|
|
},
|
|
data() {
|
|
return {
|
|
permission: {
|
|
add: ['admin', this.permissionStr + ':add'],
|
|
edit: ['admin', this.permissionStr + ':edit']
|
|
},
|
|
verifyDialogVisible: false,
|
|
form: {
|
|
verifyCode: ''
|
|
},
|
|
formLabelWidth: '110px',
|
|
btn: '',
|
|
showVerifyDialog: true
|
|
}
|
|
},
|
|
created() {
|
|
this.crud.title = this.title
|
|
this.crud.query = {
|
|
isType: this.isType
|
|
}
|
|
this.crud.toQuery()
|
|
},
|
|
methods: {
|
|
[CRUD.HOOK.beforeToCU](crud, form, btn) {
|
|
if (this.showVerifyDialog) {
|
|
// 打开输入验证码对话框
|
|
this.verifyDialogVisible = true
|
|
this.btn = btn
|
|
return false
|
|
}
|
|
},
|
|
[CRUD.HOOK.beforeToEdit](crud, form, btn) {
|
|
if (form.isColumnLength === null) {
|
|
form.isColumnLength = undefined
|
|
}
|
|
},
|
|
[CRUD.HOOK.beforeSubmit]() {
|
|
this.crud.form.isType = this.isType
|
|
if (!this.crud.form.isSequence) {
|
|
this.crud.form.isSequence = this.crud.data.reduce((prev, cur) => { return { isSequence: Math.max(prev.isSequence, cur.isSequence) } }).isSequence + 1
|
|
}
|
|
},
|
|
handleConfirm() {
|
|
verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {
|
|
if (res) {
|
|
// 关闭输入验证码对话框
|
|
this.verifyDialogVisible = false
|
|
this.form.verifyCode = ''
|
|
this.showVerifyDialog = false
|
|
if (this.btn === 'add') {
|
|
this.crud.toAdd()
|
|
} else if (this.btn === 'edit') {
|
|
this.crud.toEdit(this.crud.selections[0])
|
|
}
|
|
this.showVerifyDialog = true
|
|
} else {
|
|
this.$message.error('验证码错误!')
|
|
}
|
|
})
|
|
},
|
|
handleClose(done) {
|
|
this.form.verifyCode = ''
|
|
done()
|
|
},
|
|
clickRowHandler(row) {
|
|
this.$refs.table.clearSelection()
|
|
this.$refs.table.toggleRowSelection(row)
|
|
},
|
|
selectionChangeHandler(val) {
|
|
if (val.length > 1) {
|
|
// 取出最后val的最后一个返回出来
|
|
const finalVal = val.pop()
|
|
// 清除所有选中
|
|
this.$refs.table.clearSelection()
|
|
// 给最后一个加上选中
|
|
this.$refs.table.toggleRowSelection(finalVal)
|
|
this.crud.selectionChangeHandler([finalVal])
|
|
} else {
|
|
this.crud.selectionChangeHandler(val)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style rel="stylesheet/scss" lang="scss" scoped>
|
|
::v-deep thead .el-table-column--selection .cell {
|
|
display: none;
|
|
}
|
|
::v-deep div.el-dialog__footer {
|
|
text-align: center;
|
|
}
|
|
</style>
|