修改bug

This commit is contained in:
caoyang
2022-03-11 18:05:52 +08:00
parent ce3400ad0c
commit 980eee9723
13 changed files with 322 additions and 96 deletions
@@ -243,6 +243,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.loadData()
},
//选择框
@@ -125,7 +125,8 @@
// getAddForm: 'ocr/ocrRecord/getForm', // 表单的字段
// addInfo: 'ocr/OcrRestful/addOcrRecord', //新增
},
rowId:''
rowId:'',
rows:[]
}
},
mounted() {
@@ -165,8 +166,8 @@
this.$message.warning(this.$t('OnlyOneSelected'))
}else{
this.rowId=rowKeys[0]
this.rows=rows[0]
}
this.rows=[...rows]
},
//点击页数
onChangePage(page,pageSize){
@@ -176,34 +177,38 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.loadData()
},
//导入按钮
tableExport(){
if(this.rows.length>1){
if(this.rows&&this.rows.length>1){
this.$message.warning(this.$t('OnlyOneSelected'))
}else {
if(this.rows.file_name){
let name = this.rows.file_name.split('.')
}else if(this.rows==undefined){
this.$message.warning(this.$t('selectLeastOne'))
}else if(this.rows&&this.rows.length==1){
let file=this.rows[0]
if(file.file_name){
let name = file.file_name.split('.')
let nameSuffix=name[name.length-1]
if(nameSuffix.toLowerCase()=='pdf'){
let params = {
attId: this.rows.id,
standName: this.rows.title,
standNumber: this.rows.serial_number,
connectId:this.rows.connect_id
attId: file.id,
standName: file.title,
standNumber: file.serial_number,
connectId:file.connect_id
}
if(this.rows.text_info=='发布稿(必读)'){
if(file.text_info=='发布稿(必读)'){
params.fileType='1'
}else if(this.rows.text_info=='增补件(必读)'){
}else if(file.text_info=='增补件(必读)'){
params.fileType='2'
}else if(this.rows.text_info=='报批稿'){
}else if(file.text_info=='报批稿'){
params.fileType='3'
}else if(this.rows.text_info=='征求意见稿'){
}else if(file.text_info=='征求意见稿'){
params.fileType='4'
}else if(this.rows.text_info=='测试程序'){
}else if(file.text_info=='测试程序'){
params.fileType='5'
}else if(this.rows.text_info=='相关资料'){
}else if(file.text_info=='相关资料'){
params.fileType='6'
}
postAction(`ocr/OcrRestful/addOcrRecord`, params).then(res => {
@@ -266,6 +266,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.$emit('queryParams',this.queryParams)
},
//回传至文档库
@@ -180,6 +180,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.loadData()
},
cancleImports(){
@@ -149,6 +149,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.loadData()
},
cancelSplit(){
@@ -4,7 +4,7 @@
<div class="split-detail-wrap">
<div class="split-detail-left">
<div class="split-detail-left-tree">
<a-input-search style="margin-bottom: 8px" placeholder="Search" @change="onChange" />
<a-input-search style="margin-bottom: 8px" :placeholder="$t('NodeQuickLookup')" @change="onLeftChange" @search="onSearch" />
<a-tree
v-if="gData.length>0"
:expanded-keys="expandedKeys"
@@ -15,9 +15,7 @@
>
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substr(0, title.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>
{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
{{ title.substr(0, title.indexOf(searchValue)) }}<span style="color: #f50">{{ searchValue }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
</template>
@@ -90,6 +88,9 @@
</div>
<div class="split-detail-table">
<a-table bordered :data-source="tableData" :columns="columns" rowKey="id" :row-selection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }" :pagination="false" :loading="loading" class="tag-con-table">
<template slot="clauseContent" slot-scope="text, record">
<a class="content-show" href="javascript:;" :title="record.serialContent" @click="showContent">{{record.serialContent}}</a>
</template>
<template slot="action" slot-scope="text, record">
<a class="action-edit" href="javascript:;" @click="onEdit(record)">{{$t('edit')}}</a>
<a class="action-delete" href="javascript:;" @click="onCancel(record)">{{$t('delete')}}</a>
@@ -110,6 +111,15 @@
</div>
</div>
</div>
<a-modal
:title="$t('clauseContent')"
:visible="contentVisible"
:confirm-loading="confirmLoading"
:footer="false"
@cancel="handleCancel"
>
<p>{{contentValue}}</p>
</a-modal>
<splitAddForm v-if="addVisible" :addVisible="addVisible" @closeVisible="closeVisible"></splitAddForm>
<upload ref="uploadSplit" @uploadSuccess="uploadSuccess"></upload>
</div>
@@ -129,6 +139,7 @@
},
data() {
return {
contentVisible:false, //条款内容弹框显示
queryParams:{
pageNo:1,
pageSize:10
@@ -138,7 +149,7 @@
{
serialNumber:'001',
serialName:'条款001',
serialContent:'12. 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米; 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米;',
serialContent:'12. 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米; 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米;12. 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米; 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米;',
functionArea:'aaa',
tecArea:'bbb'
}
@@ -148,6 +159,7 @@
searchValue: '',
autoExpandParent: true,
dataList: [],
contentValue:'12. 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米; 附加光反射器,可以是贴纸,具有以下规格: a) 正面左右两侧呈白色或淡黄色; b) 背面左右两侧呈红色; c) 防护板下面是白色;和 d) 高至少400(四百)毫米和宽至少100(一百)毫米;',
gData: [
{
title: '总目录',
@@ -156,20 +168,22 @@
{
title: '第一条 替代品',
key: '0-0-0',
children: [
{ title: '0-0-0-0', key: '0-0-0-0' },
{ title: '0-0-0-1', key: '0-0-0-1' },
{ title: '0-0-0-2', key: '0-0-0-2' },
],
},
{
title: '第二条',
key: '0-0-1',
children: [
{ title: '0-0-1-0', key: '0-0-1-0' },
{ title: '0-0-1-1', key: '0-0-1-1' },
{ title: '0-0-1-2', key: '0-0-1-2' },
],
},
{
title: '第三条',
key: '0-0-2',
},
{
title: '第四条',
key: '0-0-3',
},
{
title: '第五条',
key: '0-0-4',
},
],
}
@@ -194,7 +208,7 @@
dataIndex: 'serialContent',
key: 'serialContent',
align: "center",
scopedSlots: {customRender: 'clauseContent'},
},
{
title: this.$t('functionalAreas'),
@@ -218,13 +232,24 @@
],
addVisible:false,
attId:'',
data:[],
confirmLoading:false,
}
},
mounted() {
this.loadMenuData()
this.generateList(this.gData);
},
methods: {
//显示条款内容弹框
showContent(){
this.contentVisible=true
},
//关闭条款内容弹框
handleCancel(){
this.contentVisible = false;
},
generateList(data){
for (let i = 0; i < data.length; i++) {
const node = data[i];
@@ -254,7 +279,7 @@
this.expandedKeys = expandedKeys;
this.autoExpandParent = false;
},
onChange(e) {
onLeftChange(e) {
const value = e.target.value;
const expandedKeys = this.dataList
.map(item => {
@@ -269,9 +294,20 @@
searchValue: value,
autoExpandParent: true,
})
this.$set(this,'autoExpandParent',true)
this.onSearch()
},
//获取左侧目录数据
loadMenuData(){
let params={
console.log('this',this)
}
// this.loading=true
getAction(`sys/category/getSysCategoryTree`, params).then(res => {
if (res.success) {
this.data = [...res.result]
this.gData = [...this.data]
}
})
},
//获取列表数据
loadData(){
@@ -403,8 +439,107 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo = 1
this.loadData()
},
onSearch() {
let self = this;
let tree = JSON.parse(JSON.stringify(this.data))
this.expandedKeys=[]
if (this.searchValue.trim() == "") {
this.gData=JSON.parse(JSON.stringify(this.data))
return;
}
if (tree && tree.length > 0) {
tree.forEach((n, i, a) => {
self.searchEach(n,this.searchValue);
});
// 没有叶子节点的根节点也要清理掉
let length = tree.length;
for (let i = length - 1; i >= 0; i--) {
let e2 = tree[i];
if (!this.isHasChildren(e2) && e2.title.indexOf(this.searchValue) <= -1) {
tree.splice(i, 1);
this.expandedKeys.push(e2.key)
}
}
this.gData=[...tree]
}
},
searchEach(node, value) {
let depth = this.getTreeDepth(node);
let self = this;
for (let i = 0; i < depth - 1; i++) {
let spliceCounter = 0;
this.traverseTree(node, n => {
if (self.isHasChildren(n)) {
let children = n.children;
let length = children.length;
for (let j = length - 1; j >= 0; j--) {
let e3 = children[j];
if (!self.isHasChildren(e3) && e3.title.indexOf(value) <= -1) {
children.splice(j, 1);
spliceCounter++;
}else{
this.expandedKeys.push(e3.key)
}
}
}
});
if (spliceCounter == 0) {
break;
}
}
},
// 判断树形结构中的一个节点是否具有孩子节点
isHasChildren(node){
let flag = false;
if (node.children && node.children.length > 0) {
flag = true;
}
return flag;
},
// 通过传入根节点获得树的深度
getTreeDepth(node){
if (undefined == node || null == node) {
return 0;
}
let r = 0;
let currentLevelNodes = [node];
while(currentLevelNodes.length > 0){
r++;
let nextLevelNodes = new Array();
for(let i = 0; i < currentLevelNodes.length; i++) {
let e = currentLevelNodes[i];
if (this.isHasChildren(e)) {
nextLevelNodes = nextLevelNodes.concat(e.children);
}
}
currentLevelNodes = nextLevelNodes;
}
return r;
},
traverseTree(node, callback) {
if (!node) {
return;
}
let stack = [];
stack.push(node);
let tmpNode;
while (stack.length > 0) {
tmpNode = stack.pop();
callback(tmpNode);
if (tmpNode.children && tmpNode.children.length > 0) {
for (let i = tmpNode.children.length - 1; i >= 0; i--) {
stack.push(tmpNode.children[i]);
}
}
}
},
}
}
</script>
@@ -416,7 +551,7 @@
display: flex;
justify-content: space-between;
.split-detail-left{
width: 260px;
min-width: 260px;
padding-right: 20px;
border-right: 1px solid #666666;
}
@@ -433,6 +568,15 @@
.action-edit{
margin-right: 20px;
}
.content-show{
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 3;
-webkit-box-orient: vertical;
height: 60px;
line-height: 20px;
}
.page{
text-align: right;
}
@@ -253,6 +253,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.loadData()
},
//选择框
@@ -14,8 +14,8 @@
v-if="treeData && treeData.length"
v-model="checkedKeys"
checkable
:autoExpandParent="autoExpandParent"
:expanded-keys="expandedKeys"
:auto-expand-parent="autoExpandParent"
:defaultExpandAll="true"
:tree-data="treeData"
:selected-keys="selectedKeys"
@@ -24,10 +24,8 @@
>
<template slot="title" slot-scope="{ title }">
<span v-if="title.indexOf(searchValue) > -1">
{{ title.substr(0, title.indexOf(searchValue)) }}
<span style="color: #f50">{{ searchValue }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span>
<span v-else>{{ title }}</span>
{{ title.substr(0, title.indexOf(searchValue)) }}<span style="color: #f50">{{ searchValue }}</span>{{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
</span><span v-else>{{ title }}</span>
</template>
</a-tree>
</a-modal>
@@ -59,7 +57,7 @@
},
watch: {
checkedKeys(val) {
console.log('onCheck', val);
// console.log('onCheck', val);
},
},
mounted() {
@@ -68,74 +66,139 @@
this.visible=this.subVisible
this.generateList(this.treeData)
},
methods:{
methods: {
//获取数据
loadData(){
let params = {
}
getAction(`sys/category/getSysCategoryTree`,params).then(res=> {
if(res.success){
console.log('result',res.result)
this.data=[...res.result]
this.treeData1=[...this.addAttr(this.data)]
this.treeData=[...this.treeData1]
loadData() {
let params = {}
getAction(`sys/category/getSysCategoryTree`, params).then(res => {
if (res.success) {
this.data = [...res.result]
// let attDate=this.addAttr(this.data)
// this.treeData1 = [...attDate]
this.treeData = [...this.data]
// console.log('treeData',this.treeData)
}
})
},
onSearch(){
// this.treeData=[]
// this.treeData=this.getSearch(this.data)
// this.getSearch(this.searchValue,this.treeData1)
onSearch() {
let self = this;
let tree = JSON.parse(JSON.stringify(this.data))
this.expandedKeys=[]
if (this.searchValue.trim() == "") {
this.treeData=JSON.parse(JSON.stringify(this.data))
return;
}
if (tree && tree.length > 0) {
tree.forEach((n, i, a) => {
self.searchEach(n,this.searchValue);
});
// 没有叶子节点的根节点也要清理掉
let length = tree.length;
for (let i = length - 1; i >= 0; i--) {
let e2 = tree[i];
if (!this.isHasChildren(e2) && e2.title.indexOf(this.searchValue) <= -1) {
tree.splice(i, 1);
this.expandedKeys.push(e2.key)
}
}
this.treeData=[...tree]
}
},
//获取用户的订阅
getSubscribtion(){
postAction(`domain/domainUserRel/queryList`,{}).then(res=> {
if(res.success){
let ids=[]
let data=res.result
data.forEach(res=>{
getSubscribtion() {
postAction(`domain/domainUserRel/queryList`, {}).then(res => {
if (res.success) {
let ids = []
let data = res.result
data.forEach(res => {
ids.push(res.domainId)
})
this.checkedKeys=[...ids]
// this.selectedKeys=this.checkedKeys
// console.log('checkKeys',this.checkedKeys)
this.checkedKeys = [...ids]
}
})
},
addAttr(dataI){
if((Array.isArray(dataI)) && dataI.length>0){
dataI.forEach((item,index)=>{
this.$set(item,'key',item.id)
addAttr(dataI) {
if ((Array.isArray(dataI)) && dataI.length > 0) {
dataI.forEach((item, index) => {
this.$set(item, 'key', item.id)
let arr = [];
this.addAttr(item.children,arr);
this.addAttr(item.children, arr);
});
}
// console.log('dataI',dataI)
return dataI
},
getSearch(key,tree){
let dataSearch=[]
let parentKey;
for (let i = 0; i < tree.length; i++) {
const node = tree[i];
searchEach(node, value) {
let depth = this.getTreeDepth(node);
let self = this;
for (let i = 0; i < depth - 1; i++) {
let spliceCounter = 0;
this.traverseTree(node, n => {
if (self.isHasChildren(n)) {
let children = n.children;
let length = children.length;
for (let j = length - 1; j >= 0; j--) {
let e3 = children[j];
if (!self.isHasChildren(e3) && e3.title.indexOf(value) <= -1) {
children.splice(j, 1);
spliceCounter++;
}else{
this.expandedKeys.push(e3.key)
}
}
}
});
if (spliceCounter == 0) {
break;
}
}
},
// 判断树形结构中的一个节点是否具有孩子节点
isHasChildren(node){
let flag = false;
if (node.children && node.children.length > 0) {
flag = true;
}
return flag;
},
if (node.children) {
if (node.children.some(item => item.title.indexOf(key)>-1)) {
console.log('titel',node)
parentKey = node.key;
this.parentItem.push(node)
} else if (this.getParentKey(key, node.children)) {
parentKey = this.getParentKey(key, node.children);
// 通过传入根节点获得树的深度
getTreeDepth(node){
if (undefined == node || null == node) {
return 0;
}
let r = 0;
let currentLevelNodes = [node];
while(currentLevelNodes.length > 0){
r++;
let nextLevelNodes = new Array();
for(let i = 0; i < currentLevelNodes.length; i++) {
let e = currentLevelNodes[i];
if (this.isHasChildren(e)) {
nextLevelNodes = nextLevelNodes.concat(e.children);
}
}
currentLevelNodes = nextLevelNodes;
}
return r;
},
traverseTree(node, callback) {
if (!node) {
return;
}
let stack = [];
stack.push(node);
let tmpNode;
while (stack.length > 0) {
tmpNode = stack.pop();
callback(tmpNode);
if (tmpNode.children && tmpNode.children.length > 0) {
for (let i = tmpNode.children.length - 1; i >= 0; i--) {
stack.push(tmpNode.children[i]);
}
}
}
console.log('dataSearch',this.parentItem)
return this.parentItem
// return dataSearch
},
afterVisibleChange(val) {
// console.log('visible', val);
@@ -185,8 +248,9 @@
return parentKey;
},
onExpand(expandedKeys){
console.log('valkey',expandedKeys)
this.expandedKeys = expandedKeys;
this.autoExpandParent = false;
this.autoExpandParent = true;
},
onChange(e) {
// this.loadData()
@@ -205,6 +269,7 @@
searchValue: value,
autoExpandParent: true,
})
this.onSearch()
},
onCheck(checkedKeys) {
// console.log('onCheck', checkedKeys);
@@ -301,6 +301,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.loadData()
},
//正则替换小数点
@@ -107,23 +107,23 @@
rules:{
name:[
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
],
itemText:[
{ required: true, message: this.$t('enterName'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
],
itemValue:[
{ required: true, message: this.$t('enterDataValue'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('charactersLength130'), trigger: 'blur' },
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },
],
enName:[
{ required: true, message: this.$t('PleaseEnterYourEnglishName'), trigger: 'blur' },
{ min:1, max: 100, message: this.$t('LengthBe1to100'), trigger: 'blur' },
{ min:1, max: 50, message: this.$t('cantExeed')+'50'+this.$t('characters'), trigger: 'blur' },
],
description:[
{ required: true, message: this.$t('PleaseEnterDescription'), trigger: 'blur' },
{ min:1, max: 300, message: this.$t('charactersLength1to300'), trigger: 'blur' },
{ min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' },
]
},
tableData:[],
@@ -109,6 +109,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.$emit('ok',this.queryParams)
// this.loadData()
@@ -82,6 +82,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.$emit('queryParams',this.queryParams)
},
}
@@ -149,8 +149,11 @@
{ min:1, max: 30, message: this.$t('cantExeed')+'30'+this.$t('characters'), trigger: 'blur' },],
attributeType:[
{ required: true, message: this.$t('PleaseSelectLabelType'), trigger: 'blur' },
{ min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' },
],
description:[
{ min:1, max: 300, message: this.$t('cantExeed')+'300'+this.$t('characters'), trigger: 'blur' },
]
},
// typeVisible:{},
dicVisible:false,
@@ -353,6 +356,7 @@
//一页显示条数
SizeChange(page,pageSize){
this.queryParams.pageSize = pageSize
this.queryParams.pageNo=1
this.loadData()
},
}