TraceabilityAPP/components/myTable/index.vue

100 lines
2.4 KiB
Vue
Raw Normal View History

2023-10-23 17:57:19 +08:00
<template>
<view class="card">
<uni-table border emptyText="暂无更多数据" width="600rpx">
<!-- 表头行 -->
<uni-tr>
2023-10-25 19:55:18 +08:00
<uni-th width="120rpx" align="center">日期</uni-th>
2023-10-23 17:57:19 +08:00
<uni-th width="200rpx" align="center">操作</uni-th>
<uni-th width="300.22rpx" align="center">相关信息</uni-th>
</uni-tr>
<!-- 表格数据行 -->
2023-10-25 19:55:18 +08:00
<uni-tr v-for="(item,index) in props.dataList" :key="index">
<!-- <uni-td>{(item.create_time).slice(5,11)}}</uni-td> -->
2023-10-30 19:09:40 +08:00
<uni-td>{{item.create_time.substring(5, 10)}}</uni-td>
2023-10-25 19:55:18 +08:00
<uni-td style="text-align: center;">{{item.action_name}}</uni-td>
2023-10-28 18:28:10 +08:00
2023-10-27 23:24:26 +08:00
<!-- <uni-td v-else> {{objFn()}}</uni-td> -->
2023-10-28 18:28:10 +08:00
<uni-td>
2023-10-27 23:24:26 +08:00
<!-- <view class="" v-for="item in objFn(item.action_content)">
{{item[0]}}:{{item[1]}}
</view> -->
2023-10-30 19:09:40 +08:00
<view class="" v-for="(items,indexs) in objFn(item.action_content)" v-show="items.tit"
:key="indexs">
2023-10-28 18:28:10 +08:00
<view class="" v-if="indexs=='pic'">
{{items.tit}}: <u--image :src="items.value" width="100%" height="210.28rpx"
alt=""></u--image>
</view>
<view style="margin-top: 10rpx;" v-if="indexs !='pic' && items.tit">
<!-- {{indexs}} -->
{{items.tit}}: {{items.value}}
</view>
2023-10-27 23:24:26 +08:00
<!-- {{index}} :{{ item}} -->
2023-10-28 18:28:10 +08:00
<!-- {{indexs}} : {{items}} -->
<!-- {{items}} -->
<!-- {{indexs}} -->
2023-10-27 23:24:26 +08:00
</view>
</uni-td>
2023-10-23 17:57:19 +08:00
</uni-tr>
</uni-table>
<view class="tit_b" v-show="tit_b" @click="navgo">
{{tit_b}} <u--image src="/static/img/CKGD.png" style="margin-left: 5rpx;" width="31.54rpx"
height="31.54rpx"></u--image>
</view>
</view>
</template>
<script setup>
import {
reactive,
ref
} from "vue"
2023-10-25 19:55:18 +08:00
let arr = "sdsd"
// arr.sl
2023-10-23 17:57:19 +08:00
const props = defineProps({
dataList: Object,
tit: String,
route: String
})
const tit_b = ref(props.tit)
const navgo = () => {
uni.navigateTo({
url: props.route
})
}
2023-10-25 19:55:18 +08:00
const objFn = (obj) => {
2023-10-28 18:28:10 +08:00
if (typeof(obj) == 'object') {
return obj
} else {
return JSON.parse(obj)
}
2023-10-27 23:24:26 +08:00
// if (typeof(obj) == 'object') {
// for (const [key, value] of Object.entries((obj))) {
// console.log((`${key}: ${value}`))
// return (`${key}: ${value}`);
// }
// } else {
// }
2023-10-25 19:55:18 +08:00
2023-10-27 18:38:25 +08:00
2023-10-25 19:55:18 +08:00
}
2023-10-23 17:57:19 +08:00
</script>
<style lang="scss" scoped>
.tit_b {
text-align: center;
color: #737373;
margin-top: 20rpx;
font-size: 26.29rpx;
display: flex;
justify-content: center;
align-items: center;
}
</style>