123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253 |
- <template>
- <div :class="$style.wrapHeight">
- <div :class="$style.rowHeight">
- <km-worktree
- ref="worktree"
- :data-type="activeKey"
- @treeSelectd="treeSelectd"
- @treeSelectValue="treeSelectValue"
- ></km-worktree>
- <div :class="$style.rightcard">
- <a-card>
- <sd-data-table
- v-if="treeId.draft !== ''"
- ref="draft"
- data-url="api/flow-mobile/v1/user-tasks/draft-with-trustor"
- :columns="columns"
- :actions="actions"
- :row-key="'instId'"
- show-selection
- :search-fields="['title']"
- :filter-expressions="expressions.draft"
- @rowClick="rowClick"
- @dataLoaded="tableDataLoaded"
- >
- <a slot="listTitle" slot-scope="text, record">
- {{ record.title }}
- <a-tooltip>
- <template slot="title">
- {{ record.groupPath }}
- </template>
- <a-tag v-if="record.srcTrustId" color="blue">兼</a-tag>
- </a-tooltip>
- </a>
- </sd-data-table>
- <sd-oa-table
- v-else
- form-id="kmKnowledge"
- page-id="knowledge/kmAtom/kmAtom"
- :columns="columns2"
- :actions="actions"
- :filter-expressions="atomExpressions"
- show-selection
- :search-fields="['redheadName']"
- @formBtnClick="formBtnClick"
- >
- <template v-slot:form="{ model }">
- <km-atom-table ref="atomTable" :model="model" />
- </template>
- </sd-oa-table>
- </a-card>
- </div>
- </div>
- </div>
- </template>
- <script>
- import storeMixin from '@/common/store-mixin'
- import { Modal } from 'ant-design-vue'
- import TableActionTypes from '@/common/services/table-action-types'
- import TableColumnTypes from '@/common/services/table-column-types'
- import FlowcenterService from '@/flowcenter/flowcenter-service'
- import flowcenter from '@/flowcenter/sd-flowcenter-mixins'
- import KmWorktree from '../../components/km-knowledge-draftstree'
- import KmAtomTable from '../knowledge-base/km-atom-table'
- import components from './_import-components/km-knowledge-drafts-import'
- const columns = [
- {
- title: '业务类型',
- dataIndex: 'appCat',
- sdCandidate: true,
- },
- {
- title: '标题',
- dataIndex: 'title',
- sdClickable: true,
- scopedSlots: { customRender: 'listTitle' },
- },
- {
- title: '创建时间',
- dataIndex: 'draftDate',
- sdRender: TableColumnTypes.dateTime,
- sorter: true,
- },
- ]
- const columns2 = [
- {
- title: '标题',
- dataIndex: 'title',
- sdClickable: true,
- },
- {
- title: '业务类型',
- dataIndex: 'categoryName',
- scopedSlots: { customRender: 'listTitle' },
- },
- {
- title: '创建时间',
- dataIndex: 'creationTime',
- sdRender: TableColumnTypes.dateTime,
- sorter: true,
- },
- ]
- export default {
- name: 'KmKnowledgeDrafts',
- metaInfo: {
- title: '草稿箱',
- },
- components: {
- ...components,
- 'km-worktree': KmWorktree,
- 'km-atom-table': KmAtomTable,
- },
- mixins: [storeMixin, flowcenter],
- data() {
- return {
- show: false,
- activeKey: 'draft',
- columns,
- columns2,
- expressions: { draft: [] },
- treeId: { draft: '' },
- defaultFilter: {
- draft: { dataType: 'str', name: 'status', op: 'ne', stringValue: '2' },
- },
- actions: [
- {
- label: '删除',
- id: 'delete',
- type: TableActionTypes.batch, // 批处理按钮,选中文档时才能点击
- permission: null,
- callback: (keys) => {
- this.deleteRows(keys)
- },
- },
- ],
- }
- },
- computed: {
- atomExpressions() {
- return [
- {
- dataType: 'str',
- name: 'creatorAccount',
- op: 'eq',
- stringValue: this.userInfo.account,
- },
- {
- dataType: 'int',
- name: 'type',
- op: 'eq',
- intValue: 1,
- },
- {
- dataType: 'int',
- name: 'atomState',
- op: 'eq',
- intValue: 0, // 1:已发布,0:草稿
- },
- ]
- },
- },
- methods: {
- // 保存和发布
- formBtnClick(evt, btn, { form, recordId }) {
- switch (btn.buttonId) {
- case 'save': {
- evt.waitUntil(
- new Promise((resolve, reject) => {
- form.setFieldValue('atomState', 1)
- resolve()
- })
- )
- break
- }
- case 'keep': {
- evt.waitUntil(
- new Promise((resolve, reject) => {
- if (form.getFieldValue('atomState') === undefined) {
- form.setFieldValue('atomState', 0)
- }
- form.saveBtnClick()
- resolve()
- })
- )
- break
- }
- default:
- break
- }
- },
- // 删除数据
- deleteRows(selectedRowKeys) {
- Modal.confirm({
- title: '你确定删除这项内容吗?',
- content: '删除这条数据后,就无法恢复初始的状态。',
- okText: '删除',
- okType: 'danger',
- onOk: () => {
- const params = {
- flowCallbackBeanName: 'formBeanCleanerCallBack',
- processInstanceIds: selectedRowKeys.join(','),
- }
- FlowcenterService.fnDarftsDelete(params).then((res) => {
- if (res.status === 200) {
- this.$refs.draft.clearSelection(true)
- this.refresh()
- }
- })
- },
- })
- },
- treeSelectValue(k, v) {
- if (k.node !== undefined) {
- if (k.node.dataRef.id === '0atom') {
- this.treeId.draft = ''
- }
- }
- },
- knowledageView(record) {
- // window.open(`#/km-knowledage-view?id=${record.id}&title=${record.title}`, '_blank')
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- .wrap-height {
- height: 100%;
- .row-height {
- display: flex;
- flex: auto;
- height: 100%;
- .rightcard {
- flex: 1;
- width: calc(100% - 20%);
- height: 100%;
- }
- }
- }
- .editor {
- margin: 0 auto;
- :global(.ql-editor) {
- min-height: 300px;
- line-height: 1.5;
- }
- }
- </style>
|