Browse Source

接口实现

master
是小王呀\24601 1 year ago
parent
commit
7317702905
  1. 22
      yifengdian-company-report/src/api/test.js
  2. 1
      yifengdian-company-report/src/router/index.js
  3. 8
      yifengdian-company-report/src/router/router_modular/index.js
  4. 135
      yifengdian-company-report/src/views/bazaar.vue
  5. 24
      yifengdian-company-report/src/views/home.vue
  6. 2
      yifengdian-company-report/src/views/login.vue
  7. 42
      yifengdian-company-report/src/views/policy.vue
  8. 70
      yifengdian-company-report/src/views/policyDetails.vue
  9. 54
      yifengdian-company-report/src/views/vegetable.vue
  10. 53
      yifengdian-company-report/src/views/vegetableDetails.vue

22
yifengdian-company-report/src/api/test.js

@ -32,4 +32,26 @@ export function getVegetableOutputList (params) {
method: 'GET',
params
})
}
//种业资讯列表
export function seedNewsScreenList (params) {
return request({
url: '/api/resi/partymember/yifengScreen/seedNewsScreenList',
method: 'GET',
params
})
}
// 种业资讯详情
export function seedNewsScreenDetail (id) {
return request({
url: `/api/resi/partymember/yifengScreen/seedNewsScreenDetail/${id}`,
method: 'GET'
})
}
// 种都力量-企业详情
export function getVegetableOutputListDetail () {
return request({
url: '/api/resi/partymember/screenenterpriseoutput/yifengScreen/getVegetableOutputListDetail',
method: 'GET'
})
}

1
yifengdian-company-report/src/router/index.js

