From 3ef93aeca3517482c87d39da8c76796103822bb6 Mon Sep 17 00:00:00 2001 From: X_Rian <904416525@qq.com> Date: Fri, 14 Jun 2024 19:30:44 +0800 Subject: [PATCH] =?UTF-8?q?flx=EF=BC=9A=E4=BF=AE=E6=94=B9=E5=AE=A1?= =?UTF-8?q?=E6=89=B9=E6=B5=81=E6=98=8E=E7=BB=86=E8=A1=A8=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/FormRender.vue | 25 +++- components/form/TableList.vue | 1 + pages/submit/InitiateProcess.vue | 1 + .../dist/cache/.vite/deps/_metadata.json | 11 +- unpackage/dist/dev/app-plus/app-service.js | 129 +++++++++++++++--- unpackage/dist/dev/app-plus/app.css | 17 +++ .../pages/instance/instancePreview.css | 17 +++ .../app-plus/pages/submit/InitiateProcess.css | 17 +++ 8 files changed, 193 insertions(+), 25 deletions(-) diff --git a/components/FormRender.vue b/components/FormRender.vue index 9f0e91d..4f4c0bb 100644 --- a/components/FormRender.vue +++ b/components/FormRender.vue @@ -122,10 +122,29 @@ }, validate(call) { this.$refs['wflowForm'].validate().then(res => { - call(true) - console.log('表单数据信息:', res); + const dataList = Object.values(this.modelValue); + const result = dataList[0][dataList[0].length - 1]; + // console.log(4444444, JSON.stringify(this.modelValue)) + const flag = this.formFields[this.formFields.length - 1].props.columns.every((v, i)=> { + if((i == this.formFields[this.formFields.length - 1].props.columns.length - 1) && result[v.id]){ + if(result[v.id][0].id){ + return true + } else { + // console.log(22222, JSON.stringify(v.props.columns)) + return v.props.columns.every(e => { + // console.log(1111111, e.props.required,e.id, JSON.stringify(result[e.id]), JSON.stringify(result[v.id])) + return e.props.required == false || (e.props.required == true && result[v.id][0][e.id] != null&& result[v.id][0][e.id] != undefined); + }) + } + return + } + return v.props.required == false || (v.props.required == true && result[v.id] != null); + }); + // console.log(3333333, flag) + call(flag) + console.log('表单数据信息:', JSON.stringify(res)); }).catch(err => { - // call(false) + call(false) console.log('表单错误信息:', err); }) }, diff --git a/components/form/TableList.vue b/components/form/TableList.vue index 8c77b6d..f222071 100644 --- a/components/form/TableList.vue +++ b/components/form/TableList.vue @@ -166,6 +166,7 @@ if (res.confirm) { this._value.splice(i, 1) this._value = this._value + this.resize() setTimeout(() => uni.$emit('showFp'), 500) } } diff --git a/pages/submit/InitiateProcess.vue b/pages/submit/InitiateProcess.vue index 441d802..0b26842 100644 --- a/pages/submit/InitiateProcess.vue +++ b/pages/submit/InitiateProcess.vue @@ -135,6 +135,7 @@ if (formValid) { process.value.validate(processValid => { if (processValid) { + // return doSubmit() } else { current.value = 1 diff --git a/unpackage/dist/cache/.vite/deps/_metadata.json b/unpackage/dist/cache/.vite/deps/_metadata.json index 4af032a..aae68a3 100644 --- a/unpackage/dist/cache/.vite/deps/_metadata.json +++ b/unpackage/dist/cache/.vite/deps/_metadata.json @@ -2,7 +2,14 @@ "hash": "0f0fbf16", "configHash": "5bd87843", "lockfileHash": "33a33614", - "browserHash": "a13cd6b4", - "optimized": {}, + "browserHash": "ba16bf7f", + "optimized": { + "@icon-park/vue-next": { + "src": "../../../../../node_modules/@icon-park/vue-next/es/index.js", + "file": "@icon-park_vue-next.js", + "fileHash": "9de4363e", + "needsInterop": false + } + }, "chunks": {} } \ No newline at end of file diff --git a/unpackage/dist/dev/app-plus/app-service.js b/unpackage/dist/dev/app-plus/app-service.js index 6135680..649d4cd 100644 --- a/unpackage/dist/dev/app-plus/app-service.js +++ b/unpackage/dist/dev/app-plus/app-service.js @@ -1198,7 +1198,7 @@ if (uni.restoreGlobal) { /* CLASS */ ); } - const __easycom_0$9 = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$v], ["__scopeId", "data-v-26544265"], ["__file", "D:/jxj/mobile-workflow/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue"]]); + const __easycom_0$8 = /* @__PURE__ */ _export_sfc(_sfc_main$1c, [["render", _sfc_render$v], ["__scopeId", "data-v-26544265"], ["__file", "D:/jxj/mobile-workflow/uni_modules/uni-nav-bar/components/uni-nav-bar/uni-nav-bar.vue"]]); const isObject$1 = (val) => val !== null && typeof val === "object"; const defaultDelimiters = ["{", "}"]; class BaseFormatter { @@ -1716,7 +1716,7 @@ if (uni.restoreGlobal) { )) : vue.createCommentVNode("v-if", true) ]); } - const __easycom_0$8 = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$u], ["__scopeId", "data-v-f07ef577"], ["__file", "D:/jxj/mobile-workflow/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue"]]); + const __easycom_1$8 = /* @__PURE__ */ _export_sfc(_sfc_main$1b, [["render", _sfc_render$u], ["__scopeId", "data-v-f07ef577"], ["__file", "D:/jxj/mobile-workflow/uni_modules/uni-search-bar/components/uni-search-bar/uni-search-bar.vue"]]); const _sfc_main$1a = { data() { return { @@ -3765,8 +3765,8 @@ if (uni.restoreGlobal) { close }); return (_ctx, _cache) => { - const _component_uni_nav_bar = resolveEasycom(vue.resolveDynamicComponent("uni-nav-bar"), __easycom_0$9); - const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_0$8); + const _component_uni_nav_bar = resolveEasycom(vue.resolveDynamicComponent("uni-nav-bar"), __easycom_0$8); + const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_1$8); const _component_uni_breadcrumb_item = resolveEasycom(vue.resolveDynamicComponent("uni-breadcrumb-item"), __easycom_1$7); const _component_uni_breadcrumb = resolveEasycom(vue.resolveDynamicComponent("uni-breadcrumb"), __easycom_2$3); const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_0$7); @@ -5883,7 +5883,7 @@ if (uni.restoreGlobal) { uni.setStorageSync("recentlyUsed", recentlyUsed.value); } return (_ctx, _cache) => { - const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_0$8); + const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_1$8); const _component_l_icon = resolveEasycom(vue.resolveDynamicComponent("l-icon"), __easycom_1$4); const _component_uni_collapse_item = resolveEasycom(vue.resolveDynamicComponent("uni-collapse-item"), __easycom_3$1); const _component_uni_collapse = resolveEasycom(vue.resolveDynamicComponent("uni-collapse"), __easycom_4); @@ -6275,7 +6275,7 @@ if (uni.restoreGlobal) { } }); return (_ctx, _cache) => { - const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_0$8); + const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_1$8); const _component_uni_breadcrumb_item = resolveEasycom(vue.resolveDynamicComponent("uni-breadcrumb-item"), __easycom_1$7); const _component_uni_breadcrumb = resolveEasycom(vue.resolveDynamicComponent("uni-breadcrumb"), __easycom_2$3); const _component_uni_tag = resolveEasycom(vue.resolveDynamicComponent("uni-tag"), __easycom_0$7); @@ -18480,7 +18480,8 @@ ${i3} return []; } }, - readonly: Boolean + readonly: Boolean, + title: String }, emits: ["update:modelValue", "resize"], setup(__props, { emit: __emit }) { @@ -18511,9 +18512,13 @@ ${i3} const emits2 = __emit; const loading = vue.ref(false); const dataOptions = vue.ref([]); + const dataOptions2 = vue.ref([]); let preHandlerFuc = null; let aftHandlerFuc = null; - const optionsKeyMap = { text: "name", value: "value" }; + const optionsKeyMap = { + text: "name", + value: "value" + }; const index2 = vue.ref(0); function loadOptionsData() { try { @@ -18523,9 +18528,14 @@ ${i3} doRequest(dataOptions.value); } } catch (e2) { - formatAppLog("log", "at components/form/SelectPlus.vue:101", e2); + formatAppLog("log", "at components/form/SelectPlus.vue:124", e2); } } + vue.watch(() => dataOptions, () => { + dataOptions2.value = dataOptions.value; + }, { + deep: true + }); vue.onMounted(() => { loadOptionsData(); }); @@ -18537,6 +18547,34 @@ ${i3} __value.value = dataOptions.value[index2.value].value; resizeCollapse(); } + function ok2(e2) { + const id = dataOptions2.value[e2.detail.value].value; + const findIndex = dataOptions.value.findIndex((item) => item.value == id); + if (findIndex > -1) { + index2.value = findIndex; + __value.value = dataOptions.value[findIndex].value; + resizeCollapse(); + isSearch.value = false; + } + } + const isSearch = vue.ref(false); + const searchValue = vue.ref(""); + function searchChange(e2) { + formatAppLog("log", "at components/form/SelectPlus.vue:165", e2); + let findList = dataOptions.value.filter((item) => item.name.includes(e2)); + dataOptions2.value = findList; + if (e2 == "") { + dataOptions2.value = dataOptions.value; + } + } + const onCancel = () => { + isSearch.value = false; + }; + const isSearchFn = () => { + setTimeout(() => { + isSearch.value = true; + }, 500); + }; function doRequest(options) { const http = props2.formProps.http || {}; if (http.url && http.method) { @@ -18552,7 +18590,10 @@ ${i3} }; preHandler(params, http.preHandler); if (http.contentType !== "JSON") { - params.data = { ...params.data, ...params.params }; + params.data = { + ...params.data, + ...params.params + }; } loading.value = true; uni.request({ @@ -18596,7 +18637,7 @@ ${i3} try { preHandlerFuc(params); } catch (e2) { - formatAppLog("log", "at components/form/SelectPlus.vue:180", e2); + formatAppLog("log", "at components/form/SelectPlus.vue:250", e2); } } } @@ -18643,13 +18684,14 @@ ${i3} try { return aftHandlerFuc(rsp) || []; } catch (e2) { - formatAppLog("log", "at components/form/SelectPlus.vue:237", e2); + formatAppLog("log", "at components/form/SelectPlus.vue:307", e2); } } return []; } return (_ctx, _cache) => { const _component_uni_data_checkbox = resolveEasycom(vue.resolveDynamicComponent("uni-data-checkbox"), __easycom_1$2); + const _component_uni_search_bar = resolveEasycom(vue.resolveDynamicComponent("uni-search-bar"), __easycom_1$8); return vue.openBlock(), vue.createElementBlock("view", null, [ !__props.readonly ? (vue.openBlock(), vue.createElementBlock( vue.Fragment, @@ -18695,14 +18737,44 @@ ${i3} { key: 2 }, [ vue.createCommentVNode(" 单选 "), + vue.createCommentVNode(" title == '司机姓名' "), __props.formProps.expanding ? (vue.openBlock(), vue.createBlock(_component_uni_data_checkbox, { key: 0, map: optionsKeyMap, modelValue: __value.value, "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => __value.value = $event), localdata: dataOptions.value - }, null, 8, ["modelValue", "localdata"])) : (vue.openBlock(), vue.createElementBlock("picker", { + }, null, 8, ["modelValue", "localdata"])) : __props.title == "司机姓名" ? (vue.openBlock(), vue.createElementBlock("picker", { key: 1, + class: "picker", + onCancel, + onChange: ok2, + mode: "selector", + value: index2.value, + "range-key": "name", + range: dataOptions2.value + }, [ + isSearch.value ? (vue.openBlock(), vue.createBlock(_component_uni_search_bar, { + key: 0, + bgColor: "#fff", + modelValue: searchValue.value, + "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => searchValue.value = $event), + class: "search", + radius: "5", + placeholder: "请输入", + clearButton: "auto", + cancelButton: "none", + onInput: searchChange + }, null, 8, ["modelValue"])) : vue.createCommentVNode("v-if", true), + vue.createVNode(ClickInput, { + onClick: _cache[4] || (_cache[4] = ($event) => isSearchFn()), + value: (__props.modelValue || []).length > 0 ? dataOptions.value[index2.value] : null, + index: "name", + placeholder: __props.formProps.placeholder || "请选择" + }, null, 8, ["value", "placeholder"]) + ], 40, ["value", "range"])) : (vue.openBlock(), vue.createElementBlock("picker", { + key: 2, + class: "picker", onChange: ok, mode: "selector", value: index2.value, @@ -18746,7 +18818,7 @@ ${i3} }; } }; - const SelectPlus = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__file", "D:/jxj/mobile-workflow/components/form/SelectPlus.vue"]]); + const SelectPlus = /* @__PURE__ */ _export_sfc(_sfc_main$k, [["__scopeId", "data-v-efe1296e"], ["__file", "D:/jxj/mobile-workflow/components/form/SelectPlus.vue"]]); const _sfc_main$j = { __name: "Location", props: { @@ -32046,7 +32118,8 @@ ${i3} return {}; } }, - readonly: Boolean + readonly: Boolean, + title: String }, computed: { _value: { @@ -32227,12 +32300,13 @@ ${i3} }, null, 8, ["modelValue", "form-props", "readonly", "formData"])) : $props.type === "SelectPlus" ? (vue.openBlock(), vue.createBlock(_component_SelectPlus, { key: 18, onResize: _cache[21] || (_cache[21] = ($event) => _ctx.$emit("resize")), + title: $props.title, modelValue: $options._value, "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => $options._value = $event), "form-props": $props.formProps, readonly: $props.readonly, formData: $props.formData - }, null, 8, ["modelValue", "form-props", "readonly", "formData"])) : $props.type === "Location" ? (vue.openBlock(), vue.createBlock(_component_Location, { + }, null, 8, ["title", "modelValue", "form-props", "readonly", "formData"])) : $props.type === "Location" ? (vue.openBlock(), vue.createBlock(_component_Location, { key: 19, modelValue: $options._value, "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => $options._value = $event), @@ -32473,10 +32547,24 @@ ${i3} }, validate(call) { this.$refs["wflowForm"].validate().then((res) => { - call(true); - formatAppLog("log", "at components/FormRender.vue:125", "表单数据信息:", res); + const dataList = Object.values(this.modelValue); + const result = dataList[0][dataList[0].length - 1]; + const flag = this.formFields[this.formFields.length - 1].props.columns.every((v2, i2) => { + if (i2 == this.formFields[this.formFields.length - 1].props.columns.length - 1 && result[v2.id]) { + if (result[v2.id][0].id) { + return true; + } else { + return v2.props.columns.every((e2) => { + return e2.props.required == false || e2.props.required == true && result[v2.id][0][e2.id] != null && result[v2.id][0][e2.id] != void 0; + }); + } + } + return v2.props.required == false || v2.props.required == true && result[v2.id] != null; + }); + call(flag); + formatAppLog("log", "at components/FormRender.vue:145", "表单数据信息:", JSON.stringify(res)); }).catch((err) => { - formatAppLog("log", "at components/FormRender.vue:128", "表单错误信息:", err); + formatAppLog("log", "at components/FormRender.vue:148", "表单错误信息:", err); }); }, loadFormItemMap(forms, map) { @@ -32707,12 +32795,13 @@ ${i3} default: vue.withCtx(() => [ vue.createVNode(_component_w_form_item, { type: item.name, + title: item.title, modelValue: $options._value[item.id], "onUpdate:modelValue": ($event) => $options._value[item.id] = $event, "form-props": item.props, readonly: item.perm !== "E", formData: $options._value - }, null, 8, ["type", "modelValue", "onUpdate:modelValue", "form-props", "readonly", "formData"]) + }, null, 8, ["type", "title", "modelValue", "onUpdate:modelValue", "form-props", "readonly", "formData"]) ]), _: 2 /* DYNAMIC */ diff --git a/unpackage/dist/dev/app-plus/app.css b/unpackage/dist/dev/app-plus/app.css index 1a66e52..7bcccd4 100644 --- a/unpackage/dist/dev/app-plus/app.css +++ b/unpackage/dist/dev/app-plus/app.css @@ -3453,6 +3453,23 @@ body[data-v-029c2886] { border-bottom: none; } + + /* .picker { + position: relative; + } */ +.search[data-v-efe1296e] { + position: fixed; + bottom: 15.78125rem; + left: 50%; + transform: translateX(-50%); + z-index: 9999; + padding:0; +} +.search[data-v-efe1296e] .uni-searchbar__box { + width: 12.5rem; + border: 0.0625rem solid #f5f5f5; +} + /** * 这里是uni-app内置的常用样式变量 * diff --git a/unpackage/dist/dev/app-plus/pages/instance/instancePreview.css b/unpackage/dist/dev/app-plus/pages/instance/instancePreview.css index 62ad26c..8d8189d 100644 --- a/unpackage/dist/dev/app-plus/pages/instance/instancePreview.css +++ b/unpackage/dist/dev/app-plus/pages/instance/instancePreview.css @@ -3388,6 +3388,23 @@ body[data-v-029c2886] { border-bottom: none; } + + /* .picker { + position: relative; + } */ +.search[data-v-efe1296e] { + position: fixed; + bottom: 15.78125rem; + left: 50%; + transform: translateX(-50%); + z-index: 9999; + padding:0; +} +.search[data-v-efe1296e] .uni-searchbar__box { + width: 12.5rem; + border: 0.0625rem solid #f5f5f5; +} + /** * 这里是uni-app内置的常用样式变量 * diff --git a/unpackage/dist/dev/app-plus/pages/submit/InitiateProcess.css b/unpackage/dist/dev/app-plus/pages/submit/InitiateProcess.css index 0d01040..1d3f7f9 100644 --- a/unpackage/dist/dev/app-plus/pages/submit/InitiateProcess.css +++ b/unpackage/dist/dev/app-plus/pages/submit/InitiateProcess.css @@ -3454,6 +3454,23 @@ body[data-v-029c2886] { border-bottom: none; } + + /* .picker { + position: relative; + } */ +.search[data-v-efe1296e] { + position: fixed; + bottom: 15.78125rem; + left: 50%; + transform: translateX(-50%); + z-index: 9999; + padding:0; +} +.search[data-v-efe1296e] .uni-searchbar__box { + width: 12.5rem; + border: 0.0625rem solid #f5f5f5; +} + /** * 这里是uni-app内置的常用样式变量 *