index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  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. <el-option
  8. v-for="dict in unitOptions"
  9. :key="dict.dictValue"
  10. :label="dict.dictLabel"
  11. :value="dict.dictValue"
  12. />
  13. </el-select>
  14. </el-form-item>
  15. <el-form-item :label="$t('班值')" prop="teams">
  16. <el-select v-model="teams" :placeholder="$t('请选择') + $t('班值')" clearable size="small" multiple>
  17. <el-option
  18. v-for="dict in teamOptions"
  19. :key="dict.dictValue"
  20. :label="dict.dictLabel"
  21. :value="dict.dictValue"
  22. />
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item :label="$t('实际岗位')" prop="actualposts" label-width="200">
  26. <el-select v-model="actualposts" :placeholder="$t('请选择') + $t('实际岗位')" clearable size="small" multiple>
  27. <el-option
  28. v-for="dict in actualpostOptions"
  29. :key="dict.dictValue"
  30. :label="dict.dictLabel"
  31. :value="dict.dictValue"
  32. />
  33. </el-select>
  34. </el-form-item>
  35. <el-form-item>
  36. <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">{{ $t('搜索') }}</el-button>
  37. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">{{ $t('重置') }}</el-button>
  38. </el-form-item>
  39. </el-form>
  40. <el-row :gutter="10" class="mb8">
  41. <right-toolbar :showSearch.sync="showSearch" @queryTable="getChartData"></right-toolbar>
  42. </el-row>
  43. <div id="tree" ref="orgChartDom"></div>
  44. </div>
  45. <vue-draggable-resizable w="auto" h="auto" :draggable="dragMove" style="background-color:white">
  46. <div class="zoom" @wheel.prevent="handleTableWheel($event)" ref="branch" >
  47. <branch :dataArray="list1"></branch>
  48. </div>
  49. </vue-draggable-resizable>
  50. <!-- 侧栏 --->
  51. <el-drawer
  52. title="附件"
  53. ref="drawer"
  54. direction="rtl"
  55. :visible.sync="drawer">
  56. <el-table :data="doc.commonfileList" border>
  57. <el-table-column :label="$t('文件名')" align="center" prop="fileName" :show-overflow-tooltip="true">
  58. <template slot-scope="scope">
  59. <a class="link-type" @click="handleDownload(scope.row)">
  60. <span>{{ scope.row.fileName }}</span>
  61. </a>
  62. </template>
  63. </el-table-column>
  64. <el-table-column :label="$t('大小(Kb)')" align="center" prop="fileSize" :show-overflow-tooltip="true" width="80" />
  65. <el-table-column :label="$t('上传人')" align="center" prop="creator" :show-overflow-tooltip="true" width="120"/>
  66. <el-table-column :label="$t('操作')" align="center" width="120" class-name="small-padding fixed-width">
  67. <template slot-scope="scope">
  68. <el-button
  69. v-if="scope.row.fileName.endsWith('pdf')"
  70. size="mini"
  71. type="text"
  72. icon="el-icon-view"
  73. @click="handleSee(scope.row)"
  74. >{{ $t('预览') }}</el-button>
  75. <el-button
  76. size="mini"
  77. type="text"
  78. icon="el-icon-download"
  79. @click="handleDownload(scope.row)"
  80. >{{ $t('下载') }}</el-button>
  81. </template>
  82. </el-table-column>
  83. </el-table>
  84. <el-dialog v-dialogDrag :title="pdf.title" :visible.sync="pdf.open" width="1300px" append-to-body>
  85. <div style="margin-top: -60px;float: right;margin-right: 40px;">
  86. <el-button size="mini" type="text" @click="openPdf">{{$t('新页面打开PDF')}}</el-button></div>
  87. <div style="margin-top: -30px">
  88. <iframe :src="pdf.pdfUrl" frameborder="0" width="100%" height="700px"></iframe>
  89. </div>
  90. </el-dialog>
  91. </el-drawer>
  92. </div>
  93. </template>
  94. <script>
  95. import VueDraggableResizable from 'vue-draggable-resizable'
  96. import Branch from './branch'
  97. import {listOgzStaffmgr} from "@/api/plant/staffmgr";
  98. import {getToken} from "@/utils/auth";
  99. import {allFileList} from "@/api/common/commonfile";
  100. export default {
  101. components: {Branch, VueDraggableResizable},
  102. data () {
  103. return {
  104. showSearch: false,
  105. // 实际岗位字典
  106. actualpostOptions: [],
  107. showOrgChartData :[],
  108. staffmgrList: [],
  109. // 部门字典
  110. unitOptions: [],
  111. // 班值字典
  112. teamOptions: [],
  113. // 查询参数
  114. queryParams: {
  115. unit: null,
  116. team: null,
  117. actualpost: null,
  118. education: null,
  119. enAbility: null,
  120. educations: null,
  121. units: null,
  122. teams: null,
  123. actualposts: null,
  124. },
  125. units: [],
  126. teams: [],
  127. actualposts: ["24","26","14","16","18","20","12","10","34","36"],
  128. dragMove: true,
  129. drawer: false,
  130. info: {},
  131. list1: [{"id":10109,"pId":0,"label":"朱晶","post":"装置经理","secretary":[[{"id":10113,"pId":10109,"label":"赵建清","post":"装置副经理","secretary":[[],[]],"children":[{"id":10101,"pId":10113,"label":"张磊","post":"资深工程师","secretary":[[],[]]},{"id":10103,"pId":10113,"label":"高勇","post":"资深工程师","secretary":[[],[]]}]},{"id":10117,"pId":10109,"label":"居海波","post":"装置副经理","secretary":[[],[]],"children":[{"id":10106,"pId":10117,"label":"邹生耀","post":"资深工程师","secretary":[[],[]]}]},{"id":10102,"pId":10109,"label":"韦岳平","post":"装置副经理","secretary":[[],[]]}],[]],"children":[{"id":10116,"pId":10109,"label":"陈琨","post":"资深工程师","secretary":[[],[]]},{"id":10114,"pId":10109,"label":"樊宏斌","post":"生产主管","secretary":[[],[]]},{"id":10108,"pId":10109,"label":"袁永成","post":"生产主管","secretary":[[],[]]},{"id":10107,"pId":10109,"label":"潘传安","post":"生产主管","secretary":[[],[]]},{"id":10104,"pId":10109,"label":"胡文逵","post":"生产主管","secretary":[[],[]]},{"id":10110,"pId":10109,"label":"孙文龙","post":"生产主管","secretary":[[],[]]},{"id":10115,"pId":10109,"label":"鲍波","post":"炉区工长","secretary":[[],[]]},{"id":10043,"pId":10109,"label":"占丽萍","post":"职员","secretary":[[],[]]},{"id":10112,"pId":10109,"label":"何氢","post":"主操(白班)","secretary":[[],[]]},{"id":10054,"pId":10109,"label":"李滕","post":"主操(白班)","secretary":[[],[]]},{"id":10001,"pId":10109,"label":"徐建飞","post":"倒班班长","secretary":[[],[]],"children":[{"id":10014,"pId":10001,"label":"陈涛","post":"倒班副班长","secretary":[[],[]]},{"id":10012,"pId":10001,"label":"陆危圣","post":"倒班副班长","secretary":[[],[]]},{"id":10008,"pId":10001,"label":"任秋香","post":"主操","secretary":[[],[]]},{"id":10019,"pId":10001,"label":"刘伟程","post":"主操","secretary":[[],[]]},{"id":10010,"pId":10001,"label":"张磊","post":"主操","secretary":[[],[]]},{"id":10015,"pId":10001,"label":"崔海军","post":"主操","secretary":[[],[]]},{"id":10000,"pId":10001,"label":"王俊","post":"主操","secretary":[[],[]]},{"id":10003,"pId":10001,"label":"马国春","post":"主操","secretary":[[],[]]},{"id":10004,"pId":10001,"label":"申海宁","post":"主操","secretary":[[],[]]},{"id":10006,"pId":10001,"label":"张燕燕","post":"主操","secretary":[[],[]]},{"id":10009,"pId":10001,"label":"缪海荣","post":"主操","secretary":[[],[]]},{"id":10017,"pId":10001,"label":"高峰","post":"主操","secretary":[[],[]]},{"id":10018,"pId":10001,"label":"蒋恒兵","post":"主操","secretary":[[],[]]},{"id":10020,"pId":10001,"label":"刘金京","post":"主操","secretary":[[],[]]},{"id":10002,"pId":10001,"label":"张力飞","post":"主操","secretary":[[],[]]},{"id":10005,"pId":10001,"label":"李欣阳","post":"主操","secretary":[[],[]]},{"id":10007,"pId":10001,"label":"宋月民","post":"主操","secretary":[[],[]]},{"id":10013,"pId":10001,"label":"贾云飞","post":"主操","secretary":[[],[]]},{"id":10016,"pId":10001,"label":"张炜","post":"主操","secretary":[[],[]]},{"id":10011,"pId":10001,"label":"宋章浩","post":"主操","secretary":[[],[]]}]},{"id":10031,"pId":10109,"label":"臧闽军","post":"倒班班长","secretary":[[],[]],"children":[{"id":10028,"pId":10031,"label":"朱健","post":"倒班副班长","secretary":[[],[]]},{"id":10032,"pId":10031,"label":"袁晨","post":"倒班副班长","secretary":[[],[]]},{"id":10035,"pId":10031,"label":"陈海飞","post":"主操","secretary":[[],[]]},{"id":10024,"pId":10031,"label":"刘尊超","post":"主操","secretary":[[],[]]},{"id":10026,"pId":10031,"label":"马卫兵","post":"主操","secretary":[[],[]]},{"id":10027,"pId":10031,"label":"曹西元","post":"主操","secretary":[[],[]]},{"id":10029,"pId":10031,"label":"顾仁海","post":"主操","secretary":[[],[]]},{"id":10036,"pId":10031,"label":"李静","post":"主操","secretary":[[],[]]},{"id":10037,"pId":10031,"label":"朱永宜","post":"主操","secretary":[[],[]]},{"id":10039,"pId":10031,"label":"封公瑾","post":"主操","secretary":[[],[]]},{"id":10040,"pId":10031,"label":"姜翠君","post":"主操","secretary":[[],[]]},{"id":10022,"pId":10031,"label":"周湘","post":"主操","secretary":[[],[]]},{"id":10041,"pId":10031,"label":"梁宏伟","post":"主操","secretary":[[],[]]},{"id":10025,"pId":10031,"label":"蒋宁宁","post":"主操","secretary":[[],[]]},{"id":10030,"pId":10031,"label":"吴中鑫","post":"主操","secretary":[[],[]]},{"id":10038,"pId":10031,"label":"刘辉","post":"主操","secretary":[[],[]]},{"id":10033,"pId":10031,"label":"郑骅","post":"主操","secretary":[[],[]]},{"id":10034,"pId":10031,"label":"张琦","post":"主操","secretary":[[],[]]},{"id":10023,"pId":10031,"label":"邓阳","post":"主操","secretary":[[],[]]},{"id":10021,"pId":10031,"label":"李凤希","post":"主操","secretary":[[],[]]}]},{"id":10049,"pId":10109,"label":"沈涛","post":"倒班班长","secretary":[[],[]],"children":[{"id":10048,"pId":10049,"label":"乔刚","post":"倒班副班长","secretary":[[],[]]},{"id":10045,"pId":10049,"label":"宦文恺","post":"倒班副班长","secretary":[[],[]]},{"id":10050,"pId":10049,"label":"卓兴凤","post":"主操","secretary":[[],[]]},{"id":10052,"pId":10049,"label":"阚久龙","post":"主操","secretary":[[],[]]},{"id":10055,"pId":10049,"label":"王超","post":"主操","secretary":[[],[]]},{"id":10056,"pId":10049,"label":"张永","post":"主操","secretary":[[],[]]},{"id":10058,"pId":10049,"label":"宋浦江","post":"主操","secretary":[[],[]]},{"id":10060,"pId":10049,"label":"夏军","post":"主操","secretary":[[],[]]},{"id":10047,"pId":10049,"label":"劳青川","post":"主操","secretary":[[],[]]},{"id":10062,"pId":10049,"label":"邢启元","post":"主操","secretary":[[],[]]},{"id":10061,"pId":10049,"label":"韩叶锋","post":"主操","secretary":[[],[]]},{"id":10053,"pId":10049,"label":"谢振华","post":"主操","secretary":[[],[]]},{"id":10057,"pId":10049,"label":"黄梓赫","post":"主操","secretary":[[],[]]},{"id":10059,"pId":10049,"label":"周权","post":"主操","secretary":[[],[]]},{"id":10046,"pId":10049,"label":"赵振湘","post":"主操","secretary":[[],[]]},{"id":10051,"pId":10049,"label":"沈文勇","post":"主操","secretary":[[],[]]},{"id":10042,"pId":10049,"label":"卞传庆","post":"主操","secretary":[[],[]]},{"id":10044,"pId":10049,"label":"李士军","post":"主操","secretary":[[],[]]}]},{"id":10064,"pId":10109,"label":"刘遵胜","post":"倒班班长","secretary":[[],[]],"children":[{"id":10063,"pId":10064,"label":"王维庆","post":"倒班副班长","secretary":[[],[]]},{"id":10083,"pId":10064,"label":"郝维祥","post":"倒班副班长","secretary":[[],[]]},{"id":10073,"pId":10064,"label":"李飞虎","post":"主操","secretary":[[],[]]},{"id":10075,"pId":10064,"label":"杨赞","post":"主操","secretary":[[],[]]},{"id":10078,"pId":10064,"label":"何叡颖","post":"主操","secretary":[[],[]]},{"id":10082,"pId":10064,"label":"王欢","post":"主操","secretary":[[],[]]},{"id":10084,"pId":10064,"label":"王守清","post":"主操","secretary":[[],[]]},{"id":10079,"pId":10064,"label":"王竹宣","post":"主操","secretary":[[],[]]},{"id":10066,"pId":10064,"label":"徐乐","post":"主操","secretary":[[],[]]},{"id":10071,"pId":10064,"label":"胡远斌","post":"主操","secretary":[[],[]]},{"id":10074,"pId":10064,"label":"马云凤","post":"主操","secretary":[[],[]]},{"id":10077,"pId":10064,"label":"秦飞","post":"主操","secretary":[[],[]]},{"id":10081,"pId":10064,"label":"程佩佩","post":"主操","secretary":[[],[]]},{"id":10069,"pId":10064,"label":"孙夕斌","post":"主操","secretary":[[],[]]},{"id":10070,"pId":10064,"label":"胡保宁","post":"主操","secretary":[[],[]]},{"id":10068,"pId":10064,"label":"王刚","post":"主操","secretary":[[],[]]},{"id":10072,"pId":10064,"label":"王勇","post":"主操","secretary":[[],[]]},{"id":10065,"pId":10064,"label":"陈熹","post":"主操","secretary":[[],[]]},{"id":10067,"pId":10064,"label":"朱国柱","post":"主操","secretary":[[],[]]},{"id":10080,"pId":10064,"label":"孙浩","post":"主操","secretary":[[],[]]}]}]}]
  132. ,
  133. list2: [],
  134. // 报告附件参数
  135. doc: {
  136. file: "",
  137. // 是否显示弹出层(报告附件)
  138. open: false,
  139. // 弹出层标题(报告附件)
  140. title: "",
  141. // 是否禁用上传
  142. isUploading: false,
  143. // 是否更新已经存在的用户数据
  144. updateSupport: 0,
  145. // 报告附件上传位置编号
  146. ids: 0,
  147. // 设置上传的请求头部
  148. headers: { Authorization: "Bearer " + getToken() },
  149. // 上传的地址
  150. url: process.env.VUE_APP_BASE_API + "/common/commonfile/uploadFile",
  151. commonfileList: null,
  152. queryParams: {
  153. pId: null,
  154. pType: 'staffmgr'
  155. },
  156. pType: 'staffmgr',
  157. pId: null
  158. },
  159. pdf : {
  160. title: '',
  161. pdfUrl: '',
  162. numPages: null,
  163. open: false,
  164. pageNum: 1,
  165. pageTotalNum: 1,
  166. loadedRatio: 0,
  167. },
  168. }
  169. },
  170. created() {
  171. this.getDicts("ACTUALPOST").then(response => {
  172. this.actualpostOptions = response.data;
  173. });
  174. this.getDicts("STAFF_UNIT").then(response => {
  175. this.unitOptions = response.data;
  176. });
  177. this.getDicts("TEAM_DIVIDE").then(response => {
  178. this.teamOptions = response.data;
  179. });
  180. this.getChartData()
  181. },
  182. mounted () {
  183. this.bus.$on('info', (data) => {
  184. this.drawer = true
  185. this.doc.queryParams.pId = data.id
  186. allFileList(this.doc.queryParams).then(response => {
  187. this.doc.commonfileList = response;
  188. });
  189. this.info = data
  190. })
  191. },
  192. methods: {
  193. handleTableWheel (event) {
  194. let obj = this.$refs['branch']
  195. return this.tableZoom(obj, event)
  196. },
  197. tableZoom (obj, event) {
  198. // 一开始默认是100%
  199. let zoom = parseInt(obj.style.zoom, 10) || 100
  200. // 滚轮滚一下wheelDelta的值增加或减少120
  201. zoom += event.wheelDelta / 12
  202. if (zoom > 50) {
  203. obj.style.zoom = zoom + '%'
  204. }
  205. return false
  206. },
  207. dclick () {
  208. this.drawer = true
  209. },
  210. /** 重置按钮操作 */
  211. resetQuery() {
  212. this.resetForm("queryForm");
  213. this.units = []
  214. this.teams = []
  215. this.actualposts = []
  216. this.handleQuery();
  217. },
  218. /** 搜索按钮操作 */
  219. handleQuery() {
  220. this.getChartData();
  221. },
  222. getChartData() {
  223. this.queryParams.units = this.units.join()
  224. this.queryParams.teams = this.teams.join()
  225. this.queryParams.actualposts = this.actualposts.join()
  226. listOgzStaffmgr(this.queryParams).then(response => {
  227. this.staffmgrList = response;
  228. this.list2 = []
  229. for (let i = 0; i < this.staffmgrList.length ; i++) {
  230. let post = this.selectDictLabel(this.actualpostOptions, this.staffmgrList[i].actualpost)
  231. if (this.staffmgrList[i].pId == 0) {
  232. let nodeData = {
  233. id: this.staffmgrList[i].id ,
  234. pId: this.staffmgrList[i].pId ,
  235. label: this.staffmgrList[i].name ,
  236. post: post,
  237. secretary: [[],[]],
  238. img: 'http://47.114.101.16:8080' + process.env.VUE_APP_BASE_API + this.staffmgrList[i].photo,
  239. bz1: false,
  240. bz2: false,
  241. bz3: false,
  242. bz4: false,
  243. bz5: false,
  244. bz6: false
  245. }
  246. this.list2.push(nodeData)
  247. }else {
  248. let nodeData = {
  249. id: this.staffmgrList[i].id ,
  250. pId: this.staffmgrList[i].pId ,
  251. label: this.staffmgrList[i].name ,
  252. post: post,
  253. img: 'http://47.114.101.16:8080' + process.env.VUE_APP_BASE_API + this.staffmgrList[i].photo,
  254. bz1: false,
  255. bz2: false,
  256. bz3: false,
  257. bz4: false,
  258. bz5: false,
  259. bz6: false
  260. }
  261. if (this.staffmgrList[i].specialDuty) {
  262. console.log(this.staffmgrList[i].specialDuty)
  263. let dutyArr = this.staffmgrList[i].specialDuty.split(",")
  264. for (let i = 0; i < dutyArr.length; i++) {
  265. if (dutyArr[i] == "10") {
  266. nodeData.bz3 = true
  267. }else if (dutyArr[i] == "12") {
  268. nodeData.bz1 = true
  269. }else if (dutyArr[i] == "14") {
  270. nodeData.bz5 = true
  271. }else if (dutyArr[i] == "16") {
  272. nodeData.bz6 = true
  273. }else if (dutyArr[i] == "18") {
  274. nodeData.bz2 = true
  275. }
  276. }
  277. }
  278. this.list2.push(nodeData)
  279. }
  280. }
  281. this.list1 = this.listToTree(this.list2)
  282. console.log(JSON.stringify(this.list1))
  283. })
  284. },
  285. listToTree(list) {
  286. let map = {};
  287. list.forEach(item => {
  288. if (! map[item.id]) {
  289. map[item.id] = item;
  290. }
  291. });
  292. list.forEach(item => {
  293. if (item.pId !== 0) {
  294. // map[item.pId].children ? map[item.pId].children.push(item) : map[item.pId].children = [item];
  295. if (item.post == '装置副经理'){
  296. map[item.pId].secretary ? map[item.pId].secretary[0].push(item) : map[item.pId].secretary[0] = [item];
  297. }else if (item.post == '生产主管' || item.post == '炉区工长'){
  298. map[item.pId].secretary[1].push(item)
  299. }else {
  300. map[item.pId].children ? map[item.pId].children.push(item) : map[item.pId].children = [item];
  301. }
  302. }
  303. });
  304. return list.filter(item => {
  305. if (item.pId === 0) {
  306. return item;
  307. }
  308. })
  309. },
  310. // 文件下载处理
  311. handleDownload(row) {
  312. var name = row.fileName;
  313. var url = row.fileUrl;
  314. var suffix = url.substring(url.lastIndexOf("."), url.length)
  315. const a = document.createElement('a')
  316. a.setAttribute('download', name)
  317. a.setAttribute('target', '_blank')
  318. a.setAttribute('href', process.env.VUE_APP_BASE_API + url)
  319. a.click()
  320. },
  321. handleSee (row){
  322. this.pdf.open =true
  323. this.pdf.title = row.fileName
  324. this.pdf.pdfUrl = process.env.VUE_APP_BASE_API +'/pdf/web/viewer.html?file=' + process.env.VUE_APP_BASE_API + row.fileUrl
  325. },
  326. openPdf(){
  327. window.open(this.pdf.pdfUrl);//path是文件的全路径地址
  328. },
  329. }
  330. }
  331. </script>
  332. <style scoped>
  333. </style>