feat: 计划列表接口对接
This commit is contained in:
parent
9b8734a39a
commit
901af49886
|
@ -16,6 +16,10 @@ this.$api.getList(params).then(res => {
|
||||||
export const GetPlanByDate = (data) =>
|
export const GetPlanByDate = (data) =>
|
||||||
request.get("/api/App/GetPlanByDate", data);
|
request.get("/api/App/GetPlanByDate", data);
|
||||||
|
|
||||||
|
// 根据日期获取计划
|
||||||
|
export const GetTodayPlanList = (data) =>
|
||||||
|
request.get("/api/App/GetTodayPlanList", data);
|
||||||
|
|
||||||
// 今日完成情况
|
// 今日完成情况
|
||||||
export const TodayCompletion = (data) =>
|
export const TodayCompletion = (data) =>
|
||||||
request.post("/api/App/TodayCompletion", data);
|
request.post("/api/App/TodayCompletion", data);
|
||||||
|
|
|
@ -10,15 +10,24 @@
|
||||||
<u-dropdown :title-size="42" active-color="#211D2F">
|
<u-dropdown :title-size="42" active-color="#211D2F">
|
||||||
<u-dropdown-item
|
<u-dropdown-item
|
||||||
v-model="dropdownValue"
|
v-model="dropdownValue"
|
||||||
title="保洁计划"
|
:title="dataInfo.planName"
|
||||||
:options="dropdownOptions"
|
:options="dropdownOptions"
|
||||||
|
@change="changeDropdown"
|
||||||
></u-dropdown-item>
|
></u-dropdown-item>
|
||||||
</u-dropdown>
|
</u-dropdown>
|
||||||
</view>
|
</view>
|
||||||
</u-navbar>
|
</u-navbar>
|
||||||
<view class="area-info">
|
<view class="area-info">
|
||||||
<view class="name">2024年11月21号</view>
|
<view class="name">{{
|
||||||
<view class="position"> 08:30~11:30</view>
|
dataInfo.planDate ? dataInfo.planDate.split("T")[0] : ""
|
||||||
|
}}</view>
|
||||||
|
<view class="position">
|
||||||
|
<span v-if="dataInfo.beginTime && dataInfo.endTime">
|
||||||
|
{{ minutesToTime(dataInfo.beginTime) }}~{{
|
||||||
|
minutesToTime(dataInfo.endTime)
|
||||||
|
}}
|
||||||
|
</span>
|
||||||
|
</view>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<view
|
<view
|
||||||
@click="changeTab(i)"
|
@click="changeTab(i)"
|
||||||
|
@ -32,24 +41,29 @@
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="arealist">
|
<view class="arealist">
|
||||||
<view class="block-info">
|
<view class="block-info" v-for="item in dataInfo.areas" :key="item.id">
|
||||||
<view class="schedule">待保洁</view>
|
<view v-if="!item.isCompleted" class="schedule schedule-wait"
|
||||||
|
>待保洁</view
|
||||||
|
>
|
||||||
|
<view v-else class="schedule schedule-completed">已完成</view>
|
||||||
|
|
||||||
<view class="name">
|
<view class="name">
|
||||||
<u-icon size="40" :name="posIcon"></u-icon>
|
<u-icon size="40" :name="posIcon"></u-icon>
|
||||||
<view class="text">东大门北侧_门2</view>
|
<view class="text">{{ item.aeraNmae }}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="type">
|
<view class="type">
|
||||||
<view class="value">区域类型</view>
|
<view class="value">区域类型</view>
|
||||||
<u-tag
|
<u-tag
|
||||||
text="室外"
|
:text="item.areaType"
|
||||||
class="tag"
|
class="tag"
|
||||||
border-color="transparent"
|
border-color="transparent"
|
||||||
type="success"
|
:type="item.areaType === '室外' ? 'success' : 'primary'"
|
||||||
/>
|
/>
|
||||||
<u-tag text="特殊" border-color="transparent" type="warning" />
|
<!-- 特殊先隐藏,没有这个字段 -->
|
||||||
|
<!-- <u-tag text="特殊" border-color="transparent" type="warning" /> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="illustrate">
|
<view class="illustrate">
|
||||||
{{ "需要清理整个户外通道/保持跑道整洁花坛边落叶清扫" }}
|
{{ item.note }}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
@ -57,14 +71,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { GetPlanInfoAreaList } from "@/api/apiList";
|
import { GetPlanInfoAreaList, GetTodayPlanList } from "@/api/apiList";
|
||||||
|
|
||||||
|
import { minutesToTime } from "@/utils/utils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
posIcon: require("@/static/images/pos-icon.png"),
|
posIcon: require("@/static/images/pos-icon.png"),
|
||||||
selectIdx: 0,
|
selectIdx: 0,
|
||||||
dropdownValue: 1,
|
dropdownValue: "",
|
||||||
dropdownOptions: [
|
dropdownOptions: [
|
||||||
{
|
{
|
||||||
label: "保洁计划1",
|
label: "保洁计划1",
|
||||||
|
@ -94,32 +110,66 @@ export default {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
||||||
paramsId: "",
|
dataInfo: {
|
||||||
|
planName: "",
|
||||||
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
computed: {
|
||||||
|
// dropdownTitle() {
|
||||||
|
// // 通过 dropdownValue 匹配 对应的项,展示 label
|
||||||
|
// const item = this.dropdownOptions.find(
|
||||||
|
// (item) => item.value === this.dropdownValue
|
||||||
|
// );
|
||||||
|
// return item ? item.label : "";
|
||||||
|
// },
|
||||||
|
},
|
||||||
|
|
||||||
onLoad(options) {
|
onLoad(options) {
|
||||||
this.paramsId = options.id;
|
// this.paramsId = options.id;
|
||||||
|
this.dropdownValue = options.id;
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
|
this.getTodayPlanList();
|
||||||
this.getPlanInfoAreaList();
|
this.getPlanInfoAreaList();
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
|
minutesToTime,
|
||||||
|
|
||||||
changeTab(i) {
|
changeTab(i) {
|
||||||
console.log(i);
|
|
||||||
this.selectIdx = i;
|
this.selectIdx = i;
|
||||||
|
|
||||||
|
this.getPlanInfoAreaList();
|
||||||
|
},
|
||||||
|
|
||||||
|
changeDropdown(e) {
|
||||||
|
this.dropdownValue = e;
|
||||||
|
|
||||||
|
this.getPlanInfoAreaList();
|
||||||
|
},
|
||||||
|
|
||||||
|
// 获取今日计划
|
||||||
|
async getTodayPlanList() {
|
||||||
|
const res = await GetTodayPlanList();
|
||||||
|
if (res.succeed) {
|
||||||
|
this.dropdownOptions = res.data.map((item) => ({
|
||||||
|
label: item.name,
|
||||||
|
value: item.id,
|
||||||
|
}));
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
// 获取计划区域列表
|
// 获取计划区域列表
|
||||||
async getPlanInfoAreaList() {
|
async getPlanInfoAreaList() {
|
||||||
const res = await GetPlanInfoAreaList({
|
const res = await GetPlanInfoAreaList({
|
||||||
id: this.paramsId,
|
id: this.dropdownValue,
|
||||||
// isCompleted: false,
|
isCompleted: this.selectIdx === 0 ? true : false,
|
||||||
});
|
});
|
||||||
if (res.succeed) {
|
if (res.succeed) {
|
||||||
console.log("res...", res);
|
this.dataInfo = res.data;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -128,7 +178,7 @@ export default {
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.content {
|
.content {
|
||||||
height: 100vh;
|
// height: 100vh;
|
||||||
background: #f7f8fc;
|
background: #f7f8fc;
|
||||||
.slot-wrap {
|
.slot-wrap {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
@ -197,6 +247,7 @@ export default {
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
border-radius: 18rpx;
|
border-radius: 18rpx;
|
||||||
padding: 65rpx 46rpx;
|
padding: 65rpx 46rpx;
|
||||||
|
margin-bottom: 32rpx;
|
||||||
.schedule {
|
.schedule {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
@ -204,14 +255,25 @@ export default {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
background-color: #feeded; /* 背景颜色 */
|
// background-color: #feeded; /* 背景颜色 */
|
||||||
color: white;
|
color: white;
|
||||||
width: 160rpx;
|
width: 160rpx;
|
||||||
height: 45rpx;
|
height: 45rpx;
|
||||||
font-size: 30rpx;
|
font-size: 30rpx;
|
||||||
color: #db3636;
|
// color: #db3636;
|
||||||
border-bottom-left-radius: 500rpx; /* 切角 */
|
border-bottom-left-radius: 500rpx; /* 切角 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.schedule-completed {
|
||||||
|
color: #4278f4;
|
||||||
|
background-color: #e5ebff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.schedule-wait {
|
||||||
|
color: #db3636;
|
||||||
|
background-color: #feeded;
|
||||||
|
}
|
||||||
|
|
||||||
.name {
|
.name {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
|
|
@ -8,7 +8,7 @@ const manager = new RequestManager()
|
||||||
|
|
||||||
|
|
||||||
// 先写死调接口
|
// 先写死调接口
|
||||||
uni.setStorageSync('token', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIwOGRkNzFiZC01N2MxLTQ1YmMtODBiYS0xMjkzYjU4MTViMmEiLCJ1bmlxdWVfbmFtZSI6IuS_nea0gSIsInJvbGUiOiJVc2VyIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiIxODE3NDAxMDU2MiIsImdyb3Vwc2lkIjoiNGIyZDk2NjItYTc2OC0wOGYyLWEwYzgtNzYyYjhjNzZkYTJhIiwibmJmIjoxNzQ0MTgyMTM4LCJleHAiOjE3NDQxODU3MzgsImlhdCI6MTc0NDE4MjEzOH0.QQNQNiKe14L-anWPNAKcvLXtzy-eo1FL9hhTsbLKAxg')
|
uni.setStorageSync('token', 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9zaWQiOiIwOGRkNzFiZC01N2MxLTQ1YmMtODBiYS0xMjkzYjU4MTViMmEiLCJ1bmlxdWVfbmFtZSI6IuS_nea0gSIsInJvbGUiOiJVc2VyIiwiaHR0cDovL3NjaGVtYXMueG1sc29hcC5vcmcvd3MvMjAwNS8wNS9pZGVudGl0eS9jbGFpbXMvbW9iaWxlcGhvbmUiOiIxODE3NDAxMDU2MiIsImdyb3Vwc2lkIjoiNGIyZDk2NjItYTc2OC0wOGYyLWEwYzgtNzYyYjhjNzZkYTJhIiwibmJmIjoxNzQ0MTg3MTE5LCJleHAiOjE3NDQxOTA3MTksImlhdCI6MTc0NDE4NzExOX0.n7mnghRVAvzNw81I7WmT6O0L73S97C2hxFNuYiExsaQ')
|
||||||
|
|
||||||
|
|
||||||
const baseRequest = async (url, method, data = {}, loading = true) =>{
|
const baseRequest = async (url, method, data = {}, loading = true) =>{
|
||||||
|
|
|
@ -499,3 +499,18 @@ export function getDateDiff(date) {
|
||||||
return `${Math.abs(daysDiff)}天前`;
|
return `${Math.abs(daysDiff)}天前`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将分钟转换为时间格式
|
||||||
|
* @param {number} minutes 分钟
|
||||||
|
* @returns {string} 时间格式
|
||||||
|
*/
|
||||||
|
export function minutesToTime(minutes) {
|
||||||
|
const hours = Math.floor(minutes / 60);
|
||||||
|
const mins = minutes % 60;
|
||||||
|
const formattedHours = String(hours).padStart(2, '0');
|
||||||
|
const formattedMins = String(mins).padStart(2, '0');
|
||||||
|
return `${formattedHours}:${formattedMins}`;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue