123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- <template>
- <span>
- <audit-form-top-banner
- :handel-save-form="saveForm"
- :handel-publish="handelPublish"
- :form-data="mode"
- :hiden-or-show="hidenOR0Show"
- @handelSaveForm="saveForm"
- @handelPublish="handelPublish"
- >
- <sd-detail-form
- ref="docform"
- page-id="audit/spiccompositedatabase/spicCompositeDatabasePublish"
- :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
- :class="$style.form"
- :read-only="readOnly"
- @close="close(true)"
- @saved="saved"
- @sdFormReady="sdFormReady"
- >
- <template v-slot="{ model, fields }">
- <table>
- <tr>
- <sd-form-item-td name="title" />
- <sd-form-item-td name="reportYear">
- <a-date-picker
- v-model="model.reportYear"
- mode="year"
- picker="YYYY"
- format="YYYY"
- :allow-clear="false"
- placeholder="选择年度"
- :input-read-only="true"
- :open="endOpen"
- :value="year"
- @panelChange="yearChange"
- @openChange="handleEndOpenChange"
- ></a-date-picker>
- </sd-form-item-td>
- </tr>
- <tr>
- <!-- 上报单位 -->
- <sd-form-item-td name="reportUnitCode" />
- <!-- 在线反馈截至时间 -->
- <sd-form-item-td name="endTime" />
- </tr>
- <!-- 附件 -->
- <!-- <tr>
- <sd-form-item-td name="attachment" :colspan="3" />
- </tr> -->
- <tr>
- <!-- 参考模板 -->
- <sd-form-item-td name="referenceTemplate" :colspan="3" />
- </tr>
- <tr>
- <!-- 资料描述 -->
- <sd-form-item-td name="infoDesc" :colspan="3">
- <a-textarea v-model="model.infoDesc" :rowspan="4" />
- </sd-form-item-td>
- </tr>
- <tr>
- <sd-form-item-td name="remark" :colspan="3">
- <a-textarea v-model="model.remark" :rowspan="3" />
- </sd-form-item-td>
- </tr>
- <tr>
- <!-- 查看人员 -->
- <sd-form-item-td name="viewRanges" :colspan="3" />
- </tr>
- <tr>
- <!-- 编制人员 -->
- <sd-form-item-td name="creatorName" />
- <!-- 编制日期 -->
- <sd-form-item-td name="creationTime" />
- </tr>
- <tr>
- <sd-form-item-td name="uuid" hidden="true" />
- </tr>
- </table>
- </template>
- </sd-detail-form>
- </audit-form-top-banner>
- </span>
- </template>
- <script>
- import { Message, Modal } from 'ant-design-vue'
- import axios from '@/common/services/axios-instance'
- import crossWindowWatcher from '@/common/services/cross-window-watcher'
- import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
- import { getUserInfo } from '@/common/store-mixin'
- import auditAdvancedGroupMixins from '@product/iam/components/audit-advanced-group-mixins'
- import components from './_import-components/xm-composite-database-publish-form-import'
- export default {
- name: 'XmCompositeDatabasePublishForm',
- metaInfo() {
- return {
- title: '综合资料下发',
- }
- },
- components: { auditFormTopBanner, ...components },
- mixins: [auditAdvancedGroupMixins],
- data() {
- return {
- endOpen: false,
- year: null,
- mode: null,
- hidenOR0Show: true,
- readOnly: false,
- publish: 0, // 为1 时是发布
- }
- },
- created() {},
- mounted() {},
- methods: {
- // 页面加载完成后
- sdFormReady() {
- const ini = setInterval(() => {
- if (
- this.$refs.docform &&
- (this.$refs.docform.$refs.form || this.$refs.docform.$refs.sdForm)
- ) {
- clearInterval(ini)
- this.mode = this.$refs.docform.formData.mode
- if (this.$refs.docform.formData.pageFormData.beanId) {
- const docStatus = this.$refs.docform.getFieldValue('docStatus')
- if (docStatus === '已发布') {
- this.hidenOR0Show = false
- this.readOnly = true
- this.mode = 'VIEW'
- } else {
- const creatorAccount = this.$refs.docform.getFieldValue('creatorAccount')
- if (creatorAccount !== getUserInfo().account) {
- this.hidenOR0Show = false
- this.readOnly = true
- this.mode = 'VIEW'
- }
- }
- }
- }
- }, 100)
- axios({
- url: 'api/xcoa-mobile/v1/spicannualreportpublish/createSpicAnnualUuid',
- method: 'post',
- }).then((res) => {
- const uuid = res.data
- this.$refs.docform.setFieldValue('uuid', uuid)
- })
- },
- yearChange(value) {
- this.year = value
- this.$refs.docform.setFieldValue('reportYear', value.format('YYYY'))
- this.$refs.docform.validateField('reportYear').then((res) => {
- console.log(res)
- })
- if (document.getElementsByClassName('ant-calendar-picker-container').length > 0) {
- document.getElementsByClassName('ant-calendar-picker-container')[0].style.display = 'none'
- }
- },
- handleEndOpenChange(open) {
- this.endOpen = open
- },
- handelPublish() {
- this.$refs.docform.validateFields().then(() => {
- Modal.confirm({
- title: '提示',
- content: '请确认是否发布当前数据',
- onOk: () => {
- // 发布,保存
- this.$refs.docform.setFieldValue('docStatus', '已发布')
- this.publish = 1
- this.$refs.docform.save().then((res) => {
- const id = this.$refs.docform.getFieldValue('id')
- const uuid = this.$refs.docform.getFieldValue('uuid')
- axios({
- url:
- 'api/xcoa-mobile/v1/spiccompositedatabasepublish/createSpicCompositeDatabaseFlow',
- method: 'post',
- data: { uuid: uuid },
- })
- .then((res) => {
- if (res.data.isRequestSuccess === 'false') {
- Message.error('年度资料下发失败,请联系系统管理员')
- } else {
- Message.success('发布成功', 1).then((res) => {
- this.close(true)
- })
- }
- })
- .catch(() => {
- Message.error('服务异常')
- })
- })
- },
- onCancel: () => {},
- })
- })
- },
- // 保存
- saveForm() {
- // debugger
- if (this.publish !== 1) {
- this.$refs.docform.setFieldValue('docStatus', '起草中')
- }
- this.$refs.docform.saveBtnClick()
- },
- saved() {
- if (this.publish === 1) {
- Message.success('发布成功', 1).then((res) => {
- this.close(true)
- })
- } else {
- Message.success('保存成功', 1).then((res) => {
- this.close(true)
- })
- }
- },
- close(flag) {
- crossWindowWatcher.notifyChange(this.$route.path, flag)
- window.close()
- },
- },
- }
- </script>
- <style module lang="scss">
- @import '@/webflow/sd-flow-form.scss';
- .ant-card-body {
- padding: 12px;
- :global(.buttons_sd-detail-form_common) {
- :global(.ant-form-item-control-wrapper) {
- padding-top: 4%;
- padding-left: 24%;
- }
- }
- .tr_border {
- box-sizing: border-box;
- border-right: 1px solid #e8e8e8;
- border-left: 1px solid #e8e8e8;
- }
- :global(.title_sd-detail-form_common) {
- font-size: 1.5em;
- text-align: center;
- }
- }
- .btnselect {
- position: relative;
- top: 4px;
- right: 200px;
- float: right;
- .batchselect {
- z-index: 100;
- margin-left: 10px;
- }
- }
- </style>
|