index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. <template>
  2. <div class="app-container">
  3. <div>
  4. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  5. <el-form-item :label="$t('部门')" prop="units">
  6. <el-select v-model="units" :placeholder="$t('请选择') + $t('部门')" clearable size="small" multiple
  7. @change="handleQuery">
  8. <el-option
  9. v-for="dict in unitOptions"
  10. :key="dict.dictValue"
  11. :label="dict.dictLabel"
  12. :value="dict.dictValue"
  13. />
  14. </el-select>
  15. </el-form-item>
  16. <el-form-item :label="$t('班值')" prop="teams">
  17. <el-select v-model="teams" :placeholder="$t('请选择') + $t('班值')" clearable size="small" multiple
  18. @change="handleQuery">
  19. <el-option
  20. v-for="dict in teamOptions"
  21. :key="dict.dictValue"
  22. :label="dict.dictLabel"
  23. :value="dict.dictValue"
  24. />
  25. </el-select>
  26. </el-form-item>
  27. <el-form-item :label="$t('实际岗位')" prop="actualposts" label-width="200">
  28. <el-select v-model="actualposts" :placeholder="$t('请选择') + $t('实际岗位')" clearable size="small" multiple
  29. @change="handleQuery">
  30. <el-option
  31. v-for="dict in actualpostOptions"
  32. :key="dict.dictValue"
  33. :label="dict.dictLabel"
  34. :value="dict.dictValue"
  35. />
  36. </el-select>
  37. </el-form-item>
  38. <el-form-item>
  39. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  40. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  41. </el-form-item>
  42. </el-form>
  43. <el-row :gutter="10" class="mb8">
  44. <el-col :span="1.5">
  45. <div class="bz-box">
  46. <i class="iconfont icon-star"></i> 应急响应管理小组组长
  47. <i class="iconfont icon-love"></i> 志愿响应小组(VRT)队长
  48. <i class="iconfont icon-triangle"></i>危化品应急处置小组成员
  49. <i class="iconfont icon-square"></i>班组安全代表
  50. <i class="iconfont icon-plus"></i>急救员
  51. <i class="iconfont icon-round"></i>义务消防员
  52. <i class="iconfont icon-yuanjiaoliujiaoxing"></i>安委会成员
  53. <i class="iconfont icon-shebeitubiao_famen"></i>TDS负责人
  54. </div>
  55. </el-col>
  56. <right-toolbar :showSearch.sync="showSearch" @queryTable="getChartData"></right-toolbar>
  57. </el-row>
  58. <div id="tree" ref="orgChartDom"></div>
  59. </div>
  60. <vue-draggable-resizable w="auto" h="auto" :draggable="dragMove" style="background-color:white">
  61. <div class="zoom" @wheel.prevent="handleTableWheel($event)" ref="branch">
  62. <branch :dataArray="list1"></branch>
  63. </div>
  64. </vue-draggable-resizable>
  65. <!-- 侧栏 --->
  66. <el-drawer
  67. title="附件"
  68. ref="drawer"
  69. direction="rtl"
  70. :visible.sync="drawer">
  71. <el-table :data="doc.commonfileList" border>
  72. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  73. <template slot-scope="scope">
  74. <a class="link-type" @click="handleDownload(scope.row)">
  75. <span>{{ scope.row.fileName }}</span>
  76. </a>
  77. </template>
  78. </el-table-column>
  79. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80"/>
  80. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  81. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  82. <template slot-scope="scope">
  83. <el-button
  84. v-if="scope.row.fileName.endsWith('pdf')"
  85. size="mini"
  86. type="text"
  87. icon="el-icon-view"
  88. @click="handleSee(scope.row)"
  89. >{{ $t('预览') }}
  90. </el-button>
  91. <el-button
  92. size="mini"
  93. type="text"
  94. icon="el-icon-download"
  95. @click="handleDownload(scope.row)"
  96. >{{ $t('下载') }}
  97. </el-button>
  98. </template>
  99. </el-table-column>
  100. </el-table>
  101. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  102. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  103. <el-button size="mini" type="text" @click="openPdf">{{ $t('新页面打开PDF') }}</el-button>
  104. </div>
  105. <div style="margin-top: -30px">
  106. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  107. </div>
  108. </el-dialog>
  109. </el-drawer>
  110. </div>
  111. </template>
  112. <script>
  113. import VueDraggableResizable from 'vue-draggable-resizable'
  114. import Branch from './branch'
  115. import {listOgzStaffmgr} from "@/api/plant/staffmgr";
  116. import {getToken} from "@/utils/auth";
  117. import {allFileList} from "@/api/common/commonfile";
  118. export default {
  119. components: {Branch, VueDraggableResizable},
  120. data() {
  121. return {
  122. showSearch: false,
  123. // 实际岗位字典
  124. actualpostOptions: [],
  125. showOrgChartData: [],
  126. staffmgrList: [],
  127. // 部门字典
  128. unitOptions: [],
  129. // 班值字典
  130. teamOptions: [],
  131. // 查询参数
  132. queryParams: {
  133. unit: null,
  134. team: null,
  135. actualpost: null,
  136. education: null,
  137. enAbility: null,
  138. educations: null,
  139. units: null,
  140. teams: null,
  141. actualposts: null,
  142. },
  143. units: [],
  144. teams: [],
  145. actualposts: ["24", "26", "14", "16", "18", "20", "12", "10", "34", "36","15"],
  146. dragMove: true,
  147. drawer: false,
  148. info: {},
  149. list0: [{
  150. "id": 10109,
  151. "pId": 0,
  152. "label": "朱晶",
  153. "post": "装置经理",
  154. "secretary": [[{
  155. "id": 10113,
  156. "pId": 10109,
  157. "label": "赵建清",
  158. "post": "装置副经理",
  159. "secretary": [[], []],
  160. "children": [{"id": 10101, "pId": 10113, "label": "张磊", "post": "资深工程师", "secretary": [[], []]}, {
  161. "id": 10103,
  162. "pId": 10113,
  163. "label": "高勇",
  164. "post": "资深工程师",
  165. "secretary": [[], []]
  166. }]
  167. }, {
  168. "id": 10117,
  169. "pId": 10109,
  170. "label": "居海波",
  171. "post": "装置副经理",
  172. "secretary": [[], []],
  173. "children": [{"id": 10106, "pId": 10117, "label": "邹生耀", "post": "资深工程师", "secretary": [[], []]}]
  174. }, {"id": 10102, "pId": 10109, "label": "韦岳平", "post": "装置副经理", "secretary": [[], []]}], []],
  175. "children": [{"id": 10116, "pId": 10109, "label": "陈琨", "post": "资深工程师", "secretary": [[], []]}, {
  176. "id": 10114,
  177. "pId": 10109,
  178. "label": "樊宏斌",
  179. "post": "生产主管",
  180. "secretary": [[], []]
  181. }, {"id": 10108, "pId": 10109, "label": "袁永成", "post": "生产主管", "secretary": [[], []]}, {
  182. "id": 10107,
  183. "pId": 10109,
  184. "label": "潘传安",
  185. "post": "生产主管",
  186. "secretary": [[], []]
  187. }, {"id": 10104, "pId": 10109, "label": "胡文逵", "post": "生产主管", "secretary": [[], []]}, {
  188. "id": 10110,
  189. "pId": 10109,
  190. "label": "孙文龙",
  191. "post": "生产主管",
  192. "secretary": [[], []]
  193. }, {"id": 10115, "pId": 10109, "label": "鲍波", "post": "工长", "secretary": [[], []]}, {
  194. "id": 10043,
  195. "pId": 10109,
  196. "label": "占丽萍",
  197. "post": "职员",
  198. "secretary": [[], []]
  199. }, {"id": 10112, "pId": 10109, "label": "何氢", "post": "主操(白班)", "secretary": [[], []]}, {
  200. "id": 10054,
  201. "pId": 10109,
  202. "label": "李滕",
  203. "post": "主操(白班)",
  204. "secretary": [[], []]
  205. }, {
  206. "id": 10001,
  207. "pId": 10109,
  208. "label": "徐建飞",
  209. "post": "倒班班长",
  210. "secretary": [[], []],
  211. "children": [{"id": 10014, "pId": 10001, "label": "陈涛", "post": "倒班副班长", "secretary": [[], []]}, {
  212. "id": 10012,
  213. "pId": 10001,
  214. "label": "陆危圣",
  215. "post": "倒班副班长",
  216. "secretary": [[], []]
  217. }, {"id": 10008, "pId": 10001, "label": "任秋香", "post": "主操", "secretary": [[], []]}, {
  218. "id": 10019,
  219. "pId": 10001,
  220. "label": "刘伟程",
  221. "post": "主操",
  222. "secretary": [[], []]
  223. }, {"id": 10010, "pId": 10001, "label": "张磊", "post": "主操", "secretary": [[], []]}, {
  224. "id": 10015,
  225. "pId": 10001,
  226. "label": "崔海军",
  227. "post": "主操",
  228. "secretary": [[], []]
  229. }, {"id": 10000, "pId": 10001, "label": "王俊", "post": "主操", "secretary": [[], []]}, {
  230. "id": 10003,
  231. "pId": 10001,
  232. "label": "马国春",
  233. "post": "主操",
  234. "secretary": [[], []]
  235. }, {"id": 10004, "pId": 10001, "label": "申海宁", "post": "主操", "secretary": [[], []]}, {
  236. "id": 10006,
  237. "pId": 10001,
  238. "label": "张燕燕",
  239. "post": "主操",
  240. "secretary": [[], []]
  241. }, {"id": 10009, "pId": 10001, "label": "缪海荣", "post": "主操", "secretary": [[], []]}, {
  242. "id": 10017,
  243. "pId": 10001,
  244. "label": "高峰",
  245. "post": "主操",
  246. "secretary": [[], []]
  247. }, {"id": 10018, "pId": 10001, "label": "蒋恒兵", "post": "主操", "secretary": [[], []]}, {
  248. "id": 10020,
  249. "pId": 10001,
  250. "label": "刘金京",
  251. "post": "主操",
  252. "secretary": [[], []]
  253. }, {"id": 10002, "pId": 10001, "label": "张力飞", "post": "主操", "secretary": [[], []]}, {
  254. "id": 10005,
  255. "pId": 10001,
  256. "label": "李欣阳",
  257. "post": "主操",
  258. "secretary": [[], []]
  259. }, {"id": 10007, "pId": 10001, "label": "宋月民", "post": "主操", "secretary": [[], []]}, {
  260. "id": 10013,
  261. "pId": 10001,
  262. "label": "贾云飞",
  263. "post": "主操",
  264. "secretary": [[], []]
  265. }, {"id": 10016, "pId": 10001, "label": "张炜", "post": "主操", "secretary": [[], []]}, {
  266. "id": 10011,
  267. "pId": 10001,
  268. "label": "宋章浩",
  269. "post": "主操",
  270. "secretary": [[], []]
  271. }]
  272. }, {
  273. "id": 10031,
  274. "pId": 10109,
  275. "label": "臧闽军",
  276. "post": "倒班班长",
  277. "secretary": [[], []],
  278. "children": [{"id": 10028, "pId": 10031, "label": "朱健", "post": "倒班副班长", "secretary": [[], []]}, {
  279. "id": 10032,
  280. "pId": 10031,
  281. "label": "袁晨",
  282. "post": "倒班副班长",
  283. "secretary": [[], []]
  284. }, {"id": 10035, "pId": 10031, "label": "陈海飞", "post": "主操", "secretary": [[], []]}, {
  285. "id": 10024,
  286. "pId": 10031,
  287. "label": "刘尊超",
  288. "post": "主操",
  289. "secretary": [[], []]
  290. }, {"id": 10026, "pId": 10031, "label": "马卫兵", "post": "主操", "secretary": [[], []]}, {
  291. "id": 10027,
  292. "pId": 10031,
  293. "label": "曹西元",
  294. "post": "主操",
  295. "secretary": [[], []]
  296. }, {"id": 10029, "pId": 10031, "label": "顾仁海", "post": "主操", "secretary": [[], []]}, {
  297. "id": 10036,
  298. "pId": 10031,
  299. "label": "李静",
  300. "post": "主操",
  301. "secretary": [[], []]
  302. }, {"id": 10037, "pId": 10031, "label": "朱永宜", "post": "主操", "secretary": [[], []]}, {
  303. "id": 10039,
  304. "pId": 10031,
  305. "label": "封公瑾",
  306. "post": "主操",
  307. "secretary": [[], []]
  308. }, {"id": 10040, "pId": 10031, "label": "姜翠君", "post": "主操", "secretary": [[], []]}, {
  309. "id": 10022,
  310. "pId": 10031,
  311. "label": "周湘",
  312. "post": "主操",
  313. "secretary": [[], []]
  314. }, {"id": 10041, "pId": 10031, "label": "梁宏伟", "post": "主操", "secretary": [[], []]}, {
  315. "id": 10025,
  316. "pId": 10031,
  317. "label": "蒋宁宁",
  318. "post": "主操",
  319. "secretary": [[], []]
  320. }, {"id": 10030, "pId": 10031, "label": "吴中鑫", "post": "主操", "secretary": [[], []]}, {
  321. "id": 10038,
  322. "pId": 10031,
  323. "label": "刘辉",
  324. "post": "主操",
  325. "secretary": [[], []]
  326. }, {"id": 10033, "pId": 10031, "label": "郑骅", "post": "主操", "secretary": [[], []]}, {
  327. "id": 10034,
  328. "pId": 10031,
  329. "label": "张琦",
  330. "post": "主操",
  331. "secretary": [[], []]
  332. }, {"id": 10023, "pId": 10031, "label": "邓阳", "post": "主操", "secretary": [[], []]}, {
  333. "id": 10021,
  334. "pId": 10031,
  335. "label": "李凤希",
  336. "post": "主操",
  337. "secretary": [[], []]
  338. }]
  339. }, {
  340. "id": 10049,
  341. "pId": 10109,
  342. "label": "沈涛",
  343. "post": "倒班班长",
  344. "secretary": [[], []],
  345. "children": [{"id": 10048, "pId": 10049, "label": "乔刚", "post": "倒班副班长", "secretary": [[], []]}, {
  346. "id": 10045,
  347. "pId": 10049,
  348. "label": "宦文恺",
  349. "post": "倒班副班长",
  350. "secretary": [[], []]
  351. }, {"id": 10050, "pId": 10049, "label": "卓兴凤", "post": "主操", "secretary": [[], []]}, {
  352. "id": 10052,
  353. "pId": 10049,
  354. "label": "阚久龙",
  355. "post": "主操",
  356. "secretary": [[], []]
  357. }, {"id": 10055, "pId": 10049, "label": "王超", "post": "主操", "secretary": [[], []]}, {
  358. "id": 10056,
  359. "pId": 10049,
  360. "label": "张永",
  361. "post": "主操",
  362. "secretary": [[], []]
  363. }, {"id": 10058, "pId": 10049, "label": "宋浦江", "post": "主操", "secretary": [[], []]}, {
  364. "id": 10060,
  365. "pId": 10049,
  366. "label": "夏军",
  367. "post": "主操",
  368. "secretary": [[], []]
  369. }, {"id": 10047, "pId": 10049, "label": "劳青川", "post": "主操", "secretary": [[], []]}, {
  370. "id": 10062,
  371. "pId": 10049,
  372. "label": "邢启元",
  373. "post": "主操",
  374. "secretary": [[], []]
  375. }, {"id": 10061, "pId": 10049, "label": "韩叶锋", "post": "主操", "secretary": [[], []]}, {
  376. "id": 10053,
  377. "pId": 10049,
  378. "label": "谢振华",
  379. "post": "主操",
  380. "secretary": [[], []]
  381. }, {"id": 10057, "pId": 10049, "label": "黄梓赫", "post": "主操", "secretary": [[], []]}, {
  382. "id": 10059,
  383. "pId": 10049,
  384. "label": "周权",
  385. "post": "主操",
  386. "secretary": [[], []]
  387. }, {"id": 10046, "pId": 10049, "label": "赵振湘", "post": "主操", "secretary": [[], []]}, {
  388. "id": 10051,
  389. "pId": 10049,
  390. "label": "沈文勇",
  391. "post": "主操",
  392. "secretary": [[], []]
  393. }, {"id": 10042, "pId": 10049, "label": "卞传庆", "post": "主操", "secretary": [[], []]}, {
  394. "id": 10044,
  395. "pId": 10049,
  396. "label": "李士军",
  397. "post": "主操",
  398. "secretary": [[], []]
  399. }]
  400. }, {
  401. "id": 10064,
  402. "pId": 10109,
  403. "label": "刘遵胜",
  404. "post": "倒班班长",
  405. "secretary": [[], []],
  406. "children": [{
  407. "id": 10063,
  408. "pId": 10064,
  409. "label": "王维庆",
  410. "post": "倒班副班长",
  411. "secretary": [[], []]
  412. }, {"id": 10083, "pId": 10064, "label": "郝维祥", "post": "倒班副班长", "secretary": [[], []]}, {
  413. "id": 10073,
  414. "pId": 10064,
  415. "label": "李飞虎",
  416. "post": "主操",
  417. "secretary": [[], []]
  418. }, {"id": 10075, "pId": 10064, "label": "杨赞", "post": "主操", "secretary": [[], []]}, {
  419. "id": 10078,
  420. "pId": 10064,
  421. "label": "何叡颖",
  422. "post": "主操",
  423. "secretary": [[], []]
  424. }, {"id": 10082, "pId": 10064, "label": "王欢", "post": "主操", "secretary": [[], []]}, {
  425. "id": 10084,
  426. "pId": 10064,
  427. "label": "王守清",
  428. "post": "主操",
  429. "secretary": [[], []]
  430. }, {"id": 10079, "pId": 10064, "label": "王竹宣", "post": "主操", "secretary": [[], []]}, {
  431. "id": 10066,
  432. "pId": 10064,
  433. "label": "徐乐",
  434. "post": "主操",
  435. "secretary": [[], []]
  436. }, {"id": 10071, "pId": 10064, "label": "胡远斌", "post": "主操", "secretary": [[], []]}, {
  437. "id": 10074,
  438. "pId": 10064,
  439. "label": "马云凤",
  440. "post": "主操",
  441. "secretary": [[], []]
  442. }, {"id": 10077, "pId": 10064, "label": "秦飞", "post": "主操", "secretary": [[], []]}, {
  443. "id": 10081,
  444. "pId": 10064,
  445. "label": "程佩佩",
  446. "post": "主操",
  447. "secretary": [[], []]
  448. }, {"id": 10069, "pId": 10064, "label": "孙夕斌", "post": "主操", "secretary": [[], []]}, {
  449. "id": 10070,
  450. "pId": 10064,
  451. "label": "胡保宁",
  452. "post": "主操",
  453. "secretary": [[], []]
  454. }, {"id": 10068, "pId": 10064, "label": "王刚", "post": "主操", "secretary": [[], []]}, {
  455. "id": 10072,
  456. "pId": 10064,
  457. "label": "王勇",
  458. "post": "主操",
  459. "secretary": [[], []]
  460. }, {"id": 10065, "pId": 10064, "label": "陈熹", "post": "主操", "secretary": [[], []]}, {
  461. "id": 10067,
  462. "pId": 10064,
  463. "label": "朱国柱",
  464. "post": "主操",
  465. "secretary": [[], []]
  466. }, {"id": 10080, "pId": 10064, "label": "孙浩", "post": "主操", "secretary": [[], []]}]
  467. }]
  468. }],
  469. list1: []
  470. ,
  471. list2: [],
  472. // 报告附件参数
  473. doc: {
  474. file: "",
  475. // 是否显示弹出层(报告附件)
  476. open: false,
  477. // 弹出层标题(报告附件)
  478. title: "",
  479. // 是否禁用上传
  480. isUploading: false,
  481. // 是否更新已经存在的用户数据
  482. updateSupport: 0,
  483. // 报告附件上传位置编号
  484. ids: 0,
  485. // 设置上传的请求头部
  486. headers: {Authorization: "Bearer " + getToken()},
  487. // 上传的地址
  488. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  489. commonfileList: null,
  490. queryParams: {
  491. pId: null,
  492. pType: 'staffmgr'
  493. },
  494. pType: 'staffmgr',
  495. pId: null
  496. },
  497. pdf: {
  498. title: '',
  499. pdfUrl: '',
  500. numPages: null,
  501. open: false,
  502. pageNum: 1,
  503. pageTotalNum: 1,
  504. loadedRatio: 0,
  505. },
  506. }
  507. },
  508. created() {
  509. this.getDicts("ACTUALPOST").then(response => {
  510. this.actualpostOptions = response.data;
  511. });
  512. this.getDicts("STAFF_UNIT").then(response => {
  513. this.unitOptions = response.data;
  514. });
  515. this.getDicts("TEAM_DIVIDE").then(response => {
  516. this.teamOptions = response.data;
  517. });
  518. this.getChartData()
  519. },
  520. mounted() {
  521. this.bus.$on('info', (data) => {
  522. this.drawer = true
  523. this.doc.queryParams.pId = data.id
  524. allFileList(this.doc.queryParams).then(response => {
  525. this.doc.commonfileList = response;
  526. });
  527. this.info = data
  528. })
  529. },
  530. methods: {
  531. handleTableWheel(event) {
  532. let obj = this.$refs['branch']
  533. return this.tableZoom(obj, event)
  534. },
  535. tableZoom(obj, event) {
  536. // 一开始默认是100%
  537. let zoom = parseInt(obj.style.zoom, 10) || 100
  538. // 滚轮滚一下wheelDelta的值增加或减少120
  539. zoom += event.wheelDelta / 12
  540. if (zoom > 50) {
  541. obj.style.zoom = zoom + '%'
  542. }
  543. return false
  544. },
  545. dclick() {
  546. this.drawer = true
  547. },
  548. /** 重置按钮操作 */
  549. resetQuery() {
  550. this.resetForm("queryForm");
  551. this.units = []
  552. this.teams = []
  553. this.actualposts = []
  554. this.handleQuery();
  555. },
  556. /** 搜索按钮操作 */
  557. handleQuery() {
  558. this.getChartData();
  559. },
  560. getChartData() {
  561. this.queryParams.units = this.units.join()
  562. this.queryParams.teams = this.teams.join()
  563. this.queryParams.actualposts = this.actualposts.join()
  564. listOgzStaffmgr(this.queryParams).then(response => {
  565. this.staffmgrList = response;
  566. this.list2 = []
  567. for (let i = 0; i < this.staffmgrList.length; i++) {
  568. console.log("第" + i)
  569. let post = this.selectDictLabel(this.actualpostOptions, this.staffmgrList[i].actualpost)
  570. if (this.staffmgrList[i].pId == 0) {
  571. let nodeData = {
  572. id: this.staffmgrList[i].id,
  573. pId: this.staffmgrList[i].pId,
  574. label: this.staffmgrList[i].name,
  575. post: post,
  576. secretary: [[], []],
  577. // img: 'http://47.114.101.16:8080' + process.env.VUE_APP_BASE_API + this.staffmgrList[i].photo,
  578. img: 'https://cpms.basf-ypc.net.cn' + process.env.VUE_APP_BASE_API + this.staffmgrList[i].photo,
  579. bz1: false,
  580. bz2: false,
  581. bz3: false,
  582. bz4: false,
  583. bz5: false,
  584. bz6: false,
  585. bz7: false,
  586. bz8: false
  587. }
  588. if (this.staffmgrList[i].specialDuty) {
  589. // console.log(this.staffmgrList[i].specialDuty)
  590. let dutyArr = this.staffmgrList[i].specialDuty.split(",")
  591. for (let i = 0; i < dutyArr.length; i++) {
  592. if (dutyArr[i] == "10") {
  593. nodeData.bz4 = true
  594. } else if (dutyArr[i] == "12") {
  595. nodeData.bz3 = true
  596. } else if (dutyArr[i] == "14") {
  597. nodeData.bz5 = true
  598. } else if (dutyArr[i] == "16") {
  599. nodeData.bz6 = true
  600. } else if (dutyArr[i] == "18") {
  601. nodeData.bz2 = true
  602. } else if (dutyArr[i] == "20") {
  603. nodeData.bz1 = true
  604. } else if (dutyArr[i] == "22") {
  605. nodeData.bz8 = true
  606. } else if (dutyArr[i] == "24") {
  607. nodeData.bz7 = true
  608. }
  609. }
  610. }
  611. this.list2.push(nodeData)
  612. } else {
  613. let nodeData = {
  614. id: this.staffmgrList[i].id,
  615. pId: this.staffmgrList[i].pId,
  616. label: this.staffmgrList[i].name,
  617. post: post,
  618. img: 'https://cpms.basf-ypc.net.cn' + process.env.VUE_APP_BASE_API + this.staffmgrList[i].photo,
  619. // img: 'http://47.114.101.16:8080' + process.env.VUE_APP_BASE_API + this.staffmgrList[i].photo,
  620. bz1: false,
  621. bz2: false,
  622. bz3: false,
  623. bz4: false,
  624. bz5: false,
  625. bz6: false,
  626. bz7: false,
  627. bz8: false
  628. }
  629. if (this.staffmgrList[i].specialDuty) {
  630. // console.log(this.staffmgrList[i].specialDuty)
  631. let dutyArr = this.staffmgrList[i].specialDuty.split(",")
  632. for (let i = 0; i < dutyArr.length; i++) {
  633. if (dutyArr[i] == "10") {
  634. nodeData.bz4 = true
  635. } else if (dutyArr[i] == "12") {
  636. nodeData.bz3 = true
  637. } else if (dutyArr[i] == "14") {
  638. nodeData.bz5 = true
  639. } else if (dutyArr[i] == "16") {
  640. nodeData.bz6 = true
  641. } else if (dutyArr[i] == "18") {
  642. nodeData.bz2 = true
  643. } else if (dutyArr[i] == "20") {
  644. nodeData.bz1 = true
  645. } else if (dutyArr[i] == "22") {
  646. nodeData.bz8 = true
  647. } else if (dutyArr[i] == "24") {
  648. nodeData.bz7 = true
  649. }
  650. }
  651. }
  652. this.list2.push(nodeData)
  653. }
  654. }
  655. this.list1 = this.listToTree(this.list2)
  656. console.log(this.list1)
  657. console.log(JSON.stringify(this.list1))
  658. })
  659. },
  660. listToTree(list) {
  661. let map = {};
  662. list.forEach(item => {
  663. if (!map[item.id]) {
  664. map[item.id] = item;
  665. }
  666. });
  667. list.forEach(item => {
  668. if (item.pId !== 0 && map[item.pId]) {
  669. // map[item.pId].children ? map[item.pId].children.push(item) : map[item.pId].children = [item];
  670. if (item.post == '装置副经理') {
  671. map[item.pId].secretary ? map[item.pId].secretary[0].push(item) : map[item.pId].secretary[0] = [item];
  672. } else if (item.post == '生产主管' || item.post == '工长') {
  673. map[item.pId].secretary[1].push(item)
  674. }else if ((item.post == '资深工程师' || item.post == '工程师') && map[item.pId].pId == 0) { //直属装置经理的资深工程师
  675. map[item.pId].secretary ? map[item.pId].secretary[0].push(item) : map[item.pId].secretary[0] = [item];
  676. } else {
  677. map[item.pId].children ? map[item.pId].children.push(item) : map[item.pId].children = [item];
  678. }
  679. }
  680. });
  681. return list.filter(item => {
  682. if (item.pId === 0) {
  683. return item;
  684. }
  685. })
  686. },
  687. // 文件下载处理
  688. handleDownload(row) {
  689. var name = row.fileName;
  690. var url = row.fileUrl;
  691. var suffix = url.substring(url.lastIndexOf("."), url.length)
  692. const a = document.createElement('a')
  693. a.setAttribute('download', name)
  694. a.setAttribute('target', '_blank')
  695. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  696. a.click()
  697. },
  698. handleSee(row) {
  699. this.pdf.open = true
  700. this.pdf.title = row.fileName
  701. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API + '/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  702. },
  703. openPdf() {
  704. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  705. },
  706. }
  707. }
  708. </script>
  709. <style scoped>
  710. .iconfont{
  711. color: #ff0000;
  712. }
  713. </style>