km-knowledage-editmodal.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <div>
  3. <!-- 勘误 -->
  4. <sd-detail-modal
  5. ref="oaDetail"
  6. :record-id="fwId"
  7. page-id="audit/km/knowledge/kmKnowledge/kmKnowledge"
  8. :modal-props="{ width: 1000 }"
  9. @saved="fwEditSaved"
  10. @actionBtnClick="actionBtnClick"
  11. >
  12. <template v-slot="{ model, fields }">
  13. <table>
  14. <tr>
  15. <sd-form-item-td name="title" :colspan="3" />
  16. </tr>
  17. <tr>
  18. <!-- 所属分类 -->
  19. <sd-form-item-td name="category" :colspan="3">
  20. <template v-slot:read-and-edit="{ editable }">
  21. <km-tree-select
  22. v-model="model.category"
  23. :editable="editable"
  24. tree-data-url="api/xcoa-mobile/v1/km-knowledge-category/knowledge-category-tree?pageId=kmKnowledge"
  25. ></km-tree-select>
  26. </template>
  27. </sd-form-item-td>
  28. </tr>
  29. <tr>
  30. <!-- 标签 -->
  31. <sd-form-item-td name="label" :colspan="3">
  32. <template v-slot:read-and-edit="{ editable }">
  33. <km-tag-picker v-model="model.label" :editable="editable" />
  34. </template>
  35. </sd-form-item-td>
  36. </tr>
  37. <tr>
  38. <!-- 业务领域 -->
  39. <sd-form-item-td name="businessArea" :colspan="3">
  40. <template v-slot:read-and-edit="{ editable }">
  41. <km-business-area-picker v-model="model.businessArea" :read-only="!editable" />
  42. </template>
  43. </sd-form-item-td>
  44. </tr>
  45. <tr>
  46. <!-- 摘要 -->
  47. <sd-form-item-td name="abstractMessage" :colspan="3">
  48. <a-textarea
  49. v-model="model.abstractMessage"
  50. :rows="4"
  51. placeholder="请输入摘要"
  52. allow-clear
  53. />
  54. </sd-form-item-td>
  55. </tr>
  56. <tr>
  57. <!-- 文档附件 -->
  58. <sd-form-item-td name="applyAttachment" :colspan="3" />
  59. </tr>
  60. <tr>
  61. <!-- 封面上传 -->
  62. <sd-form-item-td name="cover">
  63. <template v-slot:read-and-edit="{ editable }">
  64. <oa-upload-img
  65. v-model="model.cover"
  66. :read-only="!editable"
  67. :group-id="JSON.parse(fields.coverAttachment.value).value"
  68. ></oa-upload-img>
  69. </template>
  70. </sd-form-item-td>
  71. <!-- 默认集成该父类权限 -->
  72. <sd-form-item-td name="authFollowParent" />
  73. </tr>
  74. <tr v-if="model.authFollowParent === '0'">
  75. <!-- 是否允许评价 -->
  76. <sd-form-item-td name="authComment" />
  77. <!-- 附件是否允许下载 -->
  78. <sd-form-item-td name="authDownload" />
  79. </tr>
  80. <tr v-if="model.authFollowParent === '0'">
  81. <!-- 发布用户 -->
  82. <sd-form-item-td name="applyPerson" />
  83. <!-- 发布部门 -->
  84. <sd-form-item-td name="applyDept" />
  85. </tr>
  86. <tr>
  87. <!-- 作者 -->
  88. <sd-form-item-td name="creatorName" />
  89. <!-- 所属部门 -->
  90. <sd-form-item-td name="createDeptName" />
  91. </tr>
  92. </table>
  93. </template>
  94. </sd-detail-modal>
  95. </div>
  96. </template>
  97. <script>
  98. import { Message, Modal } from 'ant-design-vue'
  99. import components from './_import-components/km-knowledage-editmodal-import'
  100. export default {
  101. name: 'KmKnowledageEditmodal',
  102. metaInfo: {
  103. title: 'OaEditForm',
  104. },
  105. components,
  106. props: {
  107. fwId: {
  108. type: Number,
  109. default: null,
  110. },
  111. showEditMoldal: {
  112. type: Boolean,
  113. default: false,
  114. },
  115. },
  116. data() {
  117. return {
  118. docId: null,
  119. }
  120. },
  121. watch: {
  122. showEditMoldal: function(newValue) {
  123. this.docId = undefined
  124. this.$refs.oaDetail.show()
  125. },
  126. },
  127. mounted() {},
  128. methods: {
  129. // 勘误保存
  130. fwEditSaved() {
  131. Modal.success({
  132. title: '勘误成功!',
  133. onOk: () => {
  134. // 获取详情
  135. this.$emit('queryKnowledgeDetails')
  136. },
  137. })
  138. },
  139. actionBtnClick(evt, btn) {
  140. if (btn.buttonId === 'save') {
  141. evt.waitUntil(
  142. new Promise((resolve, reject) => {
  143. const params = this.$refs.oaDetail.getFieldsValue()
  144. if (params.authFollowParent === '0') {
  145. if (params.applyDept.length === 0 && params.applyPerson.length === 0) {
  146. Message.warn('发布人员和发布部门不能同时为空')
  147. evt.preventDefault()
  148. resolve()
  149. } else {
  150. resolve()
  151. }
  152. } else {
  153. resolve()
  154. }
  155. })
  156. )
  157. }
  158. },
  159. },
  160. }
  161. </script>
  162. <style module lang="scss">
  163. @use '@/common/design' as *;
  164. </style>