other.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { getDicts } from "@/api/system/dict/data";
  2. import {
  3. getFormName
  4. } from "@/api/dragform/form.js";
  5. import store from '@/store'
  6. /**
  7. * 获取非基础表列表
  8. */
  9. export async function getUncommonTable() {
  10. let data = {
  11. databaseName: store.state.user.dataSource.databaseName,
  12. databaseType: store.state.user.dataSource.databaseType,
  13. }
  14. const res = await getFormName(data);
  15. const baseTable = await getDicts("base_table");
  16. let result = res.data.filter((item) => {
  17. return !baseTable.data.some(
  18. (value) =>
  19. value.dictValue.toLowerCase() == item.tableName.toLowerCase()
  20. );
  21. });
  22. return result
  23. }
  24. /**
  25. * 禁止input自动补全
  26. */
  27. export function inputDisableComplete() {
  28. // 获取页面上所有的输入字段
  29. var inputs = document.getElementsByTagName('input');
  30. // 遍历输入字段并将 autocomplete 属性设置为 off
  31. for (var i = 0; i < inputs.length; i++) {
  32. inputs[i].setAttribute('autocomplete', 'off');
  33. }
  34. }
  35. /**
  36. *获取字典值的对应label
  37. *
  38. * @param {字典值} value
  39. * @param {字典数据} [dictLsit=[]]
  40. * @return {*}
  41. */
  42. export function getDictLabel(value, dictLsit = []) {
  43. return dictLsit.find((item) => {
  44. return item.value == value;
  45. })?.label;
  46. }