diff --git a/src/api/documentToolApi.js b/src/api/documentToolApi.js
index d042afa8..13a11f70 100644
--- a/src/api/documentToolApi.js
+++ b/src/api/documentToolApi.js
@@ -6,11 +6,14 @@ import { getAction, postAction } from './manage'
const releaseSplitStandard = (params) => postAction('', params)
// 文档拆分详情-表头
const getDocSplitTableHeader = (params) => getAction('', params)
+// 文档拆分详情-查询条件
+const getDocSplitSearch = (params) => getAction('', params)
export {
// 文档拆分
releaseSplitStandard,
// 文档拆分-详情
- getDocSplitTableHeader
+ getDocSplitTableHeader,
+ getDocSplitSearch
}
diff --git a/src/assets/less/common.less b/src/assets/less/common.less
index f0be9621..b2de34c3 100644
--- a/src/assets/less/common.less
+++ b/src/assets/less/common.less
@@ -530,6 +530,10 @@
}
}
+.tree-search {
+ margin-bottom: 8px;
+}
+
/*抽屉样式修改*/
.custom-drawer-style {
height: 100%;
diff --git a/src/mixins/ConfigurableTableMixin.js b/src/mixins/ConfigurableTableMixin.js
index 5e759ee2..30e7fffe 100644
--- a/src/mixins/ConfigurableTableMixin.js
+++ b/src/mixins/ConfigurableTableMixin.js
@@ -30,6 +30,7 @@ export const ConfigurableTableMixin = {
},
columns: [],
selectedRowKeys: [],
+ selectionRows: [],
dataSource: [],
isTrue: false, // 是否显示
searchParams: {},
@@ -209,8 +210,9 @@ export const ConfigurableTableMixin = {
this.ipagination = pagination
this.loadData(1)
},
- onSelectChange (selectedRowKeys) {
+ onSelectChange (selectedRowKeys, selectionRows) {
this.selectedRowKeys = selectedRowKeys
+ this.selectionRows = selectionRows
},
/* 导入 */
handleImportExcel (info) {
@@ -384,7 +386,7 @@ export const ConfigurableTableMixin = {
content: this.$t('deleteAData'),
onOk: () => {
this.loading = true
- postAction(this.url.delete, { ids: ids }).then((res) => {
+ postAction(this.url.deleteBatch, { ids: ids }).then((res) => {
if (res.success) {
// 重新计算分页问题
this.reCalculatePage(this.selectedRowKeys.length)
@@ -458,9 +460,22 @@ export const ConfigurableTableMixin = {
},
onClearSelected () {
this.selectedRowKeys = []
+ this.selectionRows = []
},
handleImportByFileId (fileId) {
// TODO 完善通过文件id上传文件的方法
+ },
+ /**
+ * 循环操作按钮的操作
+ * @param operation
+ * @param record
+ */
+ operationClick (operation, record) {
+ if (operation.clickEvent === 'handleDelete') {
+ this.handleDelete(record.id)
+ } else {
+ this[operation.clickEvent](record)
+ }
}
}
}
diff --git a/src/views/documentTool/DocumentSplitDetail.vue b/src/views/documentTool/DocumentSplitDetail.vue
index b00ed801..5a56521a 100644
--- a/src/views/documentTool/DocumentSplitDetail.vue
+++ b/src/views/documentTool/DocumentSplitDetail.vue
@@ -3,81 +3,102 @@
-
-
-
-
-
-
- {{ title.substr(0, title.indexOf(searchValue)) }}{{ searchValue }}
- {{ title.substr(title.indexOf(searchValue) + searchValue.length) }}
-
-
- {{ title && title.length > 18 ? title.slice(0, 17) + '...' : title }}
-
-
- {{ title.substr(0, title.indexOf(searchValue)) }}
-
- {{ title.indexOf(searchValue) + searchValue.length > 18 ? searchValue.substr(0, 18 - title.indexOf(searchValue)) : searchValue
- }}
-
- {{ title.indexOf(searchValue) + searchValue.length > 18 ? '...' : title.substr(title.indexOf(searchValue) + searchValue.length, 18 - title.indexOf(searchValue) - searchValue.length) + '...'
- }}
-
-
- {{ title && title.length > 18 ? title.slice(0, 17) + '...' : title }}
-
-
- onContextMenuClick(treeKey, menuKey, record)">
-
- {{ $t('newNode') }}
-
-
- {{ $t('modifyNode') }}
-
- {{ $t('deleteNode') }}
-
- {{ $t('moveUp') }}
-
- {{ $t('moveDown') }}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ {{ record.title }}
+
+ {{ record.title }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
{{ $t('newlyAdded') }}
{{ $t('import') }}
@@ -85,7 +106,6 @@
{{ $t('export') }}
@@ -95,12 +115,11 @@
{{ $t('templateDownload') }}
-
{{ $t('docTool.split.batchCopy') }}
+
{{ $t('docTool.split.batchCopy') }}
{{ $t('docTool.split.batchEdit') }}
@@ -153,8 +172,9 @@
-
+
@@ -170,13 +190,11 @@ import SplitClauseDetail from './modules/SplitClauseDetail.vue'
import SplitDetailNodeAdd from './modules/SplitDetailNodeAdd.vue'
// 批量设置弹框
import SplitDetailBatchSetting from './modules/SplitDetailBatchSetting.vue'
-import Vue from 'vue'
-import { ACCESS_TOKEN } from '../../store/mutation-types.js'
import { mapGetters } from 'vuex'
import { postAction, getAction, downloadFile } from '../../api/manage.js'
-import moment from 'moment'
import { ConfigurableTableMixin } from '../../mixins/ConfigurableTableMixin.js'
-import {getDocSplitTableHeader} from '../../api/documentToolApi.js'
+import { getDocSplitTableHeader, getDocSplitSearch } from '../../api/documentToolApi.js'
+import Search from '../../components/customField/Search.vue'
export default {
name: 'DocumentSplitDetail',
@@ -186,23 +204,12 @@ export default {
SplitAddForm,
SplitClauseDetail,
SplitDetailNodeAdd,
- SplitDetailBatchSetting
+ SplitDetailBatchSetting,
+ Search
},
mixins: [ConfigurableTableMixin],
data () {
return {
- userData: {},
- contentVisible: false, // 条款内容弹框显示
- selectedRowKeys: [],
- selectedRows: [],
- selectedKeys: [],
- expandedKeys: [],
- searchValue: '',
- autoExpandParent: true,
- dataList: [],
- contentValue: '',
- gData: [],
- attId: '',
data: [],
loading: false, // 提交的加载
confirmLoading: false,
@@ -212,26 +219,6 @@ export default {
menuId: '',
itemId: '',
itemVal: {},
- // 操作栏
- operationList: [
- {
- text: this.$t('edit'),
- ClickEvent: 'editClick'
- },
- {
- text: this.$t('delete'),
- ClickEvent: 'deleteClick'
- }
- ],
- url: {
- tableHeader: 'split/sarFileSplitItems/getHeader', // 表格头部字段
- getSearchList: 'split/sarFileSplitItems/queryCondition', // 搜索字段
- list: 'split/sarFileSplitItems/getSplitItemsByPage', // 表格数据
- getAddForm: 'split/sarFileSplitItems/getForm', // 表单的字段
- getDocumentInfo: 'split/sarFileSplitItems/getSplitItemsById',
- importZipUrl: '/split/sarFileSplitItems/importSplitItems' // 导入
- },
- token: Vue.ls.get(ACCESS_TOKEN),
uploadMenuId: '',
deleteNode: false,
moveDownFlag: false,
@@ -240,29 +227,55 @@ export default {
parameter: {},
administrators: false,
showAction: this.isCanOperate,
- flag: '4' // 查询要用到
+ flag: '4', // 查询要用到
+
+ getQueryConditionFunc: getDocSplitSearch,
+ getTableHeaderFunc: getDocSplitTableHeader,
+ treeData: [],
+ searchValue: '',
+ selectedKeys: [],
+ mouseInNodeKey: null, // 鼠标悬浮的节点key值
+ // 操作栏
+ operationList: [
+ {
+ text: this.$t('edit'),
+ ClickEvent: 'handleEdit'
+ },
+ {
+ text: this.$t('delete'),
+ ClickEvent: 'handleDelete'
+ }
+ ],
+ url: {
+ list: '',
+ importUrl: '', // 导入
+ exportXlsUrl: '', // 导出
+ delete: '', // 删除
+ deleteBatch: '', // 批量删除
+ downTemplateUrl: '' // 模板下载
+ }
}
},
computed: {
isCanOperate () {
- return !!(this.$route.query.createBy === this.userData.username || this.administrators)
- },
- filters () {
- return {
- menu_id: this.menuId,
- info_id: this.infoId
- }
+ return !!(this.$route.query.createBy === this.userInfo.username || this.administrators)
},
// 页面标题是标准名称
pageTitle () {
return this.$route.query.standardName
+ },
+ ...mapGetters(['userInfo'])
+ },
+ created () {
+ this.filters = {
+ menu_id: this.menuId,
+ info_id: this.infoId
}
},
mounted () {
- this.userData = this.userInfo()
this.administrators = false
- if (this.userInfo().userRoleList && this.userInfo().userRoleList.length > 0) {
- this.userInfo().userRoleList.forEach(res => {
+ if (this.userInfo.userRoleList && this.userInfo.userRoleList.length > 0) {
+ this.userInfo.userRoleList.forEach(res => {
if (res.roleCode === 'admin') {
this.administrators = true
}
@@ -270,59 +283,38 @@ export default {
}
this.infoId = this.$route.query.infoId
this.loadMenuData()
- this.generateList(this.gData)
},
methods: {
- ...mapGetters(['userInfo']),
+ /**
+ * 树节点鼠标移入
+ * @param key
+ */
+ handleTreeMouseover (key) {
+ this.mouseInNodeKey = key
+ },
+ /**
+ * 树节点鼠标移出
+ * @param key
+ */
+ handleTreeMouseout (key) {
+ if (this.mouseInNodeKey === key) {
+ this.mouseInNodeKey = null
+ }
+ },
+ /**
+ * 选中树节点
+ * @param dataRef
+ */
+ handleSelectTreeNode ({ dataRef }) {
+ this.selectedKeys = [dataRef.key]
+ this.filters.nodeCode = dataRef.nodeCode
+ this.loadData(1)
+ },
+
// 显示条款内容弹框
showContent (val) {
this.$refs.splitClauseDetail.open(val)
},
- generateList (data) {
- for (let i = 0; i < data.length; i++) {
- const node = data[i]
- const key = node.key
- this.dataList.push({ key, title: key })
- if (node.children) {
- this.generateList(node.children)
- }
- }
- },
- getParentKey (key, tree) {
- let parentKey
- for (let i = 0; i < tree.length; i++) {
- const node = tree[i]
- if (node.children) {
- if (node.children.some(item => item.key === key)) {
- parentKey = node.key
- } else if (this.getParentKey(key, node.children)) {
- parentKey = this.getParentKey(key, node.children)
- }
- }
- }
- return parentKey
- },
- onExpand (expandedKeys) {
- this.expandedKeys = expandedKeys
- this.autoExpandParent = false
- },
- onLeftChange (e) {
- const value = e.target.value
- const expandedKeys = this.dataList
- .map(item => {
- if (item.title.indexOf(value) > -1) {
- return this.getParentKey(item.key, this.gData)
- }
- return null
- })
- .filter((item, i, self) => item && self.indexOf(item) === i)
- Object.assign(this, {
- expandedKeys,
- searchValue: value,
- autoExpandParent: true
- })
- this.onSearch()
- },
// 获取左侧目录数据
loadMenuData () {
const params = {
@@ -332,11 +324,7 @@ export default {
getAction(`split/sarFileSplitMenu/getSplitMenusByInfoId`, params).then(res => {
if (res.success) {
this.data = this.toTree(res.result)
- this.gData = [...this.data]
- Object.assign(this, {
- expandedKeys: this.expandedKeys,
- autoExpandParent: true
- })
+ this.treeData = [...this.data]
}
}).finally(() => {
this.loading = false
@@ -373,34 +361,6 @@ export default {
})
return val
},
- // 鼠标右键
- rightClick ({ event, node }) {
- this.deleteNode = !!node._props.dataRef.pid
- this.moveDownFlag = node._props.dataRef.moveDownFlag === true
- this.moveUpFlag = node._props.dataRef.moveUpFlag === true
- const x = event.currentTarget.offsetLeft + event.currentTarget.clientWidth
- const y = event.currentTarget.offsetTop
- this.nodeTreeItem = {
- pageX: x,
- pageY: y,
- id: node._props.dataRef.id,
- name: node._props.dataRef.name,
- itemName: node._props.dataRef.itemName,
- displaySeq: node._props.dataRef.displaySeq,
- title: node._props.dataRef.title,
- pid: node._props.dataRef.pid || null
- }
- this.nodeItem = JSON.parse(JSON.stringify(this.nodeTreeItem))
- this.tmpStyle = {
- position: 'absolute',
- maxHeight: 40,
- textAlign: 'center',
- left: `${x + 10 - 0}px`,
- top: `${y + 6 - 0}px`,
- background: `#FFFFFF`,
- zIndex: `2`
- }
- },
// 用于点击空白处隐藏增删改菜单
clearMenu () {
this.nodeTreeItem = null
@@ -410,8 +370,8 @@ export default {
this.menuId = selectedKeys[0]
this.uploadMenuId = selectedKeys[0]
this.selectedKeys = selectedKeys
- this.parameter.info_id = this.infoId
- this.parameter.menu_id = this.menuId
+ this.filters.info_id = this.infoId
+ this.filters.menu_id = this.menuId
this.loadData()
},
// 树形新增
@@ -424,7 +384,6 @@ export default {
},
// 添加节点完成后的回调
nodeAddOk () {
- this.expandedKeys.push(this.nodeItem.id)
this.loadMenuData()
this.loadData()
},
@@ -496,62 +455,6 @@ export default {
onContextMenuClick (treeKey, menuKey) {
// console.log(`treeKey: ${treeKey}, menuKey: ${menuKey}`);
},
- // 表格操作列按钮的点击
- operationClick (operation, record) {
- if (this[operation.clickEvent]) {
- this[operation.clickEvent](record)
- }
- },
- /**
- * 处理表头数据
- * @param columns
- * @returns {*[]}
- */
- dealColumns (columns) {
- const tempColumns = []
- columns.forEach(item => {
- // 可点击项加入插槽
- if (item.click === 'true') {
- item.scopedSlots = {
- customRender: 'detailClick'
- }
- } else if (item.urlClick === 'true') {
- item.scopedSlots = {
- customRender: 'urlClick'
- }
- } else if (item.db_field_name === 'iterms_conditions') {
- // 拆分文档详情页的条款内容点击可预览
- item.scopedSlots = {
- customRender: 'showContent'
- }
- }
- // 是否可排序
- item.sorter = item.sort === 'true'
- item.width = 215
- item.title = item.db_field_txt
- item.dataIndex = item.db_field_name
- item.align = 'left'
- tempColumns.push(item)
- })
- if (this.showAction && this.operateColumn) {
- let width = 0
- if (this.operationList.length > 0) {
- for (let i = 0; i < this.operationList.length; i++) {
- width += this.getTextWith(this.operationList[i].text)
- }
- }
- const operateColumn = JSON.parse(JSON.stringify(this.operateColumn))
- operateColumn.width = width
- tempColumns.push(operateColumn)
- }
- return tempColumns
- },
- // 清空按钮
- resetSearch () {
- this.menuId = ''
- this.uploadMenuId = ''
- this.selectedKeys = []
- },
// 复制按钮
handleCopyManage (record) {
const ids = []
@@ -575,7 +478,7 @@ export default {
getAction('/split/sarFileSplitItems/batchCopyItems', params).then((res) => {
if (res.data.success) {
this.$message.success(this.$t('operationSuccessful'))
- this.selectClear()
+ this.onClearSelected()
this.loadMenuData()
this.loadData()
} else {
@@ -595,76 +498,6 @@ export default {
this.$refs.splitForm.add()
this.$refs.splitForm.formTitle = this.$t('add')
})
- // if (this.menuId) {
- // this.formTitle = this.$t('add')
- // this.itemId = ''
- // this.addVisible = true
- // this.$nextTick(() => {
- // this.$refs.splitForm.add()
- // this.$refs.splitForm.formTitle = this.$t('add')
- // })
- // } else {
- // this.$message.warning(this.$t('docTool.split.selectDirectoryTerms'))
- // }
- },
- // 关闭新增弹框
- closeVisible (val) {
- this.addVisible = val
- },
- // 导入
- handleImportManage () {
- if (!this.menuId) {
- this.$message.warning(this.$t('docTool.split.selectDirectoryTerms'))
- }
- },
- // 上传成功
- uploadSuccess (data, status) {
- if (status === 'success') {
- this.loadMenuData()
- this.loadData()
- }
- const attIdList = []
- if (data && data.length > 0) {
- data.forEach(item => {
- attIdList.push(item.id || data.name)
- })
- this.attId = attIdList.join(',')
- }
- },
- queryParamsValues (search) {
- Object.keys(search).forEach(res => {
- if (search[res] instanceof Array) {
- search[res] = search[res].join(',')
- }
- })
- this.parameter = search
- this.parameter.info_id = this.infoId
- this.parameter.menu_id = this.menuId
- },
- // 导出
- handleExportManage () {
- if (JSON.stringify(this.parameter) === '{}') {
- this.parameter.info_id = this.infoId
- this.parameter.menu_id = this.menuId
- }
- // console.log('menuId',this.menuId)
- const dateName = moment(new Date()).format('YYYY-MM-DD HH-mm-ss')
- const name = this.$route.query.infoNumber + ' ' + dateName + '.zip'
- const query = {
- exportName: this.$route.query.infoNumber + ' ' + dateName,
- idList: this.selectedRowKeys.join(','),
- parameter: this.parameter
- }
- downloadFile('split/sarFileSplitItems/exportSplitInfoZip', name, query, this.selectClear)
- },
- selectClear () {
- this.selectedRowKeys = []
- this.selectedRows = []
- },
- // 模板下载
- handleDownManage () {
- const name = this.$t('docTool.split.documentSplitTemplate') + '.xlsx'
- downloadFile('split/sarFileSplitItems/exportTemplate', name, {})
},
// 合并条款
handleMergeManage () {
@@ -679,7 +512,7 @@ export default {
getAction('/split/sarFileSplitItems/batchMergeItems', { ids: ids }).then(res => {
if (res.data.success) {
this.$message.success(this.$t('operationSuccessful'))
- this.selectClear()
+ this.onClearSelected()
this.loadMenuData()
this.loadData()
this.selectedRowKeys = []
@@ -702,174 +535,16 @@ export default {
},
// 批量设置完成的回调
batchSettingOk () {
- this.selectClear()
+ this.onClearSelected()
this.loadData()
},
- // 批量删除
- handleBatCancel () {
- const params = {
- ids: this.selectedRowKeys.join(',')
- }
- if (this.selectedRowKeys && this.selectedRowKeys.length > 0) {
- this.$confirm({
- title: this.$t('confirmBatchDeletion'),
- content: '',
- onOk: () => {
- postAction('/split/sarFileSplitItems/batchDeleteItems', params).then((res) => {
- if (res.data.success) {
- this.$message.success(this.$t('operationSuccessful'))
- this.loadMenuData()
- this.filter = {
- menu_id: this.menuId,
- info_id: this.infoId
- }
- this.loadData()
- this.selectClear()
- } else {
- this.$message.warning(res.data.message)
- }
- })
- }
- })
- } else {
- this.$message.warning(this.$t('selectLeastOne'))
- }
- },
- // 编辑
- editClick (val) {
- this.formTitle = this.$t('edit')
- this.itemVal = val
- this.itemId = val.id
- this.addVisible = true
- this.$nextTick(() => {
- this.$refs.splitForm.edit(val)
- this.$refs.splitForm.formTitle = this.$t('edit')
- })
- },
// 保存成功
sumber () {
this.loadData()
this.loadMenuData()
},
- // 删除
- deleteClick (val) {
- const params = {
- ids: val.id
- }
- this.$confirm({
- title: this.$t('areYouSure'),
- content: '',
- onOk: () => {
- postAction('/split/sarFileSplitItems/batchDeleteItems', params).then((res) => {
- if (res.data.success) {
- this.$message.success(this.$t('operationSuccessful'))
- this.loadMenuData()
- this.loadData()
- } else {
- this.$message.warning(this.$t('operationFailed'))
- }
- })
- }
- })
- },
- // 选择框
- onSelectChange (selectedRowKeys, rows) {
- this.selectedRowKeys = selectedRowKeys
- this.selectedRows = rows
- },
onSearch () {
- const self = this
- const 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)
- })
- // 没有叶子节点的根节点也要清理掉
- const length = tree.length
- for (let i = length - 1; i >= 0; i--) {
- const 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) {
- const depth = this.getTreeDepth(node)
- const self = this
- for (let i = 0; i < depth - 1; i++) {
- let spliceCounter = 0
- this.traverseTree(node, n => {
- if (self.isHasChildren(n)) {
- const children = n.children
- const length = children.length
- for (let j = length - 1; j >= 0; j--) {
- const 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 || node === null) {
- return 0
- }
- let r = 0
- let currentLevelNodes = [node]
- while (currentLevelNodes.length > 0) {
- r++
- let nextLevelNodes = []
- for (let i = 0; i < currentLevelNodes.length; i++) {
- const e = currentLevelNodes[i]
- if (this.isHasChildren(e)) {
- nextLevelNodes = nextLevelNodes.concat(e.children)
- }
- }
- currentLevelNodes = nextLevelNodes
- }
- return r
- },
- traverseTree (node, callback) {
- if (!node) {
- return
- }
- const 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])
- }
- }
- }
+
}
},
beforeDestroy () {
diff --git a/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue b/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue
index e0bd2195..04a19138 100644
--- a/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue
+++ b/src/views/standardRegulationLibrary/domesticStandard/DomesticStandardList.vue
@@ -3,7 +3,7 @@
-
@@ -23,7 +23,6 @@
{{ record.title }}
-