等待增加打印模板后端渲染

This commit is contained in:
2025-04-20 01:24:05 +08:00
parent 81515b035d
commit 0a2e1cc47b
7 changed files with 389 additions and 61 deletions

View File

@@ -1,6 +1,6 @@
<view class="page-section">
<view class="page-section-demo">
<text> v1.0.11 </text>
<text> v1.0.12 </text>
</view>
</view>
<view class="nav-container">

View File

@@ -23,4 +23,13 @@
border: none;
border-radius: 5px;
}
/* 让 rich-text 内的文字字体变小 */
rich-text {
font-size: 12px;
}
/* 让 textarea 内的文字字体变小 */
textarea {
font-size: 12px;
}

View File

@@ -2,7 +2,18 @@
<view>
<rich-text nodes="{{nodes}}" onTap="tap"></rich-text>
</view>
<view class="page-section">
<view class="page-section-title">TSPL指令集</view>
<view class="page-section-demo">
<textarea onBlur="bindTextAreaBlur" auto-height placeholder="Please input something" value="{{tspl.code}}" />
</view>
</view>
<view class="page-section">
<view class="page-section-title">TSPL指令集</view>
<view class="page-section-demo">
<textarea onBlur="bindTextAreaBlur" auto-height placeholder="Please input something" value="{{tspl.currentCode}}" />
</view>
</view>
<view class="cart-bottom">
<view class="cart-info">
</view>

View File

@@ -1,5 +1,6 @@
import jsonrpcFunc from '../../../../../../ulti/jsonrpc'
Page({
data: {
nodes: [{
@@ -13,9 +14,24 @@ Page({
text: 'Hello&nbsp;World! 拖拉设计打印模板待开发',
}],
}],
tspl:{},
loginInfo: '', //权限验证信息
},
onLoad(query) {
// 页面加载
const loginInfo = dd.getStorageSync({
key: 'loginInfo'
}).data;
if (loginInfo && loginInfo.apiurl && loginInfo.databaseName && loginInfo.username && loginInfo.password && loginInfo.uid > 0) {
this.setData({
loginInfo
});
// console.log('销售页得到的本地信息', loginInfo);
//执行获取销售订单第一页数据分页第一页默认
this.fetchData(1);
} else {
// console.log('本地缓存中未获取到登录信息');
}
},
onReady() {
// 页面加载完成
@@ -51,4 +67,46 @@ Page({
console.log('tap');
},
//
fetchData(page) {
const {
loginInfo,
} = this.data;
// 调用 search_count 方法获取总记录数
const tspl = {
"jsonrpc": "2.0",
"method": "call",
"id": 2,
"params": {
"service": "object",
"method": "execute_kw",
"args": [
loginInfo.databaseName,
loginInfo.uid,
loginInfo.password,
'sale.order',
"tspl",
[
[]
],
{}
]
}
};
jsonrpcFunc(loginInfo, tspl)
.then((response) => {
// 保存数据到本地缓存
dd.setStorageSync({
key: 'tspl',
data: response
});
this.setData({
tspl: response
});
console.log("response", response)
})
.catch((error) => {
console.log("获取打印模板失败")
// console.error('请求数据时出错:', error);
});
},
});