1e16ca1a15e24d124a4c8dbafa0d2f4b2ed0ab41.svn-base 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  1. <template>
  2. <!-- 弹出窗 -->
  3. <el-dialog id="dialog" width="70%" title="添加人员" :visible.sync="dialogFormVisible">
  4. <el-container >
  5. <!-- <el-aside width="200px" style="border:1px solid #d5d5ff">
  6. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;"><i class="el-icon-share"></i>所在机构</p>
  7. <provTreeList rootCode='000000' rootType='1' style="max-height:400px;" @provTreeSelectChange="provTreeSelectChangeHandler"></provTreeList>
  8. </el-aside> -->
  9. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
  10. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查人员</p>
  11. <el-form :label-position="labelPosition" label-width="80px">
  12. <el-form-item style="margin-bottom: 0px;" label="" :label-width="formLabelWidth"></el-form-item>
  13. <div>
  14. <div style="display:flex;height: 30px;padding: 10px;">
  15. <el-form-item label="人员姓名" style="display:flex;">
  16. <el-input style="width:140px;padding-left: 10px;" v-model="searchText" clearable placeholder="请输入人员名称"></el-input>
  17. </el-form-item>
  18. <el-form-item label="所属部门" style="display:flex;padding-left: 30px;">
  19. <el-input style="width:140px;padding-left: 10px;" v-model="jgName" clearable placeholder="请输入所属部门"></el-input>
  20. </el-form-item>
  21. <el-form-item label="手机号码" style="display:flex;padding-left: 30px;">
  22. <el-input style="width:140px;padding-left: 10px;" v-model="numb" clearable placeholder="请输入手机号码"></el-input>
  23. </el-form-item>
  24. <!-- <el-input
  25. placeholder="请输入姓名"
  26. v-model="searchText"
  27. style="width: 200px;padding-bottom: 10px;padding-top: 10px; margin-left:10px;"
  28. class="input-with-select"
  29. >
  30. </el-input> -->
  31. <el-button type="primary" style="margin-left:20px;" @click="getTableData">查询</el-button>
  32. </div>
  33. <el-table
  34. ref="menTable"
  35. border
  36. :data="currentShowList"
  37. tooltip-effect="dark"
  38. style="width: 100%"
  39. @selection-change="handleSelectionChange"
  40. >
  41. <el-table-column align="center" width="70" type="selection" :selectable="selectable" :reserve-selection="false"></el-table-column>
  42. <el-table-column align="center" show-overflow-tooltip width="60" prop="index" label="序号"></el-table-column>
  43. <el-table-column align="center" show-overflow-tooltip prop="persName" label="人员姓名"></el-table-column>
  44. <el-table-column align="center" show-overflow-tooltip prop="sex1" label="性别"></el-table-column>
  45. <!-- <el-table-column align="center" show-overflow-tooltip prop="persCode" label="身份证号"></el-table-column> -->
  46. <!-- <el-table-column align="center" show-overflow-tooltip prop="telnumb" label="办公室电话"></el-table-column> -->
  47. <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号码"></el-table-column>
  48. <el-table-column align="center" show-overflow-tooltip prop="orgName" label="机构名称" min-width="100"></el-table-column>
  49. <el-table-column align="center" show-overflow-tooltip prop="dpnm" label="所属部门"></el-table-column>
  50. <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务级别" min-width="100"></el-table-column>
  51. <el-table-column align="center" show-overflow-tooltip prop="dcNum" label="参与督查次数" min-width="120"></el-table-column>
  52. <el-table-column align="center" show-overflow-tooltip prop="dppost" label="职称"></el-table-column>
  53. <el-table-column align="center" v-if="objType=='8'" show-overflow-tooltip prop="specialty" label="专业" min-width="100"></el-table-column>
  54. <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="参与督查情况" min-width="300">
  55. <template slot-scope="scope">
  56. <div v-if="scope.row.dcWork" style="width: 100%">
  57. <p v-for="(item,index) in scope.row.dcWork.split('\r')">{{item}}</p>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. <!-- <el-table-column align="center" show-overflow-tooltip prop="modifyTime1" label="最后修改时间"></el-table-column> -->
  62. <!-- <el-table-column align="center" show-overflow-tooltip prop="name" label="标签">
  63. <template slot-scope="scope">
  64. <el-tag
  65. :closable="scope.row.type == 1 ? true : false"
  66. size="mini"
  67. :type="scope.row.type == 1 ? 'warning' : 'info'"
  68. @close="handleClose(item,scope.$index,scope.row)">
  69. {{scope.row.type == 1 ? '组长' : '成员'}}
  70. </el-tag>
  71. </template>
  72. </el-table-column>-->
  73. <!-- <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务级别"></el-table-column>
  74. <el-table-column align="center" show-overflow-tooltip prop="title" label="技术职称"></el-table-column>
  75. <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号"></el-table-column> -->
  76. <!-- <el-table-column
  77. fixed="right"
  78. label="操作"
  79. align="center"
  80. width="100">
  81. <template slot-scope="scope" >
  82. <el-button :disabled="scope.row.type == 1 ? true : false" @click="setLeader(scope.$index, scope.row)" type="text" size="small">设置组长</el-button>
  83. </template>
  84. </el-table-column>-->
  85. </el-table>
  86. <div
  87. class="block"
  88. style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;"
  89. >
  90. <el-pagination
  91. small
  92. @current-change="handleCurrentChange"
  93. :current-page.sync="pageIndex"
  94. :page-size="pageSize"
  95. layout="total, prev, pager, next"
  96. :total="total"
  97. ></el-pagination>
  98. </div>
  99. </div>
  100. <!-- </el-form-item> -->
  101. </el-form>
  102. </el-main>
  103. </el-container>
  104. <div slot="footer" class="dialog-footer">
  105. <el-button @click="dialogFormVisible = false">取 消</el-button>
  106. <el-button type="primary" @click="addMens">确 定</el-button>
  107. </div>
  108. </el-dialog>
  109. </template>
  110. <script>
  111. import provTreeList from '../../widgets/provTreeList.vue'
  112. import { getArenGrpMen, addDczOthersMens } from "../../api/duChaPlan.js";
  113. import {dateFormat} from '../../utils/gw_date.js'
  114. import request from "../../utils/gw_ajax_request.js";
  115. export default {
  116. components: {
  117. 'provTreeList':provTreeList,
  118. },
  119. props: ['objType','dczId','dczName','jiGouId','addPerType','isNew'],
  120. computed: {},
  121. data() {
  122. return {
  123. addOnce:false,
  124. jgName:'',
  125. numb:"",
  126. total: 0,
  127. addArr: "",
  128. labelPosition: "top",
  129. searchText: "",
  130. pageSize: 10,
  131. pageIndex: 1,
  132. currentShowList: [],
  133. dialogFormVisible: false,
  134. formLabelWidth: "120",
  135. checkList: [],
  136. personList: [],
  137. jigourenyuan: [],
  138. multipleSelection: [],
  139. multipleSelectionAll: [],
  140. idKey: "guid",
  141. searchProvTreeListCode :'',
  142. tableHeight:window.innerHeight - 160,
  143. rememberselectAllIds:[],
  144. dcGroupId: ''
  145. };
  146. },
  147. mounted() {
  148. },
  149. methods: {
  150. showDialog() {
  151. this.dialogFormVisible = true;
  152. this.getTableData();
  153. this.addArr = '';
  154. },
  155. saveNewZu() {
  156. this.$emit("cancelHandler");
  157. console.log(this.checkList);
  158. },
  159. zuLeaderChange() {},
  160. zuMemberChange() {},
  161. handleSelectionChange(val) {
  162. this.multipleSelection = val;
  163. if (!this.multipleSelection || this.multipleSelection.length <= 0) {
  164. return;
  165. }
  166. // 标识当前行的唯一键的名称
  167. let idKey = this.idKey;
  168. let selectAllIds = [];
  169. let that = this;
  170. this.multipleSelection.forEach(row => {
  171. selectAllIds.push(row[idKey]);
  172. });
  173. this.rememberselectAllIds = this.rememberselectAllIds.concat(selectAllIds);
  174. console.log(val)
  175. },
  176. handleCurrentChange(val) {
  177. // if (this.currentShowList) {
  178. // this.currentShowList.forEach(row => {
  179. // this.$refs.menTable.toggleRowSelection(row,true);
  180. // });
  181. // } else {
  182. // this.$refs.menTable.clearSelection();
  183. // }
  184. this.refreshCurrentShow();
  185. },
  186. getTableData() {
  187. //获取非当前督查需人员列表
  188. if(!this.dczId){
  189. this.dcGroupId = 'jwW2Wihf5E9X3UC9t45fmSHyffUs2rzI';
  190. }else{
  191. this.dcGroupId = this.dczId
  192. }
  193. if(!this.jiGouId){
  194. this.jiGouId = '4355A1641209412DA5534DE05A941BCC';
  195. }
  196. var _self = this;
  197. console.log(_self.dczInfo);
  198. getArenGrpMen(
  199. this.dcGroupId.substring(3,6),
  200. this.dcGroupId,
  201. _self.pageSize,
  202. _self.pageIndex,
  203. this.searchText,
  204. this.searchProvTreeListCode,
  205. this.jgName,
  206. this.numb
  207. ).then(response => {
  208. var arr = response.data.list;
  209. arr.forEach((arrItem,index) =>{
  210. arrItem['index'] = (_self.pageSize * (_self.pageIndex-1)) + index + 1;
  211. arrItem['sex1'] = arrItem.sex=='1'?'男':
  212. arrItem.sex =='2'?'女':'';
  213. arrItem['modifyTime1'] = arrItem.modifyTime==null?'':dateFormat(arrItem.modifyTime,'yyyy-MM-DD');
  214. });
  215. _self.currentShowList = response.data.list;
  216. this.$nextTick(function () {
  217. // DOM 更新了
  218. _self.$refs.menTable.clearSelection();
  219. for (var i = 0; i < _self.currentShowList.length; i++) {
  220. if (_self.rememberselectAllIds.indexOf(_self.currentShowList[i][_self.idKey]) >= 0) {
  221. // 设置选中,记住table组件需要使用ref="table"
  222. _self.$refs.menTable.toggleRowSelection(_self.currentShowList[i], true);
  223. }
  224. }
  225. })
  226. _self.total = response.data.total;
  227. // setTimeout(() => {
  228. // _self.setSelectRow();
  229. // }, 20);
  230. });
  231. },
  232. // 得到选中的所有数据
  233. getAllSelectionData() {
  234. // 再执行一次记忆勾选数据匹配,目的是为了在当前页操作勾选后直接获取选中数据
  235. this.changePageCoreRecordData();
  236. console.log(this.multipleSelectionAll);
  237. },
  238. // 设置选中的方法
  239. setSelectRow() {
  240. if (!this.multipleSelectionAll || this.multipleSelectionAll.length <= 0) {
  241. return;
  242. }
  243. // 标识当前行的唯一键的名称
  244. let idKey = this.idKey;
  245. let selectAllIds = [];
  246. let that = this;
  247. this.multipleSelectionAll.forEach(row => {
  248. selectAllIds.push(row[idKey]);
  249. });
  250. this.$refs.menTable.clearSelection();
  251. for (var i = 0; i < this.currentShowList.length; i++) {
  252. if (selectAllIds.indexOf(this.currentShowList[i][idKey]) >= 0) {
  253. // 设置选中,记住table组件需要使用ref="table"
  254. this.$refs.menTable.toggleRowSelection(this.currentShowList[i], true);
  255. }
  256. }
  257. },
  258. // 记忆选择核心方法
  259. changePageCoreRecordData() {
  260. // 标识当前行的唯一键的名称
  261. let idKey = this.idKey;
  262. let that = this;
  263. // 如果总记忆中还没有选择的数据,那么就直接取当前页选中的数据,不需要后面一系列计算
  264. if (this.multipleSelectionAll.length <= 0) {
  265. this.multipleSelectionAll = this.multipleSelection;
  266. return;
  267. }
  268. // 总选择里面的key集合
  269. let selectAllIds = [];
  270. this.multipleSelectionAll.forEach(row => {
  271. selectAllIds.push(row[idKey]);
  272. });
  273. let selectIds = [];
  274. // 获取当前页选中的id
  275. this.multipleSelection.forEach(row => {
  276. selectIds.push(row[idKey]);
  277. // 如果总选择里面不包含当前页选中的数据,那么就加入到总选择集合里
  278. if (selectAllIds.indexOf(row[idKey]) < 0) {
  279. that.multipleSelectionAll.push(row);
  280. }
  281. });
  282. let noSelectIds = [];
  283. // 得到当前页没有选中的id
  284. this.currentShowList.forEach(row => {
  285. if (selectIds.indexOf(row[idKey]) < 0) {
  286. noSelectIds.push(row[idKey]);
  287. }
  288. });
  289. noSelectIds.forEach(id => {
  290. if (selectAllIds.indexOf(id) >= 0) {
  291. for (let i = 0; i < that.multipleSelectionAll.length; i++) {
  292. if (that.multipleSelectionAll[i][idKey] == id) {
  293. // 如果总选择中有未被选中的,那么就删除这条
  294. that.multipleSelectionAll.splice(i, 1);
  295. break;
  296. }
  297. }
  298. }
  299. });
  300. },
  301. addMens: function() {
  302. this.changePageCoreRecordData();
  303. //提交当前选中人员
  304. var _self = this;
  305. var mohurd = '';
  306. if(_self.addOnce){
  307. _self.addOnce = false;
  308. return;
  309. }
  310. _self.addOnce = true;
  311. const length = _self.multipleSelection.length;
  312. for (let i = 0; i < length; i++) {
  313. _self.addArr += _self.multipleSelection[i].guid + ",";
  314. mohurd += _self.multipleSelection[i].mohurd + ",";
  315. }
  316. if(this.addPerType){
  317. let newpersAllDtoList = [];
  318. let newPersId = [];
  319. _self.multipleSelection.forEach((element)=>{
  320. newpersAllDtoList.push({
  321. guid:element.guid,
  322. persName:element.persName,
  323. persType:_self.addPerType
  324. });
  325. newPersId.push(element.guid);
  326. });
  327. console.log('新版本督查计划调用');
  328. request.post('/supervision/plan/insertSupervisionObj',{
  329. "id":_self.dcGroupId,
  330. "persAllAreaDtoList":[],
  331. "persAllDtoList":newpersAllDtoList,
  332. "persAllObjDtoList": [],
  333. // "pid": _self.tableCurrentRow.pid
  334. })
  335. .then(response => {
  336. if(this.isNew){
  337. _self.addOnce = false;
  338. _self.$message.success("添加成功");
  339. _self.$emit('addSuccess',{listArr:newpersAllDtoList,listIds:newPersId,persType:_self.addPerType});
  340. _self.dialogFormVisible = false;
  341. }else{
  342. _self.addOnce = false;
  343. _self.$message.success("添加成功");
  344. _self.$emit('addSuccess');
  345. _self.dialogFormVisible = false;
  346. }
  347. })
  348. }else{
  349. if(_self.addArr){
  350. try {
  351. addDczOthersMens(_self.addArr,_self.dcGroupId,mohurd).then(response => {
  352. if (response.success) {
  353. _self.addOnce = false;
  354. // this.getTableData();
  355. this.$message.success("添加成功");
  356. this.$emit('addSuccess');
  357. _self.dialogFormVisible = false;
  358. } else{
  359. this.$message.error(response.message);
  360. }
  361. });
  362. } catch (e) {
  363. this.$message.error("添加失败,请稍后再试");
  364. }
  365. }else{
  366. this.$message.error("请选择要添加的人员");
  367. }
  368. }
  369. },
  370. // 获取row的key值
  371. getRowKeys(row) {
  372. return row.guid;
  373. },
  374. selectable(row,index){
  375. if(row.guid){
  376. return true;
  377. }else{
  378. return false;
  379. }
  380. },
  381. refreshCurrentShow: function() {
  382. this.getTableData();
  383. },
  384. search() {},
  385. provTreeSelectChangeHandler:function(params){
  386. this.searchProvTreeListCode = params.code;
  387. this.getTableData();
  388. }
  389. }
  390. };
  391. </script>
  392. <style>
  393. #dialog .el-dialog__body {
  394. padding: 20px 20px;
  395. }
  396. </style>