hookehuyr

iframe模式下配合后台编辑页面操作

1 <!-- 1 <!--
2 * @Date: 2022-07-18 10:22:22 2 * @Date: 2022-07-18 10:22:22
3 * @LastEditors: hookehuyr hookehuyr@gmail.com 3 * @LastEditors: hookehuyr hookehuyr@gmail.com
4 - * @LastEditTime: 2024-06-17 14:58:40 4 + * @LastEditTime: 2024-06-19 18:05:04
5 * @FilePath: /data-table/src/views/index.vue 5 * @FilePath: /data-table/src/views/index.vue
6 * @Description: 首页 6 * @Description: 首页
7 --> 7 -->
...@@ -28,13 +28,13 @@ ...@@ -28,13 +28,13 @@
28 :is="item.component" :item="item" @active="onActive" @remove="onRemove" /> 28 :is="item.component" :item="item" @active="onActive" @remove="onRemove" />
29 </van-cell-group> 29 </van-cell-group>
30 <!-- 非流程版表单 --> 30 <!-- 非流程版表单 -->
31 - <div v-if="formData.length && PCommit.visible" style="margin: 16px"> 31 + <div v-if="formData.length && PCommit.visible && !formSetting.is_flow" style="margin: 16px">
32 <van-button round block type="primary" native-type="submit" :disabled="submitStatus"> 32 <van-button round block type="primary" native-type="submit" :disabled="submitStatus">
33 {{ PCommit.text ? PCommit.text : '提交' }} 33 {{ PCommit.text ? PCommit.text : '提交' }}
34 </van-button> 34 </van-button>
35 </div> 35 </div>
36 <!-- 流程表单 --> 36 <!-- 流程表单 -->
37 - <div v-if="formSetting.is_flow" style="margin: 16px; border-top: 1px dashed #eee; padding-top: 1rem;"> 37 + <div v-if="formSetting.is_flow" style="margin: 16px; padding-top: 1rem;">
38 <p style="margin-bottom: 1rem; font-size: 0.85rem; font-weight: bold;">审批意见</p> 38 <p style="margin-bottom: 1rem; font-size: 0.85rem; font-weight: bold;">审批意见</p>
39 <div style="margin-bottom: 1rem; border: 1px solid #eee;"> 39 <div style="margin-bottom: 1rem; border: 1px solid #eee;">
40 <van-field 40 <van-field
...@@ -107,7 +107,7 @@ ...@@ -107,7 +107,7 @@
107 </van-overlay> 107 </van-overlay>
108 <van-action-sheet 108 <van-action-sheet
109 v-model:show="approval_show" 109 v-model:show="approval_show"
110 - :actions="actions" 110 + :actions="approval_actions"
111 @select="onApprovalSelect" 111 @select="onApprovalSelect"
112 cancel-text="取消" 112 cancel-text="取消"
113 close-on-click-action 113 close-on-click-action
...@@ -228,6 +228,7 @@ const onSubmitPwd = async () => { ...@@ -228,6 +228,7 @@ const onSubmitPwd = async () => {
228 } 228 }
229 } 229 }
230 230
231 +// 弹出流程审核操作
231 const approval_show = ref(false); 232 const approval_show = ref(false);
232 const approval_note = ref(''); 233 const approval_note = ref('');
233 // 审批组件点击 234 // 审批组件点击
...@@ -235,11 +236,11 @@ const onClickFloatingBubble = () => { ...@@ -235,11 +236,11 @@ const onClickFloatingBubble = () => {
235 approval_show.value = true; 236 approval_show.value = true;
236 } 237 }
237 const myForm = ref(null); 238 const myForm = ref(null);
238 -const actions = [ 239 +const approval_actions = [
239 { name: '提交', id: 'commit', }, 240 { name: '提交', id: 'commit', },
240 { name: '撤回', id: 'withdraw', disabled: true }, 241 { name: '撤回', id: 'withdraw', disabled: true },
241 { name: '驳回', id: 'reject', }, 242 { name: '驳回', id: 'reject', },
242 - { name: '结束流程', key: 'terminate', }, 243 + { name: '结束流程', id: 'terminate', },
243 ]; 244 ];
244 const onApprovalSelect = (item) => { 245 const onApprovalSelect = (item) => {
245 switch (item.id) { 246 switch (item.id) {
...@@ -282,9 +283,13 @@ onMounted(async () => { ...@@ -282,9 +283,13 @@ onMounted(async () => {
282 // 提交按钮 283 // 提交按钮
283 page_commit = element; 284 page_commit = element;
284 } else { 285 } else {
286 + // TODO:过滤掉自定义流程中的字段-需要新API接口
287 + // console.warn(element);
285 page_form.push(element); 288 page_form.push(element);
286 } 289 }
287 }); 290 });
291 + // TODO: 判断是否流程表单-需要新API接口
292 + formSetting.value.is_flow = false;
288 /** 页眉属性 293 /** 页眉属性
289 * @param label 表单标题 294 * @param label 表单标题
290 * @param banner_type 页眉类型:["文字", "单张图", "轮播图"] text=文字,image=单张图,carousel=轮播图 295 * @param banner_type 页眉类型:["文字", "单张图", "轮播图"] text=文字,image=单张图,carousel=轮播图
...@@ -563,8 +568,6 @@ onMounted(async () => { ...@@ -563,8 +568,6 @@ onMounted(async () => {
563 submitStatus.value = true; 568 submitStatus.value = true;
564 } 569 }
565 } 570 }
566 - // TODO: 判断是否流程表单
567 - formSetting.value.is_flow = false;
568 }); 571 });
569 572
570 // 打开轮询用户是否关注 573 // 打开轮询用户是否关注
...@@ -849,6 +852,12 @@ const onSubmit = async (values) => { ...@@ -849,6 +852,12 @@ const onSubmit = async (values) => {
849 showSuccessToast("提交成功"); 852 showSuccessToast("提交成功");
850 // 缓存表单返回值 853 // 缓存表单返回值
851 store.changeSuccessInfo(result.data); 854 store.changeSuccessInfo(result.data);
855 + //在 iframe 中调用父页面中定义的变量
856 + let getChildVal = parent.parent.getChildVal;
857 + if (getChildVal) {
858 + getChildVal();
859 + return false;
860 + }
852 // 如果类型为跳转网页 861 // 如果类型为跳转网页
853 if (result.data.commit_action === 'url') { 862 if (result.data.commit_action === 'url') {
854 window.location.href = result.data.commit_url; 863 window.location.href = result.data.commit_url;
...@@ -878,6 +887,12 @@ const onSubmit = async (values) => { ...@@ -878,6 +887,12 @@ const onSubmit = async (values) => {
878 showSuccessToast("提交成功"); 887 showSuccessToast("提交成功");
879 // 缓存表单返回值 888 // 缓存表单返回值
880 store.changeSuccessInfo(result.data); 889 store.changeSuccessInfo(result.data);
890 + //在 iframe 中调用父页面中定义的变量
891 + let getChildVal = parent.parent.getChildVal;
892 + if (getChildVal) {
893 + getChildVal();
894 + return false;
895 + }
881 // 如果类型为跳转网页 896 // 如果类型为跳转网页
882 if (result.data.commit_action === 'url') { 897 if (result.data.commit_action === 'url') {
883 window.location.href = result.data.commit_url; 898 window.location.href = result.data.commit_url;
......