detail.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708
  1. <template>
  2. <transition name="fade-slide">
  3. <LjDetail
  4. name="custCrmDetail"
  5. v-show="ifShow"
  6. v-if="ifInit"
  7. ref="LjDetailRef"
  8. v-bind="detailProps"
  9. v-model:order-status="orderStatus"
  10. :data="mainData"
  11. :init-param="mainData[0]"
  12. :if-layout-editable="false"
  13. :if-basic-editable="false"
  14. :if-fold-layout="false"
  15. :search-col="{ xs: 2, sm: 2, md: 2, lg: 2, xl: 2 }"
  16. :basic-group-col="{ xs: 2, sm: 2, md: 2, lg: 2, xl: 2 }"
  17. :action="orderStatus ? orderEditAction : orderDefaultAction"
  18. >
  19. <template #baseSetting>
  20. <el-row class="w-full h-full basic-inner__body" :gutter="10">
  21. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="8" class="h-full overflow-auto">
  22. <div class="flx-col">
  23. <LjHeader class="flx-shrink" size="small" :title="$t('business.detail.syspwr')">
  24. <template #title>
  25. <div class="flx">
  26. <span>{{ $t("business.detail.syspwr") }}</span>
  27. <el-input
  28. ref="filterInputRef"
  29. v-model="filterText"
  30. class="flx-1 ml-12 mr-12"
  31. clearable
  32. title="支持拼音、首字母,检索名称、funcid"
  33. placeholder="支持拼音、首字母,检索名称、funcid"
  34. ></el-input>
  35. </div>
  36. <!-- <el-button :icon="!ifSearch ? Search : Close" circle @click.stop="searchCompany" /> -->
  37. </template>
  38. <template #toolButton>
  39. <el-checkbox v-model="ifAllFuncpwr" :indeterminate="isIndeterminate" @change="handleSelectAllFuncpwr">{{
  40. $t("common.table.selectAll")
  41. }}</el-checkbox>
  42. </template>
  43. </LjHeader>
  44. <div class="flx-1">
  45. <el-tree
  46. ref="sysFuncPwrTreeRef"
  47. :data="sysFuncPwrData"
  48. :props="defaultProps_sysfunc"
  49. show-checkbox
  50. node-key="funcid"
  51. default-expand-all
  52. :default-checked-keys="defaultCheckedKeys_sysfunc"
  53. :expand-on-click-node="false"
  54. check-on-click-node
  55. :filter-node-method="filterNode"
  56. @check-change="autoCheckSysFuncPwr"
  57. >
  58. </el-tree>
  59. </div>
  60. </div>
  61. </el-col>
  62. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="8" class="h-full overflow-auto">
  63. <LjHeader class="flx-1" size="small" :title="$t('business.detail.outrep')" />
  64. <!-- <el-tree
  65. ref="outrepRef"
  66. :data="userListData"
  67. :props="defaultProps_outrep"
  68. show-checkbox
  69. node-key="empid"
  70. default-expand-all
  71. :default-checked-keys="defaultCheckedKeys_outrep"
  72. :expand-on-click-node="false"
  73. check-on-click-node
  74. >
  75. </el-tree> -->
  76. <LjVxeTable
  77. ref="outrepRef"
  78. row-key="key"
  79. table-cls="flx-1"
  80. :data="userListData"
  81. :columns="columns_outrep"
  82. :table-props="tableProps"
  83. :tool-button="[]"
  84. :request-auto="false"
  85. >
  86. </LjVxeTable>
  87. </el-col>
  88. <el-col :xs="24" :sm="12" :md="8" :lg="8" :xl="8" class="h-full overflow-auto">
  89. <div class="flx-col h-full">
  90. <div class="flx-1 mb-12">
  91. <LjHeader size="small" :title="$t('business.detail.dept')" />
  92. <!-- <el-tree
  93. ref="deptRef"
  94. :data="deptData"
  95. :props="defaultProps_dept"
  96. show-checkbox
  97. node-key="deptid"
  98. default-expand-all
  99. :default-checked-keys="defaultCheckedKeys_dept"
  100. :expand-on-click-node="false"
  101. check-on-click-node
  102. >
  103. </el-tree> -->
  104. <LjVxeTable
  105. ref="deptRef"
  106. row-key="key"
  107. table-cls="flx-1"
  108. :data="deptData"
  109. :columns="columns_dept"
  110. :table-props="tableProps"
  111. :tool-button="[]"
  112. :request-auto="false"
  113. >
  114. </LjVxeTable>
  115. </div>
  116. <div class="flx-1">
  117. <LjHeader size="small" :title="$t('business.detail.priceList')" />
  118. <LjVxeTable
  119. ref="pricelistRef"
  120. row-key="key"
  121. table-cls=""
  122. :data="defaultCheckedKeys_pricelist"
  123. :columns="columns_pricelist"
  124. :table-props="tableProps"
  125. :table-events="tableEvents"
  126. :tool-button="[]"
  127. :request-auto="false"
  128. >
  129. <!-- <template #edit> 321 </template> -->
  130. </LjVxeTable>
  131. </div>
  132. </div>
  133. </el-col>
  134. </el-row>
  135. </template>
  136. </LjDetail></transition
  137. >
  138. </template>
  139. <script setup lang="tsx" name="userDetail">
  140. import { ref, watch, reactive, inject, nextTick, computed } from "vue";
  141. import { DwnameEnum } from "@/enums/dwnameEnum";
  142. import LjDetail from "@/components/LjDetail/index.vue";
  143. import { DetailProp } from "@/components/LjDetail/interface";
  144. import { useI18n } from "vue-i18n";
  145. import { useHooks } from "./hooks/index";
  146. import { useAuthButtons } from "@/hooks/useAuthButtons";
  147. import LjHeader from "@/components/LjHeader/index.vue";
  148. import LjVxeTable from "@/components/LjVxeTable/index.vue";
  149. import { cloneDeep } from "lodash-es";
  150. import { ElMessage, ElNotification } from "element-plus";
  151. import { saveUserList, delUserList } from "@/api/modules/basicinfo";
  152. // import { Search, Close } from "@element-plus/icons-vue";
  153. import { pinyinFilter } from "@/utils/pinyin";
  154. interface detailProp {
  155. /**
  156. * @argument any 页面数据
  157. */
  158. data?: any;
  159. /**
  160. * @argument string 请求数据的api ==> 非必传
  161. */
  162. requestApi?: (params: any) => Promise<any>;
  163. /**
  164. * @argument any 基础信息,表格展示数据
  165. */
  166. // columns?: any;
  167. /**
  168. * @description 是否可编辑
  169. */
  170. status: "edit" | "new" | string;
  171. }
  172. const props = withDefaults(defineProps<detailProp>(), {});
  173. const { t } = useI18n();
  174. const { columns, columns_pricelist, columns_dept, columns_outrep } = useHooks();
  175. const { CheckPower, CheckOption, buttonNew, buttonDefault } = useAuthButtons(t);
  176. const mainData = ref([{}]);
  177. const defaultCheckedKeys_sysfunc = ref([]);
  178. const defaultCheckedKeys_outrep = ref([]);
  179. const defaultCheckedKeys_dept = ref([]);
  180. const defaultCheckedKeys_pricelist = ref([]);
  181. const selected_pricelist_view = ref([]);
  182. const selected_pricelist_edit = ref([]);
  183. const ifShow = ref(true);
  184. const ifInit = ref(true);
  185. const ifAllFuncpwr = ref(true);
  186. const isIndeterminate = ref(false);
  187. const defaultProps_sysfunc = {
  188. children: "children",
  189. label: "menuname"
  190. };
  191. const defaultProps_outrep = {
  192. label: "username"
  193. };
  194. const defaultProps_dept = {
  195. label: "deptname"
  196. };
  197. const sysFuncPwrTreeRef = ref();
  198. const outrepRef = ref();
  199. const deptRef = ref();
  200. const pricelistRef = ref();
  201. const LjDetailRef = ref();
  202. const sysFuncPwrData = inject("sysFuncPwrData", ref([]));
  203. const deptData = inject("deptData", ref([]));
  204. const priceListData = inject("priceListData", ref([]));
  205. const userListData = inject("userListData", ref([]));
  206. const emit = defineEmits(["edit", "del", "cancel", "goto", "unlock"]);
  207. /**
  208. * @description 是否可编辑
  209. */
  210. const orderStatus = ref("");
  211. const orderDefaultAction = [
  212. buttonDefault({
  213. label: t("common.redo"),
  214. icon: "iconRefresh_light",
  215. clickFunc: () => {
  216. refresh(mainData.value[0]);
  217. ElMessage.success(t("sys.api.operationSuccess"));
  218. }
  219. }),
  220. buttonDefault({
  221. label: t("common.editText"),
  222. icon: "iconuser-edit",
  223. clickFunc: () => {
  224. if (!CheckPower(122)) {
  225. return "你没有【用户权限】的使用权限";
  226. }
  227. // refresh(mainData.value[0]);
  228. emit("edit", mainData.value[0]);
  229. }
  230. }),
  231. buttonDefault({
  232. label: t("common.delText"),
  233. icon: "iconwrong_light",
  234. clickFunc: () => {
  235. if (!CheckPower(122)) {
  236. return "你没有【用户权限】的使用权限";
  237. }
  238. emit("del", mainData.value[0]);
  239. }
  240. }),
  241. buttonDefault({
  242. label: "解锁",
  243. icon: "iconUnlock_light",
  244. clickFunc: () => {
  245. emit("unlock", mainData.value[0]);
  246. },
  247. limited: () => {
  248. return !mainData.value[0].isLocked;
  249. }
  250. })
  251. ];
  252. const orderEditAction = [
  253. buttonDefault({
  254. label: t("common.cancelText"),
  255. icon: "iconchevron-left",
  256. clickFunc: () => {
  257. emit("cancel");
  258. }
  259. }),
  260. buttonNew({
  261. label: t("common.saveText"),
  262. icon: "iconsave-01",
  263. clickFunc: async () => {
  264. let ls_rightstring = Array(1000).fill("0").join("");
  265. let ls_outrepstr = "-1";
  266. let ls_deptstr = "-1";
  267. let ls_pricelist_seestr = "-1";
  268. let ls_pricelist_editstr = "-1";
  269. /** 权限值 */
  270. let current: any = sysFuncPwrTreeRef.value.getCheckedKeys();
  271. current.forEach(index => {
  272. if (index > 0 && index <= 1000) {
  273. ls_rightstring = ls_rightstring.substring(0, index - 1) + "1" + ls_rightstring.substring(index);
  274. }
  275. });
  276. /** 业务员 */
  277. let ifAllOutrep = outrepRef.value.element.isAllCheckboxChecked();
  278. if (!ifAllOutrep) {
  279. let selected = outrepRef.value.element.getCheckboxRecords(true);
  280. let selectedName = selected.map((item: any) => item.username).join(",");
  281. if (selectedName.length > 0) {
  282. ls_outrepstr = "," + selectedName + ",";
  283. } else {
  284. ls_outrepstr = "0";
  285. }
  286. }
  287. /** 部门 */
  288. let ifAllDept = deptRef.value.element.isAllCheckboxChecked();
  289. if (!ifAllDept) {
  290. let selected = deptRef.value.element.getCheckboxRecords(true);
  291. let selectedName = selected.map((item: any) => item.deptid).join(",");
  292. if (selectedName.length > 0) {
  293. ls_deptstr = "," + selectedName + ",";
  294. } else {
  295. ls_deptstr = "0";
  296. }
  297. }
  298. console.log("ls_deptstr :>> ", ls_deptstr);
  299. /** 价格表 */
  300. console.log("defaultCheckedKeys_pricelist.value :>> ", defaultCheckedKeys_pricelist.value);
  301. let selected_view = defaultCheckedKeys_pricelist.value.filter(t => t.view);
  302. if (!selected_view.length) {
  303. ls_pricelist_seestr = "0";
  304. } else if (selected_view.length < defaultCheckedKeys_pricelist.value.length) {
  305. ls_pricelist_seestr = "," + selected_view.map(t => t.pricelistid).join(",") + ",";
  306. }
  307. let selected_edit = defaultCheckedKeys_pricelist.value.filter(t => t.edit);
  308. if (!selected_edit.length) {
  309. ls_pricelist_editstr = "0";
  310. } else if (selected_edit.length < defaultCheckedKeys_pricelist.value.length) {
  311. ls_pricelist_editstr = "," + selected_edit.map(t => t.pricelistid).join(",") + ",";
  312. }
  313. console.log("ls_pricelist_seestr :>> ", ls_pricelist_seestr);
  314. console.log("ls_pricelist_editstr :>> ", ls_pricelist_editstr);
  315. console.log("mainData.value :>> ", mainData.value);
  316. console.log("LjDetailRef :>> ", LjDetailRef.value.infoParam);
  317. let initParams = mainData.value[0].empid == 0 ? LjDetailRef.value.infoParam : mainData.value[0];
  318. console.log("initParams :>> ", initParams);
  319. let res = await saveUserList({
  320. userList: [
  321. {
  322. ...initParams,
  323. rightstring: ls_rightstring,
  324. outrepstr: ls_outrepstr,
  325. deptstr: ls_deptstr,
  326. pricelist_seestr: ls_pricelist_seestr,
  327. pricelist_editstr: ls_pricelist_editstr
  328. }
  329. ]
  330. });
  331. console.log("saveUserList res :>> ", res);
  332. if (res) {
  333. if (initParams.empid == 0) {
  334. ElNotification({
  335. title: t("sys.api.operationSuccess"),
  336. message: t("business.detail.successToAdd"),
  337. type: "success"
  338. });
  339. } else {
  340. ElNotification({
  341. title: t("sys.api.operationSuccess"),
  342. message: t("business.detail.successToEdit"),
  343. type: "success"
  344. });
  345. }
  346. emit("goto", res.empid);
  347. }
  348. }
  349. })
  350. ];
  351. const detailProps = reactive<DetailProp>({
  352. dwname: DwnameEnum.userlist,
  353. columns: columns,
  354. // detailApi: {
  355. // requestApi: getDetailData,
  356. // initParam: initParam.value
  357. // },
  358. header: {
  359. fieldNames: {
  360. code: "cuscode",
  361. codeLabel: t("table.u_cust.cuscode") + ":",
  362. name: "name"
  363. },
  364. icon: "iconuser-01",
  365. // icon: Close
  366. // icon: (params: any) => {
  367. // console.log("detailProps params :>> ", params);
  368. // return <i class={"iconfont iconclipboard-check"}></i>;
  369. // }
  370. tabsProp: {
  371. scrollspy: false,
  372. sticky: true
  373. }
  374. },
  375. mould: [
  376. {
  377. id: "baseSetting",
  378. type: "table",
  379. label: t("business.detail.basicSetting")
  380. }
  381. ]
  382. });
  383. /**
  384. * @description 提取出所有的 funcid
  385. * @param data
  386. */
  387. const extractFuncIds = (data: any) => {
  388. let funcIds = [];
  389. data.forEach(item => {
  390. // 添加当前项的 funcid
  391. funcIds.push(item.funcid);
  392. // 如果当前项有子项,则递归处理子项
  393. if (item.children && Array.isArray(item.children)) {
  394. funcIds = funcIds.concat(extractFuncIds(item.children));
  395. }
  396. });
  397. return funcIds;
  398. };
  399. const allFuncpwrid = computed(() => {
  400. return extractFuncIds(sysFuncPwrData.value);
  401. });
  402. const autoCheckSysFuncPwr = (data: any) => {
  403. let current: any = sysFuncPwrTreeRef.value.getCheckedKeys();
  404. ifAllFuncpwr.value = allFuncpwrid.value.length == current.length;
  405. isIndeterminate.value = current.length > 0 && allFuncpwrid.value.length > current.length;
  406. };
  407. const handleSelectAllFuncpwr = (val: boolean) => {
  408. defaultCheckedKeys_sysfunc.value = val ? allFuncpwrid.value : [];
  409. sysFuncPwrTreeRef.value.setCheckedKeys(defaultCheckedKeys_sysfunc.value, true);
  410. // ifAllFuncpwr.value = val;
  411. isIndeterminate.value = false;
  412. };
  413. const refresh = (val: any) => {
  414. mainData.value = [val];
  415. /* 权限值 */
  416. if (val.empid == 0 && val.userid) {
  417. defaultCheckedKeys_sysfunc.value = allFuncpwrid.value;
  418. } else {
  419. defaultCheckedKeys_sysfunc.value = val.rightstring
  420. .split("")
  421. .map((t, idx) => Number(t) > 0 && idx + 1)
  422. .filter(t => t);
  423. }
  424. ifAllFuncpwr.value = allFuncpwrid.value.length == defaultCheckedKeys_sysfunc.value.length;
  425. isIndeterminate.value =
  426. defaultCheckedKeys_sysfunc.value.length > 0 && allFuncpwrid.value.length > defaultCheckedKeys_sysfunc.value.length;
  427. sysFuncPwrTreeRef.value.setCheckedKeys(defaultCheckedKeys_sysfunc.value, true);
  428. /* 业务员 */
  429. // if (val.outrepstr == "-1") {
  430. // // -1: 全选
  431. // defaultCheckedKeys_outrep.value = userListData.value.map(t => t.empid);
  432. // } else if (val.outrepstr == "0") {
  433. // // 0: 全不选
  434. // defaultCheckedKeys_outrep.value = [];
  435. // } else {
  436. // // 部分选
  437. // let outrepArr = val.outrepstr.split(",").filter(t => t);
  438. // defaultCheckedKeys_outrep.value = userListData.value
  439. // .map(t => outrepArr.includes(t.username) && t)
  440. // .filter(t => t)
  441. // .map(t => t.empid);
  442. // }
  443. // outrepRef.value.setCheckedKeys(defaultCheckedKeys_outrep.value, true);
  444. console.log('val.outrepstr == "-1" :>> ', val.outrepstr == "-1");
  445. if (val.outrepstr == "-1") {
  446. // -1: 全选
  447. // defaultCheckedKeys_outrep.value = cloneDeep(userListData.value);
  448. defaultCheckedKeys_outrep.value = userListData.value.filter(t => t.username);
  449. } else if (val.outrepstr == "0") {
  450. // 0: 全不选
  451. defaultCheckedKeys_outrep.value = [];
  452. } else {
  453. // 部分选
  454. let outrepArr = val.outrepstr.split(",").filter(t => t);
  455. defaultCheckedKeys_outrep.value = userListData.value.map(t => outrepArr.includes(t.username) && t).filter(t => t);
  456. }
  457. outrepRef.value.element.clearCheckboxRow();
  458. outrepRef.value.element.setCheckboxRow(defaultCheckedKeys_outrep.value, true);
  459. /* 部门 */
  460. // if (val.deptstr == "-1") {
  461. // // -1: 全选
  462. // defaultCheckedKeys_dept.value = deptData.value.map(t => t.deptid);
  463. // } else if (val.deptstr == "0") {
  464. // // 0: 全不选
  465. // defaultCheckedKeys_dept.value = [];
  466. // } else {
  467. // // 部分选
  468. // defaultCheckedKeys_dept.value = val.deptstr
  469. // .split(",")
  470. // .filter(t => t)
  471. // .map(t => Number(t));
  472. // }
  473. // deptRef.value.setCheckedKeys(defaultCheckedKeys_dept.value, true);
  474. if (val.deptstr == "-1") {
  475. // -1: 全选
  476. defaultCheckedKeys_dept.value = deptData.value.filter(t => t.deptid);
  477. } else if (val.deptstr == "0") {
  478. // 0: 全不选
  479. defaultCheckedKeys_dept.value = [];
  480. } else {
  481. // 部分选
  482. let deptArr = val.deptstr
  483. .split(",")
  484. .filter(t => t)
  485. .map(t => Number(t));
  486. console.log("deptArr :>> ", deptArr);
  487. defaultCheckedKeys_dept.value = deptData.value.filter(t => deptArr.includes(t.deptid));
  488. }
  489. deptRef.value.element.clearCheckboxRow();
  490. deptRef.value.element.setCheckboxRow(defaultCheckedKeys_dept.value, true);
  491. /** 价格列表 */
  492. if (val.pricelist_seestr == "-1") {
  493. // -1: 全选
  494. selected_pricelist_view.value = priceListData.value.map(t => t.pricelistid);
  495. } else if (val.pricelist_seestr == "0") {
  496. // 0: 全不选
  497. selected_pricelist_view.value = [];
  498. } else {
  499. // 部分选
  500. let plArr = val.pricelist_seestr.split(",").filter(t => t);
  501. selected_pricelist_view.value = priceListData.value
  502. .map(t => plArr.includes(t.pricelistname) && t)
  503. .filter(t => t)
  504. .map(t => t.pricelistid);
  505. }
  506. if (val.pricelist_editstr == "-1") {
  507. // -1: 全选
  508. selected_pricelist_edit.value = priceListData.value.map(t => t.pricelistid);
  509. } else if (val.pricelist_editstr == "0") {
  510. // 0: 全不选
  511. selected_pricelist_edit.value = [];
  512. } else {
  513. // 部分选
  514. let plArr = val.pricelist_editstr.split(",").filter(t => t);
  515. selected_pricelist_edit.value = priceListData.value
  516. .map(t => plArr.includes(t.pricelistname) && t)
  517. .filter(t => t)
  518. .map(t => t.pricelistid);
  519. }
  520. defaultCheckedKeys_pricelist.value = cloneDeep(priceListData.value);
  521. defaultCheckedKeys_pricelist.value.map((item: any) => {
  522. item.view = selected_pricelist_view.value.includes(item.pricelistid);
  523. item.edit = selected_pricelist_edit.value.includes(item.pricelistid);
  524. return item;
  525. });
  526. };
  527. // watch(
  528. // () => props.data,
  529. // val => {
  530. // // ifInit.value = true;
  531. // // nextTick(() => {
  532. // // ifShow.value = true;
  533. // console.log("props.data, val :>> ", val);
  534. // mainData.value = [val];
  535. // nextTick(() => {
  536. // refresh(val);
  537. // });
  538. // // });
  539. // }
  540. // // { immediate: true }
  541. // );
  542. watch(
  543. () => props.status,
  544. val => {
  545. console.log("props.status val :>> ", val);
  546. if (val != orderStatus.value) {
  547. ifShow.value = false;
  548. setTimeout(() => {
  549. ifInit.value = false;
  550. orderStatus.value = val;
  551. tableProps.editConfig.enabled = orderStatus.value != "";
  552. setTimeout(() => {
  553. ifInit.value = true;
  554. nextTick(() => {
  555. ifShow.value = true;
  556. nextTick(() => {
  557. refresh(props.data);
  558. });
  559. });
  560. }, 100);
  561. }, 500);
  562. }
  563. },
  564. { immediate: true, deep: true }
  565. );
  566. const handleCheckboxChange = (data: any) => {
  567. console.log("handleCheckboxChange data :>> ", data);
  568. // selected_pricelist.value = data.records;
  569. };
  570. const tableProps = reactive({
  571. height: "",
  572. // minHeight: "300px",
  573. // maxHeight: "600px",
  574. // cellStyle: cellStyle,
  575. // headerCellStyle: headerCellStyle,
  576. editConfig: { trigger: "click", mode: "cell", enabled: orderStatus.value != "" },
  577. checkboxConfig: { trigger: "row" },
  578. keepSource: true
  579. // keyboardConfig: {
  580. // isChecked: true
  581. // }
  582. });
  583. const tableEvents = {
  584. "checkbox-change": handleCheckboxChange,
  585. "checkbox-range-change": handleCheckboxChange,
  586. "checkbox-all": handleCheckboxChange
  587. // "cell-dblclick": handleDBlClickTable,
  588. // "cell-click": handleClickTable,
  589. // "edit-closed": autoEditClosed
  590. };
  591. const ifSearch = ref(false);
  592. const filterText = ref();
  593. const filterInputRef = ref();
  594. // /**
  595. // * @description 搜索
  596. // */
  597. // const searchCompany = () => {
  598. // // if (!ifSearch.value) {
  599. // // ifSearch.value = true;
  600. // nextTick(() => {
  601. // filterInputRef.value.focus();
  602. // });
  603. // // } else {
  604. // // ifSearch.value = false;
  605. // // filterText.value = "";
  606. // // sysFuncPwrTreeRef.value!.filter("");
  607. // // }
  608. // };
  609. // 关键字,筛选
  610. watch(filterText, val => {
  611. sysFuncPwrTreeRef.value!.filter(val);
  612. });
  613. // 筛选钩子
  614. const filterNode = (value: string, data: any, node: any) => {
  615. if (!value) return true;
  616. return partentFilter(value, data, node);
  617. };
  618. /**
  619. * 拼音筛选,父级符合,其自己,孙集均符合
  620. * @param value keyword
  621. * @param data 当前层级数据
  622. * @param node 节点
  623. */
  624. const partentFilter = (value: string, data: any, node: any): boolean => {
  625. let arr = pinyinFilter(value, [data], ["treename", "menuname", "funcid"]);
  626. console.log("arr :>> ", arr);
  627. console.log("data :>> ", data);
  628. console.log("node.parent level :>> ", node.parent.level);
  629. if (arr.length > 0) {
  630. return true;
  631. } else if (node.parent.level > 0) {
  632. return partentFilter(value, node.parent.data, node.parent);
  633. } else {
  634. return false;
  635. }
  636. };
  637. defineExpose({
  638. refresh
  639. });
  640. </script>
  641. <style lang="scss">
  642. .longjoe-detail-layout.fold-vertical {
  643. display: flex;
  644. flex-direction: column;
  645. .longjoe-detail-layout__tabs {
  646. flex: 1;
  647. // height: unset;
  648. overflow: hidden;
  649. }
  650. }
  651. .basic-inner__body {
  652. flex: 1;
  653. @media screen and (max-width: $screen-md) {
  654. flex: unset;
  655. }
  656. }
  657. </style>