index.vue 27 KB

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