| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408 |
- <template>
- <!-- 弹出窗 -->
- <el-dialog id="dialog" width="70%" title="添加人员" :visible.sync="dialogFormVisible">
- <el-container >
- <!-- <el-aside width="200px" style="border:1px solid #d5d5ff">
- <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;"><i class="el-icon-share"></i>所在机构</p>
- <provTreeList rootCode='000000' rootType='1' style="max-height:400px;" @provTreeSelectChange="provTreeSelectChangeHandler"></provTreeList>
- </el-aside> -->
- <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 :label-position="labelPosition" label-width="80px">
- <el-form-item style="margin-bottom: 0px;" label="" :label-width="formLabelWidth"></el-form-item>
- <div>
- <div style="display:flex;height: 30px;padding: 10px;">
- <el-form-item label="人员姓名" style="display:flex;">
- <el-input style="width:140px;padding-left: 10px;" v-model="searchText" clearable placeholder="请输入人员名称"></el-input>
- </el-form-item>
- <el-form-item label="所属部门" style="display:flex;padding-left: 30px;">
- <el-input style="width:140px;padding-left: 10px;" v-model="jgName" clearable placeholder="请输入所属部门"></el-input>
- </el-form-item>
- <el-form-item label="手机号码" style="display:flex;padding-left: 30px;">
- <el-input style="width:140px;padding-left: 10px;" v-model="numb" clearable placeholder="请输入手机号码"></el-input>
- </el-form-item>
- <!-- <el-input
- placeholder="请输入姓名"
- v-model="searchText"
- style="width: 200px;padding-bottom: 10px;padding-top: 10px; margin-left:10px;"
- class="input-with-select"
- >
- </el-input> -->
- <el-button type="primary" style="margin-left:20px;" @click="getTableData">查询</el-button>
- </div>
- <el-table
- ref="menTable"
- border
- :data="currentShowList"
- tooltip-effect="dark"
- style="width: 100%"
- @selection-change="handleSelectionChange"
- >
- <el-table-column align="center" width="70" type="selection" :selectable="selectable" :reserve-selection="false"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip width="60" prop="index" label="序号"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="persName" label="人员姓名"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="sex1" label="性别"></el-table-column>
- <!-- <el-table-column align="center" show-overflow-tooltip prop="persCode" label="身份证号"></el-table-column> -->
- <!-- <el-table-column align="center" show-overflow-tooltip prop="telnumb" label="办公室电话"></el-table-column> -->
- <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号码"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="orgName" label="机构名称" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="dpnm" label="所属部门"></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="dcNum" label="参与督查次数" min-width="120"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="dppost" label="职称"></el-table-column>
- <el-table-column align="center" v-if="objType=='8'" show-overflow-tooltip prop="specialty" label="专业" min-width="100"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="参与督查情况" min-width="300">
- <template slot-scope="scope">
- <div v-if="scope.row.dcWork" style="width: 100%">
- <p v-for="(item,index) in scope.row.dcWork.split('\r')">{{item}}</p>
- </div>
- </template>
- </el-table-column>
- <!-- <el-table-column align="center" show-overflow-tooltip prop="modifyTime1" label="最后修改时间"></el-table-column> -->
- <!-- <el-table-column align="center" show-overflow-tooltip prop="name" label="标签">
- <template slot-scope="scope">
- <el-tag
- :closable="scope.row.type == 1 ? true : false"
- size="mini"
- :type="scope.row.type == 1 ? 'warning' : 'info'"
- @close="handleClose(item,scope.$index,scope.row)">
- {{scope.row.type == 1 ? '组长' : '成员'}}
- </el-tag>
- </template>
- </el-table-column>-->
- <!-- <el-table-column align="center" show-overflow-tooltip prop="admDuty" label="职务级别"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="title" label="技术职称"></el-table-column>
- <el-table-column align="center" show-overflow-tooltip prop="mobilenumb" label="手机号"></el-table-column> -->
- <!-- <el-table-column
- fixed="right"
- label="操作"
- align="center"
- width="100">
- <template slot-scope="scope" >
- <el-button :disabled="scope.row.type == 1 ? true : false" @click="setLeader(scope.$index, scope.row)" type="text" size="small">设置组长</el-button>
- </template>
- </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"
- :current-page.sync="pageIndex"
- :page-size="pageSize"
- layout="total, prev, pager, next"
- :total="total"
- ></el-pagination>
- </div>
- </div>
- <!-- </el-form-item> -->
- </el-form>
- </el-main>
- </el-container>
- <div slot="footer" class="dialog-footer">
- <el-button @click="dialogFormVisible = false">取 消</el-button>
- <el-button type="primary" @click="addMens">确 定</el-button>
- </div>
- </el-dialog>
- </template>
- <script>
- import provTreeList from '../../widgets/provTreeList.vue'
- import { getArenGrpMen, addDczOthersMens } from "../../api/duChaPlan.js";
- import {dateFormat} from '../../utils/gw_date.js'
- import request from "../../utils/gw_ajax_request.js";
- export default {
- components: {
- 'provTreeList':provTreeList,
- },
- props: ['objType','dczId','dczName','jiGouId','addPerType','isNew'],
- computed: {},
- data() {
- return {
- addOnce:false,
- jgName:'',
- numb:"",
- total: 0,
- addArr: "",
- labelPosition: "top",
- searchText: "",
- pageSize: 10,
- pageIndex: 1,
- currentShowList: [],
- dialogFormVisible: false,
- formLabelWidth: "120",
- checkList: [],
- personList: [],
- jigourenyuan: [],
- multipleSelection: [],
- multipleSelectionAll: [],
- idKey: "guid",
- searchProvTreeListCode :'',
- tableHeight:window.innerHeight - 160,
- rememberselectAllIds:[],
- dcGroupId: ''
- };
- },
- mounted() {
- },
- methods: {
- showDialog() {
- this.dialogFormVisible = true;
- this.getTableData();
- this.addArr = '';
- },
- saveNewZu() {
- this.$emit("cancelHandler");
- console.log(this.checkList);
- },
- zuLeaderChange() {},
- zuMemberChange() {},
- handleSelectionChange(val) {
- this.multipleSelection = val;
- if (!this.multipleSelection || this.multipleSelection.length <= 0) {
- return;
- }
- // 标识当前行的唯一键的名称
- let idKey = this.idKey;
- let selectAllIds = [];
- let that = this;
- this.multipleSelection.forEach(row => {
- selectAllIds.push(row[idKey]);
- });
- this.rememberselectAllIds = this.rememberselectAllIds.concat(selectAllIds);
- console.log(val)
- },
- handleCurrentChange(val) {
- // if (this.currentShowList) {
- // this.currentShowList.forEach(row => {
- // this.$refs.menTable.toggleRowSelection(row,true);
- // });
- // } else {
- // this.$refs.menTable.clearSelection();
- // }
- this.refreshCurrentShow();
- },
- getTableData() {
- //获取非当前督查需人员列表
- if(!this.dczId){
- this.dcGroupId = 'jwW2Wihf5E9X3UC9t45fmSHyffUs2rzI';
- }else{
- this.dcGroupId = this.dczId
- }
- if(!this.jiGouId){
- this.jiGouId = '4355A1641209412DA5534DE05A941BCC';
- }
- var _self = this;
- console.log(_self.dczInfo);
- getArenGrpMen(
- this.dcGroupId.substring(3,6),
- this.dcGroupId,
- _self.pageSize,
- _self.pageIndex,
- this.searchText,
- this.searchProvTreeListCode,
- this.jgName,
- this.numb
- ).then(response => {
- var arr = response.data.list;
- arr.forEach((arrItem,index) =>{
- arrItem['index'] = (_self.pageSize * (_self.pageIndex-1)) + index + 1;
- arrItem['sex1'] = arrItem.sex=='1'?'男':
- arrItem.sex =='2'?'女':'';
- arrItem['modifyTime1'] = arrItem.modifyTime==null?'':dateFormat(arrItem.modifyTime,'yyyy-MM-DD');
- });
- _self.currentShowList = response.data.list;
- this.$nextTick(function () {
- // DOM 更新了
- _self.$refs.menTable.clearSelection();
- for (var i = 0; i < _self.currentShowList.length; i++) {
- if (_self.rememberselectAllIds.indexOf(_self.currentShowList[i][_self.idKey]) >= 0) {
- // 设置选中,记住table组件需要使用ref="table"
- _self.$refs.menTable.toggleRowSelection(_self.currentShowList[i], true);
- }
- }
- })
- _self.total = response.data.total;
- // setTimeout(() => {
- // _self.setSelectRow();
- // }, 20);
- });
- },
- // 得到选中的所有数据
- getAllSelectionData() {
- // 再执行一次记忆勾选数据匹配,目的是为了在当前页操作勾选后直接获取选中数据
- this.changePageCoreRecordData();
- console.log(this.multipleSelectionAll);
- },
- // 设置选中的方法
- setSelectRow() {
- if (!this.multipleSelectionAll || this.multipleSelectionAll.length <= 0) {
- return;
- }
- // 标识当前行的唯一键的名称
- let idKey = this.idKey;
- let selectAllIds = [];
- let that = this;
- this.multipleSelectionAll.forEach(row => {
- selectAllIds.push(row[idKey]);
- });
- this.$refs.menTable.clearSelection();
- for (var i = 0; i < this.currentShowList.length; i++) {
- if (selectAllIds.indexOf(this.currentShowList[i][idKey]) >= 0) {
- // 设置选中,记住table组件需要使用ref="table"
- this.$refs.menTable.toggleRowSelection(this.currentShowList[i], true);
- }
- }
- },
- // 记忆选择核心方法
- changePageCoreRecordData() {
- // 标识当前行的唯一键的名称
- let idKey = this.idKey;
- let that = this;
- // 如果总记忆中还没有选择的数据,那么就直接取当前页选中的数据,不需要后面一系列计算
- if (this.multipleSelectionAll.length <= 0) {
- this.multipleSelectionAll = this.multipleSelection;
- return;
- }
- // 总选择里面的key集合
- let selectAllIds = [];
- this.multipleSelectionAll.forEach(row => {
- selectAllIds.push(row[idKey]);
- });
- let selectIds = [];
- // 获取当前页选中的id
- this.multipleSelection.forEach(row => {
- selectIds.push(row[idKey]);
- // 如果总选择里面不包含当前页选中的数据,那么就加入到总选择集合里
- if (selectAllIds.indexOf(row[idKey]) < 0) {
- that.multipleSelectionAll.push(row);
- }
- });
- let noSelectIds = [];
- // 得到当前页没有选中的id
- this.currentShowList.forEach(row => {
- if (selectIds.indexOf(row[idKey]) < 0) {
- noSelectIds.push(row[idKey]);
- }
- });
- noSelectIds.forEach(id => {
- if (selectAllIds.indexOf(id) >= 0) {
- for (let i = 0; i < that.multipleSelectionAll.length; i++) {
- if (that.multipleSelectionAll[i][idKey] == id) {
- // 如果总选择中有未被选中的,那么就删除这条
- that.multipleSelectionAll.splice(i, 1);
- break;
- }
- }
- }
- });
- },
- addMens: function() {
- this.changePageCoreRecordData();
- //提交当前选中人员
- var _self = this;
- var mohurd = '';
- if(_self.addOnce){
- _self.addOnce = false;
- return;
- }
- _self.addOnce = true;
- const length = _self.multipleSelection.length;
- for (let i = 0; i < length; i++) {
- _self.addArr += _self.multipleSelection[i].guid + ",";
- mohurd += _self.multipleSelection[i].mohurd + ",";
- }
- if(this.addPerType){
- let newpersAllDtoList = [];
- let newPersId = [];
- _self.multipleSelection.forEach((element)=>{
- newpersAllDtoList.push({
- guid:element.guid,
- persName:element.persName,
- persType:_self.addPerType
- });
- newPersId.push(element.guid);
- });
- console.log('新版本督查计划调用');
- request.post('/supervision/plan/insertSupervisionObj',{
- "id":_self.dcGroupId,
- "persAllAreaDtoList":[],
- "persAllDtoList":newpersAllDtoList,
- "persAllObjDtoList": [],
- // "pid": _self.tableCurrentRow.pid
- })
- .then(response => {
- if(this.isNew){
- _self.addOnce = false;
- _self.$message.success("添加成功");
- _self.$emit('addSuccess',{listArr:newpersAllDtoList,listIds:newPersId,persType:_self.addPerType});
- _self.dialogFormVisible = false;
- }else{
- _self.addOnce = false;
- _self.$message.success("添加成功");
- _self.$emit('addSuccess');
- _self.dialogFormVisible = false;
- }
- })
- }else{
- if(_self.addArr){
- try {
- addDczOthersMens(_self.addArr,_self.dcGroupId,mohurd).then(response => {
- if (response.success) {
- _self.addOnce = false;
- // this.getTableData();
- this.$message.success("添加成功");
- this.$emit('addSuccess');
- _self.dialogFormVisible = false;
- } else{
- this.$message.error(response.message);
- }
- });
- } catch (e) {
- this.$message.error("添加失败,请稍后再试");
- }
- }else{
- this.$message.error("请选择要添加的人员");
- }
- }
- },
- // 获取row的key值
- getRowKeys(row) {
- return row.guid;
- },
- selectable(row,index){
- if(row.guid){
- return true;
- }else{
- return false;
- }
- },
- refreshCurrentShow: function() {
- this.getTableData();
- },
- search() {},
- provTreeSelectChangeHandler:function(params){
- this.searchProvTreeListCode = params.code;
- this.getTableData();
- }
- }
- };
- </script>
- <style>
- #dialog .el-dialog__body {
- padding: 20px 20px;
- }
- </style>
|