Browse Source

门类管理 修改

master
z_yu 3 years ago
parent
commit
b2bc552d69
  1. 3
      src/views/archivesConfig/dict/dictDetail.vue
  2. 3
      src/views/category/fieldManage/module/form.vue
  3. 95
      src/views/category/fileNoFormat/index.vue
  4. 117
      src/views/category/fileNoFormat/module/form.vue
  5. 19
      src/views/category/fileNoFormat/module/sortDialog.vue
  6. 1
      src/views/category/index.vue
  7. 4
      src/views/category/listBrowsing/module/form.vue
  8. 2072
      src/views/category/orderingRule/data1.json
  9. 142
      src/views/category/orderingRule/data2.json
  10. 113
      src/views/category/orderingRule/index.vue
  11. 119
      src/views/category/orderingRule/module/form.vue
  12. 63
      src/views/category/orderingRule/module/sortDialog.vue
  13. 15
      src/views/category/sortDialog.vue

3
src/views/archivesConfig/dict/dictDetail.vue

@ -170,9 +170,6 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
::v-deep thead .el-table-column--selection .cell {
display: none;
}

3
src/views/category/fieldManage/module/form.vue

@ -101,7 +101,4 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
</style>

95
src/views/category/fileNoFormat/index.vue

@ -34,10 +34,21 @@
<el-table-column prop="ikConnector" label="组成符号" align="center" />
</el-table>
<!--表单渲染-->
<eForm />
<eForm ref="cuform" />
</div>
<!--排序对话框组件-->
<sortDialog ref="sort" />
<sortDialog ref="sort" @doSort="doSort" />
<!--删除对话框组件-->
<el-dialog title="移除字段" :visible.sync="deleteVisible">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<p><span style="color:#fff;">确定要移除当前字段吗</span></p>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click.native="handleDelConfirm">确定</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
@ -58,7 +69,7 @@ export default {
del: ['admin', 'fileNoFormat:delete'],
sort: ['admin', 'fileNoFormat:sort']
},
// verifyDialogVisible: false,
deleteVisible: false,
// form: {
// verifyCode: ''
// },
@ -88,44 +99,17 @@ export default {
// }
// this.crud.toQuery()
// verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {}
this.table.left.data = data1.rows
this.table.right.data = data2.rows
this.getLeftTableData()
this.getRightTableData()
},
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
// }
// },
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('')
// }
// })
getLeftTableData() {
// verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {}
this.table.left.data = data1.rows
},
handleClose(done) {
this.form.verifyCode = ''
done()
getRightTableData() {
// verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {}
this.table.right.data = data2.rows
},
clickRowHandler(row, column, e, tableName) {
this.$refs[tableName].toggleRowSelection(row)
@ -134,16 +118,51 @@ export default {
this.table[tableName].selections = val
},
toAdd() {
this.$refs.cuform.formData.fields = this.table.left.selections
this.$refs.cuform.cuDialogVisible = true
},
toEdit() {
this.$refs.cuform.formData.fields = this.table.right.selections
this.$refs.cuform.cuDialogVisible = true
},
toDelete() {
this.deleteVisible = true
},
handleDelConfirm() {
this.deleteVisible = false
this.delAllLoading = true
// sort(encrypt(this.form.verifyCode)).then((res) => {
this.delAllLoading = false
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
this.getRightTableData()
this.getLeftTableData()
// }).catch(() => {
// this.delAllLoading = false
// })
},
toSort() {
// findSubsetById(data[0].id).then(res => {
this.$refs.sort.sortTableData = this.table.right.data
this.$refs.sort.sortVisible = true
// })
},
doSort(data) {
this.sortLoading = true
// sort(encrypt(this.form.verifyCode)).then((res) => {
this.sortLoading = false
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.getRightTableData()
// }).catch(() => {
// this.sortLoading = false
// })
}
}
}

117
src/views/category/fileNoFormat/module/form.vue

