You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
326 lines
8.5 KiB
326 lines
8.5 KiB
<template>
|
|
<view class="v-pages">
|
|
<view class="m-top-bar">
|
|
<uni-section class="m-block-pick" title="批次">
|
|
<uni-data-select :clear="false" v-model="defaultBitch" :localdata="bitchList" @change="bathChange"></uni-data-select>
|
|
</uni-section>
|
|
<view class="add-btn" v-if="canClick" @click="goNoteJob">记农事</view>
|
|
</view>
|
|
<view class="note-list" v-if="activities.length > 0">
|
|
<view class="note-item-box" v-for="(item, index) in activities">
|
|
<vlew class="item-title" :class="index == 0 ? 'active-title' : ''">
|
|
<span class="title-time" v-if="item.operatingTime && item.operatingTime != '' && item.operatingTime != null">
|
|
{{ parseTime(item.operatingTime, '{y}-{m}-{d} {h}:{i}') }}
|
|
</span>
|
|
<span class="titme-name">{{ item.husbandryName && item.husbandryName != '' && item.husbandryName != null ? item.husbandryName : '-' }}</span>
|
|
</vlew>
|
|
<view class="item-data" :class="index == 0 ? 'active-data' : ''">
|
|
<view class="item-label" v-if="item.nickname">
|
|
农事负责人:
|
|
<span class="item-value">{{ item.nickname && item.nickname != '' && item.nickname != null ? item.nickname : '-' }}</span>
|
|
</view>
|
|
<view class="item-label" v-if="item.operator">
|
|
操作人:
|
|
<span class="item-value">{{ item.operator && item.operator != '' && item.operator != null ? item.operator : '-' }}</span>
|
|
</view>
|
|
<view class="item-label" v-if="item.jobTime">
|
|
农事时间:
|
|
<span class="item-value">{{ parseTime(item.jobTime, '{y}-{m}-{d}') }}</span>
|
|
</view>
|
|
<view class="item-label" v-if="item.husbandryId && item.husbandryId == 1">
|
|
种植方式:
|
|
<dict-tag :type="'planting_way'" :value="item.plantingWay" class="m-dic-tag" />
|
|
</view>
|
|
<view class="item-label">
|
|
作业方式:
|
|
<dict-tag :type="'operation_way'" :value="item.jobWay" class="m-dic-tag" />
|
|
</view>
|
|
<view class="item-label" v-if="item.husbandryId && item.husbandryId == 11">
|
|
采收数量:
|
|
<span class="item-value">{{ item.production && item.production != '' && item.production != null ? item.production : '-' }}公斤</span>
|
|
</view>
|
|
<view class="item-label" v-if="item.agriculturalList && item.agriculturalList.length > 0">
|
|
农资:
|
|
<view class="nz-list" v-for="items in item.agriculturalList">
|
|
<view class="nz-top">
|
|
<view class="nz-name">{{ items.agriculturalName && items.agriculturalName != '' && items.agriculturalName != null ? items.agriculturalName : '-' }}</view>
|
|
<view class="nz-com">{{ items.manufacturer && items.manufacturer != '' && items.manufacturer != null ? items.manufacturer : '-' }}</view>
|
|
</view>
|
|
<view class="nz-used">
|
|
{{ items.agriculturalUsed && items.agriculturalUsed != '' && items.agriculturalUsed != null ? items.agriculturalUsed : 0
|
|
}}{{ items.agriculturalUnit && items.agriculturalUnit != '' && items.agriculturalUnit != null ? items.agriculturalUnit : '' }}
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="item-label" v-if="item.husbandryImage && item.husbandryImage.length > 0">
|
|
<view class="">农事照片:</view>
|
|
<htz-image-upload
|
|
v-model="item.husbandryImage"
|
|
:chooseNum="1"
|
|
:compress="false"
|
|
:max="1"
|
|
:showTips="false"
|
|
:remove="false"
|
|
:add="false"
|
|
:quality="80"
|
|
:sourceType="['album', 'camera']"
|
|
class="m-img-upload"
|
|
mediaType="image"
|
|
></htz-image-upload>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<view class="no-data" v-else>
|
|
<image src="@/static/images/default-data.svg" mode=""></image>
|
|
暂无数据
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import { getCropperNote } from '@/api/system/addNoteJob/addNoteJob.js';
|
|
import { parseTime } from '@/utils/ruoyi';
|
|
import { getDictDatas, DICT_TYPE } from '@/utils/dict';
|
|
import DictTag from '@/components/DictTag/index.vue';
|
|
import htzImageUpload from '@/components/htz-image-upload/htz-image-upload.vue';
|
|
|
|
export default {
|
|
components: {
|
|
DictTag,
|
|
htzImageUpload
|
|
},
|
|
data() {
|
|
return {
|
|
resviceData: null,
|
|
bitchList: [],
|
|
defaultBitch: 1,
|
|
activities: [],
|
|
canClick: true
|
|
};
|
|
},
|
|
onLoad(options) {
|
|
if (options.params) {
|
|
this.resviceData = JSON.parse(options.params);
|
|
this.resviceData.choose = false;
|
|
this.getBathList(this.resviceData.batch);
|
|
this.defaultBitch = this.resviceData.batch;
|
|
this.getCropperNote(this.defaultBitch);
|
|
}
|
|
},
|
|
methods: {
|
|
//格式化时间
|
|
parseTime(time, pattern) {
|
|
return parseTime(time, pattern);
|
|
},
|
|
//批次下拉
|
|
getBathList(batch) {
|
|
this.bitchList = [];
|
|
for (let index = 1; index <= batch; index++) {
|
|
this.bitchList.push({
|
|
value: index,
|
|
text: this.resviceData.productName + '-' + this.resviceData.blockName + '-第' + index + '批'
|
|
});
|
|
}
|
|
},
|
|
//批次切换
|
|
bathChange(e) {
|
|
this.defaultBitch = e;
|
|
this.resviceData.batch = e;
|
|
console.log(e, this.resviceData);
|
|
this.getCropperNote(e);
|
|
},
|
|
//几农事
|
|
goNoteJob() {
|
|
const data = encodeURIComponent(JSON.stringify(this.resviceData));
|
|
console.log(data);
|
|
uni.navigateTo({
|
|
url: '/sunPages/addNoteJob/addNoteJob?params=' + data
|
|
});
|
|
},
|
|
//批次详情
|
|
getCropperNote(val) {
|
|
getCropperNote(this.resviceData.cropperId, val)
|
|
.then((res) => {
|
|
this.activities = res.data;
|
|
this.activities.forEach((item) => {
|
|
if (item.husbandryImage && item.husbandryImage.includes(',')) {
|
|
item.husbandryImage = item.husbandryImage.split(',');
|
|
} else if (item.husbandryImage && item.husbandryImage.includes(',') == false) {
|
|
item.husbandryImage = [item.husbandryImage];
|
|
}
|
|
});
|
|
if (this.activities.length == 0) {
|
|
this.canClick = true;
|
|
} else if (this.activities.length > 0) {
|
|
for (let i = 0; i < this.activities.length; i++) {
|
|
if (this.activities[i].husbandryId == 11) {
|
|
this.canClick = false;
|
|
break;
|
|
} else {
|
|
this.canClick = true;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
.catch((err) => {
|
|
console.log(err);
|
|
});
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
/deep/ .m-img-upload .htz-image-upload-Item {
|
|
background-color: #eee;
|
|
}
|
|
.v-pages {
|
|
background-color: #f5f5f5;
|
|
height: fit-content;
|
|
min-height: 100vh;
|
|
padding-bottom: 100rpx;
|
|
}
|
|
/deep/ .m-block-pick {
|
|
.uni-section {
|
|
display: flex;
|
|
align-items: center;
|
|
background-color: unset;
|
|
}
|
|
|
|
.uni-select {
|
|
border: none;
|
|
}
|
|
}
|
|
|
|
.m-top-bar {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding-right: 30rpx;
|
|
background-color: #fff;
|
|
|
|
.add-btn {
|
|
background: #11d6811c;
|
|
border-radius: 20rpx;
|
|
border: 1px solid #14c171;
|
|
padding: 5rpx 10rpx;
|
|
font-size: 24rpx;
|
|
color: #14c171;
|
|
}
|
|
}
|
|
|
|
.note-list {
|
|
padding: 20rpx 30rpx;
|
|
margin: 20rpx;
|
|
background: #fff;
|
|
border-radius: 20rpx;
|
|
|
|
.note-item-box {
|
|
padding: 0 20rpx;
|
|
margin-bottom: 20rpx;
|
|
|
|
.item-title {
|
|
font-weight: 500;
|
|
font-size: 32rpx;
|
|
color: #1b1b1b;
|
|
line-height: 60rpx;
|
|
width: 100%;
|
|
position: relative;
|
|
padding-left: 50rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
&:before {
|
|
content: '';
|
|
width: 25rpx;
|
|
height: 25rpx;
|
|
opacity: 0.3;
|
|
background-color: #14c171;
|
|
position: absolute;
|
|
top: 10px;
|
|
left: 0;
|
|
border-radius: 50%;
|
|
border: none;
|
|
}
|
|
|
|
.titme-name {
|
|
margin-left: 20rpx;
|
|
}
|
|
}
|
|
.active-title:before {
|
|
opacity: 1;
|
|
}
|
|
.item-data {
|
|
background-color: rgba(0, 0, 0, 0.03);
|
|
border-radius: 20rpx;
|
|
padding: 20rpx;
|
|
margin-left: 35rpx;
|
|
position: relative;
|
|
&:before {
|
|
content: '';
|
|
width: 2rpx;
|
|
height: 100%;
|
|
background-color: #ddd;
|
|
border: none;
|
|
position: absolute;
|
|
left: -25rpx;
|
|
top: 0;
|
|
}
|
|
|
|
.item-label {
|
|
font-weight: 400;
|
|
font-size: 28rpx;
|
|
color: #999999;
|
|
line-height: 60rpx;
|
|
|
|
.item-value,
|
|
.m-dic-tag {
|
|
color: #333;
|
|
margin-left: 10rpx;
|
|
}
|
|
|
|
.nz-list {
|
|
background-color: rgba(0, 0, 0, 0.05);
|
|
border-radius: 12rpx;
|
|
padding: 15rpx;
|
|
margin-bottom: 30rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
|
|
.nz-top {
|
|
max-width: 70%;
|
|
.nz-name {
|
|
color: #333;
|
|
}
|
|
.nz-name,
|
|
.nz-com {
|
|
white-space: nowrap;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
}
|
|
}
|
|
|
|
.nz-used {
|
|
font-weight: 500;
|
|
font-size: 24rpx;
|
|
color: #14c171;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
.active-data:before {
|
|
background: linear-gradient(180deg, #14c171 0%, #14c17100 100%);
|
|
}
|
|
}
|
|
}
|
|
.no-data {
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
color: #666;
|
|
height: 100vh;
|
|
background: #fff;
|
|
padding-top: 100rpx;
|
|
}
|
|
</style>
|
|
|