|
|
@ -1,14 +1,18 @@ |
|
|
|
<template> |
|
|
|
<div> |
|
|
|
<div class="head-container"> |
|
|
|
<crudOperation :permission="permission" /> |
|
|
|
<crudOperation :permission="permission" crud-tag="field"> |
|
|
|
<template v-slot:right> |
|
|
|
<el-button v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="crud.delAllLoading" :disabled="crud.selections.length === 0" @click="toDelete(crud.selections)">删除</el-button> |
|
|
|
</template> |
|
|
|
</crudOperation> |
|
|
|
</div> |
|
|
|
<!--表格渲染--> |
|
|
|
<el-table ref="table" v-loading="crud.loading" :data="crud.data" style="min-width: 100%;" height="calc(100vh - 302px)" @selection-change="selectionChangeHandler" @row-click="clickRowHandler"> |
|
|
|
<el-table ref="fieldTable" v-loading="crud.loading" :data="crud.data" style="min-width: 100%;" height="calc(100vh - 302px)" crud-tag="field" @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="字段名称" min-width="85" /> |
|
|
|
<el-table-column prop="fieldName" label="字段标识" min-width="85" /> |
|
|
|
<el-table-column prop="fieldCnName" label="字段名称" min-width="140" /> |
|
|
|
<el-table-column prop="fieldName" label="字段标识" min-width="140" /> |
|
|
|
<el-table-column label="数据类型" min-width="85"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<span v-if="scope.row.isDataType === 1">字符</span> |
|
|
@ -39,11 +43,6 @@ |
|
|
|
<el-checkbox v-model="scope.row.isDefaultValue" :disabled="true" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="自动加一" min-width="85"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-checkbox v-model="scope.row.isDefaultValue" :disabled="true" /> |
|
|
|
</template> |
|
|
|
</el-table-column> |
|
|
|
<el-table-column label="自动补零" min-width="85"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
<el-checkbox v-model="scope.row.isDefaultValue" :disabled="true" /> |
|
|
@ -57,7 +56,18 @@ |
|
|
|
</el-table-column> |
|
|
|
</el-table> |
|
|
|
<!--表单渲染--> |
|
|
|
<eForm /> |
|
|
|
<eForm crud-tag="field" /> |
|
|
|
<el-dialog title="删除字段" :visible.sync="deleteVisible" :before-close="handleClose"> |
|
|
|
<span class="dialog-right-top" /> |
|
|
|
<span class="dialog-left-bottom" /> |
|
|
|
<div class="setting-dialog"> |
|
|
|
<p><span style="color:#fff;">确定要删除当前字段吗?</span></p> |
|
|
|
<p><span style="color:red;">提示:如果删除当前字典,此字典内所属内容会一并删除</span></p> |
|
|
|
<div slot="footer" class="dialog-footer"> |
|
|
|
<el-button type="primary" @click.native="handleConfirm">确定</el-button> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</el-dialog> |
|
|
|
</div> |
|
|
|
</template> |
|
|
|
|
|
|
@ -66,14 +76,18 @@ import { add, edit } from '@/api/archivesConfig/field' |
|
|
|
import eForm from './module/form' |
|
|
|
import CRUD, { presenter } from '@crud/crud' |
|
|
|
import crudOperation from '@crud/CRUD.operation' |
|
|
|
import data1 from './data1.json' |
|
|
|
|
|
|
|
export default { |
|
|
|
components: { eForm, crudOperation }, |
|
|
|
mixins: [presenter()], |
|
|
|
cruds() { |
|
|
|
return CRUD({ |
|
|
|
url: 'api/field/findGroupType', |
|
|
|
tag: 'field', |
|
|
|
// url: 'api/field/findGroupType', |
|
|
|
crudMethod: { add, edit }, |
|
|
|
title: '字段', |
|
|
|
// delete |
|
|
|
optShow: { |
|
|
|
add: true, |
|
|
|
edit: true, |
|
|
@ -87,16 +101,19 @@ export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
permission: { |
|
|
|
add: ['admin', this.permissionStr + ':add'], |
|
|
|
edit: ['admin', this.permissionStr + ':edit'] |
|
|
|
}, |
|
|
|
verifyDialogVisible: false, |
|
|
|
form: { |
|
|
|
verifyCode: '' |
|
|
|
add: ['admin', 'fieldManage:add'], |
|
|
|
edit: ['admin', 'fieldManage:edit'], |
|
|
|
del: ['admin', 'fieldManage:edit'] |
|
|
|
}, |
|
|
|
formLabelWidth: '110px', |
|
|
|
btn: '', |
|
|
|
showVerifyDialog: true |
|
|
|
deleteVisible: false, |
|
|
|
deleteData: {}, |
|
|
|
// form: { |
|
|
|
// verifyCode: '' |
|
|
|
// }, |
|
|
|
// formLabelWidth: '110px', |
|
|
|
// btn: '', |
|
|
|
// showVerifyDialog: true, |
|
|
|
delLoading: false |
|
|
|
} |
|
|
|
}, |
|
|
|
created() { |
|
|
@ -105,6 +122,7 @@ export default { |
|
|
|
// isType: this.isType |
|
|
|
// } |
|
|
|
// this.crud.toQuery() |
|
|
|
this.crud.data = data1 |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
// [CRUD.HOOK.beforeToCU](crud, form, btn) { |
|
|
@ -120,44 +138,35 @@ export default { |
|
|
|
// form.isColumnLength = undefined |
|
|
|
// } |
|
|
|
// }, |
|
|
|
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) |
|
|
|
this.$refs.fieldTable.clearSelection() |
|
|
|
this.$refs.fieldTable.toggleRowSelection(row) |
|
|
|
}, |
|
|
|
selectionChangeHandler(val) { |
|
|
|
if (val.length > 1) { |
|
|
|
// 取出最后val的最后一个返回出来 |
|
|
|
const finalVal = val.pop() |
|
|
|
// 清除所有选中 |
|
|
|
this.$refs.table.clearSelection() |
|
|
|
this.$refs.fieldTable.clearSelection() |
|
|
|
// 给最后一个加上选中 |
|
|
|
this.$refs.table.toggleRowSelection(finalVal) |
|
|
|
this.$refs.fieldTable.toggleRowSelection(finalVal) |
|
|
|
this.crud.selectionChangeHandler([finalVal]) |
|
|
|
} else { |
|
|
|
this.crud.selectionChangeHandler(val) |
|
|
|
} |
|
|
|
}, |
|
|
|
toDelete(data) { |
|
|
|
this.deleteData = data |
|
|
|
this.deleteVisible = true |
|
|
|
}, |
|
|
|
handleConfirm() { |
|
|
|
this.deleteVisible = false |
|
|
|
this.crud.delAllLoading = true |
|
|
|
this.crud.doDelete(this.deleteData) |
|
|
|
}, |
|
|
|
handleClose(done) { |
|
|
|
this.deleteData = {} |
|
|
|
done() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -170,4 +179,7 @@ export default { |
|
|
|
::v-deep div.el-dialog__footer { |
|
|
|
text-align: center; |
|
|
|
} |
|
|
|
::v-deep.el-table tr .el-table__cell { |
|
|
|
height: 40px; |
|
|
|
} |
|
|
|
</style> |