123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252 |
- <template>
- <audit-form-top-banner
- :handel-publish="handelPublish"
- :handel-save-form="saveForm"
- :form-data="mode"
- :hiden-or-show="hidenOR0Show"
- @handelPublish="handelPublish"
- @handelSaveForm="saveForm"
- >
- <sd-detail-form
- ref="iamAuditSurveyDetail"
- form-id="iamAuditSurvey"
- page-id="audit/survey/iamAuditSurvey"
- :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
- :class="$style.form"
- @close="close(true)"
- @saved="surveySave"
- @sdFormReady="sdFormReady"
- >
- <template v-slot="{ model }">
- <table>
- <tr :class="$style.displayTr">
- <td class="ant-form-item-label ant-form-item-label"></td>
- <td></td>
- <td class="ant-form-item-label ant-form-item-label"></td>
- <td></td>
- </tr>
- <tr>
- <!-- 文件标题 -->
- <sd-form-item-td name="title" :colspan="3" />
- </tr>
- <tr>
- <!-- 被审计单位 -->
- <sd-form-item-td name="auditedUnit" />
- <!-- <sd-form-item-td name="auditedUnitNames">
- <template v-slot:read-and-edit="{ editable }">
- <sd-list-picker
- v-model="model.auditedUnitNames"
- :read-only="!editable"
- :option-value="'code'"
- :load-list-data="getPikerData(model.projectId)"
- />
- </template>
- </sd-form-item-td> -->
- <!-- 文件编号 -->
- <sd-form-item-td name="code">
- <!-- <template v-slot:read-and-edit="{ editable }">
- <a-input
- v-if="editable"
- v-model="model.code"
- placeholder="编号自动生成"
- read-only
- ></a-input>
- <span v-else>{{ model.code }}</span>
- </template> -->
- </sd-form-item-td>
- </tr>
- <tr>
- <!-- 文件描述 -->
- <sd-form-item-td name="description" :colspan="3" />
- </tr>
- <tr>
- <!-- 附件 -->
- <sd-form-item-td name="attachment" :colspan="3" />
- </tr>
- <tr>
- <!-- 备注 -->
- <sd-form-item-td name="docRemarks" :colspan="3">
- <a-textarea v-model="model.docRemarks" :rows="3" />
- </sd-form-item-td>
- </tr>
- <tr>
- <!-- 编制人员 -->
- <sd-form-item-td name="drawUpName" />
- <!-- 编制日期 -->
- <sd-form-item-td name="drawUpTime" />
- </tr>
- <tr>
- <!-- 项目id -->
- <sd-form-item-td name="projectId" :hidden="true" />
- <!-- 编制人员账号 -->
- </tr>
- </table>
- </template>
- <span slot="AppointmentTime" slot-scope="appointmentTime">
- {{ appointmentTime | sdDateFormat('YYYY-MM-DD HH:mm') }}
- </span>
- </sd-detail-form>
- </audit-form-top-banner>
- </template>
- <script>
- import axios from '@/common/services/axios-instance'
- import crossWindowWatcher from '@/common/services/cross-window-watcher'
- import { Message } from 'ant-design-vue'
- import auditFormTopBanner from '../../components/audit-form-top-banner'
- import components from './_import-components/iam-work-survey-form-import'
- export default {
- name: 'IamWorkSurveyForm',
- metaInfo: {
- title: '审计调查',
- },
- components: {
- ...components,
- auditFormTopBanner,
- },
- data() {
- return {
- projectId: this.$route.query.projectId, // 项目ID
- publish: 0, // 为1 时是发布
- mode: null,
- hidenOR0Show: true,
- }
- },
- mounted() {
- setTimeout(() => {
- const record = this.$route.query.record
- if (!record) {
- // this.setCode()
- this.setAuditUnit()
- this.$refs.iamAuditSurveyDetail.setFieldValue('projectId', parseFloat(this.projectId))
- }
- }, 500)
- },
- methods: {
- handelPublish() {
- // 发布,保存
- this.$refs.iamAuditSurveyDetail.setFieldValue('flileStatus', 2)
- this.publish = 1
- this.saveForm()
- },
- // 保存
- saveForm() {
- this.$refs.iamAuditSurveyDetail.validateFields().then(() => {
- this.$refs.iamAuditSurveyDetail.saveBtnClick()
- })
- },
- // 页面加载完成后
- sdFormReady() {
- this.mode = this.$refs.iamAuditSurveyDetail.formData.mode
- if (!this.mode) {
- this.mode = this.$refs.iamAuditSurveyDetail.formData.pageFormData.pageFieldInfos.find(
- (item) => {
- return item.name === 'title'
- }
- ).readonly
- ? 'VIEW'
- : 'EDIT'
- }
- const docStatus = this.$refs.iamAuditSurveyDetail.getFieldValue('flileStatus')
- if (docStatus === '2') {
- this.hidenOR0Show = false
- }
- },
- surveySave(model) {
- 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.fullPath, flag)
- window.close()
- },
- setCode(model) {
- const params = {
- projectId: this.projectId,
- }
- if (this.projectId) {
- axios({
- url: 'api/xcoa-mobile/v1/iamauditsurvey/findCode',
- method: 'post',
- params,
- }).then((res) => {
- this.$refs.iamAuditSurveyDetail.setFieldValue('code', res.data)
- })
- }
- },
- setAuditUnit(model) {
- const params = {
- projectId: this.projectId,
- }
- if (this.projectId) {
- axios({
- url: 'api/xcoa-mobile/v1/iamauditsurvey/findAuditUnit',
- method: 'post',
- params,
- }).then((res) => {
- this.$refs.iamAuditSurveyDetail.setFieldValue('auditedUnit', res.data)
- })
- }
- },
- getPikerData(projectId) {
- return function() {
- return new Promise((resolve) => {
- axios({
- url: 'api/xcoa-mobile/v1/iamauditsurvey/findAuditedUnit?projectId=' + projectId,
- method: 'get',
- }).then((res) => {
- const dataSource = []
- res.data.forEach((item) => {
- dataSource.push({
- name: item.name,
- code: item.account,
- type: 'Group',
- })
- })
- resolve(dataSource)
- })
- })
- }
- },
- },
- }
- </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-left: 24%;
- padding-top: 4%;
- }
- }
- .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;
- }
- }
- .display-tr {
- td {
- border: none !important;
- }
- }
- </style>
|