| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297 |
- <template>
- <!-- 弹出窗 -->
- <el-dialog :title="memberTitle" :before-close="closeMemberDialog" :append-to-body="true" :visible.sync="dialogFormVisible" width="80%">
- <el-container>
- <el-main style="border:1px solid #d5d5ff;margin-left:5px;padding:0px;">
- <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">督查人员</p>
- <el-form style="padding:10px">
- <div>
- <el-form size="mini" :inline="true" class="demo-form-inline">
- <el-form-item label="人员名称">
- <el-input
- style="width:140px;"
- v-model="searchNameOfMemberName"
- clearable
- placeholder="请输入人员名称"
- ></el-input>
- </el-form-item>
- <el-form-item>
- <el-button type="primary" @click="refreshCurrentShow">查询</el-button>
- </el-form-item>
- </el-form>
- <el-table
- ref="multipleTable"
- v-if="type == 'checkbox'"
- border
- v-loading="loading"
- :data="currentShowList"
- tooltip-effect="dark"
- style="width: 100%"
- @select="isSelected"
- @selection-change="handleSelectionChange">
- <el-table-column align="center" type="selection" width="70"></el-table-column>
- <el-table-column align="center" type="index" label="序号" min-width="45">
- <template slot-scope="scope">
- {{ (pageIndex - 1) * pageSize + (scope.$index + 1) }}
- </template>
- </el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="persName" label="人员姓名" min-width="80"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="orgNm" label="机构名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="dpnm" label="部门名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="dppost" label="职称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="sex" label="性别" :formatter="sexFormatter" min-width="50"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号" min-width="100"></el-table-column>
- </el-table>
- <el-table
- v-if="type == 'radio'"
- border
- v-loading="loading"
- :data="currentShowList"
- tooltip-effect="dark"
- style="width: 100%">
- <el-table-column align="center" width="70">
- <template slot-scope="scope">
- <el-radio v-model="radioSelect" :label="scope.row.guid" @change="radioChange(scope.row)"> </el-radio>
- </template>
- </el-table-column>
- <el-table-column align="center" type="index" label="序号" min-width="45">
- <template slot-scope="scope">
- {{ (pageIndex - 1) * pageSize + (scope.$index + 1) }}
- </template>
- </el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="persName" label="人员姓名" min-width="80"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="orgNm" label="机构名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="dpnm" label="部门名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="dppost" label="职称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="sex" label="性别" :formatter="sexFormatter" min-width="50"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号" min-width="100"></el-table-column>
- </el-table>
- <div
- class="block"
- style="display:flex;flex-direction:row;justify-content:center;align-items:center;padding-top: 5px;background-color: #fff;">
- <el-pagination
- small
- @current-change="handleCurrentChange"
- :pager-count="5"
- :current-page.sync="pageIndex"
- :page-size="pageSize"
- layout="total, prev, pager, next"
- :total="total"
- ></el-pagination>
- </div>
- </div>
- </el-form>
- </el-main>
- </el-container>
- <div slot="footer" class="dialog-footer">
- <el-button @click="closeMemberDialog">取 消</el-button>
- <el-button type="primary" @click="saveChange">确 定</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import request from '../../../utils/gw_ajax_request.js';
- import {getTrees} from '@util/gw_formatTree'
- import provTreeList from "../../../widgets/jigouTreeList.vue";
- export default {
- props: ['type','members','title'],
- data() {
- return {
- treeData: [],
- searchNameOfMemberName: '',
- currentShowList: [],
- dialogFormVisible: true,
- formLabelWidth: "120",
- multipleSelection: [],
- singleSeclection: {},
- groupId: '',
- memberIds: [],
- memberNames: [],
- pageIndex: 1,
- pageSize: 10,
- total: 0,
- loading:false,
- defaultProps: {
- children: 'children',
- label: 'pnm',
- id: 'id'
- },
- radioSelect: ''
- }
- },
- components:{
- provTreeList
- },
- mounted() {
- this.initMember()
- this.getMemberList()
- },
- computed:{
- userId:function(){
- return localStorage.getItem("userid")? localStorage.getItem("userid"): '1098101939614724096'
- },
- orgId(){
- return localStorage.getItem('guid') ? localStorage.getItem('guid') : ''
- },
- memberTitle(){
- return this.title ? this.title : '添加参会人员'
- }
- },
- methods: {
- //获取当前用户机构数据
- getGroupData(){
- request.get(`/dc/organization/base/getAllNode?userId=${this.userId}`).then(res=>{
- if(res.success){
- this.treeData = getTrees(res.data)
- this.getMemberList()
- }
- }).catch(res=>{
- })
- },
- getMemberList(){
- let params = {
- orgId: this.orgId,
- pageSize:this.pageSize,
- pageNum:this.pageIndex,
- persName: this.searchNameOfMemberName
- }
- this.loading = true
- request.post(`/bis/insp/list`,params).then(res=>{
- this.loading = false
- if(res.success){
- let _this = this
- this.currentShowList = res.data.list
- this.total = res.data.total
- this.$nextTick(function () {
- if(this.multipleSelection.length && this.currentShowList.length){
- let selectedRows = []
- this.multipleSelection.forEach(ele=>{
- let guid = ele.persId ? ele.persId : ele.guid
- _this.currentShowList.forEach(element=>{
- if(guid == element.guid){
- selectedRows.push(element)
- }
- })
- })
- selectedRows.forEach(row => {
- _this.$refs.multipleTable.toggleRowSelection(row,true);
- });
- }
- })
- }
- }).catch(res=>{
- })
- },
- addObjectChange: function() {
- //提交当前选中对象
- let _this = this
- if(this.multipleSelection.length && this.type == 'checkbox'){
- this.memberIds = []
- this.memberNames = []
- this.multipleSelection.forEach(ele=>{
- _this.memberIds.push(ele.guid)
- _this.memberNames.push(ele.persName)
- })
- let personInfo = {
- memberIds: '',
- memberNames: '',
- allInfo: []
- }
- personInfo.memberIds = this.memberIds
- personInfo.memberNames = this.memberNames.join(',')
- personInfo.allInfo = this.multipleSelection
- this.$emit('sendPersonInfoOrgan',personInfo)
- }
- if(Object.keys(this.singleSeclection).length && this.type == 'radio'){
- let personInfo = {
- memberId: '',
- memberName: ''
- }
- personInfo.memberId = this.singleSeclection.guid
- personInfo.memberName = this.singleSeclection.persName
- this.$emit('sendPersonInfoOrgan',personInfo)
- }
- },
- saveChange() {
- this.addObjectChange();
- },
- initMember(){
- let oldMembers = []
- if(this.members.length){
- this.members.forEach(ele=>{
- oldMembers.push({'guid':ele.persId ? ele.persId : ele.guid,'persName':ele.persName})
- })
- this.multipleSelection = oldMembers;
- }
- },
- handleSelectionChange(val) {
- if(val.length){
- val.forEach(ele=>{
- this.multipleSelection.push({'guid':ele.persId ? ele.persId : ele.guid,'persName':ele.persName})
- })
- this.multipleSelection = this.multipleSelection
- }
- let allArr = []
- for(var i=0;i<this.multipleSelection.length;i++){
- let flag = true;
- for(var j=0;j<allArr.length;j++){
- if(this.multipleSelection[i].guid == allArr[j].guid){
- flag = false;
- };
- };
- if(flag){
- allArr.push(this.multipleSelection[i]);
- };
- };
- this.multipleSelection = allArr
- // this.multipleSelection = Array.from(new Set(this.multipleSelection))
- },
- isSelected(rows,row){
- let _this = this
- let selected = rows.length && rows.indexOf(row) !== -1
- if(!selected){
- this.multipleSelection.forEach((ele,index)=>{
- if(ele.guid == row.guid){
- this.multipleSelection.splice(index,1)
- }
- })
- }
- console.log(_this.multipleSelection)
- console.log(_this.multipleSelection.length)
- },
- radioChange(row){
- this.singleSeclection = row
- },
- handleCurrentChange(val) {
- this.refreshCurrentShow();
- },
- refreshCurrentShow: function() {
- this.getMemberList()
- },
- treeNodeClickHandler(param){
- this.groupId = param.code
- },
- closeMemberDialog(){
- this.$emit('closeMember')
- // this.multipleSelection = []
- },
- sexFormatter: function (row, column) {
- return row.sex == 2 ? "女" : row.sex == 1 ? "男" : '';
- },
- },
- watch: {
- groupId(val){
- this.getMemberList()
- }
- }
- };
- </script>
- <style>
- </style>
|