44c3e3b2dcd23ce04f69e104133aec99bccbdf71.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <!-- 弹出窗 -->
  3. <el-dialog :title="memberTitle" :before-close="closeMemberDialog" :append-to-body="true" :visible.sync="dialogFormVisible" width="80%">
  4. <el-container>
  5. <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
  6. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查人员</p>
  7. <el-form style="padding:10px">
  8. <div>
  9. <el-form size="mini" :inline="true" class="demo-form-inline">
  10. <el-form-item label="人员名称">
  11. <el-input
  12. style="width:140px;"
  13. v-model="searchNameOfMemberName"
  14. clearable
  15. placeholder="请输入人员名称"
  16. ></el-input>
  17. </el-form-item>
  18. <el-form-item>
  19. <el-button type="primary" @click="refreshCurrentShow">查询</el-button>
  20. </el-form-item>
  21. </el-form>
  22. <el-table
  23. ref="multipleTable"
  24. v-if="type == 'checkbox'"
  25. border
  26. v-loading="loading"
  27. :data="currentShowList"
  28. tooltip-effect="dark"
  29. style="width: 100%"
  30. @select="isSelected"
  31. @selection-change="handleSelectionChange">
  32. <el-table-column align="center" type="selection" width="70"></el-table-column>
  33. <el-table-column align="center" type="index" label="序号" min-width="45">
  34. <template slot-scope="scope">
  35. {{ (pageIndex - 1) * pageSize + (scope.$index + 1) }}
  36. </template>
  37. </el-table-column>
  38. <el-table-column align="center" show-overflow-tooltip prop="persName" label="人员姓名" min-width="80"></el-table-column>
  39. <el-table-column align="center" show-overflow-tooltip prop="orgNm" label="机构名称" min-width="100"></el-table-column>
  40. <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务" min-width="100"></el-table-column>
  41. <el-table-column align="center" show-overflow-tooltip prop="dpnm" label="部门名称" min-width="100"></el-table-column>
  42. <el-table-column align="center" show-overflow-tooltip prop="dppost" label="职称" min-width="100"></el-table-column>
  43. <el-table-column align="center" show-overflow-tooltip prop="sex" label="性别" :formatter="sexFormatter" min-width="50"></el-table-column>
  44. <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号" min-width="100"></el-table-column>
  45. </el-table>
  46. <el-table
  47. v-if="type == 'radio'"
  48. border
  49. v-loading="loading"
  50. :data="currentShowList"
  51. tooltip-effect="dark"
  52. style="width: 100%">
  53. <el-table-column align="center" width="70">
  54. <template slot-scope="scope">
  55. <el-radio v-model="radioSelect" :label="scope.row.guid" @change="radioChange(scope.row)">&nbsp;</el-radio>
  56. </template>
  57. </el-table-column>
  58. <el-table-column align="center" type="index" label="序号" min-width="45">
  59. <template slot-scope="scope">
  60. {{ (pageIndex - 1) * pageSize + (scope.$index + 1) }}
  61. </template>
  62. </el-table-column>
  63. <el-table-column align="center" show-overflow-tooltip prop="persName" label="人员姓名" min-width="80"></el-table-column>
  64. <el-table-column align="center" show-overflow-tooltip prop="orgNm" label="机构名称" min-width="100"></el-table-column>
  65. <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务" min-width="100"></el-table-column>
  66. <el-table-column align="center" show-overflow-tooltip prop="dpnm" label="部门名称" min-width="100"></el-table-column>
  67. <el-table-column align="center" show-overflow-tooltip prop="dppost" label="职称" min-width="100"></el-table-column>
  68. <el-table-column align="center" show-overflow-tooltip prop="sex" label="性别" :formatter="sexFormatter" min-width="50"></el-table-column>
  69. <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号" min-width="100"></el-table-column>
  70. </el-table>
  71. <div
  72. class="block"
  73. style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;">
  74. <el-pagination
  75. small
  76. @current-change="handleCurrentChange"
  77. :pager-count="5"
  78. :current-page.sync="pageIndex"
  79. :page-size="pageSize"
  80. layout="total, prev, pager, next"
  81. :total="total"
  82. ></el-pagination>
  83. </div>
  84. </div>
  85. </el-form>
  86. </el-main>
  87. </el-container>
  88. <div slot="footer" class="dialog-footer">
  89. <el-button @click="closeMemberDialog">取 消</el-button>
  90. <el-button type="primary" @click="saveChange">确 定</el-button>
  91. </div>
  92. </el-dialog>
  93. </template>
  94. <script>
  95. import request from '../../../utils/gw_ajax_request.js';
  96. import {getTrees} from '@util/gw_formatTree'
  97. import provTreeList from "../../../widgets/jigouTreeList.vue";
  98. export default {
  99. props: ['type','members','title'],
  100. data() {
  101. return {
  102. treeData: [],
  103. searchNameOfMemberName: '',
  104. currentShowList: [],
  105. dialogFormVisible: true,
  106. formLabelWidth: "120",
  107. multipleSelection: [],
  108. singleSeclection: {},
  109. groupId: '',
  110. memberIds: [],
  111. memberNames: [],
  112. pageIndex: 1,
  113. pageSize: 10,
  114. total: 0,
  115. loading:false,
  116. defaultProps: {
  117. children: 'children',
  118. label: 'pnm',
  119. id: 'id'
  120. },
  121. radioSelect: ''
  122. }
  123. },
  124. components:{
  125. provTreeList
  126. },
  127. mounted() {
  128. this.initMember()
  129. this.getMemberList()
  130. },
  131. computed:{
  132. userId:function(){
  133. return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
  134. },
  135. orgId(){
  136. return localStorage.getItem('guid') ? localStorage.getItem('guid') : ''
  137. },
  138. memberTitle(){
  139. return this.title ? this.title : '添加参会人员'
  140. }
  141. },
  142. methods: {
  143. //获取当前用户机构数据
  144. getGroupData(){
  145. request.get(`/dc/organization/base/getAllNode?userId=${this.userId}`).then(res=>{
  146. if(res.success){
  147. this.treeData = getTrees(res.data)
  148. this.getMemberList()
  149. }
  150. }).catch(res=>{
  151. })
  152. },
  153. getMemberList(){
  154. let params = {
  155. orgId: this.orgId,
  156. pageSize:this.pageSize,
  157. pageNum:this.pageIndex,
  158. persName: this.searchNameOfMemberName
  159. }
  160. this.loading = true
  161. request.post(`/bis/insp/list`,params).then(res=>{
  162. this.loading = false
  163. if(res.success){
  164. let _this = this
  165. this.currentShowList = res.data.list
  166. this.total = res.data.total
  167. this.$nextTick(function () {
  168. if(this.multipleSelection.length && this.currentShowList.length){
  169. let selectedRows = []
  170. this.multipleSelection.forEach(ele=>{
  171. let guid = ele.persId ? ele.persId : ele.guid
  172. _this.currentShowList.forEach(element=>{
  173. if(guid == element.guid){
  174. selectedRows.push(element)
  175. }
  176. })
  177. })
  178. selectedRows.forEach(row => {
  179. _this.$refs.multipleTable.toggleRowSelection(row,true);
  180. });
  181. }
  182. })
  183. }
  184. }).catch(res=>{
  185. })
  186. },
  187. addObjectChange: function() {
  188. //提交当前选中对象
  189. let _this = this
  190. if(this.multipleSelection.length && this.type == 'checkbox'){
  191. this.memberIds = []
  192. this.memberNames = []
  193. this.multipleSelection.forEach(ele=>{
  194. _this.memberIds.push(ele.guid)
  195. _this.memberNames.push(ele.persName)
  196. })
  197. let personInfo = {
  198. memberIds: '',
  199. memberNames: '',
  200. allInfo: []
  201. }
  202. personInfo.memberIds = this.memberIds
  203. personInfo.memberNames = this.memberNames.join(',')
  204. personInfo.allInfo = this.multipleSelection
  205. this.$emit('sendPersonInfoOrgan',personInfo)
  206. }
  207. if(Object.keys(this.singleSeclection).length && this.type == 'radio'){
  208. let personInfo = {
  209. memberId: '',
  210. memberName: ''
  211. }
  212. personInfo.memberId = this.singleSeclection.guid
  213. personInfo.memberName = this.singleSeclection.persName
  214. this.$emit('sendPersonInfoOrgan',personInfo)
  215. }
  216. },
  217. saveChange() {
  218. this.addObjectChange();
  219. },
  220. initMember(){
  221. let oldMembers = []
  222. if(this.members.length){
  223. this.members.forEach(ele=>{
  224. oldMembers.push({'guid':ele.persId ? ele.persId : ele.guid,'persName':ele.persName})
  225. })
  226. this.multipleSelection = oldMembers;
  227. }
  228. },
  229. handleSelectionChange(val) {
  230. if(val.length){
  231. val.forEach(ele=>{
  232. this.multipleSelection.push({'guid':ele.persId ? ele.persId : ele.guid,'persName':ele.persName})
  233. })
  234. this.multipleSelection = this.multipleSelection
  235. }
  236. let allArr = []
  237. for(var i=0;i<this.multipleSelection.length;i++){
  238. let flag = true;
  239.   for(var j=0;j<allArr.length;j++){
  240.     if(this.multipleSelection[i].guid == allArr[j].guid){
  241.       flag = false;
  242.     };
  243.   };
  244.   if(flag){
  245.     allArr.push(this.multipleSelection[i]);
  246.   };
  247. };
  248. this.multipleSelection = allArr
  249. // this.multipleSelection = Array.from(new Set(this.multipleSelection))
  250. },
  251. isSelected(rows,row){
  252. let _this = this
  253. let selected = rows.length && rows.indexOf(row) !== -1
  254. if(!selected){
  255. this.multipleSelection.forEach((ele,index)=>{
  256. if(ele.guid == row.guid){
  257. this.multipleSelection.splice(index,1)
  258. }
  259. })
  260. }
  261. console.log(_this.multipleSelection)
  262. console.log(_this.multipleSelection.length)
  263. },
  264. radioChange(row){
  265. this.singleSeclection = row
  266. },
  267. handleCurrentChange(val) {
  268. this.refreshCurrentShow();
  269. },
  270. refreshCurrentShow: function() {
  271. this.getMemberList()
  272. },
  273. treeNodeClickHandler(param){
  274. this.groupId = param.code
  275. },
  276. closeMemberDialog(){
  277. this.$emit('closeMember')
  278. // this.multipleSelection = []
  279. },
  280. sexFormatter: function (row, column) {
  281. return row.sex == 2 ? "女" : row.sex == 1 ? "男" : '';
  282. },
  283. },
  284. watch: {
  285. groupId(val){
  286. this.getMemberList()
  287. }
  288. }
  289. };
  290. </script>
  291. <style>
  292. </style>