workDeptThree.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <div class="treebox" v-loading="loading" style="height: 30rem">
  3. <el-checkbox-group v-model="userList">
  4. <div v-for="(item, index) in treeList" :key="index">
  5. <el-checkbox :label="item" @change="checkChange(item)">{{
  6. item.loginNameStr
  7. }}</el-checkbox>
  8. </div>
  9. </el-checkbox-group>
  10. <!-- <el-input placeholder="输入关键字进行过滤" v-model="filterText"></el-input> -->
  11. <!-- <el-tree-->
  12. <!-- :highlight-current="true"-->
  13. <!-- :check-strictly="true"-->
  14. <!-- ref="tree"-->
  15. <!-- @check-change="handleCheckChange"-->
  16. <!-- :data="treeList"-->
  17. <!-- node-key="id"-->
  18. <!-- :default-checked-keys="defaultListc"-->
  19. <!-- :default-expanded-keys="defaultListc"-->
  20. <!-- @node-click="handleNodeClick"-->
  21. <!-- :filter-node-method="filterNode"-->
  22. <!-- >-->
  23. <!-- <span class="custom-tree-node" slot-scope="{ node }" @click="cs(node)">-->
  24. <!-- <em-->
  25. <!-- style="display: inline-block; width: 20px"-->
  26. <!-- v-if="node.data.haveUserFlag == 'N' && node.data.children.length == 0"-->
  27. <!-- ></em>-->
  28. <!-- <i-->
  29. <!-- class="el-icon-caret-right"-->
  30. <!-- v-if="node.data.haveUserFlag == 'Y' && node.data.children.length == 0"-->
  31. <!-- ></i>-->
  32. <!-- <el-checkbox-->
  33. <!-- style="margin-right: 10px"-->
  34. <!-- v-model="node.checked"-->
  35. <!-- v-if="node.data.type == 1"-->
  36. <!-- ></el-checkbox>-->
  37. <!-- <span>{{ node.label }}</span>-->
  38. <!-- </span>-->
  39. <!-- </el-tree>-->
  40. </div>
  41. </template>
  42. <script>
  43. export default {
  44. props: ["defaultList", "type", "closeList", "treeList"],
  45. data() {
  46. return {
  47. userList: [],
  48. // treeList: [],
  49. opt: [],
  50. defaultProps: {
  51. children: "children",
  52. label: "label",
  53. },
  54. defaultListc: [],
  55. loading: false,
  56. filterText: "",
  57. list: [],
  58. };
  59. },
  60. // watch: {
  61. // immediate: true,
  62. // treeList: {
  63. // handler(oldVal,newVal) {
  64. // console.log(oldVal);
  65. // console.log(newVal);
  66. // },
  67. // },
  68. // },
  69. methods: {
  70. checkChange(e) {
  71. // console.log(this.userList)
  72. // let newList = []
  73. // this.userList.map((item) =>{
  74. // let array = {
  75. // userid:item,
  76. // taskid:e.id_,
  77. // nextid:e.id
  78. // }
  79. // newList.push(array)
  80. // // newList.map((items,i) =>{
  81. // // if(item !== items.userid){
  82. // // newList.splice(i,1)
  83. // // }
  84. // // })
  85. //
  86. // })
  87. // this.list = newList
  88. // this.userList.map((item) =>{
  89. // newList.map((items,i) =>{
  90. // if(item !==items.id){
  91. // newList.splice(i,1)
  92. // }
  93. // })
  94. // })
  95. // console.log(newList)
  96. this.$emit("changeTree", this.userList);
  97. this.$emit("changeUserName", e);
  98. },
  99. },
  100. };
  101. // filterNode(value, data) {
  102. // if (!value) return true;
  103. // return data.label.indexOf(value) !== -1;
  104. // },
  105. // cs(v) {
  106. // // console.log(v)
  107. // },
  108. // getTree(v) {
  109. // this.loading = true;
  110. // this.$http({
  111. // url: "/sysmgr/csysdept/queryAllList",
  112. // method: "post",
  113. // headers: {
  114. // "Content-Type": "application/json",
  115. // },
  116. // data: {
  117. // parentorgid: '00440089000000000000',
  118. // },
  119. // }).then((res) => {
  120. // console.log(res);
  121. // // this.treeList = res.data;
  122. // // this.loading = false;
  123. // });
  124. // },
  125. // handleCheckChange(v) {
  126. // let opt = [];
  127. // let list = this.$refs.tree.getCheckedNodes();
  128. // for (let i = 0; i < list.length; i++) {
  129. // if (list[i].type == 1) {
  130. // opt.push({
  131. // receiveNo: list[i].loginNoStr,
  132. // receiveName: list[i].label,
  133. // deptName: list[i].displayname,
  134. // deptCode: list[i].groupId,
  135. // id: list[i].id,
  136. // type: list[i].type,
  137. // label: list[i].label,
  138. // });
  139. // }
  140. // }
  141. // this.$emit("treeCheck", opt);
  142. // },
  143. // handleNodeClick(v) {
  144. // console.log(v);
  145. // let s = false;
  146. // if (v.children && v.children.length == 0) {
  147. // s = true;
  148. // }
  149. // if (v.type) {
  150. // return;
  151. // }
  152. // if (
  153. // v.children &&
  154. // v.children.length > 0 &&
  155. // v.children[v.children.length - 1].type == 1
  156. // ) {
  157. // return;
  158. // }
  159. // this.$http({
  160. // url: "/sysmgr/sysuserinfo/queryList",
  161. // method: "post",
  162. // headers: {
  163. // "Content-Type": "application/json",
  164. // },
  165. // data: {
  166. // groupId: v.o,
  167. // },
  168. // }).then((res) => {
  169. // res.data.forEach((item) => {
  170. // v.children.push({
  171. // id: item.id,
  172. // label: item.loginNameStr,
  173. // type: 1,
  174. // displayname: v.displayname,
  175. // groupId: item.groupId,
  176. // loginNoStr: item.loginNoStr,
  177. // });
  178. // });
  179. // });
  180. // for (let i = 0; i < this.$refs.tree.store._getAllNodes().length; i++) {
  181. // if (s && v.o == this.$refs.tree.store._getAllNodes()[i].data.o) {
  182. // this.$refs.tree.store._getAllNodes()[i].expanded = true;
  183. // return;
  184. // }
  185. // }
  186. // },
  187. // },
  188. // created() {
  189. // console.log(this.treeList);
  190. // // this.getTree();
  191. // this.defaultListc = this.defaultList;
  192. // },
  193. // watch: {
  194. // filterText(val) {
  195. // this.$refs.tree.filter(val);
  196. // },
  197. // type() {
  198. // this.defaultListc = this.defaultList;
  199. // this.$forceUpdate();
  200. // },
  201. // defaultList() {
  202. // this.$forceUpdate();
  203. // },
  204. // closeList() {
  205. // this.$refs.tree.setCheckedNodes(this.closeList);
  206. // },
  207. // },
  208. // };
  209. </script>
  210. <style scoped lang="scss">
  211. .el-icon-caret-right {
  212. color: #ccc;
  213. margin: 0 5px;
  214. }
  215. .treebox {
  216. border: 1px solid #ddd;
  217. }
  218. ::v-deep .el-checkbox-group {
  219. display: flex;
  220. flex-direction: column;
  221. align-items: baseline;
  222. /* font-size: 38px; */
  223. margin-left: 20px;
  224. }
  225. </style>