123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186 |
- <template>
- <a-card>
- <component
- :is="computedAppId ? SdDataTableEx : SdDataTableSys"
- ref="printTable"
- ex
- form-id="oaDocPrintTemplate"
- page-id="base/print/oaDocPrintTemplate"
- :filter-expressions="expressions"
- :columns="columns"
- show-selection
- :actions="actions"
- :search-fields="['templateName']"
- >
- <template v-slot:form="{ model, fields }">
- <sd-form-item
- v-if="computedAppId"
- name="appId"
- hidden
- :input-props="{ defaultValue: computedAppId }"
- />
- <sd-form-item name="templateName"></sd-form-item>
- <sd-form-item name="attachment">
- <template v-slot:read-and-edit>
- <sd-attachment
- v-model="model.attachment"
- :max="1"
- :group-id="JSON.parse(fields.attachment.value).value"
- accept=".docx"
- />
- </template>
- </sd-form-item>
- <sd-form-item name="status"></sd-form-item>
- </template>
- </component>
- <!-- 批量导入 -->
- <a-modal
- v-model="isBatchImport"
- title="打印模版批量导入"
- destroy-on-close
- v-bind="{ width: 800 }"
- :mask-closable="false"
- @ok="bacthImport"
- @cancel="isBatchImport = false"
- >
- <a-form :label-col="{ span: 4 }" :wrapper-col="{ span: 18 }">
- <a-form-item label="模板文件" :required="true">
- <sd-attachment :group-id="groupId" accept=".docx" />
- </a-form-item>
- </a-form>
- </a-modal>
- </a-card>
- </template>
- <script>
- import { Message } from 'ant-design-vue'
- import asyncComponent from '@/common/services/async-component'
- import TableColumnTypes from '../common/services/table-column-types'
- import TableActionTypes from '../common/services/table-action-types'
- import WorkbenchService from './workbench-service'
- import components from './_import-components/sd-print-maintain-import'
- const columns = [
- {
- title: '模板名称',
- dataIndex: 'templateName',
- sdClickable: true,
- width: '35%',
- },
- {
- title: '创建时间',
- dataIndex: 'creationTime',
- sdRender: TableColumnTypes.dateTime,
- sorter: true,
- width: '50%',
- },
- {
- title: '当前状态',
- dataIndex: 'status',
- sdRender: TableColumnTypes.ex.switch,
- },
- ]
- export default {
- name: 'SdPrintMaintain',
- metaInfo: {
- title: '打印配置维护管理',
- },
- components,
- props: {
- appId: {
- type: String,
- default: '',
- },
- },
- data() {
- return {
- showform: false,
- confirmLoading: false,
- columns,
- isBatchImport: false,
- actions: [
- {
- label: '批量导入',
- id: 'import',
- permission: null,
- callback: () => {
- WorkbenchService.getGroupCode().then((res) => {
- if (res.status === 200) {
- if (res.data) {
- this.groupId = res.data.toString()
- this.isBatchImport = true // 弹出导入面板
- } else {
- Message.error('获取groupId失败')
- }
- } else {
- Message.error(res.statusText)
- }
- })
- },
- },
- {
- label: '新建',
- id: 'new',
- type: TableActionTypes.ex.create,
- },
- {
- label: '删除',
- id: 'delete',
- type: TableActionTypes.ex.delete,
- },
- ],
- groupId: '', // 批量导入group附件组id
- routeAppId: '',
- }
- },
- computed: {
- computedAppId() {
- return this.appId || this.routeAppId
- },
- expressions() {
- const expressions = []
- if (this.computedAppId) {
- expressions.push({
- dataType: 'str',
- name: 'appId',
- op: 'eq',
- stringValue: this.computedAppId,
- })
- } else {
- expressions.push({
- dataType: 'str',
- name: 'appId',
- op: 'is_null',
- })
- }
- return expressions
- },
- },
- created() {
- this.SdDataTableEx = asyncComponent(() =>
- import(/* webpackChunkName: "sd-data-table" */ '@/common/components/sd-data-table-ex.vue')
- )
- this.SdDataTableSys = asyncComponent(() =>
- import(/* webpackChunkName: "sd-data-table" */ '@/common/components/sd-data-table-sys.vue')
- )
- this.routeAppId = this.$route.query.appId
- },
- methods: {
- bacthImport() {
- const belongedOrg = this.computedAppId ? null : this.$refs.printTable.getHierarchy()
- WorkbenchService.batchImport({
- groupId: this.groupId,
- appId: this.computedAppId,
- belongedOrgId: belongedOrg?.id,
- }).then((res) => {
- Message.success('上传成功')
- this.isBatchImport = false
- this.$refs.printTable.refresh()
- })
- },
- },
- }
- </script>
- <style module lang="scss">
- @use '@/common/design' as *;
- </style>
|