internalFiles.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <template>
  2. <ibps-layout ref="layout">
  3. <!-- 外部 -->
  4. <div slot="west">
  5. <div class="box">
  6. <p class="title">文件类型</p>
  7. <el-input placeholder="输入关键字进行过滤" v-model="filterText">
  8. </el-input>
  9. <div class="treeDiv">
  10. <el-tree ref="tree" :data="typeData" :props="defaultProps" @node-click="handleNodeClick"
  11. :filter-node-method="filterNode"></el-tree>
  12. </div>
  13. </div>
  14. <ibps-container :margin-left="width + 'px'" class="page">
  15. <el-alert v-if="!show" :closable="false" title="请选择左边菜单右键进行操作!" type="warning" show-icon
  16. style="height:50px;" />
  17. <template v-else>
  18. <ibps-crud key="istree" ref="crud" :data="tableData" :toolbars="listConfig.toolbars"
  19. :search-form="listConfig.searchForm" :pk-key="pkKey" :columns="listConfig.columns"
  20. :loading="loading" @action-event="handleAction">
  21. <template slot="wenjinachayue" slot-scope="scope">
  22. <ibps-attachment :value="scope.row.zi_duan_er_" readonly allow-download :download="true" />
  23. </template>
  24. </ibps-crud>
  25. </template>
  26. </ibps-container>
  27. </div>
  28. </ibps-layout>
  29. </template>
  30. <script>
  31. import ActionUtils from '@/utils/action'
  32. import { getFileType, getFileByUserId } from '@/api/permission/file'
  33. import IbpsAttachment from '@/business/platform/file/attachment/selector'
  34. export default {
  35. components: {
  36. 'ibps-attachment': IbpsAttachment
  37. },
  38. data() {
  39. return {
  40. show: '',
  41. rightsArr: ['join', 'delete'],
  42. rowHandle: true,
  43. width: 230,
  44. orgId: '',
  45. oldorgId: '',
  46. orgName: '',
  47. loading: false,
  48. typeData: [
  49. { id: '0', label: '质量手册' },
  50. { id: '1', label: '程序文件' },
  51. { id: '2', label: '程序文件表单' },
  52. { id: '3', label: '检测方法SOP' },
  53. { id: '4', label: '设备操作维护SOP' },
  54. { id: '5', label: '设备设施验证SOP' },
  55. { id: '6', label: '检测方法验证SOP' },
  56. { id: '7', label: '管理类SOP' },
  57. { id: '8', label: '检测方法SOP表单' },
  58. { id: '9', label: '设备操作维护SOP表单' },
  59. { id: '10', label: '设备设施验证SOP表单' },
  60. { id: '11', label: '检测方法验证SOP表单' },
  61. { id: '12', label: '管理类SOP表单' },
  62. { id: '13', label: '公司管理制度' },
  63. { id: '14', label: '非检测方法SOP' },
  64. { id: '15', label: '检测方法确认SOP' },
  65. { id: '16', label: '非标确认规定' },
  66. { id: '17', label: '非检测方法SOP表单' },
  67. { id: '18', label: '非检测方法确认SOP表单' },
  68. ],
  69. filterText: '',
  70. defaultProps: {
  71. children: 'children',
  72. label: 'label'
  73. },
  74. pkKey: 'id', // 主键 如果主键不是pk需要传主键
  75. loading: false,
  76. tableData: [],
  77. listTreeData: [],
  78. listConfig: {
  79. // 工具栏
  80. toolbars: [
  81. { key: 'search' }
  82. ],
  83. // 查询条件
  84. searchForm: {
  85. forms: [
  86. { prop: 'fileCode', label: '文件编号' },
  87. { prop: 'fileName', label: '文件名称' },
  88. // { prop: 'deptName', label: '部门' },
  89. ]
  90. },
  91. // 表格字段配置
  92. columns: [
  93. // { prop: 'zi_duan_yi_', label: '部门' },
  94. { prop: 'wen_jian_bian_hao', label: '文件编号' },
  95. { prop: 'wen_jian_ming_che', label: '文件名称' },
  96. { prop: 'ban_ben_hao_', label: '版本号' },
  97. { prop: 'fa_bu_ri_qi_', label: '发布日期' },
  98. { prop: 'zi_duan_er_', label: '查阅', slotName: "wenjinachayue" }
  99. ]
  100. },
  101. listOptions: {
  102. border: true,
  103. stripe: true
  104. },
  105. pagination: {},
  106. sorts: {},
  107. // testData: [{
  108. // zi_duan_yi_: '1',
  109. // wen_jian_bian_hao: '2',
  110. // wen_jian_ming_che: '3',
  111. // ban_ben_hao_: '4',
  112. // fa_bu_ri_qi_: '5',
  113. // zi_duan_er_: '880481571788816384'
  114. // }]
  115. }
  116. },
  117. mounted() {
  118. // this.loadNode()
  119. },
  120. methods: {
  121. filterNode(value, data) {
  122. if (!value) return true;
  123. return data.label.indexOf(value) !== -1;
  124. },
  125. loadNode() {
  126. this.loading = true
  127. // getFileType("内部文件").then(res => {
  128. // this.loading = false
  129. // for (let i in res.variables.data) {
  130. // let data = {}
  131. // data["id"] = i
  132. // data["label"] = res.variables.data[i]
  133. // this.typeData.push(data)
  134. // }
  135. // }).catch(res => {
  136. // this.loading = false
  137. // })
  138. },
  139. refreshData() {
  140. this.tableData = []
  141. getFileByUserId(this.getSearcFormData()).then(res => {
  142. this.tableData = res.variables.data
  143. }).catch(res => {
  144. this.loading = false
  145. this.tableData = []
  146. })
  147. },
  148. handleNodeClick(data) {
  149. this.show = 'detail'
  150. if (this.oldorgId == data.id) {
  151. return
  152. } else {
  153. getFileByUserId({
  154. deptName: "",
  155. fileCode: "",
  156. fileName: "",
  157. fileType: data.label,
  158. userId: this.$store.getters.userInfo.employee.id
  159. }).then(res => {
  160. this.oldorgId = data.id
  161. this.tableData = res.variables.data
  162. }).catch(res => {
  163. this.loading = false
  164. this.tableData = []
  165. })
  166. }
  167. },
  168. /**
  169. * 获取格式化参数
  170. */
  171. getSearcFormData() {
  172. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  173. params['fileType'] = this.typeData[this.oldorgId].label
  174. params['userId'] = this.$store.getters.userInfo.employee.id
  175. return params
  176. },
  177. /**
  178. * 处理按钮事件
  179. */
  180. handleAction(command, position, selection, data) {
  181. switch (command) {
  182. case 'search':// 查询
  183. this.refreshData()
  184. break
  185. default:
  186. break
  187. }
  188. },
  189. },
  190. watch: {
  191. filterText(val) {
  192. this.$refs.tree.filter(val);
  193. }
  194. },
  195. }
  196. </script>
  197. <style lang="less" scoped>
  198. .box {
  199. width: 230px;
  200. }
  201. .title {
  202. font-size: 14px;
  203. margin: 21px 5px 5px;
  204. padding: 0;
  205. }
  206. .treeDiv {
  207. height: 800px;
  208. overflow-y: auto;
  209. }
  210. /deep/ .el-tree-node__content {
  211. display: block;
  212. }
  213. </style>