2024-04-29 09:57:04 +08:00

93 lines
2.4 KiB
Vue

<template>
<view>
<u-subsection :list="list" :current="current" @change="sectionChange" mode="subsection" fontSize="1.5rem"></u-subsection>
<view v-if="current == 0">
<view class="area">
<u-row>
<u-col span="8">
<u-button @click="timeshow = true">选择日期</u-button>
<u-datetime-picker :show="timeshow" v-model="queryParams.workerorder_time" mode="date" @confirm="confirm()" @cancel="timeshow = false"></u-datetime-picker>
</u-col>
<u-col span="4">
<view style="font-size: 1.2rem">{{ queryParams.workerorder_time | formatDate }}</view>
</u-col>
</u-row>
<u-gap height="10" bgColor="#bbb"></u-gap>
<u-list @scrolltolower="scrolltolower">
<u-list-item v-for="(item, index) in indexList" :key="index">
<u-cell :title="`列表长度-${index + 1}`">
<u-avatar slot="icon" shape="square" size="35" :src="item.url" customStyle="margin: -3px 5px -3px 0"></u-avatar>
</u-cell>
</u-list-item>
</u-list>
</view>
</view>
<view v-if="current == 1"></view>
</view>
</template>
<script>
import { getIngredientTask } from '@/api/materialManagement/MaterialProductionInput.js';
export default {
data() {
return {
list: ['车间叫料', '空车返程'],
current: 0,
queryParams: {
workerorder_time:Number(new Date()),
pageNum: 1,
pageSize: 10,
sort: undefined,
sortType: undefined,
totalNum: 0
},
timeshow: false
};
},
filters: {
formatDate: function (value) {
// 创建一个 Date 对象,并使用时间戳初始化
const date = new Date(value);
// 提取年、月、日信息
const year = date.getFullYear();
const month = date.getMonth() + 1; // 月份从 0 开始,所以要加 1
const day = date.getDate();
return `${year}-${month < 10 ? '0' + month : month}-${day < 10 ? '0' + day : day}`;
}
},
mounted() {},
methods: {
// todo 分页查询
getInitList() {
getIngredientTask(this.queryParams).then((res) => {});
},
sectionChange(index) {
this.current = index;
},
scrolltolower() {
this.loadmore();
},
loadmore() {
for (let i = 0; i < 30; i++) {
this.indexList.push({
url: this.urls[uni.$u.random(0, this.urls.length - 1)]
});
}
},
//todo 选择时间
confirm() {
this.timeshow = false;
}
}
};
</script>
<style scoped>
.area {
height: 500px;
background-color: white;
}
</style>