befddddeb4551bcec009d3008df7d7b69f1aec6d.svn-base 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. <template>
  2. <div id="kjrmap">
  3. <div class="process_line" style="padding-left:0;">
  4. <el-row style="margin-bottom:5px;">
  5. <el-col :span="24">
  6. <div class="grid-content bg-purple-light">
  7. <el-card class="kjr-card box-card" style="height:100%;">
  8. <el-row>
  9. <div style="padding:10px;">
  10. <span style="font-size: 12px;">姓名:</span>
  11. <el-input style="width:120px;" class="kjr-input" size="mini" v-model="model_peopleName"
  12. placeholder="请输入姓名" @keydown.enter.native="searchPeople" clearable></el-input>
  13. <span style="font-size: 12px;margin-left:10px;">证件号:</span>
  14. <el-input style="width:120px;" class="kjr-input" size="mini" v-model="certificateCode"
  15. placeholder="请输入工作证件号" @keydown.enter.native="searchPeople" clearable></el-input>
  16. <span style="font-size: 12px;margin-left:10px;">名称:</span>
  17. <el-input style="width:120px;" class="kjr-input" size="mini" v-model="deptName"
  18. placeholder="请输入机构名称" @keydown.enter.native="searchPeople" clearable></el-input>
  19. <el-button @click="searchPeople" size="mini" type="primary" style="margin-left:20px;">查询</el-button>
  20. <el-checkbox v-model="model_peopleOnline" @change="bPeopleOnline" style="margin-left:20px;">是否在线</el-checkbox>
  21. </div>
  22. </el-row>
  23. <el-row>
  24. <el-col :span="7">
  25. <el-tabs v-model="activeTabName" @tab-click="handleTabClick" type="border-card"
  26. style="overflow:auto;">
  27. <el-tab-pane v-if="bAdmin" label="机构" name="three">
  28. <div class="grid-content bg-purple">
  29. <el-tree :data="treeData3" node-key="orgId" :expand-on-click-node="false"
  30. :highlight-current="true" :current-node-key="curNode" :default-expanded-keys="['1']"
  31. :props="defaultProps3" @node-click="handleNodeClick3"></el-tree>
  32. </div>
  33. </el-tab-pane>
  34. <el-tab-pane v-if="bAdmin" label="专项" name="second">
  35. <div class="grid-content bg-purple">
  36. <el-tree :data="treeData2" node-key="id" :expand-on-click-node="false"
  37. :highlight-current="true" :current-node-key="curNode" :default-expanded-keys="['1']"
  38. :props="defaultProps" @node-click="handleNodeClick"></el-tree>
  39. </div>
  40. </el-tab-pane>
  41. <el-tab-pane v-if="!bAdmin" label="所在组成员" name="fourth">
  42. <div class="grid-content bg-purple">
  43. <el-tree :data="treeData4" node-key="id" :expand-on-click-node="false"
  44. :highlight-current="true" :current-node-key="curNode" :default-expanded-keys="['1']"
  45. :props="defaultProps" @node-click="handleNodeClick"></el-tree>
  46. </div>
  47. </el-tab-pane>
  48. </el-tabs>
  49. </el-col>
  50. <el-col :span="17">
  51. <div class="grid-content bg-purple-light">
  52. <div style="padding:5px;">
  53. <el-table :data="tableData_peopleList"
  54. :default-sort="{prop: 'operateTime', order: 'descending'}"
  55. @sort-change='people_sortEvent' height="500" border stripe style="width: 100%">
  56. <el-table-column type="index" label="No." width="50" :index="indexMethod">
  57. </el-table-column>
  58. <el-table-column prop="operateTime" label="时间" width="100" align="center" sortable="custom" show-overflow-tooltip>
  59. </el-table-column>
  60. <el-table-column prop="persName" label="姓名" width="80" align="center">
  61. </el-table-column>
  62. <el-table-column prop="orgNm" label="单位/部门" width="100" align="center" show-overflow-tooltip>
  63. </el-table-column>
  64. <el-table-column prop="status" label="状态" width="60" align="center">
  65. <template slot-scope="scope">
  66. <span v-if="scope.row.state == '1'" style="width: 10px;height: 10px;border-radius: 5px;display: inline-block;background: #4cae4c;"></span>
  67. <span v-if="scope.row.state == '0'" style="width: 10px;height: 10px;display: inline-block;border-radius: 5px;background: red;"></span>
  68. </template>
  69. </el-table-column>
  70. <el-table-column
  71. fixed="right"
  72. label="操作"
  73. min-width="160">
  74. <template slot-scope="scope">
  75. <el-button type="text" size="small" @click="peopleInfo(scope.row,'location')">定位</el-button>
  76. <el-button type="text" size="small" @click="peopleInfo(scope.row,'track')">轨迹</el-button>
  77. <el-button type="text" size="small" @click="peopleInfo(scope.row,'group')">工作情况</el-button>
  78. </template>
  79. </el-table-column>
  80. </el-table>
  81. <div class="block" style="margin-top:5px;">
  82. <el-pagination background @size-change="handleSizeChange"
  83. @current-change="handleCurrentChange" :page-sizes="[10,50, 100, 200]"
  84. :page-size="15" layout="total,sizes, prev, pager, next" :pager-count="5"
  85. :total="recordTotal">
  86. </el-pagination>
  87. </div>
  88. </div>
  89. </div>
  90. </el-col>
  91. </el-row>
  92. </el-card>
  93. </div>
  94. </el-col>
  95. </el-row>
  96. </div>
  97. </div>
  98. </template>
  99. <script>
  100. import request from '../../../utils/gw_ajax_request'
  101. import { getDcryList } from '../js/duChaRenYuan'
  102. import personInGroupInfo from '../components/personInGroupInfo'
  103. export default {
  104. name: "InspectionPersonnel",
  105. props: [],
  106. components:{
  107. personInGroupInfo
  108. },
  109. data() {
  110. return {
  111. treeData3: [],
  112. treeData2: [{
  113. id: "1",
  114. pnm: '全国',
  115. children: []
  116. }],
  117. treeData4: [{
  118. id: "1",
  119. pnm: '所有成员',
  120. children: []
  121. }],
  122. curNode: "1",
  123. defaultProps: {
  124. children: 'children',
  125. label: 'pnm'
  126. },
  127. defaultProps3: {
  128. label: 'orgNm',
  129. children: 'children',
  130. },
  131. activeTabName: 'three',
  132. bAdmin: false,
  133. model_peopleName: "",
  134. model_idNum:'',
  135. model_jgName:'',
  136. tableData_peopleList:[],
  137. model_peopleOnline: false,
  138. rowIndex: 0,
  139. pageSize: 10,
  140. pageIndex: 1,
  141. recordTotal:0,
  142. showPersonInGroupInfo:false,
  143. currentPersName:'',
  144. currentIsAdmin:'',
  145. currentPersId:'',
  146. certificateCode:'',
  147. deptName:'',
  148. curId: "",
  149. curOrgId: "1",
  150. curBasin: "",
  151. curType: "",
  152. menuCount:0,
  153. menuOnLineCount:0
  154. }
  155. },
  156. beforeMount() {
  157. this.bAdmin = localStorage.getItem("isAdmin") == 1 ? true : false;
  158. },
  159. mounted(){
  160. this.initTree();
  161. },
  162. watch:{
  163. model_peopleName: function () {
  164. this.rowIndex = 0;
  165. this.pageSize = this.pageSize;
  166. // this.getOnlinePeoples();
  167. if (!this.bAdmin) {
  168. this.getOnlinePeoples();
  169. } else if (this.activeTabName == "three") {
  170. this.getOnlinePeoples2();
  171. } else {
  172. this.getOnlinePeoples();
  173. }
  174. },
  175. },
  176. computed: {
  177. recPersId() {
  178. return localStorage.getItem("userid") ? localStorage.getItem("userid") : ''
  179. }
  180. },
  181. methods:{
  182. handleTabClick(tab, event) {
  183. if (this.activeTabName == "three") {
  184. this.getOnlinePeoples2();
  185. } else {
  186. this.getOnlinePeoples();
  187. }
  188. },
  189. refreashOnline() {
  190. if (this.bAdmin) {
  191. this.activeTabName = "three";
  192. this.curOrgId = "1";
  193. this.initTree();
  194. }
  195. this.$message({
  196. message: '刷新成功!',
  197. type: 'success'
  198. });
  199. },
  200. handleNodeClick(data) {
  201. console.log("handleNodeClick...........", data);
  202. if (data) {
  203. if (!this.bAdmin && data.id == "1") {
  204. this.curId = data.id__;
  205. } else {
  206. if (data.id == "1") {
  207. this.curId = "";
  208. } else {
  209. this.curId = data.id;
  210. }
  211. }
  212. this.getOnlinePeoples();
  213. this.loadPoint_people("point_people");
  214. }
  215. },
  216. handleNodeClick3(data) {
  217. console.log(data);
  218. if (data) {
  219. if (data.orgId == "1") {
  220. this.curOrgId = "1";
  221. } else {
  222. this.curOrgId = data.orgId;
  223. }
  224. this.curNode = data.orgId;
  225. this.getOnlinePeoples2();
  226. this.loadPoint_people("point_people");
  227. }
  228. },
  229. people_sortEvent(column, prop, order) {
  230. console.log(column, prop, order)
  231. if (column.column == null)
  232. return;
  233. // this.orderField = column.prop;
  234. if (column.order == "ascending") {
  235. this.sortBy = "asc";
  236. } else if (column.order == "descending") {
  237. this.sortBy = "desc";
  238. }
  239. this.orderField = column.prop.replace(/\B([A-Z])/g, '_$1').toLowerCase()
  240. if (!this.bAdmin) {
  241. this.getOnlinePeoples();
  242. } else if (this.activeTabName == "three") {
  243. this.getOnlinePeoples2();
  244. } else {
  245. this.getOnlinePeoples();
  246. }
  247. },
  248. handleSizeChange: function (pageSize) {
  249. this.rowIndex = 0;
  250. this.pageSize = pageSize;
  251. // this.getOnlinePeoples();
  252. if (!this.bAdmin) {
  253. this.getOnlinePeoples();
  254. } else if (this.activeTabName == "one") {
  255. this.getOnlinePeoples2();
  256. } else {
  257. this.getOnlinePeoples();
  258. }
  259. },
  260. handleCurrentChange: function (pageNum) {
  261. this.rowIndex = 0;
  262. this.pageIndex = pageNum;
  263. // this.getOnlinePeoples();
  264. if (!this.bAdmin) {
  265. this.getOnlinePeoples();
  266. } else if (this.activeTabName == "three") {
  267. this.getOnlinePeoples2();
  268. } else {
  269. this.getOnlinePeoples();
  270. }
  271. },
  272. searchPeople() {
  273. if (this.activeTabName == "three") {
  274. this.getOnlinePeoples2();
  275. } else {
  276. this.getOnlinePeoples();
  277. }
  278. },
  279. getOnlinePeoples(flag = true) {
  280. request.get(`/pers/position/findPersListByClassify`, {
  281. params: {
  282. pageNum: this.pageIndex,
  283. pageSize: this.pageSize,
  284. count: false,
  285. orderBy: this.orderField + " " + this.sortBy,
  286. id: flag ? (this.bAdmin ? this.curId : (this.curId || "-")) : "-",
  287. persName: this.model_peopleName,
  288. certificateCode: this.certificateCode,
  289. deptName: this.deptName,
  290. status: this.model_peopleOnline ? "1" : ""
  291. }
  292. })
  293. .then((res) => {
  294. if (res.success) {
  295. var obj = res.data;
  296. this.tableData_peopleList = obj.list;
  297. this.recordTotal = obj.total;
  298. }
  299. })
  300. .catch(function (error) {
  301. console.log(error);
  302. });
  303. },
  304. getOnlinePeoples2() {
  305. request.get(`/pers/position/findPersPageByOrgId`, {
  306. params: {
  307. pageNum: this.pageIndex,
  308. pageSize: this.pageSize,
  309. orderBy: this.orderField + " " + this.sortBy,
  310. orgId: this.curOrgId,
  311. persName: this.model_peopleName,
  312. certificateCode: this.certificateCode,
  313. deptName: this.deptName,
  314. status: this.model_peopleOnline ? "1" : ""
  315. }
  316. })
  317. .then((res) => {
  318. if(res.success){
  319. this.tableData_peopleList = res.data.list;
  320. this.recordTotal = res.data.total;
  321. }
  322. })
  323. .catch(function (error) {
  324. console.log(error);
  325. });
  326. },
  327. initTree() {
  328. if (this.bAdmin) {
  329. this.curOrgId = "1";
  330. this.getOnlinePeoples2();
  331. } else {
  332. // 权限
  333. this.activeTabName = 'fourth';
  334. request.get(`/pers/position/findNodeByPersId`,{
  335. params: {
  336. persId: localStorage.getItem("userid")
  337. }
  338. }).then((res) => {
  339. if (res.success) {
  340. $.each(res.data, (index, e) => {
  341. e.pnm = e.pnm + `(${e.onLineCount}/${e.count})`
  342. })
  343. var trData = this.transData(res.data, 'id', 'pid', 'children');
  344. var total = 0;
  345. var onlineTotal = 0;
  346. var id = "";
  347. $.each(trData, (index, e) => {
  348. total += e.count;
  349. onlineTotal += e.onLineCount;
  350. id += `${e.id},`;
  351. })
  352. id = id.substring(0, id.length - 1);
  353. this.treeData4[0].children = trData;
  354. this.treeData4[0].id__ = id;
  355. this.treeData4[0].pnm = this.treeData4[0].pnm + `(${onlineTotal}/${total})`;
  356. console.log("权限tree。。。。", this.treeData4)
  357. console.log("权限root-id。。。。", id)
  358. this.curId = id || '-';
  359. this.loadPoint_people('point_people')
  360. if (!this.bAdmin)
  361. this.getOnlinePeoples();
  362. }
  363. })
  364. .catch(function (error) {
  365. console.log(error);
  366. });
  367. }
  368. //专项
  369. request.get(`/pers/position/findClassify`, {
  370. params: {
  371. type: 1
  372. }
  373. })
  374. .then((res) => {
  375. if (res.success) {
  376. this.treeData2 = [{
  377. id: "1",
  378. pnm: '全国',
  379. children: []
  380. }]
  381. this.treeData2[0].children = res.data;
  382. var total = 0;
  383. var total2 = 0;
  384. $.each(this.treeData2[0].children, (index, e) => {
  385. e.pnm = `${e.pnm}(${e.onLineCount}/${e.count})`;
  386. total += e.count;
  387. total2 += e.onLineCount;
  388. })
  389. this.treeData2[0].pnm = `${this.treeData2[0].pnm}(${total2}/${total})`;
  390. }
  391. })
  392. .catch(function (error) {
  393. console.log(error);
  394. });
  395. //机构
  396. request.get(`/pers/position/findOrgList`, {
  397. params: {}
  398. })
  399. .then((res) => {
  400. if (res.success) {
  401. console.log("机构。。。。", res)
  402. $.each(res.data, (index, e) => {
  403. e.orgNm = e.orgNm + `(${e.onLineCount}/${e.count})`
  404. });
  405. var trData = this.transData(res.data, 'orgId', 'orgPid', 'children');
  406. this.treeData3 = trData;
  407. }
  408. })
  409. .catch(function (error) {
  410. console.log(error);
  411. });
  412. },
  413. transData(objs, idStr, pidStr, chindrenStr) {
  414. var a = objs;
  415. var r = [],
  416. hash = {},
  417. id = idStr,
  418. pid = pidStr,
  419. children = chindrenStr,
  420. i = 0,
  421. j = 0,
  422. len = a.length;
  423. for (; i < len; i++) {
  424. hash[a[i][id]] = a[i];
  425. }
  426. for (; j < len; j++) {
  427. var aVal = a[j],
  428. hashVP = hash[aVal[pid]];
  429. if (hashVP) {
  430. !hashVP[children] && (hashVP[children] = []);
  431. hashVP[children].push(aVal);
  432. } else {
  433. r.push(aVal);
  434. }
  435. }
  436. return r;
  437. },
  438. indexMethod(index) {
  439. return (index + 1) + this.pageSize * (this.pageIndex - 1)
  440. },
  441. bPeopleOnline(val) {
  442. // this.curId = "";
  443. if (this.activeTabName == "three") {
  444. this.getOnlinePeoples2();
  445. this.loadPoint_people("point_people");
  446. } else {
  447. this.getOnlinePeoples();
  448. this.loadPoint_people("point_people");
  449. }
  450. },
  451. //定位
  452. peopleInfo(row,info){
  453. this.$emit('peopleInfo',row,info);
  454. },
  455. // ryGroup(row){
  456. // this.currentPersId = row.guid;
  457. // this.currentIsAdmin = row.permission;
  458. // this.currentPersName = row.persName;
  459. // this.$emit('paramsEmit',this.currentPersId,this.currentIsAdmin,this.currentPersName)
  460. // this.showPersonInGroupInfo = true;
  461. // },
  462. closeInfo(name){
  463. switch (name) {
  464. case 'groupInfo':
  465. this.showPersonInGroupInfo = false;
  466. break;
  467. }
  468. },
  469. loadPoint_people: function () {
  470. var _this = this;
  471. var params_ = {};
  472. if (this.activeTabName == "three") {
  473. params_ = {
  474. orgId: this.curOrgId,
  475. }
  476. } else {
  477. params_ = {
  478. id: this.curId,
  479. }
  480. }
  481. },
  482. }
  483. }
  484. </script>
  485. <style>
  486. #kjrmap .el-card__body .el-tabs__nav-scroll {
  487. background-color: #d4e5f7;
  488. padding: 0 16px;
  489. }
  490. #kjrmap .el-tabs--border-card {
  491. height: 532px!important;
  492. }
  493. #kjrmap .el-tree-node>.el-tree-node__children {
  494. overflow-x: auto!important;
  495. }
  496. #kjrmap .el-card__body {
  497. padding: 15px !important;
  498. }
  499. </style>