iam-work-survey-form.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <audit-form-top-banner
  3. :handel-publish="handelPublish"
  4. :handel-save-form="saveForm"
  5. :form-data="mode"
  6. :hiden-or-show="hidenOR0Show"
  7. @handelPublish="handelPublish"
  8. @handelSaveForm="saveForm"
  9. >
  10. <sd-detail-form
  11. ref="iamAuditSurveyDetail"
  12. form-id="iamAuditSurvey"
  13. page-id="audit/survey/iamAuditSurvey"
  14. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  15. :class="$style.form"
  16. @close="close(true)"
  17. @saved="surveySave"
  18. @sdFormReady="sdFormReady"
  19. >
  20. <template v-slot="{ model }">
  21. <table>
  22. <tr :class="$style.displayTr">
  23. <td class="ant-form-item-label ant-form-item-label"></td>
  24. <td></td>
  25. <td class="ant-form-item-label ant-form-item-label"></td>
  26. <td></td>
  27. </tr>
  28. <tr>
  29. <!-- 文件标题 -->
  30. <sd-form-item-td name="title" :colspan="3" />
  31. </tr>
  32. <tr>
  33. <!-- 被审计单位 -->
  34. <sd-form-item-td name="auditedUnit" />
  35. <!-- <sd-form-item-td name="auditedUnitNames">
  36. <template v-slot:read-and-edit="{ editable }">
  37. <sd-list-picker
  38. v-model="model.auditedUnitNames"
  39. :read-only="!editable"
  40. :option-value="'code'"
  41. :load-list-data="getPikerData(model.projectId)"
  42. />
  43. </template>
  44. </sd-form-item-td> -->
  45. <!-- 文件编号 -->
  46. <sd-form-item-td name="code">
  47. <!-- <template v-slot:read-and-edit="{ editable }">
  48. <a-input
  49. v-if="editable"
  50. v-model="model.code"
  51. placeholder="编号自动生成"
  52. read-only
  53. ></a-input>
  54. <span v-else>{{ model.code }}</span>
  55. </template> -->
  56. </sd-form-item-td>
  57. </tr>
  58. <tr>
  59. <!-- 文件描述 -->
  60. <sd-form-item-td name="description" :colspan="3" />
  61. </tr>
  62. <tr>
  63. <!-- 附件 -->
  64. <sd-form-item-td name="attachment" :colspan="3" />
  65. </tr>
  66. <tr>
  67. <!-- 备注 -->
  68. <sd-form-item-td name="docRemarks" :colspan="3">
  69. <a-textarea v-model="model.docRemarks" :rows="3" />
  70. </sd-form-item-td>
  71. </tr>
  72. <tr>
  73. <!-- 编制人员 -->
  74. <sd-form-item-td name="drawUpName" />
  75. <!-- 编制日期 -->
  76. <sd-form-item-td name="drawUpTime" />
  77. </tr>
  78. <tr>
  79. <!-- 项目id -->
  80. <sd-form-item-td name="projectId" :hidden="true" />
  81. <!-- 编制人员账号 -->
  82. </tr>
  83. </table>
  84. </template>
  85. <span slot="AppointmentTime" slot-scope="appointmentTime">
  86. {{ appointmentTime | sdDateFormat('YYYY-MM-DD HH:mm') }}
  87. </span>
  88. </sd-detail-form>
  89. </audit-form-top-banner>
  90. </template>
  91. <script>
  92. import axios from '@/common/services/axios-instance'
  93. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  94. import { Message } from 'ant-design-vue'
  95. import auditFormTopBanner from '../../components/audit-form-top-banner'
  96. import components from './_import-components/iam-work-survey-form-import'
  97. export default {
  98. name: 'IamWorkSurveyForm',
  99. metaInfo: {
  100. title: '审计调查',
  101. },
  102. components: {
  103. ...components,
  104. auditFormTopBanner,
  105. },
  106. data() {
  107. return {
  108. projectId: this.$route.query.projectId, // 项目ID
  109. publish: 0, // 为1 时是发布
  110. mode: null,
  111. hidenOR0Show: true,
  112. }
  113. },
  114. mounted() {
  115. setTimeout(() => {
  116. const record = this.$route.query.record
  117. if (!record) {
  118. // this.setCode()
  119. this.setAuditUnit()
  120. this.$refs.iamAuditSurveyDetail.setFieldValue('projectId', parseFloat(this.projectId))
  121. }
  122. }, 500)
  123. },
  124. methods: {
  125. handelPublish() {
  126. // 发布,保存
  127. this.$refs.iamAuditSurveyDetail.setFieldValue('flileStatus', 2)
  128. this.publish = 1
  129. this.saveForm()
  130. },
  131. // 保存
  132. saveForm() {
  133. this.$refs.iamAuditSurveyDetail.validateFields().then(() => {
  134. this.$refs.iamAuditSurveyDetail.saveBtnClick()
  135. })
  136. },
  137. // 页面加载完成后
  138. sdFormReady() {
  139. this.mode = this.$refs.iamAuditSurveyDetail.formData.mode
  140. if (!this.mode) {
  141. this.mode = this.$refs.iamAuditSurveyDetail.formData.pageFormData.pageFieldInfos.find(
  142. (item) => {
  143. return item.name === 'title'
  144. }
  145. ).readonly
  146. ? 'VIEW'
  147. : 'EDIT'
  148. }
  149. const docStatus = this.$refs.iamAuditSurveyDetail.getFieldValue('flileStatus')
  150. if (docStatus === '2') {
  151. this.hidenOR0Show = false
  152. }
  153. },
  154. surveySave(model) {
  155. if (this.publish === 1) {
  156. Message.success('发布成功', 1).then((res) => {
  157. this.close(true)
  158. })
  159. } else {
  160. Message.success('保存成功', 1).then((res) => {
  161. this.close(true)
  162. })
  163. }
  164. },
  165. close(flag) {
  166. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  167. window.close()
  168. },
  169. setCode(model) {
  170. const params = {
  171. projectId: this.projectId,
  172. }
  173. if (this.projectId) {
  174. axios({
  175. url: 'api/xcoa-mobile/v1/iamauditsurvey/findCode',
  176. method: 'post',
  177. params,
  178. }).then((res) => {
  179. this.$refs.iamAuditSurveyDetail.setFieldValue('code', res.data)
  180. })
  181. }
  182. },
  183. setAuditUnit(model) {
  184. const params = {
  185. projectId: this.projectId,
  186. }
  187. if (this.projectId) {
  188. axios({
  189. url: 'api/xcoa-mobile/v1/iamauditsurvey/findAuditUnit',
  190. method: 'post',
  191. params,
  192. }).then((res) => {
  193. this.$refs.iamAuditSurveyDetail.setFieldValue('auditedUnit', res.data)
  194. })
  195. }
  196. },
  197. getPikerData(projectId) {
  198. return function() {
  199. return new Promise((resolve) => {
  200. axios({
  201. url: 'api/xcoa-mobile/v1/iamauditsurvey/findAuditedUnit?projectId=' + projectId,
  202. method: 'get',
  203. }).then((res) => {
  204. const dataSource = []
  205. res.data.forEach((item) => {
  206. dataSource.push({
  207. name: item.name,
  208. code: item.account,
  209. type: 'Group',
  210. })
  211. })
  212. resolve(dataSource)
  213. })
  214. })
  215. }
  216. },
  217. },
  218. }
  219. </script>
  220. <style module lang="scss">
  221. @import '@/webflow/sd-flow-form.scss';
  222. .ant-card-body {
  223. padding: 12px;
  224. :global(.buttons_sd-detail-form_common) {
  225. :global(.ant-form-item-control-wrapper) {
  226. padding-left: 24%;
  227. padding-top: 4%;
  228. }
  229. }
  230. .tr_border {
  231. box-sizing: border-box;
  232. border-right: 1px solid #e8e8e8;
  233. border-left: 1px solid #e8e8e8;
  234. }
  235. :global(.title_sd-detail-form_common) {
  236. font-size: 1.5em;
  237. text-align: center;
  238. }
  239. }
  240. .display-tr {
  241. td {
  242. border: none !important;
  243. }
  244. }
  245. </style>