@ -1,107 +1,54 @@
<template>
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title">
<el-dialog :close-on-click-modal="false" :visible.sync="cuDialogVisible" title="修改字段">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="中文名称" prop="fieldCnName">
<el-input v-model="form.fieldCnName" style="width: 370px;" />
</el-form-item>
<el-form-item label="字段标识" prop="fieldName">
<el-input v-model="form.fieldName" style="width: 370px;" />
</el-form-item>
<el-form-item label="数据类型" prop="isDataType">
<el-select v-model="form.isDataType" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="字段长度" prop="isColumnLength">
<el-input-number v-model="form.isColumnLength" controls-position="right" style="width: 370px;" />
</el-form-item>
<el-form-item label="默认值" prop="isDefaultValue">
<el-input v-model="form.isDefaultValue" style="width: 370px;" />
</el-form-item>
</el-form>
<div class="fields-list">
<el-form ref="form" :model="formData" size="small" label-width="75px">
<el-row v-for="(item) in formData.fields" :key="item.id" :gutter="10">
<el-col :span="14">
<el-form-item label="组成字段">
<el-input v-if="item.fieldCnName" v-model="item.fieldCnName" :disabled="true" />
<el-input v-if="item.ikFieldName" v-model="item.ikFieldName" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="9">
<el-form-item label="组成符号">
<el-input v-model="item.ikConnector" />
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">
取消
</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">
确认
</el-button>
<el-button type="primary" @click="submitCU">保存</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import { form } from '@crud/crud'
const defaultForm = {
id: null,
fieldCnName: '',
fieldName: '',
isDataType: 1,
isColumnLength: 100,
isDefaultValue: ''
}
export default {
mixins: [form(defaultForm)],
data() {
var checkMaxLength = (rule, value, callback) => {
if (value !== undefined && (!Number.isInteger(value) || value <= 0)) {
callback(new Error('请输入正整数数字值'))
} else {
if (this.form.isDataType === 1 && value > 2000) {
callback(new Error('字符最大长度不能超过2000位'))
} else if (this.form.isDataType === 2 && value > 11) {
callback(new Error('数字最大长度不能超过11位'))
} else {
callback()
}
}
}
var checkFieldName = (rule, value, callback) => {
const reg = /^[A-Za-z][A-Za-z_]+[a-zA-Z]*$/
if (reg.test(value)) {
callback()
} else {
callback(new Error('字段标识只能由字母、字符“_”组成,并且必须以字母开头和结尾'))
}
}
return {
rules: {
fieldCnName: [
{ required: true, message: '请输入中文名称', trigger: 'blur' }
],
fieldName: [
{ required: true, message: '请选择字段标识', trigger: 'blur' },
{ validator: checkFieldName, trigger: 'blur' }
],
isDataType: [
{ required: true, message: '请选择数据类型', trigger: 'blur' }
],
isColumnLength: [
{ validator: checkMaxLength, trigger: 'blur' }
]
},
options: [
{
value: 1,
label: '字符'
},
{
value: 2,
label: '数字'
}
]
cuDialogVisible: false,
formData: {}
}
},
methods: {
submitCU() {
console.log(2)
// this.cuDialogVisible = false
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
.fields-list {
max-height: calc(100vh - 312px);
overflow-x: hidden;
overflow-y: auto;
position: relative;
}
</style>

19
src/views/category/fileNoFormat/module/sortDialog.vue

@ -4,8 +4,9 @@
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-table :data="sortTableData" class="sort" style="width: 100%;max-height: 70vh;" row-key="id">
<el-table-column type="index" label="序号" width="100" />
<i class="drag-tip">提示请通过拖动鼠标来调整当前顺序</i>
<el-table :data="sortTableData" class="fileno-format-sort" style="width: 100%;max-height: 70vh;" row-key="id">
<el-table-column type="index" label="序号" width="100" align="center" />
<el-table-column prop="ikFieldName" label="字段名称" />
</el-table>
<div slot="footer" class="dialog-footer">
@ -28,7 +29,6 @@ export default {
methods: {
//
rowDrop(className, targetName) {
console.log(1)
//
const tbody = document.querySelector('.' + className + ' .el-table__body-wrapper tbody')
const that = this
@ -42,14 +42,23 @@ export default {
})
},
opened() {
this.rowDrop('sort', 'sortTableData')
this.rowDrop('fileno-format-sort', 'sortTableData')
},
handleSort() {
this.sortVisible = false
this.$emit('doSort', this.sortTableData)
}
}
}
</script>
<style lang="scss" scoped>
.drag-tip {
display: block;
padding-left: 20px;
padding-bottom: 10px;
font-style: normal;
font-weight: bold;
color: #fff;
}
</style>

1
src/views/category/index.vue

@ -170,7 +170,6 @@ export default {
this.$refs.tree.updateKeyChildren(this.$refs.tree.getCurrentKey(), data)
},
toDelete(data) {
console.log(data.childMenus)
this.deleteData = data
this.deleteVisible = true
},

4
src/views/category/listBrowsing/module/form.vue

@ -101,7 +101,5 @@ export default {
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
}
</style>

2072
src/views/category/orderingRule/data1.json
File diff suppressed because it is too large
View File

142
src/views/category/orderingRule/data2.json

@ -1,56 +1,102 @@
{
"total":0,
"total":1,
"rows":[
{
"id":"a38da83350114b459ef3469340ffe577",
"ikFieldName":"全宗号",
"fieldYingName":"fonds_no",
"ikConnector":"-",
"ikSequence":1,
"ikFiledId":"3d6d548d30db426ea3d95d63f589b294",
"ikCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"ikInputClass":"easyui-combobox"
"id":"53e68102f0bc44a98704e478565cd414",
"fieldName":"archive_no",
"fieldCnName":"档号1",
"isDefaultValue":"",
"isDefaultValueType":"",
"isPattern":null,
"isPrecept":null,
"isDataType":1,
"isColumnLength":100,
"isMaxlength":null,
"isMinlength":null,
"isSequence":9,
"isType":4,
"isGlobal":null,
"isSystem":1,
"isAccede":null,
"isAutoaccountvalue":null,
"isOperate":null,
"isSearch":null,
"isCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"createTime":1502689066000,
"isOrder":1,
"isOrderSeq":1,
"isOrderType":"asc",
"isDisplay":1,
"isDisplayWidth":170,
"isDisplayOrder":2,
"isDisplayAlign":"center",
"isInputClass":"easyui-textbox",
"isInput":1,
"isInputLength":245,
"isFullrow":0,
"isRequired":0,
"isInherit":0,
"isIncrease":null,
"isAuto":1,
"isAutoField":0,
"isDosearchCard":1,
"isSupplement":0,
"isSupplementNum":null,
"isNoRepetition":1,
"isAdjust":0,
"isAdjustSeq":0,
"isAdjustWidth":0,
"isRelevance":null,
"relevanceSeq":null
},
{
"id":"c669f176ba80402d865f899b2976ffd8",
"ikFieldName":"归档年度",
"fieldYingName":"filing_year",
"ikConnector":"-",
"ikSequence":2,
"ikFiledId":"d173c2d2e6ab49e0a38e1c46343e69b1",
"ikCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"ikInputClass":"easyui-numberbox"
},
{
"id":"a61508d47433421a989fed6385facd17",
"ikFieldName":"机构(问题)",
"fieldYingName":"archive_ctg_no",
"ikConnector":"-",
"ikSequence":3,
"ikFiledId":"01b22836d0d1442094e2ecb78210306c",
"ikCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"ikInputClass":"easyui-combobox"
},
{
"id":"6dc035b5f60a4f4dba256e96877a9541",
"ikFieldName":"保管期限",
"fieldYingName":"retention",
"ikConnector":"-",
"ikSequence":4,
"ikFiledId":"ebc2ceda16ff40ebab0d3c82d2721002",
"ikCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"ikInputClass":"easyui-combobox"
},
{
"id":"3deb020b78dc4770b95b9b484e965f84",
"ikFieldName":"件号",
"fieldYingName":"piece_no",
"ikConnector":"",
"ikSequence":5,
"ikFiledId":"8a1700abf5c346fda9a3f898569039d3",
"ikCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"ikInputClass":"easyui-numberbox"
}
"id":"53e68102f0bc44a98704e478565cd415",
"fieldName":"archive_no",
"fieldCnName":"档号2",
"isDefaultValue":"",
"isDefaultValueType":"",
"isPattern":null,
"isPrecept":null,
"isDataType":1,
"isColumnLength":100,
"isMaxlength":null,
"isMinlength":null,
"isSequence":9,
"isType":4,
"isGlobal":null,
"isSystem":1,
"isAccede":null,
"isAutoaccountvalue":null,
"isOperate":null,
"isSearch":null,
"isCategoryId":"f88a8b3960ac476b8d94e63961bbeabe",
"createTime":1502689066000,
"isOrder":1,
"isOrderSeq":1,
"isOrderType":"asc",
"isDisplay":1,
"isDisplayWidth":170,
"isDisplayOrder":2,
"isDisplayAlign":"center",
"isInputClass":"easyui-textbox",
"isInput":1,
"isInputLength":245,
"isFullrow":0,
"isRequired":0,
"isInherit":0,
"isIncrease":null,
"isAuto":1,
"isAutoField":0,
"isDosearchCard":1,
"isSupplement":0,
"isSupplementNum":null,
"isNoRepetition":1,
"isAdjust":0,
"isAdjustSeq":0,
"isAdjustWidth":0,
"isRelevance":null,
"relevanceSeq":null
}
],
"footer":null,
"postparam":null

113
src/views/category/orderingRule/index.vue

@ -24,18 +24,36 @@
<el-button v-permission="permission.del" icon="el-icon-delete" size="mini" :loading="delAllLoading" :disabled="table.right.selections.length === 0" @click="toDelete(table.right.selections)">
删除
</el-button>
<el-button v-permission="permission.sort" icon="el-icon-sort" size="mini" :loading="sortLoading" :disabled="table.right.data <= 1" @click="toSort(table.right.data)">排序</el-button>
<el-button v-permission="permission.sort" icon="el-icon-sort" size="mini" :loading="sortLoading" :disabled="table.right.data <= 1" @click="toSort">排序</el-button>
</div>
<!--表格渲染-->
<el-table ref="rightTable" v-loading="table.right.loading" :data="table.right.data" style="min-width: 100%;" height="calc(100vh - 302px)" @selection-change="(val)=>selectionChangeHandler(val,'right')" @row-click="(row,column,e)=>clickRowHandler(row,column,e,'rightTable')">
<el-table-column type="selection" width="55" align="center" />
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="ikFieldName" label="显示字段" align="center" />
<el-table-column prop="ikConnector" label="排序方式" align="center" />
<el-table-column prop="fieldCnName" label="显示字段" align="center" />
<el-table-column label="排序方式" align="center">
<template slot-scope="scope">
<span v-if="scope.row.isOrderType === 'asc'">升序</span>
<span v-if="scope.row.isOrderType === 'desc'">降序</span>
</template>
</el-table-column>
</el-table>
<!--表单渲染-->
<eForm />
<eForm ref="cuform" />
</div>
<!--排序对话框组件-->
<sortDialog ref="sort" @doSort="doSort" />
<!--删除对话框组件-->
<el-dialog title="移除字段" :visible.sync="deleteVisible">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<p><span style="color:#fff;">确定要移除当前字段吗</span></p>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click.native="handleDelConfirm">确定</el-button>
</div>
</div>
</el-dialog>
</div>
</template>
@ -44,9 +62,10 @@
import data1 from './data1.json'
import data2 from './data2.json'
import eForm from './module/form'
import sortDialog from './module/sortDialog'
export default {
components: { eForm },
components: { eForm, sortDialog },
data() {
return {
permission: {
@ -55,7 +74,7 @@ export default {
del: ['admin', 'orderingRule:delete'],
sort: ['admin', 'orderingRule:sort']
},
// verifyDialogVisible: false,
deleteVisible: false,
// form: {
// verifyCode: ''
// },
@ -85,44 +104,17 @@ export default {
// }
// this.crud.toQuery()
// verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {}
this.table.left.data = data1.rows
this.table.right.data = data2.rows
this.getLeftTableData()
this.getRightTableData()
},
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
// }
// },
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('')
// }
// })
getLeftTableData() {
// verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {}
this.table.left.data = data1.rows
},
handleClose(done) {
this.form.verifyCode = ''
done()
getRightTableData() {
// verifyMaintenance(encrypt(this.form.verifyCode)).then((res) => {}
this.table.right.data = data2.rows
},
clickRowHandler(row, column, e, tableName) {
this.$refs[tableName].toggleRowSelection(row)
@ -131,12 +123,51 @@ export default {
this.table[tableName].selections = val
},
toAdd() {
this.$refs.cuform.formData.fields = this.table.left.selections
this.$refs.cuform.cuDialogVisible = true
},
toEdit() {
this.$refs.cuform.formData.fields = this.table.right.selections
this.$refs.cuform.cuDialogVisible = true
},
toDelete() {
this.deleteVisible = true
},
handleDelConfirm() {
this.deleteVisible = false
this.delAllLoading = true
// sort(encrypt(this.form.verifyCode)).then((res) => {
this.delAllLoading = false
this.$notify({
title: '删除成功',
type: 'success',
duration: 2500
})
this.getRightTableData()
this.getLeftTableData()
// }).catch(() => {
// this.delAllLoading = false
// })
},
toSort() {
// findSubsetById(data[0].id).then(res => {
this.$refs.sort.sortTableData = this.table.right.data
this.$refs.sort.sortVisible = true
// })
},
doSort(data) {
this.sortLoading = true
// sort(encrypt(this.form.verifyCode)).then((res) => {
this.sortLoading = false
this.$notify({
title: '保存成功',
type: 'success',
duration: 2500
})
this.getRightTableData()
// }).catch(() => {
// this.sortLoading = false
// })
}
}
}

119
src/views/category/orderingRule/module/form.vue

@ -1,107 +1,56 @@
<template>
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible="crud.status.cu > 0" :title="crud.status.title">
<el-dialog :close-on-click-modal="false" :visible.sync="cuDialogVisible" title="修改字段">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
<el-form-item label="中文名称" prop="fieldCnName">
<el-input v-model="form.fieldCnName" style="width: 370px;" />
</el-form-item>
<el-form-item label="字段标识" prop="fieldName">
<el-input v-model="form.fieldName" style="width: 370px;" />
</el-form-item>
<el-form-item label="数据类型" prop="isDataType">
<el-select v-model="form.isDataType" placeholder="请选择">
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
<el-form-item label="字段长度" prop="isColumnLength">
<el-input-number v-model="form.isColumnLength" controls-position="right" style="width: 370px;" />
</el-form-item>
<el-form-item label="默认值" prop="isDefaultValue">
<el-input v-model="form.isDefaultValue" style="width: 370px;" />
</el-form-item>
</el-form>
<div class="fields-list">
<el-form ref="form" :model="formData" size="small" label-width="75px">
<el-row v-for="(item, index) in formData.fields" :key="item.id" :gutter="10">
<el-col :span="13">
<el-form-item label="组成字段">
<el-input v-model="item.fieldCnName" :disabled="true" />
</el-form-item>
</el-col>
<el-col :span="10">
<el-form-item label="排序方式">
<el-radio-group>
<el-radio v-model="formData.fields[index].isOrderType" :label="asc">升序</el-radio>
<el-radio v-model="formData.fields[index].isOrderType" :label="desc">降序</el-radio>
</el-radio-group>
</el-form-item>
</el-col>
</el-row>
</el-form>
</div>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">
取消
</el-button>
<el-button :loading="crud.status.cu === 2" type="primary" @click="crud.submitCU">
确认
</el-button>
<el-button type="primary" @click="submitCU">保存</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import { form } from '@crud/crud'
const defaultForm = {
id: null,
fieldCnName: '',
fieldName: '',
isDataType: 1,
isColumnLength: 100,
isDefaultValue: ''
}
export default {
mixins: [form(defaultForm)],
data() {
var checkMaxLength = (rule, value, callback) => {
if (value !== undefined && (!Number.isInteger(value) || value <= 0)) {
callback(new Error('请输入正整数数字值'))
} else {
if (this.form.isDataType === 1 && value > 2000) {
callback(new Error('字符最大长度不能超过2000位'))
} else if (this.form.isDataType === 2 && value > 11) {
callback(new Error('数字最大长度不能超过11位'))
} else {
callback()
}
}
}
var checkFieldName = (rule, value, callback) => {
const reg = /^[A-Za-z][A-Za-z_]+[a-zA-Z]*$/
if (reg.test(value)) {
callback()
} else {
callback(new Error('字段标识只能由字母、字符“_”组成,并且必须以字母开头和结尾'))
}
}
return {
rules: {
fieldCnName: [
{ required: true, message: '请输入中文名称', trigger: 'blur' }
],
fieldName: [
{ required: true, message: '请选择字段标识', trigger: 'blur' },
{ validator: checkFieldName, trigger: 'blur' }
],
isDataType: [
{ required: true, message: '请选择数据类型', trigger: 'blur' }
],
isColumnLength: [
{ validator: checkMaxLength, trigger: 'blur' }
]
},
options: [
{
value: 1,
label: '字符'
},
{
value: 2,
label: '数字'
}
]
cuDialogVisible: false,
formData: {}
}
},
methods: {
submitCU() {
console.log(2)
// this.cuDialogVisible = false
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-input-number .el-input__inner {
text-align: left;
.fields-list {
max-height: calc(100vh - 312px);
overflow-x: hidden;
overflow-y: auto;
position: relative;
}
</style>

63
src/views/category/orderingRule/module/sortDialog.vue

@ -0,0 +1,63 @@
<template>
<!--表单组件-->
<el-dialog title="排序" :visible.sync="sortVisible" @opened="opened">
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<i class="drag-tip">提示请通过拖动鼠标来调整当前顺序</i>
<el-table :data="sortTableData" class="ordering-rule-sort" style="width: 100%;max-height: 70vh;" row-key="id">
<el-table-column type="index" label="序号" width="100" align="center" />
<el-table-column prop="fieldCnName" label="字段名称" />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click.native="handleSort">保存</el-button>
</div>
</div>
</el-dialog>
</template>
<script>
import Sortable from 'sortablejs'
export default {
data() {
return {
sortVisible: false,
sortTableData: []
}
},
methods: {
//
rowDrop(className, targetName) {
//
const tbody = document.querySelector('.' + className + ' .el-table__body-wrapper tbody')
const that = this
Sortable.create(tbody, {
//
draggable: '.el-table__row',
onEnd({ newIndex, oldIndex }) {
if (newIndex === oldIndex) return
that[targetName].splice(newIndex, 0, that[targetName].splice(oldIndex, 1)[0])
}
})
},
opened() {
this.rowDrop('ordering-rule-sort', 'sortTableData')
},
handleSort() {
}
}
}
</script>
<style lang="scss" scoped>
.drag-tip {
display: block;
padding-left: 20px;
padding-bottom: 10px;
font-style: normal;
font-weight: bold;
color: #fff;
}
</style>

15
src/views/category/sortDialog.vue

@ -4,8 +4,9 @@
<span class="dialog-right-top" />
<span class="dialog-left-bottom" />
<div class="setting-dialog">
<el-table :data="sortTableData" class="sort" style="width: 100%;max-height: 70vh;" row-key="id">
<el-table-column type="index" label="序号" width="100" />
<i class="drag-tip">提示请通过拖动鼠标来调整当前顺序</i>
<el-table :data="sortTableData" class="category-sort" style="width: 100%;max-height: 70vh;" row-key="id">
<el-table-column type="index" label="序号" width="100" align="center" />
<el-table-column prop="dicName" label="门类名称" />
</el-table>
<div slot="footer" class="dialog-footer">
@ -41,7 +42,7 @@ export default {
})
},
opened() {
this.rowDrop('sort', 'sortTableData')
this.rowDrop('category-sort', 'sortTableData')
},
handleSort() {
@ -51,4 +52,12 @@ export default {
</script>
<style lang="scss" scoped>
.drag-tip {
display: block;
padding-left: 20px;
padding-bottom: 10px;
font-style: normal;
font-weight: bold;
color: #fff;
}
</style>
Loading…
Cancel
Save