阅行客电子档案
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

212 lines
7.0 KiB

  1. <template>
  2. <el-dialog class="detail-dialog" :title="overDetialTitle" :visible.sync="overDetialVisible" :close-on-click-modal="false" :modal-append-to-body="false" append-to-body :before-close="handleClose" @opened="opened">
  3. <div class="setting-dialog">
  4. <div class="detail-tab tab-content">
  5. <ul class="tab-nav" style="padding: 0;">
  6. <li :class="{'active-tab-nav': activeIndex == 0 }" @click="changeActiveTab(0)">流程表单</li>
  7. <li :class="{'active-tab-nav': activeIndex == 1 }" @click="changeActiveTab(1)">流程图</li>
  8. </ul>
  9. <div v-if="activeIndex == 0">
  10. <el-form ref="form" :model="form" :rules="rules" inline label-width="110px">
  11. <el-form-item label="标题" prop="title">
  12. <el-input v-model="form.title" style="width: 280px;" />
  13. </el-form-item>
  14. <el-form-item label="申请时间" prop="date">
  15. <el-input v-model="form.date" style="width: 280px;" disabled />
  16. </el-form-item>
  17. <el-form-item label="申请人" prop="applicant">
  18. <el-input v-model="form.applicant" style="width: 280px;" disabled />
  19. </el-form-item>
  20. <el-form-item label="申请人部门" prop="dept">
  21. <el-input v-model="form.dept" style="width: 280px;" disabled />
  22. </el-form-item>
  23. <el-form-item label="申请理由" prop="reason">
  24. <el-input v-model="form.reason" type="textarea" style="width: 660px;" :rows="4" />
  25. </el-form-item>
  26. </el-form>
  27. <ArchivesListModule v-if="activeIndex == 0" ref="archivesListModule" :selected-category="selectedCategory" :collect-level="collectLevel" :selections="selections" />
  28. </div>
  29. <div v-if="activeIndex == 1" class="tab-img">
  30. <img :src="'data:image/jpeg;base64,'+ srcImg" alt="" :onerror="defaultImg">
  31. </div>
  32. </div>
  33. <div slot="footer" class="dialog-footer">
  34. <el-button type="primary" @click="submitHandOverForm">提交</el-button>
  35. </div>
  36. </div>
  37. </el-dialog>
  38. </template>
  39. <script>
  40. import { FetchFondsDetail } from '@/api/system/fonds'
  41. import { FetchBusinessFlowTitle } from '@/api/collect/collect'
  42. import { FetchIntoFlowBusiness } from '@/api/archivesManage/library'
  43. import { mapGetters } from 'vuex'
  44. import ArchivesListModule from '@/views/components/archivesListModule/index'
  45. import { getCurrentTime } from '@/utils/index'
  46. export default {
  47. name: 'HandOverForm',
  48. components: { ArchivesListModule },
  49. props: {
  50. selectedCategory: {
  51. type: Object,
  52. default: function() {
  53. return {}
  54. }
  55. },
  56. collectLevel: {
  57. type: Number,
  58. default: function() {
  59. return null
  60. }
  61. },
  62. selections: {
  63. type: Array,
  64. default: () => []
  65. },
  66. isHandOver: {
  67. type: Boolean,
  68. default: false
  69. }
  70. },
  71. data() {
  72. return {
  73. overType: 3,
  74. targetFondsNo: null,
  75. overDetialTitle: '',
  76. activeIndex: 0,
  77. overDetialVisible: false,
  78. form: {
  79. title: null,
  80. date: null,
  81. applicant: null,
  82. dept: null,
  83. reason: null,
  84. fondsNo: null
  85. },
  86. rules: {
  87. title: [
  88. { required: true, message: '标题不可为空', trigger: 'blur' }
  89. ]
  90. },
  91. defaultImg: 'this.src="' + require('@/assets/images/system/default-img.jpg') + '"',
  92. srcImg: null
  93. }
  94. },
  95. computed: {
  96. ...mapGetters([
  97. 'user',
  98. 'baseApi'
  99. ])
  100. },
  101. created() {
  102. },
  103. methods: {
  104. opened() {
  105. if (this.activeIndex === 0) {
  106. this.form.applicant = this.user.username
  107. this.form.dept = this.user.dept.deptsName
  108. this.form.date = getCurrentTime().split(' ')[0]
  109. this.getFondsDetail()
  110. this.$refs.archivesListModule.getViewTable()
  111. }
  112. },
  113. getFondsDetail() {
  114. FetchFondsDetail({ id: this.user.fonds.id }).then((res) => {
  115. this.form.fondsNo = res.fondsNo
  116. if (res.fondsNo) {
  117. this.getBusinessFlowTitle()
  118. }
  119. }).catch(err => {
  120. console.log(err)
  121. })
  122. },
  123. changeActiveTab(data) {
  124. this.activeIndex = data
  125. if (this.activeIndex === 0) {
  126. console.log('流程表单')
  127. } else if (this.activeIndex === 1) {
  128. console.log('流程图')
  129. }
  130. },
  131. getBusinessFlowTitle() {
  132. const params = {
  133. 'username': this.user.username,
  134. 'fondsNo': this.form.fondsNo,
  135. 'businessType': this.isHandOver ? 6 : this.overType
  136. }
  137. FetchBusinessFlowTitle(params).then((res) => {
  138. if (res.code !== 500) {
  139. console.log(res)
  140. this.form.title = res
  141. } else {
  142. this.$message({ message: '失败', type: 'error', offset: 8 })
  143. }
  144. }).catch(err => {
  145. console.log(err)
  146. })
  147. },
  148. submitHandOverForm() {
  149. this.$refs['form'].validate((valid) => {
  150. if (valid) {
  151. const archivesIds = []
  152. this.selections.forEach(val => {
  153. archivesIds.push(val.id)
  154. })
  155. const params = {
  156. 'title': this.form.title, // 流程名称
  157. 'applicant': this.user.username, // 申请人
  158. 'archivesIds': archivesIds,
  159. 'businessType': this.isHandOver ? 6 : this.overType,
  160. 'categoryId': this.selectedCategory.id,
  161. 'categoryLevel': this.collectLevel,
  162. 'reason': this.form.reason,
  163. 'fondsNo': this.form.fondsNo, // 原始全宗
  164. 'targetFondsNo': this.targetFondsNo ? this.targetFondsNo.fondsId : null// 目标全宗号
  165. // 'targetPosition': 'string', // 目的位置
  166. // 'startPosition': 'string', // 开始位置
  167. // 'giveStartTime': null, // 赋权开始时间
  168. // 'giveEndTime': null // 赋权结束时间
  169. }
  170. console.log(params)
  171. FetchIntoFlowBusiness(params).then((res) => {
  172. if (res.code !== 5001) {
  173. this.$message({ message: '操作提交成功', type: 'success', offset: 8 })
  174. this.$emit('close-dialog')
  175. } else {
  176. // const message = JSON.parse(res.message)
  177. // this.$message.error(message.fail.join(',') + '操作提交失败')
  178. this.$message({ message: res.message, type: 'error', offset: 8 })
  179. }
  180. this.handleClose()
  181. }).catch(err => {
  182. console.log(err)
  183. })
  184. } else {
  185. console.log('error submit!!')
  186. return false
  187. }
  188. })
  189. },
  190. // dialog - close
  191. handleClose(done) {
  192. this.form.title = ''
  193. this.form.reason = ''
  194. this.overDetialVisible = false
  195. this.$refs['form'].resetFields()
  196. done()
  197. }
  198. }
  199. }
  200. </script>
  201. <style lang="scss" scoped>
  202. .tab-img{
  203. height: 440px;
  204. overflow: hidden;
  205. img{
  206. display: block;
  207. width: 100%;
  208. // height: 100%;
  209. }
  210. }
  211. </style>