SetChannelManager.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598
  1. <template>
  2. <div class="setupManager">
  3. <el-main ref="elMain" style="padding: 0px">
  4. <Split :gutterSize="2" style="height: calc(100vh - 120px)">
  5. <SplitArea :size="leftSplitWidth" :minSize="240">
  6. <div class="container_left">
  7. <div class="search">
  8. <el-input v-model="filterText" size="small" placeholder="请输入姓名" suffix-icon="el-icon-search"></el-input>
  9. </div>
  10. <el-tree
  11. ref="tree"
  12. :data="treeData"
  13. :props="{children: 'children', label: 'name'}"
  14. :highlight-current="true"
  15. :current-node-key="currentKey"
  16. :filter-node-method="filterNode"
  17. @node-click="handleNodeClick"
  18. >
  19. <div class="custom-tree-node" slot-scope="{ node, data }">
  20. <span>{{ data.name }}</span>
  21. <span class="totalNum">{{ data.totalNum }}</span>
  22. </div>
  23. </el-tree>
  24. </div>
  25. </SplitArea>
  26. <SplitArea :size="rightSplitWidth">
  27. <div class="container_right">
  28. <el-row >
  29. <el-form ref="queryFormRef" :inline="false" :model="queryFrom" label-position="left" label-width="60px">
  30. <el-col :span="6">
  31. <el-form-item label="工号">
  32. <el-input size="small" clearable placeholder="请输入工号" v-model="queryFrom.userId"></el-input>
  33. </el-form-item>
  34. </el-col>
  35. <el-col :span="6">
  36. <el-form-item label="姓名">
  37. <el-input size="small" clearable placeholder="请输入姓名" v-model="queryFrom.name"></el-input>
  38. </el-form-item>
  39. </el-col>
  40. <el-col :span="6">
  41. <el-form-item label="手机号">
  42. <el-input size="small" clearable placeholder="请输入手机号" v-model="queryFrom.mobile"></el-input>
  43. </el-form-item>
  44. </el-col>
  45. <!-- <el-col :span="6">
  46. <el-form-item label="状态">
  47. <el-select size="small" clearable v-model="queryFrom.status" placeholder="请选择">
  48. <el-option v-for="val in user_statusoptions"
  49. :label="val.label"
  50. :value="val.value"
  51. :key="val.id">
  52. </el-option>
  53. </el-select>
  54. </el-form-item>
  55. </el-col> -->
  56. <el-col :span="6">
  57. <el-form-item label>
  58. <el-button size="small"
  59. type="primary"
  60. @click="queryStaffInfo">查询
  61. </el-button>
  62. <el-button size="small"
  63. type="default"
  64. @click="reset">重置
  65. </el-button>
  66. </el-form-item>
  67. </el-col>
  68. </el-form>
  69. </el-row>
  70. <el-row style="margin-bottom: 20px">
  71. <el-button size="small"
  72. type="primary"
  73. @click="BatchSettingsDialog">批量设置
  74. </el-button>
  75. <el-button size="small"
  76. type="primary"
  77. :disabled="selection.length == 0"
  78. @click="BatchCancellation">批量取消
  79. </el-button>
  80. </el-row>
  81. <kt-common-table ref="ktcommontable"
  82. :tableHeights="650"
  83. :data="pageResult"
  84. :columns="columns"
  85. :showBatchDelete="false"
  86. :select="true"
  87. :showOperation="false"
  88. :showDefaultPage="false"
  89. @findPage="queryList"
  90. @selectionChange="selectionChange">
  91. </kt-common-table>
  92. </div>
  93. </SplitArea>
  94. </Split>
  95. </el-main>
  96. <el-dialog :title="settingDialog.title" :visible.sync="settingDialog.visible"
  97. :close-on-press-escape="false" :modal="true"
  98. :show-close="false"
  99. custom-class="settingDialog"
  100. v-dialogDrag
  101. top="1vh">
  102. <el-row >
  103. <el-form ref="queryFormRef" :inline="false" :model="settingDialog.queryFrom" label-position="left" label-width="60px">
  104. <el-col :span="6">
  105. <el-form-item label="工号">
  106. <el-input size="small" clearable placeholder="请输入工号" v-model="settingDialog.queryFrom.userId"></el-input>
  107. </el-form-item>
  108. </el-col>
  109. <el-col :span="6">
  110. <el-form-item label="姓名">
  111. <el-input size="small" clearable placeholder="请输入姓名" v-model="settingDialog.queryFrom.name"></el-input>
  112. </el-form-item>
  113. </el-col>
  114. <el-col :span="6">
  115. <el-form-item label="手机号">
  116. <el-input size="small" clearable placeholder="请输入手机号" v-model="settingDialog.queryFrom.mobile"></el-input>
  117. </el-form-item>
  118. </el-col>
  119. <el-col :span="6">
  120. <el-form-item label>
  121. <el-button size="small"
  122. type="primary"
  123. @click="queryDialogList">查询
  124. </el-button>
  125. <el-button size="small"
  126. type="default"
  127. @click="resetDialog">重置
  128. </el-button>
  129. </el-form-item>
  130. </el-col>
  131. </el-form>
  132. </el-row>
  133. <kt-common-table ref="ktcommontable"
  134. :tableHeights="437"
  135. :data="settingDialog.pageResult"
  136. :columns="columns"
  137. :showBatchDelete="false"
  138. :select="true"
  139. :showOperation="false"
  140. @findPage="queryDialogList"
  141. @selectionChange="selectionDialogChange">
  142. </kt-common-table>
  143. <div class="footerHandle" style="text-align: right">
  144. <el-button
  145. size="small"
  146. style="border: 1px solid #D42426;
  147. color: #D42426;"
  148. class="closeBtn"
  149. @click="closeDialog"
  150. >取消</el-button
  151. >
  152. <el-button size="small" type="primary" :disabled="selectionDialog.length == 0" @click="BatchSettings"
  153. >确定</el-button
  154. >
  155. </div>
  156. </el-dialog>
  157. </div>
  158. </template>
  159. <script>
  160. import mixa from "../mixin";
  161. import KtCommonTable from "@/views/Core/KtCommonTable.vue"; //表格组件
  162. const mixin = new mixa({
  163. treeTypeNum: null
  164. });
  165. export default {
  166. name: 'setupManager',
  167. components: {
  168. KtCommonTable,
  169. },
  170. mixins: [mixin],
  171. watch: {
  172. filterText(val) {
  173. this.$refs.tree.filter(val);
  174. }
  175. },
  176. data(){
  177. return {
  178. treeData: [], //左侧树数据
  179. currentKey: '', //选中的左侧节点
  180. pageResult: {}, //表格数据
  181. columns: [ //表格列
  182. { prop: "deptId", label: "部门编码", minWidth: 80, sortable: false },
  183. { prop: "pdeptName", label: "机构名称", minWidth: 120, sortable: false },
  184. { prop: "deptName", label: "部门名称", minWidth: 80, sortable: false },
  185. { prop: "userId", label: "工号", minWidth: 80, sortable: false },
  186. { prop: "name", label: "姓名", minWidth: 120, sortable: false },
  187. // { prop: "sex", label: "性别", minWidth: 80, sortable: false, isSex: true },
  188. { prop: "mobile", label: "联系电话", minWidth: 100, sortable: false },
  189. // { prop: "roleId", label: "角色", minWidth: 80, sortable: false },
  190. // { prop: "submitTime", label: "提交时间", type: "text", minWidth: 100 },
  191. // { prop: "approveTime", label: "审核时间", type: "text", minWidth: 100 },
  192. { prop: "approveBy", label: "审核人", type: "text", minWidth: 100 },
  193. { prop: "leaderName", label: "管理人", type: "text", minWidth: 100 },
  194. // { prop: "status", label: "状态", minWidth: 120, sortable: false, isStatus: true },
  195. ],
  196. queryFrom: { //查询参数
  197. userId: "",
  198. name: "",
  199. mobile: "",
  200. status: "",
  201. roleId: "21",
  202. agentFlag: "1"
  203. },
  204. pageData: {
  205. pageNum: 1,
  206. pageSize: 20,
  207. totalSize: 0,
  208. },
  209. selection: [],
  210. selectionDialog: [],
  211. filterText: '',
  212. leaderName: '',
  213. settingDialog: {
  214. title: '设置管理人',
  215. visible: false,
  216. columns: [ //表格列
  217. { prop: "deptId", label: "部门编码", minWidth: 80, sortable: false },
  218. { prop: "pdeptName", label: "机构名称", minWidth: 120, sortable: false },
  219. { prop: "deptName", label: "部门名称", minWidth: 80, sortable: false },
  220. { prop: "userId", label: "工号", minWidth: 80, sortable: false },
  221. { prop: "name", label: "姓名", minWidth: 120, sortable: false },
  222. // { prop: "sex", label: "性别", minWidth: 80, sortable: false, isSex: true },
  223. { prop: "mobile", label: "联系电话", minWidth: 100, sortable: false },
  224. // { prop: "roleId", label: "角色", minWidth: 80, sortable: false },
  225. // { prop: "submitTime", label: "提交时间", type: "text", minWidth: 100 },
  226. // { prop: "approveTime", label: "审核时间", type: "text", minWidth: 100 },
  227. { prop: "approveBy", label: "审核人", type: "text", minWidth: 100 },
  228. // { prop: "leaderName", label: "管理人", type: "text", minWidth: 100 },
  229. // { prop: "status", label: "状态", minWidth: 120, sortable: false, isStatus: true },
  230. ],
  231. pageData: {
  232. pageNum: 1,
  233. pageSize: 20,
  234. totalSize: 0,
  235. },
  236. queryFrom: { //查询参数
  237. userId: "",
  238. name: "",
  239. mobile: "",
  240. status: "",
  241. roleId: "21",
  242. agentFlag: "1"
  243. },
  244. pageResult: {}, //表格数据
  245. }
  246. }
  247. },
  248. created(){
  249. this.$nextTick(() =>{
  250. this.searchLeaderFun();
  251. })
  252. },
  253. methods: {
  254. filterNode(value, data) {
  255. if (!value) return true;
  256. return data.name.indexOf(value) !== -1;
  257. },
  258. queryStaffInfo(){ //按搜索条件搜索右侧列表
  259. this.pageData = {
  260. pageNum: 1,
  261. pageSize: 20,
  262. totalSize: 0,
  263. }
  264. this.queryList(this.currentKey);
  265. },
  266. reset(){ //重置搜索条件
  267. this.queryFrom = { //查询参数
  268. userId: "",
  269. name: "",
  270. mobile: "",
  271. status: "",
  272. roleId: "21",
  273. agentFlag: "1"
  274. },
  275. this.pageData = {
  276. pageNum: 1,
  277. pageSize: 20,
  278. totalSize: 0,
  279. }
  280. this.queryList(this.currentKey);
  281. },
  282. resetDialog(){ //重置弹窗搜索
  283. this.settingDialog.queryFrom = { //查询参数
  284. userId: "",
  285. name: "",
  286. mobile: "",
  287. status: "",
  288. roleId: "21",
  289. agentFlag: "1"
  290. },
  291. this.settingDialog.pageData = {
  292. pageNum: 1,
  293. pageSize: 20,
  294. totalSize: 0,
  295. }
  296. this.queryDialogList();
  297. },
  298. searchLeaderFun(){ //查询左侧树
  299. this.$api.user.getManageList({
  300. roleId: "21",
  301. agentFlag: "1"
  302. }).then((res) => {
  303. this.treeData = res.data;
  304. if(this.treeData.length){
  305. this.currentKey = this.treeData[0].id;
  306. this.leaderName = this.treeData[0].name;
  307. this.queryList(this.currentKey);
  308. }
  309. }).catch(e =>{
  310. });
  311. },
  312. handleNodeClick(node){ //点击左侧树节点,查询右侧列表
  313. this.currentKey = node.id;
  314. this.pageData = {
  315. pageNum: 1,
  316. pageSize: 20,
  317. totalSize: 0,
  318. }
  319. this.queryList();
  320. },
  321. queryList(data){ //查询右侧人员列表
  322. // 获取分页数据
  323. if (data && data.pageRequest) {
  324. this.pageData.pageNum = data.pageRequest.pageNum;
  325. this.pageData.pageSize = data.pageRequest.pageSize;
  326. }
  327. this.queryFrom.leaderId = this.currentKey;
  328. this.$api.user.getManagePersonnel({
  329. ...this.pageData, dto: {...this.queryFrom}
  330. })
  331. .then((res) => {
  332. res.data.records.forEach((val) => {
  333. if (val.sex && val.sex !== "" && val.sex !== null) {
  334. val.sex = this.sexoptions.find(
  335. (ele) => ele.value == val.sex
  336. ).label;
  337. }
  338. if (val.status && val.status !== "" && val.status !== null) {
  339. val.status = this.user_statusoptions.find(
  340. (ele) => ele.value == val.status
  341. ).label;
  342. }
  343. val.roleId = val.roleName;
  344. });
  345. this.pageResult = { //表格组件参数
  346. content: res.data.records,
  347. pageNum: res.data.current,
  348. pageSize: res.data.size,
  349. totalPages: res.data.pages,
  350. totalSize: res.data.total,
  351. };
  352. // this.$nextTick(() => {
  353. // let arr = [];
  354. // res.data.records.forEach(item =>{
  355. // if(item.selectedNot){
  356. // arr.push(item);
  357. // }
  358. // })
  359. // this.$refs.ktcommontable.setDefaultSelections(arr);
  360. // });
  361. this.pageData.pageNum = res.data.current;
  362. this.pageData.pageSize = res.data.size;
  363. this.pageData.totalSize = res.data.total;
  364. });
  365. },
  366. selectionChange(data){ //批量取消表格勾选事件
  367. this.selection = data.selections;
  368. },
  369. selectionDialogChange(data){ //批量设置表格勾选事件
  370. this.selectionDialog = data.selections;
  371. },
  372. BatchSettingsDialog(){ //打开批量设置弹窗
  373. this.queryDialogList();
  374. this.settingDialog.visible = true;
  375. },
  376. closeDialog(){ //关闭设置管理人弹窗
  377. this.settingDialog.visible = false;
  378. },
  379. async queryDialogList(data){
  380. // 获取分页数据
  381. if (data && data.pageRequest) {
  382. this.settingDialog.pageData.pageNum = data.pageRequest.pageNum;
  383. this.settingDialog.pageData.pageSize = data.pageRequest.pageSize;
  384. }else{
  385. this.settingDialog.pageData = {
  386. pageNum: 1,
  387. pageSize: 20,
  388. totalSize: 0,
  389. }
  390. }
  391. this.settingDialog.queryFrom.notSelected = 0;
  392. await this.$api.user.getManagePersonnel({
  393. ...this.settingDialog.pageData, dto: {...this.settingDialog.queryFrom}
  394. })
  395. .then((res) => {
  396. res.data.records.forEach((val) => {
  397. if (val.sex && val.sex !== "" && val.sex !== null) {
  398. val.sex = this.sexoptions.find(
  399. (ele) => ele.value == val.sex
  400. ).label;
  401. }
  402. if (val.status && val.status !== "" && val.status !== null) {
  403. val.status = this.user_statusoptions.find(
  404. (ele) => ele.value == val.status
  405. ).label;
  406. }
  407. val.roleId = val.roleName;
  408. });
  409. this.settingDialog.pageResult = { //表格组件参数
  410. content: res.data.records,
  411. pageNum: res.data.current,
  412. pageSize: res.data.size,
  413. totalPages: res.data.pages,
  414. totalSize: res.data.total,
  415. };
  416. // this.$nextTick(() => {
  417. // let arr = [];
  418. // res.data.records.forEach(item =>{
  419. // if(item.selectedNot){
  420. // arr.push(item);
  421. // }
  422. // })
  423. // this.$refs.ktcommontable.setDefaultSelections(arr);
  424. // });
  425. this.settingDialog.pageData.pageNum = res.data.current;
  426. this.settingDialog.pageData.pageSize = res.data.size;
  427. this.settingDialog.pageData.totalSize = res.data.total;
  428. });
  429. },
  430. BatchSettings(){ //批量设置
  431. let arr = [];
  432. this.selectionDialog.forEach(item =>{
  433. arr.push(item.userId);
  434. })
  435. let data = {
  436. leaderId: this.currentKey,
  437. leaderName: this.leaderName,
  438. userIds: arr
  439. }
  440. this.$api.user.setManage(data).then(res =>{
  441. if(res.code == 200){
  442. this.$message({
  443. message: "设置成功",
  444. type: "success",
  445. });
  446. this.reset();
  447. this.settingDialog.visible = false;
  448. }else{
  449. this.$message.error(res.msg);
  450. }
  451. }).catch(e =>{
  452. console.log(e);
  453. })
  454. // console.log(this.selection);
  455. },
  456. BatchCancellation(){ //批量取消
  457. let arr = [];
  458. this.selection.forEach(item =>{
  459. arr.push(item.userId);
  460. })
  461. let data = {
  462. leaderId: this.currentKey,
  463. leaderName: this.leaderName,
  464. userIds: arr
  465. }
  466. console.log(data);
  467. this.$api.user.cancleManage(data).then(res =>{
  468. if(res.code == 200){
  469. this.$message({
  470. message: "设置成功",
  471. type: "success",
  472. });
  473. this.reset();
  474. this.selectionDialog.visible = false;
  475. }else{
  476. this.$message.error(res.msg);
  477. }
  478. }).catch(e =>{
  479. console.log(e);
  480. })
  481. },
  482. }
  483. }
  484. </script>
  485. <style lang="scss" scoped>
  486. .setupManager{
  487. width: 100%;
  488. height: 100%;
  489. position: relative;
  490. .container_left{
  491. height: 100%;
  492. // border-top: 1px solid #DCDFE6;
  493. padding-right: 10px;
  494. .search{
  495. padding-bottom: 15px;
  496. }
  497. .el-tree{
  498. height: calc(100% - 55px);
  499. overflow: auto;
  500. .el-tree-node__content{
  501. width: 100%;
  502. .custom-tree-node{
  503. width: 100%;
  504. display: flex;
  505. justify-content: space-between;
  506. padding-right: 20px;
  507. .totalNum{
  508. color: #999;
  509. }
  510. }
  511. }
  512. }
  513. }
  514. .container_right{
  515. padding: 20px;
  516. .el-form-item{
  517. display: flex;
  518. }
  519. >>>.el-form-item__content{
  520. margin: 0 !important;
  521. width: calc(100% - 70px);
  522. .el-input,.el-select{
  523. width: 100%;
  524. }
  525. }
  526. }
  527. .el-button{
  528. // width: 90px;
  529. // height: 36px;
  530. // font-size: 16px;
  531. // font-weight: 300 !important;
  532. }
  533. .el-button--default{
  534. &:hover{
  535. background: transparent;
  536. border: 1px solid #D42426;
  537. }
  538. &:focus{
  539. background: transparent;
  540. border: 1px solid #D42426;
  541. }
  542. }
  543. .el-dialog__wrapper{
  544. width: 100%;
  545. height: 100%;
  546. position: absolute;
  547. }
  548. >>>.settingDialog{
  549. width: calc(85%);
  550. // height: 100%;
  551. // position: absolute;
  552. // right: 0;
  553. // bottom: 0;
  554. // margin: 0;
  555. .el-dialog__header{
  556. height: 50px;
  557. line-height: 50px;
  558. padding: 0;
  559. text-align: center;
  560. border-top-left-radius: 6px;
  561. border-top-right-radius: 6px;
  562. .el-dialog__title{
  563. color: #333;
  564. font-weight: 500;
  565. }
  566. }
  567. .el-dialog__body{
  568. background: #fff;
  569. border-radius: 6px;
  570. padding-bottom: 0;
  571. height: 600px;
  572. .bottomFixed{
  573. position: absolute;
  574. bottom: -50px;
  575. }
  576. .el-col-6{
  577. padding-right: 10px;
  578. }
  579. .footerHandle{
  580. position: absolute;
  581. bottom: 20px;
  582. right: 20px;
  583. .el-button{
  584. width: 90px;
  585. height: 36px;
  586. font-size: 16px;
  587. margin-left: 24px;
  588. font-weight: 310;
  589. }
  590. }
  591. }
  592. }
  593. }
  594. </style>