update 文档拆分-编辑-批量编辑、编辑

This commit is contained in:
赵霄
2023-10-17 17:45:19 +08:00
parent c185a29c01
commit 4436670c21
8 changed files with 721 additions and 239 deletions
@@ -93,9 +93,8 @@
{{ $t('export') }}
</a-button>
<!--批量删除-->
<a-button type="primary" icon="delete" ghost @click="batchDel" v-has="'split:sarFileSplitItems:delete'">{{
$t('batchDelete')
}}
<a-button type="primary" icon="delete" ghost @click="batchDel">
{{ $t('batchDelete') }}
</a-button>
<!--模板下载-->
<a-button type="primary"
@@ -106,11 +105,11 @@
{{ $t('templateDownload') }}
</a-button>
<!--批量复制-->
<a-button type="primary" ghost @click="handleCopy" v-has="'split:sarFileSplitItems:copy'">
<a-button type="primary" ghost @click="handleBatchCopy" v-has="'split:sarFileSplitItems:copy'">
{{ $t('docTool.split.batchCopy') }}
</a-button>
<!--批量编辑-->
<a-button type="primary" ghost @click="handleManage" v-has="'split:sarFileSplitItems:batchUpdate'">
<a-button type="primary" ghost @click="handleBatchEdit" v-has="'split:sarFileSplitItems:batchUpdate'">
{{ $t('docTool.split.batchEdit') }}
</a-button>
<!--合并条款-->
@@ -129,6 +128,7 @@
:pagination="ipagination"
:scroll="{x: '100%'}"
:operation-list="operationList"
:loading="loading"
@change="tableOnChange"
@operationClick="operationClick">
@@ -153,16 +153,16 @@
</div>
</div>
<!-- 条款详情 -->
<!--条款详情-->
<split-clause-detail ref="splitClauseDetail"/>
<!-- 添加节点 -->
<!--添加节点-->
<split-detail-node-add ref="splitDetailNodeAdd" @ok="nodeAddOk"/>
<!-- 批量设置弹框 -->
<split-detail-batch-setting ref="splitDetailBatchSetting" @ok="batchSettingOk"/>
<!--批量编辑-->
<split-detail-batch-edit-drawer ref="batchEditDrawer" @ok="modalFormOk"/>
<!--条款添加-->
<split-add-form ref="modalForm" :flag="'4'"
:url="url" :infoId="infoId" :menuId="menuId" :itemId="itemId"
@sumber="sumber"/>
@sumber="modalFormOk"/>
</internal-detail-page>
</template>
@@ -175,8 +175,6 @@ import SplitAddForm from './modules/SplitAddForm.vue'
import SplitClauseDetail from './modules/SplitClauseDetail.vue'
// 添加左侧树节点弹框
import SplitDetailNodeAdd from './modules/SplitDetailNodeAdd.vue'
// 批量设置弹框
import SplitDetailBatchSetting from './modules/SplitDetailBatchSetting.vue'
import { mapGetters } from 'vuex'
import { ConfigurableTableMixin } from '../../../mixins/ConfigurableTableMixin.js'
import {
@@ -186,10 +184,13 @@ import {
moveUpOrDownClauseTreeNode,
batchCopyClause,
merageClause,
getClauseTreeData
getClauseTreeData,
copyClause
} from '../../../api/documentToolApi.js'
import Search from '../../../components/customField/Search.vue'
import { isHasPermission } from '../../../utils/hasPermission.js'
import SplitDetailBatchEditDrawer from './modules/SplitDetailBatchEditDrawer.vue'
import { postAction } from '../../../api/manage'
export default {
name: 'DocumentSplitDetail',
@@ -199,8 +200,8 @@ export default {
SplitAddForm,
SplitClauseDetail,
SplitDetailNodeAdd,
SplitDetailBatchSetting,
Search
Search,
SplitDetailBatchEditDrawer
},
mixins: [ConfigurableTableMixin],
data () {
@@ -241,7 +242,7 @@ export default {
// 复制
{
text: this.$t('copy'),
clickEvent: 'handleEdit'
clickEvent: 'handleCopy'
// has: 'split:sarFileSplitItems:update'
},
// 删除
@@ -425,47 +426,49 @@ export default {
}
})
},
handleCopy ({ id }) {
this.$confirm({
title: this.$t('confirmReplication'),
content: '',
onOk: () => {
this.loading = true
copyClause({ id }).then(res => {
if (res.success) {
this.$message.success(res.message)
this.loadData()
} else {
this.$message.warning(res.message)
}
}).finally(() => {
this.loading = false
})
}
})
},
/**
* 批量复制
*/
handleCopy () {
handleBatchCopy () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
return
}
const ids = []
const infoIds = []
const menuIds = []
this.selectedRows.forEach(item => {
ids.push(item.id)
infoIds.push(item.info_id)
menuIds.push(item.menu_id)
this.$confirm({
title: this.$t('confirmReplication'),
content: '',
onOk: () => {
batchCopyClause({ ids: this.selectedRowKeys.join(',') }).then((res) => {
if (res.success) {
this.$message.success(this.$t('operationSuccessful'))
this.onClearSelected()
this.loadMenuData()
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
const params = {
ids: ids.join(','),
infoIds: infoIds.join(','),
menuids: menuIds.join(',')
}
if (menuIds && menuIds.length > 0) {
this.$confirm({
title: this.$t('confirmReplication'),
content: '',
onOk: () => {
batchCopyClause(params).then((res) => {
if (res.data.success) {
this.$message.success(this.$t('operationSuccessful'))
this.onClearSelected()
this.loadMenuData()
this.loadData()
} else {
this.$message.warning(this.$t('operationFailed'))
}
})
}
})
} else if (menuIds.length === 0) {
this.$message.warning(this.$t('pleaseSelectData'))
}
},
// 新增
handleAdd () {
@@ -504,31 +507,48 @@ export default {
}
})
},
// 批量设置
handleManage () {
const ids = this.selectedRowKeys.join(',')
if (this.selectedRowKeys && this.selectedRowKeys.length < 1) {
/**
* 批量编辑
*/
handleBatchEdit () {
if (!this.selectedRowKeys || this.selectedRowKeys.length === 0) {
this.$message.warning(this.$t('selectLeastOne'))
} else {
this.$refs.splitDetailBatchSetting.open(ids)
return
}
},
// 批量设置完成的回调
batchSettingOk () {
this.onClearSelected()
this.loadData()
},
// 保存成功
sumber () {
this.loadData()
this.loadMenuData()
this.$refs.batchEditDrawer.open(this.selectedRowKeys.join(','))
},
onSearch () {
this.loadMenuData()
},
/**
* 删除
* @param id
*/
handleDelete (id) {
if (!this.url.delete) {
this.$message.error('请设置url.delete属性!')
return
}
const that = this
this.$confirm({
title: this.$t('confirmDeletion'),
content: this.$t('areYouSure'),
onOk: () => {
postAction(that.url.delete, { id: id }).then((res) => {
if (res.success) {
that.$message.success(res.message)
// 判断当前删除的数据是否是最后一页的最后一条数据,如果是的话页码减一
if (that.ipagination.current > 1 && ((that.ipagination.current - 1) * that.ipagination.pageSize) + 1 === that.ipagination.total) {
that.ipagination.current -= 1
}
that.loadData()
} else {
that.$message.warning(res.message)
}
})
}
})
}
},
beforeDestroy () {
window.removeEventListener('resize', {}, false)
}
}
</script>