【update】标签管理修改成jtable

This commit is contained in:
fengchenchen
2023-08-25 17:22:05 +08:00
parent 91a649d1fe
commit 59e68f795b
8 changed files with 74 additions and 96 deletions
+2 -4
View File
@@ -151,10 +151,8 @@ export const SimpleListMixin = {
this.$message.warning('请选择一条记录!') this.$message.warning('请选择一条记录!')
return return
} }
let ids = ''
for (let a = 0; a < this.selectedRowKeys.length; a++) { const ids = this.selectedRowKeys.join()
ids += this.selectedRowKeys[a] + ','
}
const that = this const that = this
this.$confirm({ this.$confirm({
title: '确认删除', title: '确认删除',
-1
View File
@@ -311,7 +311,6 @@ export default {
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'center', align: 'center',
width: 170 width: 170
+6 -3
View File
@@ -119,12 +119,15 @@ export default {
this.model.dictCode = (this.model.dictCode || '').trim() this.model.dictCode = (this.model.dictCode || '').trim()
this.model.description = (this.model.description || '').trim() this.model.description = (this.model.description || '').trim()
let obj let obj
const formData = Object.assign({}, this.model)
if (!this.model.id) { if (!this.model.id) {
obj = addDict(this.model) obj = addDict
} else { } else {
obj = editDict(this.model) obj = editDict
} }
obj.then((res) => { // 重要,设置为数据字典内容
formData.isTagDict = 0
obj(formData).then((res) => {
if (res.success) { if (res.success) {
that.$message.success(res.message) that.$message.success(res.message)
that.$emit('ok') that.$emit('ok')
@@ -119,7 +119,6 @@ export default {
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'left', align: 'left',
width: 60 width: 60
@@ -41,13 +41,13 @@
</div> </div>
</div> </div>
<a-table <j-table
ref="table" ref="table"
can-drag
:class="{'tree-table': attributeType === TagsAttributeTypeEnums.TREE.value}" :class="{'tree-table': attributeType === TagsAttributeTypeEnums.TREE.value}"
:bordered="true" :bordered="true"
size="middle" size="middle"
rowKey="id" rowKey="id"
:components="drag(columns,'columns')"
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="attributeType === TagsAttributeTypeEnums.TREE.value ? false : ipagination" :pagination="attributeType === TagsAttributeTypeEnums.TREE.value ? false : ipagination"
@@ -55,18 +55,11 @@
:scroll="{x: '100%'}" :scroll="{x: '100%'}"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"> @change="handleTableChange">
<template slot="text" slot-scope="text"> <div slot="action" class="table-action" slot-scope="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
<div slot="action" class="table-action" slot-scope="text, record">
<a class="action-edit" @click="handleEdit(record)">{{ $t('edit') }}</a> <a class="action-edit" @click="handleEdit(record)">{{ $t('edit') }}</a>
<a class="table-del" @click="handleDelete(record.id)">{{ $t('delete') }}</a> <a class="table-del" @click="handleDelete(record.id)">{{ $t('delete') }}</a>
</div> </div>
</a-table> </j-table>
</div> </div>
<tag-content-dict-item-modal ref="modalForm" :attribute-type="attributeType" @ok="modalFormOk"></tag-content-dict-item-modal> <tag-content-dict-item-modal ref="modalForm" :attribute-type="attributeType" @ok="modalFormOk"></tag-content-dict-item-modal>
</a-drawer> </a-drawer>
@@ -74,24 +67,24 @@
<script> <script>
import '@assets/less/common.less' import '@assets/less/common.less'
import { ResizeColumnProvide, ResizeHeader } from '../../../../mixins/header'
import TagContentDictItemModal from './TagContentDictItemModal' import TagContentDictItemModal from './TagContentDictItemModal'
import { SimpleListMixin } from '../../../../mixins/SimpleListMixin' import { SimpleListMixin } from '../../../../mixins/SimpleListMixin'
import { TagsAttributeTypeEnums } from '../../../../enums/commonEnums' import { TagsAttributeTypeEnums } from '../../../../enums/commonEnums'
import JTable from '../../../../components/jero/JTable'
export default { export default {
name: 'TagContentDictListDrawer', name: 'TagContentDictListDrawer',
mixins: [SimpleListMixin, ResizeHeader, ResizeColumnProvide], mixins: [SimpleListMixin],
components: { components: {
// JDictSelectTag TagContentDictItemModal,
TagContentDictItemModal JTable
}, },
data () { data () {
return { return {
TagsAttributeTypeEnums, TagsAttributeTypeEnums,
visible: false, visible: false,
title: this.$t('system.tag.dictionaryConfiguration'), title: this.$t('system.tag.dictionaryConfiguration'),
width: 800, width: 1000,
confirmLoading: false, confirmLoading: false,
commonColumns: [ commonColumns: [
{ {
@@ -122,7 +115,6 @@ export default {
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'left', align: 'left',
width: 170 width: 170
@@ -135,7 +127,9 @@ export default {
key: 'itemText', key: 'itemText',
align: 'left', align: 'left',
ellipsis: true, ellipsis: true,
width: 150 width: 150,
// 必须增加 为了过滤掉组件本身的插槽
scopedSlots: { customRender: '' }
} }
], ],
listColumn: [ listColumn: [
@@ -31,12 +31,12 @@
</div> </div>
</div> </div>
<a-table <j-table
ref="table" ref="table"
:bordered="true" :bordered="true"
size="middle" size="middle"
rowKey="id" rowKey="id"
:components="drag(columns,'columns')" can-drag
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
@@ -57,22 +57,24 @@
<a class="table-del" v-if="record.isReadOnly===2 || record.isReadOnly===0" v-has="'tag:logicDelete'" @click="handleDelete(record.id)" <a class="table-del" v-if="record.isReadOnly===2 || record.isReadOnly===0" v-has="'tag:logicDelete'" @click="handleDelete(record.id)"
>{{ $t('delete') }}</a> >{{ $t('delete') }}</a>
</div> </div>
</a-table> </j-table>
<clause-splitting-drawer ref="modalForm" v-bind="$props" @ok="modalFormOk"></clause-splitting-drawer> <clause-splitting-drawer ref="modalForm" v-bind="$props" @ok="modalFormOk"></clause-splitting-drawer>
</div> </div>
</template> </template>
<script> <script>
import { ResizeColumnProvide, ResizeHeader } from '../../../../mixins/header' import '@assets/less/common.less'
import ClauseSplittingDrawer from '../modules/ClauseSplittingDrawer' import ClauseSplittingDrawer from '../modules/ClauseSplittingDrawer'
import { SimpleListMixin } from '../../../../mixins/SimpleListMixin' import { SimpleListMixin } from '../../../../mixins/SimpleListMixin'
import JTable from '../../../../components/jero/JTable'
export default { export default {
name: 'ClauseSplittingList', name: 'ClauseSplittingList',
mixins: [SimpleListMixin, ResizeHeader, ResizeColumnProvide], mixins: [SimpleListMixin],
components: { components: {
ClauseSplittingDrawer ClauseSplittingDrawer,
JTable
}, },
props: { props: {
type: { type: {
@@ -124,7 +126,6 @@ export default {
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'left', align: 'left',
width: 170 width: 170
+31 -41
View File
@@ -1,7 +1,6 @@
<!-- 国内法规--> <!-- 国内法规-->
<template> <template>
<div> <div>
{{$props}}--{{type}}
<div class="table-page-search-wrapper"> <div class="table-page-search-wrapper">
<a-form layout="inline" @keyup.enter.native="searchQuery"> <a-form layout="inline" @keyup.enter.native="searchQuery">
<a-row :gutter="24"> <a-row :gutter="24">
@@ -47,33 +46,24 @@
</div> </div>
<div> <div>
<a-table <j-table
ref="table"
:bordered="true"
size="middle"
rowKey="id" rowKey="id"
:components="drag(columns,'columns')" can-drag
:columns="columns" :columns="columns"
:dataSource="dataSource" :dataSource="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading"
:scroll="{x: '100%'}" :scroll="{x: '100%'}"
:rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}" :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
@change="handleTableChange"> @change="handleTableChange"
<template slot="text" slot-scope="text"> >
<a-tooltip overlay-class-name="tooltip-style"> <!--todo 需要查看下是否有这个字段并且看一下判断是否必然-->
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template> <div slot="action" class="table-action" slot-scope="{text, record}">
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
<!--TODO 需要查看下是否有这个字段并且看一下判断是否必然-->
<div slot="action" class="table-action" slot-scope="text, record">
<a class="action-edit" @click="handleEdit(record)" v-if="record.isReadOnly===0" v-has="'tag:edit'" <a class="action-edit" @click="handleEdit(record)" v-if="record.isReadOnly===0" v-has="'tag:edit'"
>{{ $t('edit') }}</a> >{{ $t('edit') }}</a>
<a class="table-del" v-if="record.isReadOnly===2 || record.isReadOnly===0" v-has="'tag:logicDelete'" @click="handleDelete(record.id)" <a class="table-del" v-if="record.isReadOnly===2 || record.isReadOnly===0" v-has="'tag:logicDelete'" @click="handleDelete(record.id)"
>{{ $t('delete') }}</a> >{{ $t('delete') }}</a>
</div> </div>
</a-table> </j-table>
</div> </div>
<!--新增字段--> <!--新增字段-->
<standard-drawer ref="modalForm" v-bind="$props" @ok="modalFormOk"></standard-drawer> <standard-drawer ref="modalForm" v-bind="$props" @ok="modalFormOk"></standard-drawer>
@@ -84,19 +74,20 @@
<script> <script>
import { getShowAreaData } from '../../../../api/api' import { getShowAreaData } from '../../../../api/api'
import { ResizeColumnProvide, ResizeHeader } from '../../../../mixins/header'
import '@assets/less/common.less' import '@assets/less/common.less'
import StandardDrawer from '../modules/StandardDrawer' import StandardDrawer from '../modules/StandardDrawer'
import AreaModal from '../modules/AreaModal' import AreaModal from '../modules/AreaModal'
import { SimpleListMixin } from '../../../../mixins/SimpleListMixin' import { SimpleListMixin } from '../../../../mixins/SimpleListMixin'
import JTable from '../../../../components/jero/JTable'
export default { export default {
name: 'StandardList', name: 'StandardList',
mixins: [SimpleListMixin, ResizeHeader, ResizeColumnProvide], mixins: [SimpleListMixin],
components: { components: {
StandardDrawer, StandardDrawer,
AreaModal AreaModal,
JTable
}, },
props: { props: {
type: { type: {
@@ -120,46 +111,45 @@ export default {
columns: [ columns: [
{ {
title: this.$t('system.tag.attributeName'), title: this.$t('system.tag.attributeName'),
align: 'left', width: 170,
width: 100, dataIndex: 'dbFieldTxt',
dataIndex: 'dbFieldTxt' scopedSlots: { customRender: 'text' }
}, },
{ {
title: this.$t('system.tag.attributeNameEnglish'), title: this.$t('system.tag.attributeNameEnglish'),
align: 'left', width: 170,
width: 100, dataIndex: 'dbFieldEnName',
dataIndex: 'dbFieldEnName' scopedSlots: { customRender: 'text' }
}, },
{ {
title: this.$t('system.tag.attributeType'), title: this.$t('system.tag.attributeType'),
align: 'left', width: 170,
width: 100, dataIndex: 'fieldShowType_dictText',
dataIndex: 'fieldShowTypeName' scopedSlots: { customRender: 'text' }
}, },
{ {
title: this.$t('system.tag.fieldLength'), title: this.$t('system.tag.fieldLength'),
align: 'left', width: 170,
width: 80, dataIndex: 'dbLength',
dataIndex: 'dbLength' scopedSlots: { customRender: 'text' }
}, },
{ {
title: this.$t('system.tag.displayOrder'), title: this.$t('system.tag.displayOrder'),
align: 'left', width: 170,
width: 80, dataIndex: 'orderNum',
dataIndex: 'orderNum' scopedSlots: { customRender: 'text' }
}, },
{ {
title: this.$t('system.tag.showArea'), title: this.$t('system.tag.showArea'),
align: 'left', width: 170,
width: 80, dataIndex: 'showArea_dictText',
dataIndex: 'showAreaName' scopedSlots: { customRender: 'text' }
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'left', align: 'center',
width: 170 width: 150
} }
] ]
} }
+15 -21
View File
@@ -39,10 +39,10 @@
</div> </div>
</div> </div>
<a-table <j-table
class="tag-con-table" class="tag-con-table"
rowKey="id" rowKey="id"
:components="drag(columns,'columns')" can-drag
:data-source="dataSource" :data-source="dataSource"
:pagination="ipagination" :pagination="ipagination"
:loading="loading" :loading="loading"
@@ -51,21 +51,13 @@
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
@change="handleTableChange" @change="handleTableChange"
> >
<template slot="text" slot-scope="text"> <div slot="action" class="table-action" slot-scope="{text, record}">
<a-tooltip overlay-class-name="tooltip-style">
<template slot="title">{{ text || text === 0 ? text : global.emptyLine }}</template>
<div class="table-text">{{ text || text === 0 ? text : global.emptyLine }}</div>
</a-tooltip>
</template>
<div slot="action" class="table-action" slot-scope="text, record">
<a class="action-dict" @click="editDictItem(record)">{{ $t('system.tag.dictionaryConfiguration') }}</a> <a class="action-dict" @click="editDictItem(record)">{{ $t('system.tag.dictionaryConfiguration') }}</a>
<!--v-if="record.id != '1635543933669818369'" v-has="'dict:edit'"-->
<a class="action-edit" @click="handleEdit(record)">{{ $t('edit') }}</a> <a class="action-edit" @click="handleEdit(record)">{{ $t('edit') }}</a>
<!--v-if="record.id != '1635543933669818369'" v-has="'dict:logicDelete'"--> <a class="action-delete" href="javascript:;" @click="handleDelete(record.id)"
<a class="action-delete" href="javascript:;" @click="handleDelete(record)"
>{{ $t('delete') }}</a> >{{ $t('delete') }}</a>
</div> </div>
</a-table> </j-table>
<!-- 新增编辑 --> <!-- 新增编辑 -->
<tag-content-modal ref="modalForm" @ok="modalFormOk"></tag-content-modal> <tag-content-modal ref="modalForm" @ok="modalFormOk"></tag-content-modal>
@@ -77,19 +69,20 @@
<script> <script>
import '@assets/less/common.less' import '@assets/less/common.less'
import { ResizeColumnProvide, ResizeHeader } from '../../../../mixins/header'
import TagContentModal from '../modules/TagContentModal' import TagContentModal from '../modules/TagContentModal'
import TagContentDictListDrawer from '../modules/TagContentDictListDrawer' import TagContentDictListDrawer from '../modules/TagContentDictListDrawer'
import JDictSelectTag from '../../../../components/dict/JDictSelectTag' import JDictSelectTag from '../../../../components/dict/JDictSelectTag'
import { SimpleListMixin } from '../../../../mixins/SimpleListMixin' import { SimpleListMixin } from '../../../../mixins/SimpleListMixin'
import JTable from '../../../../components/jero/JTable'
export default { export default {
name: 'TagContent', name: 'TagContent',
mixins: [SimpleListMixin, ResizeHeader, ResizeColumnProvide], mixins: [SimpleListMixin],
components: { components: {
TagContentModal, TagContentModal,
TagContentDictListDrawer, TagContentDictListDrawer,
JDictSelectTag JDictSelectTag,
JTable
}, },
data () { data () {
return { return {
@@ -98,8 +91,8 @@ export default {
title: this.$t('system.tag.labelName'), title: this.$t('system.tag.labelName'),
dataIndex: 'dictName', dataIndex: 'dictName',
key: 'dictName', key: 'dictName',
align: 'left', // align: 'left',
ellipsis: true, // ellipsis: true,
width: 100, width: 100,
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, },
@@ -115,7 +108,7 @@ export default {
align: 'left', align: 'left',
dataIndex: 'description', dataIndex: 'description',
ellipsis: true, ellipsis: true,
width: 300, width: 200,
scopedSlots: { customRender: 'text' } scopedSlots: { customRender: 'text' }
}, },
{ {
@@ -127,7 +120,6 @@ export default {
}, },
{ {
title: this.$t('operation'), title: this.$t('operation'),
dataIndex: 'action',
scopedSlots: { customRender: 'action' }, scopedSlots: { customRender: 'action' },
align: 'left', align: 'left',
width: 170 width: 170
@@ -135,7 +127,9 @@ export default {
], ],
// dataSource: [], // dataSource: [],
url: { url: {
list: 'sys/dict/tagDictPage' list: 'sys/dict/tagDictPage',
delete: 'sys/dict/delete',
deleteBatch: 'sys/dict/deleteBatch'
}, },
// 增加其他的查询条件 // 增加其他的查询条件
filters: { filters: {