@ -18,4 +18,5 @@ router.beforeEach((to,from,next)=>{
router.afterEach((to,from)=>{
console.log(to,from);
})
export default router

8
yifengdian-company-report/src/router/router_modular/index.js

@ -2,7 +2,7 @@
const router_modular = [
{
path: '/',
path: '/login',
name: 'login',
component: () => import('@/views/login')
},
@ -16,10 +16,11 @@ const router_modular = [
path: '/vegetableDetails',
name: 'vegetableDetails',
component: () => import(/* webpackChunkName: "about" */ '@/views/vegetableDetails.vue'),
title:'企业上报'
title:'企业上报',
meta: { requiresAuth: true },
},
{
path: '/home',
path: '/',
name: 'home',
component: () => import(/* webpackChunkName: "about" */ '@/views/home.vue'),
title:'首页'
@ -51,4 +52,5 @@ const router_modular = [
]
export default router_modular

135
yifengdian-company-report/src/views/bazaar.vue

@ -8,10 +8,10 @@
</div>
</div>
<div>
<van-search v-model="searchKey" placeholder="请输入品种" background="#ffffff" shape="round" />
<van-search @search="goToSearch(searchKey)" v-model="searchKey" placeholder="请输入品种" background="#ffffff" shape="round" />
</div>
</div>
<div class="collect m-bot10">
<!-- <div class="collect m-bot10">
<div class="title flex flex-center2 ">
<img src="@/assets/images/icons/collect.png" alt="">
<span>收藏品种</span>
@ -23,11 +23,11 @@
v-for="(item, index) in collectList" :key="index" @close="handelClickClose(item)">{{ item
}}</van-tag>
</div>
</div>
</div> -->
<div class="card m-top10 list">
<div class="title">
<span class=""><img src="@/assets/images/icons/date-blue.png" alt=""
class="img-15 m-right4">2024-01-11</span>
class="img-15 m-right4">{{currentDate?currentDate:times }}</span>
<span>单位/公斤</span>
</div>
<div class="scroll-box m-top18">
@ -39,10 +39,14 @@
<section style="overflow: hidden;">
<div class="scroll-content">
<div class="flex flex-mean item" v-for="(item, index) in priceList" :key="'price' + index">
<div class="flex1 van-ellipsis" style="color: #333;">{{ item.name }} </div>
<div class="flex1 van-ellipsis" style="color: #333;">{{ item.Name }} </div>
<div class="flex1 van-ellipsis font-bold">{{ item.price }} </div>
<div class="vegetable-item-row2 flex1 van-ellipsis">{{ item.old }} <img
src="@/assets/up.png" alt="" style="width: 11px;height: 15px;"></div>
<div class="vegetable-item-row2 flex1 van-ellipsis">{{ item.jzrPrice }}
<img v-if="item.jzrPrice > 0 && item.jzrPrice != '暂无'" src="@/assets/up.png" alt=""
style="width: 11px;height: 15px;">
<img v-if="item.jzrPrice < 0 && item.jzrPrice != '暂无'" src="@/assets/down.png" alt=""
style="width: 11px;height: 15px;">
</div>
</div>
</div>
</section>
@ -53,15 +57,31 @@
type="date" title="选择年月日" />
</van-popup>
<van-popup v-model="showAdd" position="bottom" :style="{ height: '40%' }">
<van-checkbox v-model="checked" shape="square" v-for="(item,index) in collectList" :key="index">{{item}}</van-checkbox>
<van-checkbox v-model="checked" shape="square" v-for="(item, index) in collectList" :key="index">{{ item
}}</van-checkbox>
</van-popup>
</div>
</template>
<script>
import { prcCollectionListForGov, seedNewsScreenList } from '@/api/test'
export default {
data() {
return {
params: {
Country: 0,
FEndDate: this.$moment().format('yyyy-MM-DD'),
FParentPartyID: 1,
FPartyName: '青岛移风蔬菜批发市场有限公司',
FPartyType: 1010,
FStartDate: this.$moment().format('yyyy-MM-DD'),
FStoreId: 1,
Name: '全部',
page: 1,
pageSize: 10,
singletype: 0,
sort: ''
},
searchKey: null,
showDate: false,
currentDate: null,
@ -125,14 +145,100 @@ export default {
],
collectList: ['白菜', '白菜', '白菜', '白菜', '白菜', '白菜', '豆角', '西红柿', '西红柿', '黄瓜', '茄子', '洋葱', '彩椒'],
closeable: false,
showAdd:false,
checked:[]
showAdd: false,
checked: [],
dayList: [],
tDayList: [],
times: this.$moment().subtract(1, 'days').format('yyyy-MM-DD')
};
},
created() {
// this.onLoad()
this.getDayScData()
},
methods: {
goToSearch(data){
console.log(data);
this.getDayScData({name:data, FEndDate: this.currentDate,
FStartDate: this.currentDate})
},
getDayScData(data) {
prcCollectionListForGov({ ...this.params, ...data }).then((res) => {
console.log(res, "XIAOWANG");
if (res.data.priceslist.length > 0) {
this.dayList = res.data.priceslist
console.log("day");
console.log(this.dayList, "day");
this.getDayScTData()
} else {
console.log("11");
this.times = this.$moment(this.times)
.subtract(1, 'days')
.format('yyyy-MM-DD')
console.log(this.times);
this.getDayScData({
FEndDate: this.$moment(this.times)
.subtract(1, 'days')
.format('yyyy-MM-DD'),
FStartDate: this.$moment(this.times)
.subtract(1, 'days')
.format('yyyy-MM-DD')
})
}
})
},
getDayScTData() {
console.log(this.times);
prcCollectionListForGov({
...this.params,
FEndDate: this.times,
FStartDate: this.times
}).then((res1) => {
console.log(res1.data, "15216516516");
if (res1.data.priceslist.length > 0) {
this.priceList = this.getScData(this.dayList, res1.data.priceslist)
console.log(this.priceList);
} else {
this.times = this.$moment(this.times)
.subtract(1, 'days')
.format('yyyy-MM-DD')
this.getDayScTData()
}
})
},
deduplicationJs(arr) {
const data = []
arr.forEach((item, index) => {
if ((index + 1) % 2 === 0) {
const num = (arr[index - 1].AvgPrice + item.AvgPrice) / 2
data.push({ ...item, price: num })
}
})
return data
},
getScData(arr, arr1) {
const dataD = this.deduplicationJs(arr)
const dataTd = this.deduplicationJs(arr1)
return dataD.map((item, index) => {
const priceTd = dataTd.filter((item1) => item.Name === item1.Name)
// [0].price
if (priceTd.length > 0) {
const jzrPrice = (item.price - priceTd[0].price).toFixed(2)
return {
...item,
jzrPrice
}
} else {
return {
...item,
jzrPrice: '暂无'
}
}
})
},
onLoad() {
setTimeout(() => {
// if (this.refreshing) {
@ -156,12 +262,17 @@ export default {
},
handelCLickConfirmDate(val) {
this.currentDate = this.$dayjs(val).format('YYYY-MM-DD');
this.getDayScData({name:this.searchKey, FEndDate: this.currentDate,
FStartDate: this.currentDate})
this.showDate = false;
},
handelClickClose(val) {
console.log(val);
},
handelClickAddCollect(){
handelClickAddCollect() {
this.showAdd = true;
},
handelClickDelCollect() {

24
yifengdian-company-report/src/views/home.vue

@ -77,15 +77,15 @@
<span @click="$router.push('/policy')">更多 <img class="img-12" src="@/assets/images/home/right.png"
alt=""></span>
</div>
<div class="flex-y">
<div class="flex-y" v-for="(item, index) in policyList">
<div class="van-multi-ellipsis--l2 font-bold" style="font-weight: 500;">
市农业农村局开展智慧农业设施农业建设工作指导
{{ item.title }}
</div>
<div class="flex flex-end m-top12">
<div class="flex font-size14 flex-center2">
<img src="@/assets/images/home/unit.png" class="img-13" alt=""><span class="blue">青岛市人民政府</span>
<img src="@/assets/images/home/unit.png" class="img-13" alt=""><span class="blue">{{item.author }}</span>
</div>
<span class="gray">2024-03-05</span>
<span class="gray">{{ item.publishTime }}</span>
</div>
</div>
</div>
@ -93,7 +93,7 @@
<div class="container1">
<div class="movable-area" @touchstart="onMovableStart" @touchmove="onMovableMove" @touchend="onMovableEnd" >
<div class="movable-view" :style="{ left: x + 'px', top: y + 'px' }">
<img @click="$router.push('/vegetableDetails')" src="@/assets/images/home/shangbao.gif" class="draggable" alt="draggable image">
<img @click="$router.push('/login')" src="@/assets/images/home/shangbao.gif" class="draggable" alt="draggable image">
</div>
</div>
</div>
@ -102,7 +102,7 @@
<script>
import { mapActions } from 'vuex'
import { prcCollectionListForGov, getVegetableOutputList } from '@/api/test'
import { prcCollectionListForGov, getVegetableOutputList,seedNewsScreenList } from '@/api/test'
export default {
data() {
@ -135,6 +135,7 @@ export default {
vegetableList: [
],
policyList:[],
priceList: [
],
@ -149,8 +150,16 @@ export default {
},
created() {
this.getDayScData()
this.seedNewsScreenList()
},
methods: {
seedNewsScreenList(){
seedNewsScreenList({}).then((res) => {
this.policyList = res.data.data.slice(0,2)
console.log(this.policyList,"564698");
})
},
onMovableStart(event) {
console.log("123");
this.dragging = true;
@ -201,6 +210,7 @@ export default {
openPdf() {
this.set_viewPdf(true)
},
deduplicationJs(arr) {
const data = []
arr.forEach((item, index) => {
@ -379,8 +389,6 @@ export default {
}
}
.container1 {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;

2
yifengdian-company-report/src/views/login.vue

@ -82,7 +82,7 @@ export default {
//
if (response.data.code == 0) {
// this.$router.push(`/list?placeOrgName=${this.placeOrgName}`); //
this.$router.replace(`/home`); //
this.$router.replace(`/vegetableDetails`); //
} else {
Toast({ message: response.data.msg });
}

42
yifengdian-company-report/src/views/policy.vue

@ -1,25 +1,20 @@
<template>
<div class=''>
<div class="flex flex-center" style="background-color: #ffffff;">
<van-search v-model="searchKey" shape="round" background="#ffffff" placeholder="请输入搜索关键词" class="flex1" />
<div class="collect flex flex-center2" style="width: 100px;">
<img class="img-15" src="@/assets/images/icons/collect.png" alt="">
<span>个人收藏</span>
</div>
<van-search @blur="onSeaech()" v-model="searchKey" shape="round" background="#ffffff" placeholder="请输入搜索关键词" class="flex1" />
</div>
<div class="container">
<div class="card">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<van-cell v-for="item in dataArray" :key="item" @click="$router.push('/policyDetails')" >
<div class="font-pingfangB">{{ item.title }}</div>
<div class="flex flex-x flex-end">
<van-cell v-for="item in policyList" :key="item" @click="goToPolicyDetails(item.id)" >
<div class="font-pingfangB font-size17">{{ item.title }}</div>
<div class="flex flex-x flex-end m-top10">
<div class="flex flex-x flex-center1 flex-center2 ">
<img class="img-13" src="@/assets/images/home/unit.png" alt="图片">
<div class="font-size13 blue">{{ item.source }}</div>
<div class="font-size13 blue">{{ item.author }}</div>
</div>
<div class="gray">{{ item.date }}</div>
<div class="gray">{{ item.publishTime }}</div>
</div>
@ -33,11 +28,12 @@
</template>
<script>
import { seedNewsScreenList } from '@/api/test'
export default {
data() {
return {
searchKey: '',
dataArray: [
policyList: [
{
title: "市农业农村局开展智慧农业、设施农业建设工作指导",
source: "青岛市人民政府",
@ -51,8 +47,26 @@ export default {
]
};
},
created() { },
methods: {},
created() {
this.seedNewsScreenList()
},
methods: {
onSeaech(){
console.log(this.searchKey);
this.seedNewsScreenList(this.searchKey)
},
goToPolicyDetails(id){
console.log(id,"id");
this.$router.push({ path: '/policyDetails', query: { id: id } });
},
seedNewsScreenList(title){
seedNewsScreenList({title}).then((res) => {
this.policyList = res.data.data
console.log(this.policyList,"564698");
})
},
},
components: {},
computed: {},
watch: {},

70
yifengdian-company-report/src/views/policyDetails.vue

@ -8,32 +8,28 @@
<div class="flex flex-x flex-end m-top10 m-bot10">
<div class="flex flex-x flex-center1 flex-center2 ">
<img class="img-13" src="@/assets/images/home/unit.png" alt="图片">
<div class="font-size14 blue">{{ ArrayList.source }}</div>
<div class="font-size14 blue">{{ ArrayList.author }}</div>
</div>
<div class="gray font-size14 ">{{ ArrayList.date }}</div>
<div class="gray font-size14 ">{{ ArrayList.publishTime }}</div>
</div>
<div class="m-top18" v-html="ArrayList.context "></div>
</div>
<div class="bto_btn flex flex-x flex-center1 flex-center2 ">
<van-button v-if="!collection" color="#E5F1FD" style="width: 120px;" class="custom-button-uncollected" round type="info">收藏</van-button>
<van-button v-if="collection" color="#0089F0" style="width: 120px;" round type="info">收藏</van-button>
<div class="v-html-content" v-html="ArrayList.content "></div>
</div>
</div>
</template>
<script>
import { seedNewsScreenDetail } from '@/api/test'
import Toast from "vant/es/toast";
import axios from "axios";
import config from "@/config/index";
const baseUrl =
process.env.NODE_ENV === "development" ? "" : config.baseUrl.pro;
export default {
data() {
return {
policyId:"",
placeOrgName: null,
password: null,
collection:false,
@ -41,45 +37,56 @@
source: "青岛市人民政府",
date: "2024-03-14",
context:" <B>各区、市人民政府,青岛西海岸新区管委,市 政府各部门,市直各单位: 为深入贯彻党的二十 大关于加快建设农业强国的部署要"
}
};
},
methods: {
getDayScTData () {
prcCollectionListForGov({
...this.params,
FEndDate: this.times,
FStartDate: this.times
}).then((res1) => {
console.log(res1);
if (res1.priceslist.length > 0) {
this.shichangList = this.getScData(this.dayList, res1.priceslist)
} else {
this.times = this.$moment(this.times)
.subtract(1, 'days')
.format('yyyy-MM-DD')
this.getDayScTData()
}
})
created(){
this.policyId = this.$route.query.id;
this.getSeedNewsScreenDetail()
},
methods: {
getSeedNewsScreenDetail () {
seedNewsScreenDetail(this.policyId).then((res) => {
console.log(res.data.data,"res");
this.ArrayList=res.data.data
})
}
},
// getDayScTData () {
// seedNewsScreenDetail({
// ...this.params,
// FEndDate: this.times,
// FStartDate: this.times
// }).then((res1) => {
// console.log(res1);
// if (res1.priceslist.length > 0) {
// this.shichangList = this.getScData(this.dayList, res1.priceslist)
// } else {
// this.times = this.$moment(this.times)
// .subtract(1, 'days')
// .format('yyyy-MM-DD')
// this.getDayScTData()
// }
// })
// },
};
</script>
<style scoped>
.login-container {
width: 100%;
height: 100vh;
overflow: hidden;
display: flex;
flex-direction: column;
/* 添加适应手机屏幕的样式 */
}
.v-html-content >>> img{
width:340px;
}
.form-box {
height: calc(100vh - 380px);
background: #ffffff;
position: relative;
border-radius: 24px 24px 0 0;
@ -103,6 +110,7 @@
color: #ffffff;
line-height: 30px;
}
</style>

54
yifengdian-company-report/src/views/vegetable.vue

@ -2,27 +2,28 @@
<div class='flex' style="overflow: hidden;">
<div>
<van-sidebar v-model="activeKey">
<van-sidebar-item :title="item.name" v-for="(item, index) in list" :key="index" />
<van-sidebar-item @click="onDatils(item)" :title="item.vegetableCategory" v-for="(item, index) in titleList" :key="index" />
</van-sidebar>
</div>
<div class="flex1" style="overflow-y: scroll;height: 100vh;">
<van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
<div v-for="(item, index) in vegetList" :key="index" class="item m-top10">
<div class="unit m-top15">{{ item.unit }}</div>
<div class="m-top12"> <span class="label">种植时间</span> <span class="value">{{ item.startTime }}</span></div>
<div class="m-top12"> <span class="label">上市时间</span> <span class="value">{{ item.endTime }}</span></div>
<div class="m-top12"> <span class="label">产量</span> <span class="value yellow">{{ item.num }}</span> </div>
<div v-for="(item, index) in numList" :key="index" class="item m-top10">
<div class="unit m-top15">{{ item.placeOrgName }}</div>
<div class="m-top12"> <span class="label">种植时间</span> <span class="value">{{ item.growTime }}</span></div>
<div class="m-top12"> <span class="label">上市时间</span> <span class="value">{{ item.marketTime }}</span></div>
<div class="m-top12"> <span class="label">产量</span> <span class="value yellow">{{ item.output }}</span> </div>
</div>
</van-list>
</div>
<div class="footer flex flex-end flex-center2">
<div></div>
<div><span>总计</span><span class="yellow font-size24 font-bold">9800</span><span class="yellow"></span></div>
<div ><span>总计</span><span class="yellow font-size24 font-bold">{{allNum}}</span><span class="yellow"></span></div>
</div>
</div>
</template>
<script>
import { getVegetableOutputListDetail } from '@/api/test'
export default {
data() {
return {
@ -32,6 +33,7 @@ export default {
{ name: '白菜', id: 1 },
{ name: '西红柿', id: 2 },
],
titleList:[],
loading: false,
finished: false,
vegetList: [
@ -65,13 +67,47 @@ export default {
endTime: '2024-02-04',
num: '100'
}
]
],
numList:[],
currentId:0,
allNum:0
};
},
created() {
// this.onLoad()
getVegetableOutputListDetail().then((res) => {
this.titleList = res.data.data
console.log(this.titleList,"3254345");
this.numList = res.data.data[0].detailList.map((item1) => {
return {
...item1,
// allNum:this.allNum+item1.output
// growTime: this.formatDateTime(new Date(item1.growTime)),
// marketTime: this.formatDateTime(new Date(item1.marketTime))
}
})
this.allNum = this.numList.reduce((acc, item) => {
return acc + item.output;}, 0);
console.log(this.allNum);
})
},
methods: {
onDatils(param){
console.log(param,"3254345");
this.currentId = param.vegetableCategory
this.numList = param.detailList.map((item1) => {
return {
...item1,
allNum:this.allNum+item1.output
}
})
console.log(this.numList);
this.allNum = this.numList.reduce((acc, item) => {
return acc + item.output;}, 0);
console.log(this.allNum);
},
onLoad() {
setTimeout(() => {
// if (this.refreshing) {

53
yifengdian-company-report/src/views/vegetableDetails.vue

@ -1,8 +1,13 @@
<template>
<div>
<van-tabs color="#3974F6" title-active-color="#3974F6">
<!-- <van-tabs color="#3974F6" title-active-color="#3974F6">
<van-tab title="信息填报">
<div class="flex flex-y">
</van-tab>
</van-tabs> -->
<div class="flex flex-y">
<div class="header font-size17 font-pingfangB text-center flex flex-center2 ">
<div class="m-left25">青岛德龙种业有限公司</div>
</div>
@ -113,47 +118,6 @@
<button @click="onSubmit" class="login-btn">上报</button></div>
</div>
</van-tab>
<van-tab title="历史信息">
<div class="header font-size17 font-pingfangB text-center flex-center1 flex flex-center2 ">
<van-button type="primary" icon-position="right" @click="onTime()" size="small" round color="#f7f8fa" style="width: 173px;">
<div class="gray flex flex-x flex- center2 flex-end" style="width: 150px;">
<div>{{Selectdate?Selectdate:"全部" }}</div>
<img src="../assets/images//icons//date.png" class="img-15 m-left25" style="right: 1px;"></div>
</van-button>
<van-search v-model="searchKey" style="width: 190px;" shape="round" background="#ffffff"search-background-color="#C1C1C1" placeholder="请输入品种" />
</div>
<div class="container">
<div class="card flex flex-y">
<div class="flex flex-x m-bot12 flex-center2" >
<img src="../assets/images//icons//date-blue.png" class="img-15">
<div class="font-size14 blue m-left5 ">2024-01</div>
</div>
<div class="border-btn" v-for="item in hisList">
<div class="font-pingfangB m-top12">{{ item.vegetable }}</div>
<div class="gray">种植时间:{{ item.PlantingTime }}</div>
<div class="gray">上市时间:{{ item.launchTime }}</div>
<div class="gray m-bot12">产量():{{ item.yield }}</div></div>
</div>
</div>
<div v-show="timeShow3" class="picker-box">
<van-datetime-picker
type="date"
v-show="timeShow3"
@cancel="onCancelTime3"
@confirm="onConfirmTime3"
:value="new Date(vegetableList[index].growTime)"
/>
</div>
</van-tab>
</van-tabs>
</div>
@ -228,11 +192,12 @@ export default {
method: "post",
url: `${baseUrl}/api/sys/dict/data/yifengScreen/dictlist`,
data: {
dictType: "",
dictType: "vegetable",
},
})
.then((response) => {
//
console.log(response,"log");
if (response.data.code == 0) {
this.columns = response.data.data.map((item) => {
return item.label;

Loading…
Cancel
Save