iam-dm-financlaljob-form.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  1. <template>
  2. <audit-form-top-banner :handel-save-form="saveForm" :form-data="mode" @handelSaveForm="saveForm">
  3. <sd-detail-form
  4. ref="docform"
  5. form-id="iamFinFinancialJob"
  6. page-id="dm/financlalJob/iamFinFinancialJob"
  7. :record-id="this.$route.query.record ? parseInt(this.$route.query.record) : null"
  8. :class="$style.form"
  9. :read-only="!saveFlag"
  10. @close="close(true)"
  11. @saved="saved"
  12. @sdFormReady="sdFormReady"
  13. >
  14. <template v-slot="{ model, fields }">
  15. <table>
  16. <tr>
  17. <td style="padding-left:5px;border:none">
  18. <audit-advanced-group
  19. :expand="basicExpand"
  20. :expand-str="'basicExpand'"
  21. :group-label="'基本信息'"
  22. tablestyle="''"
  23. @changedClick="changedClick"
  24. ></audit-advanced-group>
  25. </td>
  26. </tr>
  27. </table>
  28. <table v-show="basicExpand">
  29. <tr>
  30. <td class="ant-form-item-label ant-form-item-label" :class="$style.firstTd"></td>
  31. <td class="ant-form-item-control-wrapper" :class="$style.firstTd"></td>
  32. <td class="ant-form-item-label ant-form-item-label" :class="$style.firstTd"></td>
  33. <td class="ant-form-item-control-wrapper" :class="$style.firstTd"></td>
  34. </tr>
  35. <tr>
  36. <!-- 转换名称 -->
  37. <sd-form-item-td name="configName" label="转换名称" :colspan="3">
  38. <template v-slot:read-and-edit>
  39. <a-select
  40. v-model="model.configName"
  41. :options="configOptions"
  42. allow-clear
  43. @change="configChange"
  44. ></a-select>
  45. </template>
  46. </sd-form-item-td>
  47. <!-- ID -->
  48. <sd-form-item-td name="configId" :hidden="true" />
  49. </tr>
  50. <tr>
  51. <!-- 执行规则 -->
  52. <sd-form-item-td name="jobCron" :colspan="3">
  53. <template v-slot:read-and-edit>
  54. <a-input v-model="model.jobCron" @click="fnShowCron"></a-input>
  55. </template>
  56. </sd-form-item-td>
  57. </tr>
  58. <tr>
  59. <!-- 是否启用 -->
  60. <sd-form-item-td name="jobStatus" :colspan="3" label="是否启用">
  61. <!-- <template v-slot:read-and-edit>
  62. <a-select v-model="model.jobStatus">
  63. <a-select-option value="1">是</a-select-option>
  64. <a-select-option value="0">否</a-select-option>
  65. </a-select>
  66. </template> -->
  67. </sd-form-item-td>
  68. </tr>
  69. <tr>
  70. <!-- 说明 -->
  71. <sd-form-item-td name="remark" :colspan="3">
  72. <a-textarea v-model="model.remark" :rows="3" />
  73. </sd-form-item-td>
  74. </tr>
  75. <tr>
  76. <!-- 维护人员 -->
  77. <sd-form-item-td name="creatorName" />
  78. <!-- 维护日期 -->
  79. <sd-form-item-td name="creationTime" />
  80. </tr>
  81. </table>
  82. <!-- cron选择组件 -->
  83. <a-modal
  84. width="600px"
  85. title="表达式"
  86. :footer="null"
  87. :visible="showCron"
  88. @cancel="handleCancel"
  89. >
  90. <vcrontab :expression="croninput" @hide="showCron = false" @fill="crontabFill"></vcrontab>
  91. </a-modal>
  92. </template>
  93. </sd-detail-form>
  94. </audit-form-top-banner>
  95. </template>
  96. <script>
  97. import vcrontab from 'vcrontab'
  98. import axios from '@/common/services/axios-instance'
  99. import crossWindowWatcher from '@/common/services/cross-window-watcher'
  100. import { message } from '@/common/one-ui'
  101. import auditFormTopBanner from '@product/iam/components/audit-form-top-banner'
  102. import auditAdvancedGroup from '@product/iam/components/audit-advanced-group'
  103. import auditAdvancedGroupMixins from '@product/iam/components/audit-advanced-group-mixins'
  104. import components from './_import-components/iam-dm-financlaljob-form-import'
  105. import 'element-ui/lib/theme-chalk/index.css'
  106. export default {
  107. name: 'IamDmFinanclaljobForm',
  108. metaInfo: {
  109. title: '定时采集配置',
  110. },
  111. components: {
  112. ...components,
  113. auditAdvancedGroup,
  114. auditFormTopBanner,
  115. vcrontab,
  116. },
  117. mixins: [auditAdvancedGroupMixins],
  118. data() {
  119. return {
  120. configOptions: [], // 转换配置列表
  121. croninput: '',
  122. showCron: false,
  123. mode: null,
  124. saveFlag: true,
  125. basicExpand: true,
  126. etlConfigOptions: [],
  127. }
  128. },
  129. mounted() {
  130. this.getOptions()
  131. },
  132. methods: {
  133. fnShowCron() {
  134. this.showCron = true
  135. },
  136. handleCancel(e) {
  137. this.showCron = !this.showCron
  138. },
  139. crontabFill(value) {
  140. // 确定后回传的值
  141. this.croninput = value
  142. this.$refs.docform.setFieldValue('jobCron', value)
  143. },
  144. configChange(val, option) {
  145. this.$refs.docform.setFieldValue('configId', Number(option.data.key))
  146. },
  147. // 页面加载完成后
  148. sdFormReady() {
  149. this.mode = this.$refs.docform.formData.mode
  150. this.croninput = this.$refs.docform.getFieldValue('jobCron')
  151. },
  152. // 保存
  153. saveForm() {
  154. this.$refs.docform.validateFields().then(() => {
  155. message.success('保存成功').then(() => {
  156. this.$refs.docform.saveBtnClick()
  157. })
  158. })
  159. // this.$refs.docform.saveBtnClick()
  160. },
  161. saved() {
  162. this.close(true)
  163. },
  164. close(flag) {
  165. crossWindowWatcher.notifyChange(this.$route.fullPath, flag)
  166. window.close()
  167. },
  168. getOptions() {
  169. axios({
  170. url: 'api/xcoa-mobile/v1/iamfinfinancialjob/getOptions',
  171. method: 'get',
  172. }).then((res) => {
  173. if (res) {
  174. this.configOptions = [...res.data].map((item) => {
  175. return {
  176. value: item.configName,
  177. label: item.configName,
  178. key: item.id,
  179. }
  180. })
  181. }
  182. })
  183. },
  184. },
  185. }
  186. </script>
  187. <style module lang="scss">
  188. @use '@/common/design' as *;
  189. @import '@/webflow/sd-flow-form.scss';
  190. .connect-btn {
  191. float: right;
  192. font-weight: 400;
  193. font-size: 16px;
  194. top: 8px;
  195. cursor: pointer;
  196. margin-right: 10px;
  197. }
  198. .first-td {
  199. border: none !important;
  200. padding: 0;
  201. }
  202. </style>