100 lines
3.5 KiB
Vue
100 lines
3.5 KiB
Vue
<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> |