UReportFileList.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <template>
  2. <a-card :bordered="false">
  3. <!-- 查询区域 -->
  4. <div class="table-page-search-wrapper">
  5. <a-form layout="inline">
  6. <a-row :gutter="24">
  7. <a-col :md="6" :sm="8">
  8. <a-form-item label="报表名称">
  9. <a-input placeholder="请输入报表名称" v-model="queryParam.name"></a-input>
  10. </a-form-item>
  11. </a-col>
  12. <a-col :md="6" :sm="8">
  13. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  14. <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
  15. <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
  16. </span>
  17. </a-col>
  18. </a-row>
  19. </a-form>
  20. </div>
  21. <a-row :gutter="24" style="margin-bottom:10px">
  22. <a-col :md="6" :sm="8">
  23. <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
  24. <a-button type="primary" @click="addData">新增</a-button>
  25. </span>
  26. </a-col>
  27. </a-row>
  28. <!-- table区域-begin -->
  29. <div>
  30. <a-table
  31. ref="table"
  32. size="middle"
  33. bordered
  34. rowKey="id"
  35. :columns="columns"
  36. :dataSource="dataSource"
  37. :pagination="ipagination"
  38. :loading="loading"
  39. @change="handleTableChange"
  40. >
  41. <span slot="action" slot-scope="text, record">
  42. <a @click="addParams(record)">绑定</a>
  43. <a-divider type="vertical" />
  44. <a @click="deleteParams(record)">解绑</a>
  45. <a-divider type="vertical" />
  46. <a @click="editData(record)">修改</a>
  47. </span>
  48. </a-table>
  49. </div>
  50. <!-- table区域-end -->
  51. <!-- 表单区域 -->
  52. <uReportFile-modal ref="modalForm" @ok="modalFormOk"></uReportFile-modal>
  53. <!-- 查看成员,接触绑定 -->
  54. <a-modal title="解除绑定" v-model="visible" @ok="handleOk" width="800px" class="close-account-my-project">
  55. <div style="display:flex;line-height:50px;flex-wrap: wrap;">
  56. <div style="width:25%;text-align:center;" v-for="(item, index) of memberList" :key="index">
  57. <a-tag color="#2db7f5" @close="log(item.userId)" closable>{{ item.userName }}</a-tag>
  58. </div>
  59. </div>
  60. </a-modal>
  61. <!-- 添加项目成员 -->
  62. <a-modal title="绑定用户" v-model="visibleAdd" @ok="handleOkAdd" :confirmLoading="confirmLoading">
  63. <!-- /sys/user/getAllUserList -->
  64. <a-select
  65. v-model="appId"
  66. showSearch
  67. allowClear
  68. mode="multiple"
  69. placeholder="请选择成员"
  70. optionFilterProp="children"
  71. style="width: 100%"
  72. :filterOption="filterOption"
  73. :maxTagCount="1"
  74. >
  75. <a-select-option
  76. v-for="appModel in options"
  77. :key="appModel.userId + new Date().getTime()"
  78. :value="appModel.userId"
  79. >
  80. {{ appModel.realName }}
  81. &#12288;&#12288;{{ appModel.roleName }}</a-select-option
  82. >
  83. </a-select>
  84. </a-modal>
  85. </a-card>
  86. </template>
  87. <script>
  88. import UReportFileModal from './modules/UReportFileModal'
  89. import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  90. import { httpAction, getAction, deleteAction } from '@/api/manage'
  91. export default {
  92. name: 'UReportFileList',
  93. mixins: [JeecgListMixin],
  94. components: {
  95. UReportFileModal
  96. },
  97. data() {
  98. return {
  99. description: '报表文件存储管理页面',
  100. // 表头
  101. columns: [
  102. {
  103. title: '报表模板名称',
  104. align: 'center',
  105. dataIndex: 'name'
  106. },
  107. {
  108. title: '操作',
  109. dataIndex: 'action',
  110. align: 'center',
  111. scopedSlots: { customRender: 'action' }
  112. }
  113. ],
  114. url: {
  115. list: '/ctop/uReportFile/list',
  116. delete: '/ctop/uReportFile/delete',
  117. deleteBatch: '/ctop/uReportFile/deleteBatch',
  118. exportXlsUrl: 'ctop/uReportFile/exportXls',
  119. importExcelUrl: 'ctop/uReportFile/importExcel'
  120. },
  121. visibleAdd: false,
  122. itemJson: null,
  123. list: [],
  124. options: [],
  125. confirmLoading: false,
  126. appId: [],
  127. memberList: [],
  128. visible: false,
  129. fileId: ''
  130. }
  131. },
  132. computed: {
  133. importExcelUrl: function() {
  134. return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
  135. }
  136. },
  137. methods: {
  138. filterOption(input, option) {
  139. return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  140. },
  141. addParams(item) {
  142. this.visibleAdd = true
  143. this.itemJson = item
  144. getAction('/sys/user/getAllUserList', '').then(res => {
  145. if (res.success) {
  146. this.list = res.result
  147. this.options = res.result
  148. }
  149. })
  150. },
  151. log(id) {
  152. httpAction('/ctop/uReportFile/unbindUser', { fileId: this.fileId, userId: id }, 'post').then(res => {
  153. if (res.success) {
  154. this.getMemberList(this.fileId)
  155. this.$message.success('删除成功')
  156. } else {
  157. this.$message.error(res.message)
  158. }
  159. })
  160. },
  161. handleOk(e) {
  162. this.visible = false
  163. },
  164. handleOkAdd(e) {
  165. var params = {}
  166. params.fileId = this.itemJson.id
  167. params.userIds = this.appId.join()
  168. this.confirmLoading = true
  169. httpAction('/ctop/uReportFile/bindUser', params, 'post').then(res => {
  170. this.confirmLoading = false
  171. if (res.success) {
  172. this.visibleAdd = false
  173. this.appId = []
  174. this.$message.success('添加成功')
  175. } else {
  176. this.$message.error('添加失败')
  177. }
  178. })
  179. },
  180. deleteParams(item) {
  181. this.fileId = item.id
  182. this.getMemberList(item.id)
  183. },
  184. editData(item) {
  185. var url = ''
  186. if (process.env.NODE_ENV === 'development') {
  187. url = 'http://api.tjyourong.com.cn/jeecg-boot/ureport/designer?_u=mysql:' + item.name
  188. } else if (process.env.NODE_ENV === 'production') {
  189. url = 'http://129.28.150.229:8804/jeecg-boot/ureport/designer?_u=mysql:' + item.name
  190. }
  191. window.open(url, '_blank')
  192. },
  193. addData(){
  194. var url = ''
  195. if (process.env.NODE_ENV === 'development') {
  196. url = 'http://api.tjyourong.com.cn/jeecg-boot/ureport/designer'
  197. } else if (process.env.NODE_ENV === 'production') {
  198. url = 'http://api.tjyourong.com.cn/jeecg-boot/ureport/designer'
  199. }
  200. window.open(url, '_blank')
  201. },
  202. getMemberList(id) {
  203. this.memberList = []
  204. httpAction('/ctop/uReportFileBindUser/userList', { fileId: id }, 'post').then(res => {
  205. if (res.success) {
  206. this.visible = true
  207. this.memberList = res.data
  208. }
  209. })
  210. }
  211. }
  212. }
  213. </script>
  214. <style scoped>
  215. @import '~@assets/less/common.less';
  216. </style>