|
@@ -459,7 +459,7 @@ export function htmlTemplate(json, options, zkqyData,dataSource,url) {
|
|
|
-webkit-background-clip: text;
|
|
|
background-clip: text;
|
|
|
-webkit-text-fill-color: transparent;
|
|
|
- color: transparent; /* 必须加上 */
|
|
|
+ color: transparent;
|
|
|
filter: drop-shadow(1px 2px 1px rgba(18, 77, 123, 0.45));
|
|
|
display: inline-block;
|
|
|
font-size: 44px;
|
|
@@ -478,7 +478,7 @@ export function htmlTemplate(json, options, zkqyData,dataSource,url) {
|
|
|
<div id="app">
|
|
|
<form-create :rule="rule" :option="options" v-model:value="formData" v-model="api" @submit="onSubmit"></form-create>
|
|
|
</div>
|
|
|
- <iframe id="my-iframe" width="100%" height="100%" style="display: none; border: none; position: fixed; top: 0; left: 0; z-index: 9999; background: #fff;"></iframe>
|
|
|
+ // <iframe id="my-iframe" width="100%" height="100%" style="display: none; border: none; position: fixed; top: 0; left: 0; z-index: 9999; background: #fff;"></iframe>
|
|
|
</div>
|
|
|
<script>
|
|
|
Vue.use(ELEMENT);
|
|
@@ -601,51 +601,34 @@ export function htmlTemplate(json, options, zkqyData,dataSource,url) {
|
|
|
return results;
|
|
|
},
|
|
|
clickImage(obj,id){
|
|
|
- console.log('clickImage方法参数obj::', obj);
|
|
|
- console.log('clickImage方法参数id:', id);
|
|
|
- if (id) {
|
|
|
- fetch('${url}' + 'api/mobilePageDesignData/queryMobileClickAddData/' + id, {
|
|
|
- method: 'GET',
|
|
|
- headers: {
|
|
|
- 'Accept': 'application/json',
|
|
|
- 'dbname': '${dataSource}',
|
|
|
- 'Content-Type': 'application/json'
|
|
|
- }
|
|
|
- }).then(response => {
|
|
|
- if (!response.ok) {
|
|
|
- throw new Error('HTTP error! status: ' + response.status);
|
|
|
- }
|
|
|
- return response.json();
|
|
|
- }).then(data => {
|
|
|
- console.log('htmlData', data?.data?.htmlData);
|
|
|
- const decodedHtml = decodeURIComponent(data?.data?.htmlData);
|
|
|
- const iframe = document.createElement('iframe');
|
|
|
- iframe.srcdoc = decodedHtml;
|
|
|
- iframe.style.width = '100%';
|
|
|
- iframe.style.height = '100vh';
|
|
|
- iframe.style.border = 'none';
|
|
|
- document.body.innerHTML = '';
|
|
|
- document.body.appendChild(iframe);
|
|
|
- iframe.onload = function() {
|
|
|
- try {
|
|
|
- const iframeWindow = iframe.contentWindow;
|
|
|
- setTimeout(() => {
|
|
|
- const vueInstance = iframeWindow.document.querySelector("#app").__vue__;
|
|
|
- if (vueInstance) {
|
|
|
- if (typeof vueInstance?.searchCardList === 'function') {
|
|
|
- vueInstance.searchCardList();
|
|
|
- }
|
|
|
- }
|
|
|
- }, 1000);
|
|
|
- } catch (error) {
|
|
|
- console.error("调用 iframe 方法时出错:", error);
|
|
|
- }
|
|
|
- };
|
|
|
- }).catch(error => {
|
|
|
- console.error('调用接口出错:', error);
|
|
|
- });
|
|
|
+ if (id) {
|
|
|
+ if (typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
+ try {
|
|
|
+ // 先发送消息
|
|
|
+ wx.miniProgram.postMessage({
|
|
|
+ data: {
|
|
|
+ type: 'navigation',
|
|
|
+ id: id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 跳转时传递 id 参数
|
|
|
+ wx.miniProgram.redirectTo({
|
|
|
+ url: "/pages/detail/webView" + id + "?id=" + id,
|
|
|
+ success: function () {
|
|
|
+ console.log('页面跳转成功');
|
|
|
+ },
|
|
|
+ fail: function (err) {
|
|
|
+ console.error('页面跳转失败:', err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.error('微信小程序跳转失败:', error);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ console.error('wx.miniProgram 未定义,可能未正确加载微信 JSSDK');
|
|
|
+ alert('请在微信小程序中打开');
|
|
|
}
|
|
|
- },
|
|
|
+ }
|
|
|
},
|
|
|
mounted() {
|
|
|
if (sessionStorage.getItem('upload_row')) {
|
|
@@ -747,13 +730,8 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
searchInputTemplate = `
|
|
|
<div style="display: flex;
|
|
|
align-items: center;
|
|
|
- position: absolute;
|
|
|
- top: 8%;
|
|
|
justify-content: flex-end;
|
|
|
- z-index: 500;
|
|
|
- width: 90%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);">
|
|
|
+ width: 90%;">
|
|
|
<el-input placeholder="请输入内容" v-model="selectValue"
|
|
|
suffix-icon="el-icon-search"
|
|
|
@change="searchCardList"
|
|
@@ -763,14 +741,9 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
} else if (cardComponent?.cardSelectType == 'monthRange') {
|
|
|
searchInputTemplate = `
|
|
|
<div style="display: flex;
|
|
|
- align-items: center;
|
|
|
- position: absolute;
|
|
|
- top: 200px;
|
|
|
- z-index: 500;
|
|
|
- width: 90%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);"
|
|
|
- class="zkqy-monthRange">
|
|
|
+ align-items: center;
|
|
|
+ justify-content: flex-end;
|
|
|
+ width: 90%;" class="zkqy-monthRange">
|
|
|
<el-date-picker
|
|
|
v-model="selectValue"
|
|
|
type="month"
|
|
@@ -782,14 +755,10 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
</div>`
|
|
|
} else if (cardComponent?.cardSelectType == 'select') {
|
|
|
searchInputTemplate = `
|
|
|
- <div style="display: flex;
|
|
|
+ <div style="display: flex;
|
|
|
align-items: center;
|
|
|
- position: absolute;
|
|
|
- top: 8%;
|
|
|
- z-index: 500;
|
|
|
- width: 90%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);">
|
|
|
+ justify-content: flex-end;
|
|
|
+ width: 90%;">
|
|
|
<el-select v-model="selectValue" placeholder="请选择" suffix-icon="el-icon-search" class="zkqy-searchInputTemplate" style="width: 100%" @change="searchCardList" clearable>
|
|
|
<el-option
|
|
|
v-for="item in selectOptions"
|
|
@@ -801,14 +770,10 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
</div>`;
|
|
|
} else if (cardComponent?.cardSelectType == 'dateRange') {
|
|
|
searchInputTemplate = `
|
|
|
- <div style="display: flex;
|
|
|
+ <div style="display: flex;
|
|
|
align-items: center;
|
|
|
- position: absolute;
|
|
|
- top: 200px;
|
|
|
- z-index: 500;
|
|
|
- width: 90%;
|
|
|
- left: 50%;
|
|
|
- transform: translate(-50%, -50%);">
|
|
|
+ justify-content: flex-end;
|
|
|
+ width: 90%;">
|
|
|
<el-date-picker
|
|
|
v-model="selectValue"
|
|
|
type="daterange"
|
|
@@ -850,17 +815,19 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
|
|
|
<!-- Import formCreate -->
|
|
|
<script src="https://unpkg.com/@form-create/element-ui@super"><\/script>
|
|
|
-
|
|
|
+ <script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
|
|
|
+ <script type="text/javascript" src="https://js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>
|
|
|
<style>
|
|
|
html,body{
|
|
|
margin: 0;
|
|
|
padding: 0;
|
|
|
background-color: rgba(249, 249, 251, 1);
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
form{
|
|
|
- height:80%;
|
|
|
- overflow: auto;
|
|
|
- }
|
|
|
+ height: 93vh;
|
|
|
+ overflow: scroll;
|
|
|
+ }
|
|
|
.zkqy-searchInputTemplate input,
|
|
|
.zkqy-searchInputTemplate textarea{
|
|
|
border-radius: 20px;
|
|
@@ -1023,7 +990,7 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
font-family: "Microsoft YaHei", "微软雅黑", sans-serif;
|
|
|
}
|
|
|
.zkqy-inputStyle-bgxqSCDD label {
|
|
|
- padding:0;
|
|
|
+ padding:0;
|
|
|
font-size: 16px;
|
|
|
color: #000000;
|
|
|
}
|
|
@@ -1062,9 +1029,9 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
<body>
|
|
|
<div id="app">
|
|
|
<el-button type="primary" icon="el-icon-arrow-left"
|
|
|
- onclick="window.parent.location.reload()"
|
|
|
+ @click="handleBack"
|
|
|
:style="{
|
|
|
- position: 'absolute',
|
|
|
+ position: 'fixed',
|
|
|
zIndex: '200',
|
|
|
background: 'none',
|
|
|
border: 'none',
|
|
@@ -1074,26 +1041,28 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
color: isDateOrMonthRange ? '#ffffff' : '#000000'
|
|
|
}">
|
|
|
</el-button>
|
|
|
- ${searchInputTemplate}
|
|
|
+ <div style="position: fixed;
|
|
|
+ z-index: 10;
|
|
|
+ width: 100%;
|
|
|
+ height: 86px;
|
|
|
+ background-color: rgba(249, 249, 251, 1);
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: flex-end;">
|
|
|
+ ${searchInputTemplate}
|
|
|
+ </div>
|
|
|
<form-create :rule="rule" :option="options" v-model:value="formData" v-model="api" @submit="onSubmit"></form-create>
|
|
|
- <!-- 分页 -->
|
|
|
- <div class="block" style="position: absolute;
|
|
|
- width: 100%;
|
|
|
- bottom: 0px;
|
|
|
- left: 0;
|
|
|
- right: 0;
|
|
|
- background: #ffffff;
|
|
|
- display: flex;
|
|
|
- justify-content: center;">
|
|
|
- <el-pagination v-if="cardList && cardList.total > 0"
|
|
|
- @size-change="handleSizeChange"
|
|
|
- @current-change="handleCurrentChange"
|
|
|
- :current-page.sync="cardList.pageNum"
|
|
|
- :page-size="cardList.pageSize"
|
|
|
- layout="prev, pager, next"
|
|
|
- :total="cardList.total">
|
|
|
- </el-pagination>
|
|
|
- </div>
|
|
|
+ <!-- 分页和加载状态 -->
|
|
|
+ <div class="block" style="width: 100%;
|
|
|
+ background: #F9F9FB;
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ flex-direction: column;
|
|
|
+ align-items: center;">
|
|
|
+ <div v-if="isLoading" style="color: #909399; font-size: 14px;">
|
|
|
+ <i class="el-icon-loading"></i> 正在加载...
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
<script>
|
|
|
Vue.use(ELEMENT);
|
|
@@ -1115,7 +1084,7 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
cardList: {
|
|
|
pageId: '',
|
|
|
total: 0,
|
|
|
- pageSize: 2,
|
|
|
+ pageSize: 10,
|
|
|
pageNum: 1
|
|
|
},
|
|
|
originalRule: null,
|
|
@@ -1131,18 +1100,83 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
{ value: '2', label: '未完成' },
|
|
|
],
|
|
|
zkqyData:${zkqyData},
|
|
|
- isDateOrMonthRange: false
|
|
|
+ isDateOrMonthRange: false,
|
|
|
+ isWeixinIOS: false,
|
|
|
+ isIOS: function () {
|
|
|
+ var ua = navigator.userAgent.toLowerCase();
|
|
|
+ if (ua.match(/iphone/i) == "iphone" || ua.match(/ipad/i) == "ipad" || ua.match(/ipod/i) == "ipod" || ua.match(/ios/i) == "ios") {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ isWeixinBrowser: function () {
|
|
|
+ var ua = navigator.userAgent.toLowerCase();
|
|
|
+ if (ua.match(/micromessenger/i) == "micromessenger") {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ },
|
|
|
+ isLoading: false,
|
|
|
};
|
|
|
},
|
|
|
mounted(){
|
|
|
+ // 获取URL参数
|
|
|
+ const urlParams = new URLSearchParams(window.location.search);
|
|
|
+ const id = urlParams.get('id');
|
|
|
+ const targetValue = urlParams.get('targetValue');
|
|
|
+ const targetValueTZArray = urlParams.get('targetValueTZArray');
|
|
|
+ // 添加滚动监听
|
|
|
+ this.bindScrollListener();
|
|
|
+ // 解码 targetValueTZArray
|
|
|
+ let decodedTargetValueTZArray = null;
|
|
|
+ // 处理数组url类型
|
|
|
+ if (targetValueTZArray && targetValueTZArray !== 'undefined' && targetValueTZArray !== 'null') {
|
|
|
+ try {
|
|
|
+ // 先进行 URL 解码
|
|
|
+ const decodedString = decodeURIComponent(targetValueTZArray);
|
|
|
+ // 然后解析 JSON 字符串
|
|
|
+ decodedTargetValueTZArray = JSON.parse(decodedString);
|
|
|
+ console.log('解码后的 targetValueTZArray:', decodedTargetValueTZArray);
|
|
|
+ } catch (error) {
|
|
|
+ console.error('解码 targetValueTZArray 失败:', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
// 保存原始规则
|
|
|
this.originalRule = JSON.parse(JSON.stringify(this.rule));
|
|
|
- const cardComponent = Array.isArray(this.rule) ?
|
|
|
+ const cardComponent = Array.isArray(this.rule) ?
|
|
|
this.rule.find(item => item.type === 'elCard') : null;
|
|
|
-
|
|
|
+ // 如果是微信iOS环境
|
|
|
+ if (this.isWeixinBrowser() && this.isIOS()) {
|
|
|
+ // 将参数存储到localStorage
|
|
|
+ if (targetValue && targetValue !== 'undefined' && targetValue !== 'null') {
|
|
|
+ localStorage.setItem("targetValueJHGL", targetValue);
|
|
|
+ }
|
|
|
+ if (decodedTargetValueTZArray && decodedTargetValueTZArray !== 'undefined' && decodedTargetValueTZArray !== 'null') {
|
|
|
+ localStorage.setItem("targetValueTZArrayJHGL", JSON.stringify(decodedTargetValueTZArray));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (decodedTargetValueTZArray) {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.searchCardList(targetValue, decodedTargetValueTZArray);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.searchCardList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ console.log('是否循环', this.cardCycle)
|
|
|
+ console.log('自选的一个接口', this.cardCallableInterface)
|
|
|
+ // 有接收值
|
|
|
+ let cardColumnTZJS = this.cardColumnTZJS
|
|
|
+ if (!cardColumnTZJS && !this.isDateOrMonthRange) {
|
|
|
+ this.getCardCycleNew({ pageId, pageNum, pageSize })
|
|
|
+ }
|
|
|
+ this.searchCardList()
|
|
|
+ }
|
|
|
// 设置isDateOrMonthRange的值
|
|
|
this.isDateOrMonthRange = cardComponent?.cardSelectType === 'dateRange' || cardComponent?.cardSelectType === 'monthRange';
|
|
|
-
|
|
|
+
|
|
|
// 如果是日期范围类型,设置默认值为当前月的月初到月末
|
|
|
if (cardComponent?.cardSelectType === 'dateRange') {
|
|
|
const now = new Date();
|
|
@@ -1152,36 +1186,114 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
firstDay.toISOString().split('T')[0],
|
|
|
lastDay.toISOString().split('T')[0]
|
|
|
];
|
|
|
-
|
|
|
}
|
|
|
if (cardComponent?.cardSelectType === 'monthRange') {
|
|
|
const now = new Date();
|
|
|
// 格式化为 YYYY-MM 格式
|
|
|
- const currentMonth = now.getFullYear()+'-'+String(now.getMonth() + 1).padStart(2, '0');
|
|
|
+ const currentMonth = now.getFullYear() + '-' + String(now.getMonth() + 1).padStart(2, '0');
|
|
|
this.selectValue = currentMonth;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// 获取pageId
|
|
|
const x = cardComponent?.props?.pageId;
|
|
|
// 设置到cardList中
|
|
|
this.cardList.pageId = x;
|
|
|
// 获取分页参数
|
|
|
- let { pageId, pageNum, pageSize} = this.cardList;
|
|
|
- if(this.oldFlag){
|
|
|
- // 调用接口
|
|
|
- this.getTableLimitInfo({pageId, pageNum, pageSize});
|
|
|
- }else{
|
|
|
- console.log('是否循环',this.cardCycle)
|
|
|
- console.log('自选的一个接口',this.cardCallableInterface)
|
|
|
- // 有接收值
|
|
|
- let cardColumnTZJS = this.cardColumnTZJS
|
|
|
- // 如果不是日期范围类型,才在初始化时调用
|
|
|
- if(!cardColumnTZJS && !this.isDateOrMonthRange){
|
|
|
- this.getCardCycleNew({pageId, pageNum, pageSize})
|
|
|
- }
|
|
|
+ let { pageId, pageNum, pageSize } = this.cardList;
|
|
|
+
|
|
|
+ // 向父窗口发送 vueReady 消息
|
|
|
+ window.parent.postMessage({ type: 'vueReady' }, '*');
|
|
|
+ // 监听物理返回键
|
|
|
+ window.history.pushState(null, null, document.URL);
|
|
|
+ window.addEventListener('popstate', this.handleBack);
|
|
|
+ },
|
|
|
+ beforeDestroy() {
|
|
|
+ // 组件销毁时移除监听
|
|
|
+ window.removeEventListener('popstate', this.handleBack);
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ // 监听rule的变化,当rule更新时重新绑定滚动监听器
|
|
|
+ rule: {
|
|
|
+ handler() {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.bindScrollListener();
|
|
|
+ });
|
|
|
+ },
|
|
|
+ deep: true
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ bindScrollListener() {
|
|
|
+ const form = document.querySelector('.el-form');
|
|
|
+ if (form) {
|
|
|
+ // 移除可能存在的旧监听器
|
|
|
+ form.removeEventListener('scroll', this.handleScroll);
|
|
|
+ // 添加新的监听器
|
|
|
+ form.addEventListener('scroll', this.handleScroll);
|
|
|
+ }
|
|
|
+ },
|
|
|
+ handleScroll(e) {
|
|
|
+ const form = e.target;
|
|
|
+ // 添加节流,避免频繁触发
|
|
|
+ if (this.scrollTimer) {
|
|
|
+ clearTimeout(this.scrollTimer);
|
|
|
+ }
|
|
|
+ this.scrollTimer = setTimeout(() => {
|
|
|
+ // 计算滚动位置
|
|
|
+ const scrollPosition = form.scrollHeight - form.scrollTop - form.clientHeight;
|
|
|
+ console.log('滚动位置:', scrollPosition);
|
|
|
+
|
|
|
+ // 当滚动到距离底部50px时触发加载
|
|
|
+ if (scrollPosition <= 50) {
|
|
|
+ console.log('滚动到底部', scrollPosition)
|
|
|
+ console.log('this.cardList.pageNum * this.cardList.pageSize', this.cardList.pageNum * this.cardList.pageSize)
|
|
|
+ if (this.cardList.total > this.cardList.pageNum * this.cardList.pageSize) {
|
|
|
+ console.log('滚动到底部,加载更多')
|
|
|
+ this.loadMore();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }, 200); // 200ms的节流时间
|
|
|
+ },
|
|
|
+ loadMore() {
|
|
|
+ console.log('loadMore')
|
|
|
+ console.log('this.isLoading', this.isLoading)
|
|
|
+
|
|
|
+ if (this.isLoading) return;
|
|
|
+ this.isLoading = true;
|
|
|
+ console.log('loadMore2')
|
|
|
+
|
|
|
+ this.cardList.pageSize = this.cardList.pageSize + 10;
|
|
|
+ this.searchCardList()
|
|
|
+ },
|
|
|
+ handleBack() {
|
|
|
+ // 检查 wx 对象是否存在
|
|
|
+ if (typeof wx !== 'undefined' && wx.miniProgram) {
|
|
|
+ try {
|
|
|
+ const urlParams = new URLSearchParams(window.location.search);
|
|
|
+ const id = urlParams.get('id');
|
|
|
+ // 先发送消息
|
|
|
+ wx.miniProgram.postMessage({
|
|
|
+ data: {
|
|
|
+ type: 'navigation',
|
|
|
+ id: id
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 跳转时传递 id 参数
|
|
|
+ wx.miniProgram.redirectTo({
|
|
|
+ // url: '/pages/detail/webView194?id=${id}',
|
|
|
+ url: '/pages/detail/webView',
|
|
|
+ success: function () {
|
|
|
+ console.log('页面跳转成功');
|
|
|
+ },
|
|
|
+ fail: function (err) {
|
|
|
+ console.error('页面跳转失败:', err);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.error('操作失败:', error);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
handleSizeChange(val) {
|
|
|
console.log("每页"+ val +"条");
|
|
|
},
|
|
@@ -1192,6 +1304,36 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
},
|
|
|
async getCardCycleNew(params = {}) {
|
|
|
const endpoint = this.cardCallableInterface;
|
|
|
+ // 确保参数正确传递
|
|
|
+ const requestParams = {
|
|
|
+ ...params,
|
|
|
+ pageId: this.cardList.pageId,
|
|
|
+ pageNum: this.cardList.pageNum,
|
|
|
+ pageSize: this.cardList.pageSize
|
|
|
+ };
|
|
|
+ // 如果有选择值,添加到参数中
|
|
|
+ if (this.selectValue) {
|
|
|
+ if (Array.isArray(this.selectValue)) {
|
|
|
+ requestParams.beginTime = this.selectValue[0];
|
|
|
+ requestParams.endTime = this.selectValue[1];
|
|
|
+ } else {
|
|
|
+ requestParams[this.selectRc] = this.selectValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 如果有保存的跳转值,添加到参数中
|
|
|
+ if (this.savedTZJSValue && this.cardColumnTZJS) {
|
|
|
+ if (Array.isArray(this.cardColumnTZJS)) {
|
|
|
+ this.cardColumnTZJS.forEach((field, index) => {
|
|
|
+ if (this.savedTZJSValue[index] !== undefined) {
|
|
|
+ requestParams[field] = this.savedTZJSValue[index];
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ requestParams[this.cardColumnTZJS] = this.savedTZJSValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
await this.fetchGet(endpoint, params, (data) => {
|
|
|
if (data.code === 200) {
|
|
|
console.log('Data', data);
|
|
@@ -1206,14 +1348,13 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
console.log('data.columns',data.data)
|
|
|
console.log('data.columns',data.data.columns)
|
|
|
console.log('data.result',data.data.result)
|
|
|
-
|
|
|
// 检查result是否为空
|
|
|
if (!data.data.result || data.data.result.length === 0) {
|
|
|
console.log('result为空,使用模板卡片');
|
|
|
this.cardList = {
|
|
|
pageId: this.cardList.pageId,
|
|
|
total: 0,
|
|
|
- pageSize: 2,
|
|
|
+ pageSize: 10,
|
|
|
pageNum: 1
|
|
|
}
|
|
|
// 创建一个新的模板卡片,但不填入任何值
|
|
@@ -1251,7 +1392,7 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
{
|
|
|
type: 'img',
|
|
|
attrs: {
|
|
|
- src: 'https://tc.z.wiki/autoupload/20250603/1l3o/1109X736/%E6%97%A0%E6%95%B0%E6%8D%AE.png',
|
|
|
+ src: 'https://yyq.mec-cloud.cn/images/none.png',
|
|
|
alt: 'logo',
|
|
|
style: 'width: 184px; height: 122px;'
|
|
|
}
|
|
@@ -1318,6 +1459,7 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
console.log('child',child);
|
|
|
// 要跳转的页面id
|
|
|
let cardButtonTZYM = child?.cardButtonTZYM;
|
|
|
+ let pageId = this.cardList.pageId;
|
|
|
let itemAssociatedField = child?.itemAssociatedField;
|
|
|
let itemAssociatedFieldTZ = child?.itemAssociatedFieldTZ;
|
|
|
let clickString =
|
|
@@ -1337,6 +1479,7 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
'console.log("当前点击的卡片索引:", '+(index+1)+');' +
|
|
|
'console.log("当前点击的targetChild:", targetChild);' +
|
|
|
'console.log("当前点击的targetChildTZ:", targetChildTZ);' +
|
|
|
+ 'let cardButtonTZYM ="'+ cardButtonTZYM +'";' +
|
|
|
'let targetValue = targetChild ? targetChild.value : null;' +
|
|
|
'let targetValueTZ = targetChildTZ ? targetChildTZ.value : null;' +
|
|
|
'let targetValueTZArray = ["'+itemAssociatedFieldTZ+'", targetValueTZ];' +
|
|
@@ -1346,6 +1489,36 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
'console.log("关联字段:", "'+itemAssociatedField+'");' +
|
|
|
'console.log("跳转列:", "'+itemAssociatedFieldTZ+'");' +
|
|
|
'console.log("跳转列数组:", targetValueTZArray);' +
|
|
|
+ 'function isWeixinBrowser() {' +
|
|
|
+ ' var ua = navigator.userAgent.toLowerCase();' +
|
|
|
+ ' return ua.match(/MicroMessenger/i) == "micromessenger";' +
|
|
|
+ '}' +
|
|
|
+ 'function isIOS() {' +
|
|
|
+ ' var ua = navigator.userAgent.toLowerCase();' +
|
|
|
+ ' return /iphone|ipad|ipod/.test(ua);' +
|
|
|
+ '}' +
|
|
|
+ 'const isWeixinIOS = isWeixinBrowser() && isIOS();' +
|
|
|
+ 'if (isWeixinIOS) {' +
|
|
|
+ ' try {' +
|
|
|
+ ' wx.miniProgram.postMessage({' +
|
|
|
+ ' data: {' +
|
|
|
+ ' type: "navigation",' +
|
|
|
+ ' id: '+cardButtonTZYM+',' +
|
|
|
+ ' }' +
|
|
|
+ ' });' +
|
|
|
+ ' wx.miniProgram.redirectTo({' +
|
|
|
+ ' url: "/pages/detail/webView"+cardButtonTZYM+"?id=" + cardButtonTZYM + "&targetValue=" + encodeURIComponent(targetValue) + "&targetValueTZArray=" + encodeURIComponent(JSON.stringify(targetValueTZArray)),' +
|
|
|
+ ' success: function() {' +
|
|
|
+ ' console.log("页面跳转成功");' +
|
|
|
+ ' },' +
|
|
|
+ ' fail: function(err) {' +
|
|
|
+ ' console.error("页面跳转失败:", err);' +
|
|
|
+ ' }' +
|
|
|
+ ' });' +
|
|
|
+ ' } catch (error) {' +
|
|
|
+ ' console.error("操作失败:", error);' +
|
|
|
+ ' }' +
|
|
|
+ '} else {' +
|
|
|
'fetch("'+this.baseUrl+'api/mobilePageDesignData/queryMobileClickAddData/'+cardButtonTZYM+'", {' +
|
|
|
' method: "GET",' +
|
|
|
' headers: {' +
|
|
@@ -1418,8 +1591,6 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
});
|
|
|
},
|
|
|
searchCardList(value,id){
|
|
|
- console.log('value',value)
|
|
|
- console.log('id',id)
|
|
|
if(value) {
|
|
|
// 如果是日期范围数组,需要特殊处理
|
|
|
if (Array.isArray(value)) {
|
|
@@ -1512,7 +1683,8 @@ export function htmlTemplateCard(json, options,zkqyData,dataSource,url) {
|
|
|
// 如果不是数组,保持原有逻辑
|
|
|
console.log('this.selectValue------------------',this.selectValue)
|
|
|
console.log('params[this.selectRc]------------------',params[this.selectRc])
|
|
|
- params[this.selectRc] = this.selectValue;
|
|
|
+ this.selectValue = this.selectValue == 'undefined' ? '' : this.selectValue;
|
|
|
+ params[this.selectRc] = this.selectValue;
|
|
|
}
|
|
|
}
|
|
|
|