c5_labsci/fapp/ciyon_ap/pages/demo/case/dict.vue
2026-01-27 00:52:00 +08:00

100 lines
3.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<ciy-header title="字典模式"></ciy-header>
<view class="ciy-card">
<view class="title">传统字典</view>
<view class="content">
<view>总控表名为zc_cata其他saas主体xx_cata</view>
<view>字段一般以字典名称命名注解支持CATA/CATM/CATS/TBIN</view>
<view>例如状态分类型号方案属性等</view>
<view>字典项较多但每一项包含数据应不超过百条</view>
<view>框架在用户登录时加载并缓存到本地localstorage</view>
<view>写页面代码时可直接使用当字典变更时框架在最近一次请求中感知并异步更新</view>
</view>
</view>
<view class="ciy-card">
<view class="title">SaaS字典</view>
<view class="content">
<view>字典表名为xx_catsaas带saasid租户</view>
<view>例如自定义合同分类自定义客户分类等</view>
<view>当用户字典中无数据则使用传统字典的数据</view>
<view>框架在用户登录时加载并缓存到本地localstorage</view>
<view>写页面代码时可直接使用当字典变更时框架在最近一次请求中感知并异步更新</view>
</view>
</view>
<view class="ciy-card">
<view class="title">表字典/页字典</view>
<view class="content">
<view>字段一般以xxid或xxuser命名注解为DB,表名</view>
<view>例如所属用户所属合同所属订单等</view>
<view>可按估算数据量少于百条可用表字典否则用页字典</view>
<view>表字典: 放入once初始化页面首次初始化加载</view>
<view>页字典: 每次调用list时动态加载</view>
<view>若更新频率低且数据量适中可当传统字典在登录时加载</view>
<view>数据量特别大且使用频率很高可集中下载到本地indexdb中</view>
</view>
</view>
<view class="ciy-card">
<view class="title">静态字典</view>
<view class="content">
<view>字段一般以xxcode命名注解为,CATx,ciy_xxx</view>
<view>例如省市区ciy_arearpc行业分类等</view>
<view>适用于数据量较大且基本不变化</view>
<view>导出成ciy_xxx.js文件可同时兼容PC和小程序</view>
<view>JS文件内容var ciy_xxx=[]</view>
<view>页面需要时调用ajax动态加载</view>
</view>
</view>
<view class="ciy-card">
<view class="title">当前传统/用户字典项</view>
<view class="content">
<view>
<button class="btn" @tap="demo">登录后加载</button>
</view>
<view v-for="(item,index) in g">
<view style="font-weight: bolder;color:var(--man6);">{{index}}</view>
<view style="margin-left:1em;">
<view v-for="(item2,index2) in item">
{{item2}}
</view>
</view>
</view>
</view>
</view>
<view class="ciy-card">
<view class="title">加载静态字典</view>
<view class="content">
<view>
<button class="btn" @tap="loadjs('ciy_arearpc')">加载ciy_arearpc</button>
</view>
<view v-for="(item,index) in ciy_arearpc">
{{item}}
</view>
</view>
</view>
</template>
<style>
</style>
<script>
export default {
data() {
return {
ciy_arearpc: []
}
},
onLoad() {},
watch: {},
computed: {},
methods: {
async loadjs(js) {
var retjson = await this.load_ciydict(this.file_stor('/dict/' + js + '.js'));
if (json.code != 1)
return this.alert(json.errmsg);
this.ciy_arearpc = retjson.arr;
},
demo() {
}
}
}
</script>