index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840
  1. <template>
  2. <div class="user">
  3. <div class="tree">
  4. <div class="treeList">
  5. <div class="title commons-title">
  6. 组织架构
  7. </div>
  8. <div class="search">
  9. <el-input v-model="search" placeholder="请输入搜索内容" clearable @clear="search = ''" @keyup.enter="searchChange"></el-input>
  10. </div>
  11. <div class="box">
  12. <el-tree :data="treeData" ref="tree" node-key="deptId" @node-click="treeChange" default-expand-all :expand-on-click-node="false"
  13. :filter-node-method="filterNode">
  14. <template #default="{ node, data }">
  15. <div>{{data.deptName}}</div>
  16. </template>
  17. </el-tree>
  18. </div>
  19. </div>
  20. </div>
  21. <div class="content">
  22. <byTable :source="sourceList.data" :pagination="sourceList.pagination" :config="config" :loading="loading" highlight-current-row :action-list="[
  23. {
  24. text: '添加用户',
  25. action: () => openModal(),
  26. },
  27. ]" @get-list="getList">
  28. <template #deptName="{ item }">
  29. <div style="width: 100%">
  30. <span v-for="(name,index) in item.deptNameList" :key="index">
  31. {{name}}
  32. <span v-if="index < item.deptNameList.length-1">=></span>
  33. </span>
  34. </div>
  35. </template>
  36. </byTable>
  37. </div>
  38. <el-dialog :title="modalType == 'add' ? '添加用户' : '编辑用户'" v-if="dialogVisible" v-model="dialogVisible" width="650" v-loading="loadingDialog">
  39. <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit">
  40. <template #deptId>
  41. <div style="width: 100%">
  42. <el-tree-select v-model="formData.data.deptId" :data="deptList" check-strictly :render-after-expand="false" node-key="deptId"
  43. :props="defaultProps" style="width:100%" :disabled="modalType=='edit'" @change="handleDeptIdChange" />
  44. </div>
  45. </template>
  46. <template #account>
  47. <el-input style="width: 200px; margin-right: 10px" v-model="formData.data.userName" @change="changeUserName"
  48. placeholder="请输入用户名"></el-input>
  49. <el-input style="width: 200px; margin-right: 10px" v-model="formData.data.password" @change="changePassword" placeholder="密码"></el-input>
  50. <span style="color: #409eff; cursor: pointer" @click="newPassword">随机生成</span>
  51. </template>
  52. <template #purchaseScope>
  53. <div style="width:100%">
  54. <el-tree :data="productTreeData" show-checkbox node-key="id" :default-checked-keys="formData.data.purchaseRangeOne"
  55. :props="defaultPropsOne" ref="productTree">
  56. </el-tree>
  57. </div>
  58. </template>
  59. </byForm>
  60. <template #footer>
  61. <el-button @click="dialogVisible = false" size="default">取 消</el-button>
  62. <el-button type="primary" @click="submitForm()" size="default">确 定</el-button>
  63. </template>
  64. </el-dialog>
  65. <el-dialog title="修改密码" v-if="roomDialogVisible" v-model="roomDialogVisible" width="500" v-loading="loading">
  66. <div>
  67. <el-input v-model="password" placeholder="请输入新密码" @change="changePassword2" />
  68. </div>
  69. <template #footer>
  70. <el-button @click="roomDialogVisible = false" size="default">取 消</el-button>
  71. <el-button type="primary" @click="submitPassword(password)" size="default" :loading="submitLoading">确 定</el-button>
  72. </template>
  73. </el-dialog>
  74. </div>
  75. </template>
  76. <script setup>
  77. import { computed, ref } from "vue";
  78. import byTable from "@/components/byTable/index";
  79. import { ElMessage, ElMessageBox } from "element-plus";
  80. import byForm from "@/components/byForm/index";
  81. import useUserStore from "@/store/modules/user";
  82. const { proxy } = getCurrentInstance();
  83. const defaultProps = {
  84. children: "children",
  85. label: "deptName",
  86. disabled: "disabled",
  87. };
  88. const defaultPropsOne = {
  89. children: "children",
  90. label: "name",
  91. };
  92. const deptList = ref([]);
  93. const sourceList = ref({
  94. data: [],
  95. pagination: {
  96. total: 0,
  97. pageNum: 1,
  98. pageSize: 10,
  99. keyword: "",
  100. tenantId: proxy.useUserStore().user.tenantId,
  101. deptId: "",
  102. },
  103. });
  104. const loading = ref(false);
  105. const config = computed(() => {
  106. return [
  107. {
  108. attrs: {
  109. label: "部门",
  110. prop: "deptName",
  111. slot: "deptName",
  112. "min-width": 150,
  113. },
  114. },
  115. {
  116. attrs: {
  117. label: "姓名",
  118. prop: "nickName",
  119. align: "left",
  120. width: 120,
  121. },
  122. },
  123. // {
  124. // attrs: {
  125. // label: "英文名",
  126. // prop: "nickNameEn",
  127. // align: "left",
  128. // width: 150,
  129. // },
  130. // },
  131. {
  132. attrs: {
  133. label: "用户名",
  134. prop: "userName",
  135. width: 120,
  136. },
  137. },
  138. {
  139. attrs: {
  140. label: "系统用户",
  141. prop: "userType",
  142. width: 100,
  143. },
  144. render(userType) {
  145. return userType == 1 ? "是" : "否";
  146. },
  147. },
  148. {
  149. attrs: {
  150. label: "手机号",
  151. prop: "phonenumber",
  152. width: 180,
  153. },
  154. },
  155. {
  156. attrs: {
  157. label: "工号",
  158. prop: "jobNumber",
  159. width: 120,
  160. },
  161. },
  162. {
  163. attrs: {
  164. label: "操作",
  165. width: "180",
  166. align: "center",
  167. },
  168. renderHTML(row) {
  169. return [
  170. {
  171. attrs: {
  172. label: "修改密码",
  173. type: "primary",
  174. text: true,
  175. },
  176. el: "button",
  177. click() {
  178. userId.value = row.userId;
  179. password.value = "";
  180. roomDialogVisible.value = true;
  181. },
  182. },
  183. {
  184. attrs: {
  185. label: "修改",
  186. type: "primary",
  187. text: true,
  188. },
  189. el: "button",
  190. click() {
  191. getDtl(row);
  192. },
  193. },
  194. {
  195. attrs: {
  196. label: "删除",
  197. type: "danger",
  198. text: true,
  199. },
  200. el: "button",
  201. click() {
  202. ElMessageBox.confirm(
  203. "此操作将永久删除该数据, 是否继续?",
  204. "提示",
  205. {
  206. confirmButtonText: "确定",
  207. cancelButtonText: "取消",
  208. type: "warning",
  209. }
  210. ).then(() => {
  211. proxy
  212. .post(
  213. "/tenantUser/" + row.userId,
  214. {
  215. id: row.userId,
  216. },
  217. "delete"
  218. )
  219. .then(() => {
  220. ElMessage({
  221. message: "删除成功",
  222. type: "success",
  223. });
  224. getList();
  225. });
  226. });
  227. },
  228. },
  229. ];
  230. },
  231. },
  232. ];
  233. });
  234. const getList = async (req) => {
  235. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  236. loading.value = true;
  237. proxy.get("/tenantUser/list", sourceList.value.pagination).then((res) => {
  238. res.rows.map((item) => {
  239. item.deptName = item.dept ? item.dept.deptName : item.dept;
  240. });
  241. sourceList.value.data = res.rows;
  242. sourceList.value.pagination.total = res.total;
  243. setTimeout(() => {
  244. loading.value = false;
  245. }, 200);
  246. });
  247. };
  248. getList();
  249. const modalType = ref("add");
  250. const dialogVisible = ref(false);
  251. const loadingDialog = ref(false);
  252. const roleData = ref([]);
  253. const productTree = ref(null);
  254. const productTreeData = ref([]);
  255. const companyData = ref([]);
  256. const submit = ref(null);
  257. const isShowPurchaseAtt = ref(false);
  258. const formOption = reactive({
  259. inline: true,
  260. labelWidth: 100,
  261. itemWidth: 100,
  262. rules: [],
  263. });
  264. const formData = reactive({
  265. data: {},
  266. });
  267. const formConfig = computed(() => {
  268. return [
  269. {
  270. type: "slot",
  271. prop: "deptId",
  272. slotName: "deptId",
  273. label: "部门名称",
  274. },
  275. {
  276. type: "input",
  277. prop: "nickName",
  278. label: "姓名",
  279. // itemWidth:50
  280. },
  281. {
  282. type: "input",
  283. prop: "nickNameEn",
  284. label: "英文名",
  285. },
  286. {
  287. type: "slot",
  288. prop: "userName",
  289. slotName: "account",
  290. label: "账户信息",
  291. },
  292. {
  293. type: "radio",
  294. prop: "userType",
  295. label: "系统用户",
  296. required: true,
  297. disabled: true,
  298. border: true,
  299. data: [
  300. {
  301. label: "是",
  302. id: 1,
  303. },
  304. {
  305. label: "否",
  306. id: 0,
  307. },
  308. ],
  309. },
  310. {
  311. type: "select",
  312. label: "角色",
  313. prop: "roleIds",
  314. multiple: true,
  315. data: roleData.value,
  316. fn: (val) => {
  317. changeRoleId(val);
  318. },
  319. },
  320. {
  321. type: "input",
  322. prop: "phonenumber",
  323. label: "手机号",
  324. required: true,
  325. itemWidth: 100,
  326. itemType: "text",
  327. },
  328. {
  329. type: "input",
  330. prop: "jobNumber",
  331. label: "工号",
  332. required: true,
  333. itemWidth: 100,
  334. itemType: "text",
  335. },
  336. {
  337. type: "select",
  338. label: "关联公司",
  339. prop: "companySet",
  340. multiple: true,
  341. clearable: false,
  342. data: companyData.value,
  343. },
  344. {
  345. type: "select",
  346. label: "身份",
  347. prop: "identity",
  348. multiple: false,
  349. data: [
  350. {
  351. label: "职员",
  352. value: 10,
  353. },
  354. {
  355. label: "股东",
  356. value: 20,
  357. },
  358. ],
  359. },
  360. {
  361. type: "input",
  362. prop: "accountBank",
  363. label: "开户行",
  364. placeholder: "请输入开户行",
  365. itemWidth: 100,
  366. },
  367. {
  368. type: "input",
  369. prop: "accountName",
  370. label: "开户名",
  371. placeholder: "请输入开户名",
  372. itemWidth: 100,
  373. },
  374. {
  375. type: "input",
  376. prop: "accountNumber",
  377. label: "账号",
  378. placeholder: "请输入账号",
  379. itemWidth: 100,
  380. },
  381. {
  382. type: "slot",
  383. slotName: "purchaseScope",
  384. label: "采购范围",
  385. // placeholder: "请输入账号",
  386. itemWidth: 100,
  387. isShow: isShowPurchaseAtt.value,
  388. },
  389. ];
  390. });
  391. const rules = ref({
  392. deptId: [{ required: true, message: "请选择部门名称", trigger: "change" }],
  393. nickName: [{ required: true, message: "请输入姓名", trigger: "blur" }],
  394. userName: [{ required: true, message: "请输入用户名", trigger: "blur" }],
  395. roleIds: [{ required: true, message: "请选择角色", trigger: "change" }],
  396. phonenumber: [{ required: true, message: "请输入手机号", trigger: "blur" }],
  397. companySet: [
  398. { required: true, message: "请选择关联公司", trigger: "change" },
  399. ],
  400. identity: [{ required: true, message: "请选择身份", trigger: "change" }],
  401. });
  402. const changeRoleId = (val) => {
  403. if (val && val.length > 0) {
  404. for (let i = 0; i < roleData.value.length; i++) {
  405. const role = roleData.value[i];
  406. for (let j = 0; j < val.length; j++) {
  407. const roleId = val[j];
  408. if (role.id == roleId) {
  409. if (role.label.indexOf("采购") != -1) {
  410. isShowPurchaseAtt.value = true;
  411. return;
  412. }
  413. }
  414. }
  415. }
  416. isShowPurchaseAtt.value = false;
  417. } else {
  418. isShowPurchaseAtt.value = false;
  419. }
  420. };
  421. const arrayRecursion = (arr, definition) => {
  422. arr.forEach((item) => {
  423. item.definition = definition;
  424. if (item.children && item.children.length > 0) {
  425. arrayRecursion(item.children, definition);
  426. }
  427. });
  428. return arr;
  429. };
  430. const allData = ref([]);
  431. const getSubset = (list, data) => {
  432. for (let i = 0; i < list.length; i++) {
  433. if (list[i].children && list[i].children.length > 0) {
  434. getSubset(list[i].children, data);
  435. } else {
  436. data.push(list[i].id);
  437. }
  438. }
  439. return data;
  440. };
  441. const getUserList = () => {
  442. proxy
  443. .get(
  444. `/tenantRole/list?pageNum=1&pageSize=10000&tenantId=${sourceList.value.pagination.tenantId}`
  445. )
  446. .then((message) => {
  447. roleData.value = message.rows.map((item) => {
  448. return {
  449. ...item,
  450. id: item.roleId,
  451. label: item.roleName,
  452. };
  453. });
  454. });
  455. proxy
  456. .get("/tenantDept/list", {
  457. pageNum: 1,
  458. pageSize: 9999,
  459. keyword: "",
  460. tenantId: proxy.useUserStore().user.tenantId,
  461. type: 0,
  462. })
  463. .then((res) => {
  464. companyData.value = res.data.map((x) => ({
  465. ...x,
  466. label: x.deptName,
  467. value: x.deptId,
  468. }));
  469. });
  470. Promise.all([
  471. proxy.post("/productClassify/tree", {
  472. parentId: "",
  473. name: "",
  474. definition: "1",
  475. }),
  476. proxy.post("/productClassify/tree", {
  477. parentId: "",
  478. name: "",
  479. definition: "2",
  480. }),
  481. ]).then((res) => {
  482. if (res && res.length > 1) {
  483. res[1].forEach((x) => {
  484. x.id = x.id + "";
  485. });
  486. productTreeData.value = [
  487. {
  488. id: "-999",
  489. name: "全部",
  490. parentId: "",
  491. children: [
  492. {
  493. id: "-9",
  494. definition: "2",
  495. name: "物料",
  496. parentId: "-999",
  497. children: arrayRecursion(res[1], "2"),
  498. },
  499. {
  500. id: "-99",
  501. definition: "1",
  502. name: "产品",
  503. parentId: "-999",
  504. children: arrayRecursion(res[0], "1"),
  505. },
  506. ],
  507. },
  508. ];
  509. allData.value = getSubset(productTreeData.value, []);
  510. }
  511. });
  512. };
  513. getUserList();
  514. const openModal = () => {
  515. modalType.value = "add";
  516. formData.data = {
  517. userType: 1,
  518. tenantId: proxy.useUserStore().user.tenantId,
  519. companySet: [],
  520. purchaseRange: [],
  521. purchaseRangeOne: [],
  522. identity: 10,
  523. };
  524. loadingDialog.value = false;
  525. dialogVisible.value = true;
  526. };
  527. function findNodeById(treeData, nodeId) {
  528. // 遍历当前层级的所有节点
  529. for (let i = 0; i < treeData.length; i++) {
  530. let node = treeData[i];
  531. // 如果当前节点的 ID 匹配目标节点的 ID,则返回当前节点
  532. if (node.deptId === nodeId) {
  533. return node;
  534. }
  535. // 如果当前节点有子节点,则递归调用当前函数继续查找子节点
  536. if (node.children && node.children.length > 0) {
  537. let foundNode = findNodeById(node.children, nodeId);
  538. // 如果在子节点中找到了目标节点,则返回找到的节点
  539. if (foundNode) {
  540. return foundNode;
  541. }
  542. }
  543. }
  544. // 如果遍历完所有节点仍未找到目标节点,则返回 null
  545. return null;
  546. }
  547. const findCompanyType = (val) => {
  548. const current = findNodeById(deptList.value, val);
  549. if (current && current.type == 0) {
  550. formData.data.companySet = [val];
  551. companyData.value = companyData.value.map((x) => ({
  552. ...x,
  553. disabled: val == x.value,
  554. }));
  555. } else {
  556. return findCompanyType(current.parentId);
  557. }
  558. };
  559. const handleDeptIdChange = (val) => {
  560. const current = findNodeById(deptList.value, val);
  561. if (current && current.type == 0) {
  562. formData.data.companySet = [val];
  563. companyData.value = companyData.value.map((x) => ({
  564. ...x,
  565. disabled: val == x.value,
  566. }));
  567. } else {
  568. findCompanyType(current.parentId);
  569. }
  570. };
  571. const noRepeat = (arr) => {
  572. var newArr = [...new Set(arr)];
  573. return newArr;
  574. };
  575. const submitForm = () => {
  576. submit.value.handleSubmit(() => {
  577. if (formData.data.password && formData.data.password.length < 5) {
  578. return ElMessage("密码长度不得低于五位");
  579. }
  580. const method = modalType.value == "add" ? "POST" : "PUT";
  581. if (formData.data.companySet && formData.data.companySet.length > 0) {
  582. formData.data.companySet = formData.data.companySet.join(",");
  583. }
  584. if (isShowPurchaseAtt.value) {
  585. let data = noRepeat(
  586. productTree.value
  587. .getHalfCheckedKeys()
  588. .concat(productTree.value.getCheckedKeys())
  589. );
  590. data = data.filter((x) => !["-999", "-99", "-9"].includes(x));
  591. formData.data.purchaseRange = data.join(",");
  592. } else {
  593. formData.data.purchaseRange = "";
  594. }
  595. proxy.post("/tenantUser", formData.data, method).then(() => {
  596. if (formData.data.password && formData.data.userId) {
  597. proxy
  598. .post(
  599. "/tenantUser/resetPwd",
  600. { password: formData.data.password, userId: formData.data.userId },
  601. "PUT"
  602. )
  603. .then();
  604. }
  605. ElMessage({
  606. message: modalType.value == "add" ? "添加成功" : "编辑成功",
  607. type: "success",
  608. });
  609. // 更新业务公司数据
  610. proxy
  611. .post("/tenantUser/getUserCompanyList", {
  612. pageNum: 1,
  613. pageSize: 9999,
  614. })
  615. .then((res) => {
  616. proxy.useUserStore().allDict["list_company_data"] = res.map((x) => ({
  617. ...x,
  618. label: x.deptName,
  619. value: x.deptId,
  620. }));
  621. proxy.useUserStore().allDict["tree_company_data"] = proxy.handleTree(
  622. res,
  623. "deptId"
  624. );
  625. });
  626. dialogVisible.value = false;
  627. getList();
  628. });
  629. });
  630. };
  631. const getDtl = (row) => {
  632. companyData.value = companyData.value.map((x) => ({
  633. ...x,
  634. disabled: row.companyId == x.value,
  635. }));
  636. dialogVisible.value = true;
  637. proxy.get(`/tenantUser/${row.userId}`).then((res) => {
  638. formData.data = { ...row, userType: 1, roleIds: res.roleIds };
  639. if (res.data && res.data.purchaseRange) {
  640. formData.data.purchaseRange = [];
  641. formData.data.purchaseRangeOne = res.data.purchaseRange.split(",");
  642. formData.data.purchaseRangeOne = formData.data.purchaseRangeOne.filter(
  643. (item) => {
  644. return allData.value.some((i) => item == i);
  645. }
  646. );
  647. } else {
  648. formData.data.purchaseRangeOne = [];
  649. }
  650. changeRoleId(res.roleIds);
  651. let companySetData = formData.data.companySet
  652. ? formData.data.companySet
  653. : "";
  654. if (companySetData) {
  655. formData.data.companySet = [
  656. ...new Set((row.companyId + "," + companySetData).split(",")),
  657. ];
  658. } else {
  659. formData.data.companySet = row.companyId.split(",");
  660. }
  661. modalType.value = "edit";
  662. });
  663. };
  664. const newPassword = () => {
  665. formData.data.password = generatePassword();
  666. };
  667. const generatePassword = () => {
  668. var length = 12,
  669. charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",
  670. password = "";
  671. for (var i = 0, n = charset.length; i < length; ++i) {
  672. password += charset.charAt(Math.floor(Math.random() * n));
  673. }
  674. return password;
  675. };
  676. const userId = ref("");
  677. const password = ref("");
  678. const roomDialogVisible = ref(false);
  679. const submitPassword = (password1) => {
  680. if (!password1) {
  681. ElMessage({
  682. message: "请输入新密码",
  683. type: "warning",
  684. });
  685. return;
  686. }
  687. if (password1.length < 5) {
  688. return ElMessage("密码长度不得低于五位");
  689. }
  690. proxy
  691. .post(
  692. "/tenantUser/resetPwd",
  693. {
  694. password: password1,
  695. userId: userId.value,
  696. },
  697. "PUT"
  698. )
  699. .then(() => {
  700. ElMessage({
  701. message: "重置成功",
  702. type: "success",
  703. });
  704. roomDialogVisible.value = false;
  705. password.value = "";
  706. });
  707. };
  708. const changeUserName = (val) => {
  709. formData.data.userName = val.trim();
  710. };
  711. const changePassword = (val) => {
  712. formData.data.password = val.trim();
  713. };
  714. const changePassword2 = (val) => {
  715. password.value = val.trim();
  716. };
  717. const treeData = ref([]);
  718. const search = ref("");
  719. const getTreeData = () => {
  720. proxy
  721. .get("/tenantDept/list", {
  722. pageNum: 1,
  723. pageSize: 9999,
  724. keyword: "",
  725. tenantId: proxy.useUserStore().user.tenantId,
  726. })
  727. .then((res) => {
  728. // treeData.value = [
  729. // {
  730. // deptName: "全部",
  731. // deptId: "0",
  732. // children: proxy.handleTree(res.data, "deptId"),
  733. // },
  734. // ];
  735. for (let i = 0; i < res.data.length; i++) {
  736. if (res.data[i] && res.data[i].type == 0) {
  737. res.data[i].disabled = true;
  738. }
  739. }
  740. treeData.value = proxy.handleTree(res.data, "deptId");
  741. deptList.value = proxy.handleTree(res.data, "deptId");
  742. });
  743. };
  744. getTreeData();
  745. const searchChange = () => {
  746. proxy.$refs.tree.filter(search.value);
  747. };
  748. const getParents = (node, name, key) => {
  749. if (node.parent && node.parent.data[key]) {
  750. name += node.parent.data[key];
  751. return getParents(node.parent, name, key);
  752. }
  753. return name;
  754. };
  755. // 以下可实现搜索显示子节点
  756. const filterNode = (value, data, node) => {
  757. let names = getParents(node, node.data.deptName, "deptName");
  758. let isName = names.indexOf(value) !== -1;
  759. return !value || isName ? true : false;
  760. };
  761. const treeChange = (e, data) => {
  762. sourceList.value.pagination.deptId = e.deptId;
  763. getList();
  764. };
  765. </script>
  766. <style lang="scss" scoped>
  767. .user {
  768. padding: 10px;
  769. display: flex;
  770. justify-content: space-between;
  771. .tree {
  772. width: 300px;
  773. }
  774. .content {
  775. width: calc(100% - 310px);
  776. }
  777. }
  778. .treeList {
  779. display: block;
  780. height: 100%;
  781. background: #fff;
  782. padding: 10px 15px 15px;
  783. height: calc(100vh - 122px);
  784. .search {
  785. display: flex;
  786. margin-bottom: 20px;
  787. .el-input {
  788. // width: calc(100% - 70px);
  789. margin-right: 10px;
  790. text-align: center;
  791. }
  792. }
  793. // .searh,.title,.box{
  794. // padding-left:20px ;
  795. // }
  796. .box {
  797. padding-right: 0px;
  798. height: calc(100vh - 245px);
  799. overflow-y: auto;
  800. overflow-x: auto;
  801. .el-tree {
  802. // .el-tree-node__content {
  803. // display: block;
  804. // }
  805. .el-tree-node > .el-tree-node__children {
  806. overflow: visible;
  807. }
  808. }
  809. }
  810. }
  811. </style>