internalFiles.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  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="输入关键字进行过滤"
  8. v-model="filterText">
  9. </el-input>
  10. <div class="treeDiv">
  11. <el-tree ref="tree"
  12. :data="typeData"
  13. :props="defaultProps"
  14. @node-click="handleNodeClick"
  15. :filter-node-method="filterNode"></el-tree>
  16. </div>
  17. </div>
  18. <ibps-container :margin-left="width + 'px'"
  19. class="page">
  20. <el-alert v-if="!show"
  21. :closable="false"
  22. title="请选择左边菜单右键进行操作!"
  23. type="warning"
  24. show-icon
  25. style="height:50px;" />
  26. <template v-else>
  27. <ibps-crud key="istree"
  28. ref="crud"
  29. :data="tableData"
  30. :toolbars="listConfig.toolbars"
  31. :search-form="listConfig.searchForm"
  32. :pk-key="pkKey"
  33. :columns="listConfig.columns"
  34. :loading="loading"
  35. @sort-change="handleSortChange"
  36. @action-event="handleAction">
  37. <template slot="wenjinachayue"
  38. slot-scope="scope">
  39. <ibps-attachment :value="scope.row.wen_jian_id_"
  40. readonly
  41. allow-download
  42. :download="false" />
  43. </template>
  44. </ibps-crud>
  45. </template>
  46. </ibps-container>
  47. </div>
  48. </ibps-layout>
  49. </template>
  50. <script>
  51. import ActionUtils from '@/utils/action'
  52. import { getFileType, getFileByUserId } from '@/api/permission/file'
  53. import IbpsAttachment from '@/business/platform/file/attachment/selector'
  54. import curdPost from '@/business/platform/form/utils/custom/joinCURD.js'
  55. export default {
  56. components: {
  57. 'ibps-attachment': IbpsAttachment
  58. },
  59. data() {
  60. return {
  61. show: '',
  62. rightsArr: ['join', 'delete'],
  63. rowHandle: true,
  64. width: 230,
  65. orgId: '',
  66. oldorgId: '',
  67. orgName: '',
  68. loading: false,
  69. typeData: [
  70. { id: '0', label: '质量管理手册(QM)' },
  71. { id: '1', label: '程序文件(QP)' },
  72. { id: '2', label: '生物安全手册(SWAQ)' },
  73. { id: '3', label: '行政管理制度(ZD)' },
  74. { id: '4', label: '检测类(JC-SOP)' },
  75. { id: '5', label: '仪器设备类(YQ-SOP)' },
  76. { id: '6', label: '期间核查类(HC-SOP)' },
  77. { id: '7', label: '环境设施类(HJ-SOP)' },
  78. { id: '8', label: '[限] 技术管理类(ZQ-SOP)' },
  79. { id: '9', label: '技术记录表(FQ)' },
  80. { id: '10', label: '管理记录表(FQ)' }
  81. ],
  82. paramsTypeData: [
  83. { id: '0', label: '质量管理手册(QM)' },
  84. { id: '1', label: '程序文件(QP)' },
  85. { id: '2', label: '生物安全手册(SWAQ)' },
  86. { id: '3', label: '行政管理制度(ZD)' },
  87. { id: '4', label: '检测类(JC-SOP)' },
  88. { id: '5', label: '仪器设备类(YQ-SOP)' },
  89. { id: '6', label: '期间核查类(HC-SOP)' },
  90. { id: '7', label: '环境设施类(HJ-SOP)' },
  91. { id: '8', label: '技术管理类(ZQ-SOP)' },
  92. { id: '9', label: '技术记录表(FQ)' },
  93. { id: '10', label: '管理记录表(FQ)' }
  94. ],
  95. filterText: '',
  96. defaultProps: {
  97. children: 'children',
  98. label: 'label'
  99. },
  100. pkKey: 'id', // 主键 如果主键不是pk需要传主键
  101. loading: false,
  102. tableData: [],
  103. listTreeData: [],
  104. listConfig: {
  105. // 工具栏
  106. toolbars: [
  107. { key: 'search' }
  108. ],
  109. // 查询条件
  110. searchForm: {
  111. forms: [
  112. { prop: 'fileCode', label: '文件编号' },
  113. { prop: 'fileName', label: '文件名称' },
  114. // { prop: 'deptName', label: '部门' },
  115. ]
  116. },
  117. // 表格字段配置
  118. columns: [
  119. // { prop: 'zi_duan_yi_', label: '部门' },
  120. { prop: 'wen_jian_bian_hao', label: '文件编号', sortable: 'custom', width: 150 },
  121. { prop: 'wen_jian_ming_che', label: '文件名称' },
  122. { prop: 'ban_ben_hao_', label: '版本号', width: 150 },
  123. { prop: 'fa_bu_ri_qi_', label: '发布日期', width: 150, sortable: 'custom' },
  124. { prop: 'wen_jian_id_', label: '查阅', slotName: "wenjinachayue" }
  125. ]
  126. },
  127. listOptions: {
  128. border: true,
  129. stripe: true
  130. },
  131. pagination: {},
  132. sorts: {},
  133. // testData: [{
  134. // zi_duan_yi_: '1',
  135. // wen_jian_bian_hao: '2',
  136. // wen_jian_ming_che: '3',
  137. // ban_ben_hao_: '4',
  138. // fa_bu_ri_qi_: '5',
  139. // wen_jian_id_: '880481571788816384'
  140. // }]
  141. }
  142. },
  143. mounted() {
  144. // this.loadNode()
  145. },
  146. methods: {
  147. filterNode(value, data) {
  148. if (!value) return true;
  149. return data.label.indexOf(value) !== -1;
  150. },
  151. loadNode() {
  152. this.loading = true
  153. },
  154. getDatas(sorts) {
  155. this.tableData = []
  156. let sql = ''
  157. let wheres = ''
  158. if (sorts.fileCode) {
  159. wheres = wheres + ` and wen_jian_bian_hao like '%${sorts.fileCode}%'`
  160. }
  161. if (sorts.fileType) {
  162. wheres = wheres + ` and wen_jian_lie_xing = '${sorts.fileType}'`
  163. }
  164. if (sorts.fileType == '技术管理类(ZQ-SOP)') {
  165. if (sorts.fileName) {
  166. wheres = wheres + ` and wj.wen_jian_ming_che like '%${sorts.fileName}%'`
  167. }
  168. if (sorts.sorts) {
  169. if (JSON.stringify(sorts.sorts) !== "{}") {
  170. wheres = wheres + ` order by ${Object.keys(sorts.sorts)} ${Object.values(sorts.sorts)}`
  171. }
  172. }
  173. sql = `select wj.*,qx.yong_hu_id_ from t_wjcysqb qx left join t_wjgl wj ON qx.wen_jian_id_ = wj.id_ where qx.yong_hu_id_ = ${sorts.userId} ${wheres} `
  174. } else {
  175. if (sorts.fileName) {
  176. wheres = wheres + ` and wen_jian_ming_che like '%${sorts.fileName}%'`
  177. }
  178. if (sorts.sorts) {
  179. if (JSON.stringify(sorts.sorts) !== "{}") {
  180. wheres = wheres + ` order by ${Object.keys(sorts.sorts)} ${Object.values(sorts.sorts)}`
  181. }
  182. }
  183. sql = `select *FROM t_wjgl WHERE wen_jian_zhuang_t = '已发放' AND yi_gai_zuo_fei_='否' ${wheres} `
  184. }
  185. curdPost('sql', sql).then(res => {
  186. this.tableData = res.variables.data
  187. }).catch(res => {
  188. this.loading = false
  189. this.tableData = []
  190. })
  191. },
  192. refreshData() {
  193. this.tableData = []
  194. this.getDatas(this.getSearcFormData())
  195. },
  196. handleNodeClick(data) {
  197. this.oldorgId = data
  198. this.show = 'detail'
  199. if (this.oldorgId == data.id) {
  200. return
  201. } else {
  202. this.getDatas({
  203. fileType: this.paramsTypeData[data.id].label,
  204. userId: this.$store.getters.userInfo.employee.id,
  205. sorts: { 'wen_jian_bian_hao': 'desc' }
  206. })
  207. }
  208. },
  209. /**
  210. * 获取格式化参数
  211. */
  212. getSearcFormData() {
  213. const params = this.$refs['crud'] ? this.$refs['crud'].getSearcFormData() : {}
  214. params['fileType'] = this.paramsTypeData[this.oldorgId.id].label
  215. params['userId'] = this.$store.getters.userInfo.employee.id
  216. params['sorts'] = this.sorts
  217. return params
  218. },
  219. /**
  220. * 处理按钮事件
  221. */
  222. handleAction(command, position, selection, data) {
  223. switch (command) {
  224. case 'search':// 查询
  225. this.refreshData()
  226. break
  227. default:
  228. break
  229. }
  230. },
  231. /**
  232. * 处理排序
  233. */
  234. handleSortChange(sort) {
  235. ActionUtils.setSorts(this.sorts, sort)
  236. this.getDatas(this.getSearcFormData())
  237. },
  238. },
  239. watch: {
  240. filterText(val) {
  241. this.$refs.tree.filter(val);
  242. }
  243. },
  244. }
  245. </script>
  246. <style lang="less" scoped>
  247. .box {
  248. width: 230px;
  249. }
  250. .title {
  251. font-size: 14px;
  252. margin: 21px 5px 5px;
  253. padding: 0;
  254. }
  255. .treeDiv {
  256. height: 800px;
  257. overflow-y: auto;
  258. }
  259. /deep/ .el-tree-node__content {
  260. display: block;
  261. }
  262. </style>