diff --git a/src/permission.js b/src/permission.js index b2e3f1d..b1fa5db 100644 --- a/src/permission.js +++ b/src/permission.js @@ -16,7 +16,6 @@ router.beforeEach(async(to, from, next) => { // set page title document.title = getPageTitle(to.meta.title) - console.log('oa-token', window.decodeURIComponent(to.query.auth_token)) if(to.query.auth_token) { setToken(window.decodeURIComponent(to.query.auth_token)) } diff --git a/src/utils/formBuilder.js b/src/utils/formBuilder.js index b897337..7926a72 100644 --- a/src/utils/formBuilder.js +++ b/src/utils/formBuilder.js @@ -1,12 +1,13 @@ import { CreateElement, VNode } from "vue"; import moment from "moment"; import { getToken } from "@/utils/auth"; -import { deepCopy, formatFileSize, formatTime } from "@/utils/index"; +import { deepCopy, formatFileSize, formatTime, debounce } from "@/utils/index"; import { uploadSize } from "@/settings"; import axios from "axios"; import { flowList } from "@/api/flow"; import MobilePicker from '@/components/MobilePicker/index.vue'; import MobileMultipleSelect from "@/components/MobileMultipleSelect/index.vue"; +import { Message } from 'element-ui' /** * @param {String} device 'desktop' | 'mobile' * @param {Object} info field参数 @@ -448,11 +449,17 @@ export default function formBuilder( .map((i) => Number(i)) : [], clearable: true, - placeholder: info.help_text, + placeholder: info.help_text || '输入标题或编号搜索流程..', multiple: true, filterable: true, "reserve-keyword": true, - loading: this.flowSelectLoading, + "filter-method": debounce((query) => { + this.tempFlowList = this.flows[info.name].filter(flow => new RegExp(query, 'i').test(flow.title + flow.no)) + console.log(query) + if (this.tempFlowList.length === 0) { + Message.warning("未搜索到匹配流程") + } + }, 500).bind(this) }, attrs: { placeholder: info.help_text, @@ -463,16 +470,29 @@ export default function formBuilder( on: { input: (e) => { this.$set(target, info.name, e.toString()); + this.tempFlowList.length = 0; }, }, }, - this.flows[info.name]?.map((option) => + (this.tempFlowList.length > 0 ? this.tempFlowList : this.flows[info.name])?.map((option) => h("el-option", { props: { label: option.title, value: option.id, }, - }) + }, [ + h("div", { + }, [ + h("span", {},option.title), + h("span", { + style: { + color: '#999', + float: 'right', + 'font-size': '12px' + } + },option.no) + ]) + ]) ) ); break; diff --git a/src/utils/index.js b/src/utils/index.js index d5563fa..d5f9840 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -189,7 +189,7 @@ export function debounce(fn, delay = 500) { return function _debounce() { if (timer) clearTimeout(timer) timer = setTimeout(() => { - fn() + fn.apply(this, arguments) }, delay) } } diff --git a/src/views/flow/DesktopForm.vue b/src/views/flow/DesktopForm.vue index cde5e27..d425918 100644 --- a/src/views/flow/DesktopForm.vue +++ b/src/views/flow/DesktopForm.vue @@ -143,6 +143,7 @@ export default { }, ], flows: {}, + tempFlowList: [] }; }, methods: {