Base.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. </template>
  3. <script>
  4. import { destroy } from "@/utils/ComponentUtils"
  5. import baseMixin from '@/mixin/baseMixin'
  6. let _ = require('lodash')
  7. // import bus from '@/assets/js/event.js'
  8. import ApprovalModal from '@/components/ApprovalModal'
  9. export default {
  10. mixins: [baseMixin],
  11. data () {
  12. return {
  13. menuId: null,
  14. checkType: 2,
  15. checkedKeys: [],
  16. refresh: true,
  17. globalReadonly: true,
  18. approver: '',
  19. initAfterFlag: false,
  20. submitStatus: 1,
  21. taskComment: ''
  22. }
  23. },
  24. computed: {
  25. curUser() {
  26. return this.$store.state.user.user;
  27. },
  28. theme() {
  29. return this.$store.state.home.theme;
  30. }
  31. },
  32. watch: {
  33. 'page.pageNo': function() {
  34. this.checkedKeys = [];
  35. },
  36. checkedKeys: function() {
  37. if (!this.page.list || this.checkedKeys.length != this.page.list.length) {
  38. this.checkType = 2;
  39. } else {
  40. this.checkType = (this.page.list && this.page.list.length >= 1) ? 1 : 2;
  41. }
  42. }
  43. },
  44. mounted () {
  45. },
  46. methods: {
  47. autoSearch: _.debounce(function() {
  48. this.$refs.pagination.search(1, true);
  49. }, 500),
  50. refreshTable: function (refreshTabId) {
  51. if (this.$route.name != refreshTabId) {
  52. return;
  53. }
  54. if (this.$refs.pagination == null) {
  55. return;
  56. }
  57. this.$nextTick(() => {
  58. if (this.$refs.pagination.$parent.$vnode.tag.endWith("-" + refreshTabId)) {
  59. this.$store.commit('home/SET_CUR_REFRESH_TABLE_TAB_ID', null);
  60. this.$refs.pagination.refresh();
  61. }
  62. });
  63. },
  64. checkAll: function(data) {
  65. this.checkedKeys = [];
  66. if (data.checked && this.page.list) {
  67. this.page.list.forEach(item => {
  68. this.checkedKeys.push(item.id);
  69. });
  70. }
  71. },
  72. check: function(data) {
  73. if (data.checked) {
  74. this.checkedKeys.push(data.val);
  75. } else {
  76. this.checkedKeys.remove(data.val);
  77. }
  78. },
  79. download: function (data, fileName) {
  80. if (!data || !data.data) {
  81. msg("文件下载失败(文件或已被删除)");
  82. return
  83. }
  84. let url = window.URL.createObjectURL(new Blob([data.data]))
  85. let link = document.createElement('a')
  86. link.style.display = 'none'
  87. link.href = url
  88. link.setAttribute('download', fileName || decodeURIComponent(data.fileName))
  89. document.body.appendChild(link)
  90. link.click()
  91. },
  92. refreshed: function() {
  93. this.refresh = false;
  94. this.$nextTick(() => {
  95. this.refresh = true;
  96. });
  97. },
  98. close: function () {
  99. var formViewName = this.$route.name;
  100. var _listViewName = formViewName;
  101. if (formViewName.endWith('Form')) {
  102. _listViewName = _listViewName.substring(0, formViewName.length - 4) + "List";
  103. } else if (formViewName.endWith('Add')) {
  104. _listViewName = _listViewName.substring(0, formViewName.length - 3) + "List";
  105. }
  106. if (_listViewName == "TransactionSubjectList" || _listViewName == "ProjectSubjectList") {
  107. _listViewName = "MeetingSubjectList";
  108. }
  109. this.closeView(this.$parent, formViewName, _listViewName);
  110. },
  111. closeView: function(parent, formViewName, _listViewName, viewName) {
  112. if (!parent) {
  113. return;
  114. }
  115. if (parent.backView) {
  116. parent.backView(formViewName, viewName || _listViewName);
  117. } else {
  118. this.closeView(parent.$parent, formViewName, _listViewName, parent.listView);
  119. }
  120. },
  121. toView: function(viewName, params, parent) {
  122. if (arguments.length == 2) {
  123. parent = this.$parent;
  124. }
  125. if (!parent) {
  126. return;
  127. }
  128. if (parent.clickMenu) {
  129. parent.clickMenu({
  130. "name": viewName,
  131. }, 3, params);
  132. return;
  133. }
  134. this.toView(viewName, params, parent.$parent);
  135. },
  136. approvalSubmit(status, cenableFlow) {
  137. // 默认正常(审批通过)状态
  138. this.submitStatus = status || 4;
  139. if (cenableFlow != false && this.enableFlow) {
  140. this.$layer.iframe({
  141. content: {
  142. content: ApprovalModal, //传递的组件对象
  143. parent: this,//当前的vue对象
  144. data: {
  145. submitFlow: true,
  146. taskName: this.$route.params.taskName || this.taskName,
  147. }
  148. },
  149. area: ['500px', '300px'],
  150. title: "选择审批人"
  151. });
  152. } else {
  153. this.save();
  154. }
  155. },
  156. trueSelectApproverAfter(approver, layerid) {
  157. this.approver = approver;
  158. this.save(layerid);
  159. },
  160. }
  161. }
  162. </script>
  163. <style scoped>
  164. </style>