<unicloud-db ref="udb" @load="onqueryload" collection="risk-lib,risk-class"
field="riskame,detail,method,riskclass{riskclass_id,riskclass_id},create_date" >
<uni-table :loading="loading" :emptyText="error.message || '没有更多数据'" border stripe type="selection"
@selection-change="selectionChange">
<uni-tr>
<uni-th align="center">风险类别</uni-th>
<uni-th align="center">创建日期</uni-th>
<uni-th width="204" align="center">操作</uni-th>
</uni-tr>
<uni-tr v-for="(item,index) in data" :key="index">
<uni-td align="center"> {{item.riskclass}} </uni-td>
<uni-td align="center"> {{item.create_date}} </uni-td>
<uni-td align="center">
<view class="uni-group">
<button @click="navigateTo('./edit?id='+item._id, false)" class="uni-button" size="mini"
type="primary">修改</button>
<button @click="confirmDelete(item._id)" class="uni-button" size="mini"
type="warn">删除</button>
</view>
</uni-td>
</uni-tr>
</uni-table>
methods: {
onqueryload(data) {
for (var i = 0; i < data.length; i++) {
let item = data[i]
console.log(data)
item.riskclass = item.riskclass.map(item => item.riskclass_name).join('、')
item.create_date = this.$formatDate(item.create_date)
}
this.expData = data
},
}
对数据预处理
去掉数据预处理