修改bug

This commit is contained in:
caoyang
2022-03-18 14:32:07 +08:00
parent 3279309a01
commit 9f98d9704d
6 changed files with 35 additions and 444 deletions
-231
View File
@@ -1,231 +0,0 @@
<template>
<div style="height: 100%">
<div class="box">
<a-table
class="table"
rowKey="id"
:row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
:pagination="false"
:scroll="{x: true}"
:data-source="dataSource"
:loading="loading"
:columns="columns"
@change="tableOnChange"
>
<span slot="detailClick" slot-scope="text,record">
<a class="text" :title="text" @click="detailClick(record)">
{{text && text.length > 18?text.slice(0,17)+'...':text}}
</a>
</span>
<span slot="operation" slot-scope="record">
<a class="text" v-for="(ol,index) in OperationList"
@click="OperationClick(ol,record)">
{{ol.text}}
</a>
</span>
</a-table>
</div>
<div class="page" v-if="dataSource.length > 0">
<a-pagination
:show-total="total => $t('total')+` ${total} ` +$t('strip')"
show-quick-jumper
show-size-changer
:page-size.sync="pageSize"
:total="total"
@change="onChange"
@showSizeChange="SizeChange"
/>
</div>
</div>
</template>
<script>
import eventBUs from '../../common/event'
import { getAction, postAction } from '@/api/manage'
export default {
name: 'coTable',
props: {
//接口
url: {
type: Object,
default: {}
},
// 操作按钮
OperationList: {
type: Array,
default: []
},
flag: {
type: String,
default: ''
},
//是否显示操作;默认不显示
showAction: {
type: Boolean,
default: false
}
},
data() {
return {
jsonBody: [],
checkboxList: [],
tableAll: false,
indeterminate: false,
columns: [],
selectedRowKeys: [],
dataSource: [],
pageNo: 1,
pageSize: 10,
total: 0,
searchParmes: {},
loading: false,
orderBy: '1',
orderByField: ''
}
},
mounted() {
eventBUs.$on('searchQuery', search => {
Object.keys(search).forEach(res => {
if (search[res] instanceof Array) {
search[res] = search[res].join(',')
}
})
this.searchParmes = search
this.getData()
this.getTableList()
})
eventBUs.$on('searchReset', target => {
this.searchParmes = {}
this.getData()
this.getTableList()
})
this.getData()
this.getTableList()
},
methods: {
getTextWith(text, fontStyle) {
var canvas = document.createElement('canvas')
var context = canvas.getContext('2d')
context.font = fontStyle || '14px' // 设置字体样式
var dimension = context.measureText(text)
return dimension.width + 70
},
getData() {
let params = {
flag: this.flag
}
getAction(this.url.tableHeader, params).then((res) => {
if (res.success) {
var jsonHead = res.result
this.columns = []
jsonHead.forEach((res, index) => {
this.columns.push({
title: res.db_field_txt,
dataIndex: res.db_field_name,
align: 'center',
ellipsis: true,
sorter: res.sort
})
if (res.click) {
this.columns[index].scopedSlots = {
customRender: 'detailClick'
}
} else {
this.columns[index].scopedSlots = {
customRender: 'detailText'
}
}
})
let width = 0
if (this.OperationList.length > 0) {
for (let i = 0; i < this.OperationList.length; i++) {
width += this.getTextWith(this.OperationList[i].text)
}
}
if (this.showAction) {
this.columns.push({
title: this.$t('operation'),
align: 'center',
fixed: 'right',
width: width,
scopedSlots: { customRender: 'operation' }
})
}
}
})
},
tableOnChange(pagination, filters, sorter) {
this.orderBy = sorter.order == 'ascend' ? '1' : '2'
this.orderByField = sorter.columnKey
this.getTableList()
},
getTableList() {
let pageNo = JSON.parse(JSON.stringify(this.pageNo))
let pageSize = JSON.parse(JSON.stringify(this.pageSize))
let params = {
...this.searchParmes,
orderBy: this.orderBy,
orderByField: this.orderByField,
pageNo: pageNo + '',
pageSize: pageSize + ''
}
this.loading = true
postAction(this.url.tableList, params).then((res) => {
if (res.success) {
this.dataSource = res.result.records
this.total = res.result.total
this.loading = false
} else {
this.loading = false
}
})
},
onChange(page, pageSize) {
this.pageNo = page
this.getTableList()
},
SizeChange(page, pageSize) {
this.pageNo = 1
this.pageSize = pageSize
this.getTableList()
},
onSelectChange(value) {
this.selectedRowKeys = value
this.$emit('onSelectChange', value)
},
OperationClick(ol, item) {
this.$emit(ol.ClickEvent, item)
},
detailClick(item, index) {
this.$emit('detailClick', item)
}
}
}
</script>
<style>
.table .ant-table-column-title {
font-weight: bold;
}
.ant-table td {
white-space: nowrap;
}
</style>
<style scoped>
.box {
width: 100%;
height: calc(100% - 100px);
overflow: auto;
}
.text {
margin-right: 10px;
}
.page {
text-align: right;
margin-top: 20px;
}
</style>
@@ -87,8 +87,8 @@
export default {
name: 'dicList',
components:{
listTable,
treeTable
ListTable,
TreeTable
},
props:{
dictVal:String,
@@ -416,7 +416,6 @@
<style lang="less" scoped>
.form-tag{
.tag-content{
margin-bottom: 30px;
}
}
.tag-info{
@@ -1,108 +0,0 @@
<template>
<div class="new-tag-drawer">
<onl-cgform-tag-form ref="realForm" @ok="submitCallback" :isTagContent="isTagContent" :editData="editData" :editId=editId :submitEdit="submitEdit" :disabled="disableSubmit" normal v-if="drawerVisible"> </onl-cgform-tag-form>
<div class="drawer-footer">
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">{{$t('preservation')}}</a-button>
<a-button @click="handleCancel" style="margin-bottom: 0;">{{$t('close')}}</a-button>
</div>
</div>
</template>
<script>
import OnlCgformTagForm from './OnlCgformTagForm'
export default {
name: 'newDrawer',
components: {
OnlCgformTagForm
},
data () {
return {
width:800,
visible: false,
disableSubmit: false
}
},
props:{
drawerVisible:Boolean,
isTagContent:Boolean,
editData:Object,
editId:String,
submitEdit:String,
},
mounted() {
this.visible=this.drawerVisible
},
methods: {
add () {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.add();
})
},
edit (record) {
this.visible=true
this.$nextTick(()=>{
this.$refs.realForm.edit(record);
});
},
close () {
this.$emit('close');
this.visible = false;
this.$emit('closeTag',this.visible)
},
submitCallback(){
this.$emit('ok');
this.visible = false;
this.$emit('closeTag',this.visible)
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.close()
}
}
}
</script>
<style lang="less" scoped>
.new-tag-drawer{
/** Button按钮间距 */
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
.drawer-footer{
position: absolute;
bottom: 0px;
width: 100%;
border-top: 1px solid #e8e8e8;
padding: 10px 16px;
text-align: right;
left: 0;
background: #fff;
border-radius: 0 0 2px 2px;
}
}
</style>
<style lang="less">
.new-tag-drawer{
.ant-spin-nested-loading{
.ant-spin-container{
.ant-form{
margin-bottom: 25px;
}
}
}
}
</style>
@@ -1,81 +0,0 @@
<template>
<div class="tag-form">
<a-form-model ref="form" :form="form" :rules="rules">
<div class="form-title">基本信息</div>
<a-divider dashed />
<a-form-model-item
:label-col="labelCol"
:wrapper-col="wrapperCol"
label="所属模块"
>
<a-select v-model="form.isModel" placeholder="请选择所属模块">
<a-select-option value="1">
文档库
</a-select-option>
<a-select-option value="2">
文档条款
</a-select-option>
</a-select>
</a-form-model-item>
<a-form-model-item
:label-col="labelCol"
:wrapper-col="wrapperCol"
label="属性名称"
>
<a-input placeholder="请输入属性名称" :maxLength="120" ></a-input>
</a-form-model-item>
<a-form-model-item>
<a-button type="primary" @click="onSubmit">
Create
</a-button>
</a-form-model-item>
</a-form-model>
</div>
</template>
<script>
export default {
name: 'tagForm',
data(){
return{
labelCol: {
xs: { span: 24 },
sm: { span: 5 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
form:{
isModel:''
},
rules:{
isModel:[
{ required: true, message: '请输入所属模块'},
]
}
}
},
mounted() {
},
methods:{
//提交表单
onSubmit() {
this.$refs.form.validate(valid => {
if (valid) {
alert('submit!');
} else {
console.log('error submit!!');
return false;
}
});
},
}
}
</script>
<style scoped>
</style>
@@ -39,7 +39,15 @@
</div>
</div>
<a-drawer class="show-drawer" :title="titleTag" placement="right" width="1000px" @close="close" :visible="drawerVisible" :after-visible-change="afterVisibleChange" >
<new-drawer v-if="drawerVisible&&editFlag" :drawerVisible="drawerVisible" :isTagContent="isTagContent" :editData="editData" :editId="editId" :submitEdit="submitEdit" @closeTag="closeTag" ></new-drawer>
<div class="new-tag-drawer">
<tag-form v-if="drawerVisible&&editFlag" ref="realForm" @ok="closeTag" :isTagContent="isTagContent" :editData="editData" :editId=editId :submitEdit="submitEdit" :disabled="disableSubmit" normal> </tag-form>
<div class="drawer-footer" v-if="drawerVisible&&editFlag">
<a-button v-if="!disableSubmit" @click="handleOk" type="primary" style="margin-bottom: 0;">{{$t('preservation')}}</a-button>
<a-button @click="handleCancel" style="margin-bottom: 0;">{{$t('close')}}</a-button>
</div>
</div>
</a-drawer>
<a-modal class="show-area" v-model="areaVisible" :title="$t('ExhibitionAreaManagement')" :footer="null" @cancel="hideModal">
<area-manage v-if="areaVisible" @diaHide="diaHide" @submitOk="submitOk" @deleteOk="deleteOk" @updateOk="updateOk"></area-manage>
@@ -64,14 +72,14 @@
import JInput from '@/components/jero/JInput'
import TabTable from './TabTable'
import AreaManage from '../dialog/AreaManage'
import newDrawer from '../dialog/newDrawer'
import TagForm from '../dialog/TagForm'
export default {
name: 'tagItem',
components:{
JInput,
TabTable,
AreaManage,
newDrawer
TagForm
},
data(){
return{
@@ -144,23 +152,15 @@
total:0,
type:'input',
ids:[],
disableSubmit:false,
selectedRowKey:[]
}
},
mounted() {
this.loadData(1)
this.loadShowArea()
// this.getHeader()
},
methods:{
getHeader(){
// getAction(`tag/onlCgformTag/getHeader`,{flag:3}).then(res=>{
//
// })
// getAction(`tag/onlCgformTag/queryCondition`,{flag:3}).then(res=>{
//
// })
},
//获取展示区域
loadShowArea(){
let params = {};
@@ -375,20 +375,11 @@
if(val=='input'){
this.typeVisible=false
this.isTagContent=false
// this.getFormCon()
} else if(val='select'){
this.typeVisible=false
this.isTagContent=true
}
},
//获取表单内容
getFormCon(){
getAction(`tag/onlCgformTag/list`, { }).then(res=>{
if(res.success){
}
})
},
//接收查询条件
queryParams(val){
this.queryParam.pageNo=val.pageNo
@@ -399,6 +390,13 @@
this.loadData(0)
}
},
handleOk () {
this.$refs.realForm.submitForm();
},
handleCancel () {
this.drawerVisible=false
this.close()
}
}
}
@@ -415,6 +413,20 @@
cursor: pointer;
}
}
.new-tag-drawer{
.drawer-footer{
height: 32px;
display: flex;
justify-content: center;
.ant-btn {
margin-left: 30px;
margin-bottom: 30px;
float: right;
}
}
}
</style>
<style lang="less">