|
@@ -2,24 +2,75 @@
|
|
|
<div class="list-page">
|
|
|
<main class="upload-box-background">
|
|
|
<div class="box-background"></div>
|
|
|
- <el-form class="upload-box" :model="form" label-position="left">
|
|
|
+ <el-form class="upload-box" :model="form" label-position="left" >
|
|
|
<p class="upload-title">水稻补贴面积上报</p>
|
|
|
- <el-form-item class="select-year">
|
|
|
- <span class="mr15">年份:</span>
|
|
|
- <el-select @change="change" v-model="form.region" placeholder="请选择年份">
|
|
|
- <el-option v-for="item in select_year" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
- </el-select>
|
|
|
- </el-form-item>
|
|
|
+ <div class="m-y">
|
|
|
+ <el-form-item class="select-year" >
|
|
|
+ <span class="m-t">{{ isShow ? '激活年份':'年份' }}</span>
|
|
|
+
|
|
|
+ <el-select style="width: 40%" clearable @change="change" v-model="form.year" placeholder="请选择年份">
|
|
|
+ <el-option v-for="item in select_year" :key="item.sdbtnfId" :label="item.nf" :value="item.sdbtnfId" />
|
|
|
+ </el-select>
|
|
|
+
|
|
|
+ </el-form-item>
|
|
|
+<!-- <el-form-item class="select-year" >-->
|
|
|
+<!-- <span class="m-t">编辑年份:</span>-->
|
|
|
+<!-- <el-select @change="change" clearable class="mr15" style="width: 24%" v-model="form.editYearId" placeholder="请选择年份">-->
|
|
|
+<!-- <el-option v-for="item in select_year" :key="item.sdbtnfId" :label="item.nf" :value="item.sdbtnfId" />-->
|
|
|
+<!-- </el-select>-->
|
|
|
+<!-- <el-input placeholder="请输入年份" style="width: 24%" v-model="form.editYearName"/>-->
|
|
|
+<!-- <el-button type="primary" class="bj-btn" @click="editYear">编辑</el-button>-->
|
|
|
|
|
|
- <el-form-item v-show="isShow" class="isActivate">
|
|
|
- <span class="mr15">是否激活:</span>
|
|
|
+<!-- </el-form-item>-->
|
|
|
+ <template v-if="isShow">
|
|
|
+ <el-form-item class="select-year" >
|
|
|
+ <span class="m-t" >新增年份:</span>
|
|
|
+ <el-input placeholder="请输入年份" class="mr15" clearable style="width: 24%" v-model="form.addYearName"/>
|
|
|
+ <el-button type="primary" @click="addYear">新增</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ <el-form-item class="select-year" >
|
|
|
+ <span class="m-t">删除年份:</span>
|
|
|
+ <el-select clearable class="mr15" @change="change" style="width: 24%" v-model="form.delYear" placeholder="请选择年份">
|
|
|
+ <el-option v-for="item in select_year" :key="item.sdbtnfId" :label="item.nf" :value="item.sdbtnfId" />
|
|
|
+ </el-select>
|
|
|
+ <el-button type="danger" @click="delYear">删除</el-button>
|
|
|
+ </el-form-item>
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+ </div>
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item v-show="isShow && form.year" class="isActivate">
|
|
|
+ <span class="mr15" >是否激活:</span>
|
|
|
<el-switch @change="changeStatus" style="--el-switch-on-color: #13ce66; --el-switch-off-color: #aaa"
|
|
|
v-model="form.status" />
|
|
|
</el-form-item>
|
|
|
<div class="upload-view-box">
|
|
|
<p v-show="!isShow" class="upload-view">
|
|
|
- <el-upload ref="upload" :multiple="false" :limit="1" action="" :http-request="toUpload"
|
|
|
- :on-exceed="handleExceed" :show-file-list="false" class="my-el-upload">水稻补贴上传</el-upload>
|
|
|
+ <span v-if="!form.year || !form.status" @click="getF">水稻补贴上传</span>
|
|
|
+ <el-upload
|
|
|
+ v-else
|
|
|
+ ref="upload"
|
|
|
+ :multiple="false"
|
|
|
+ :limit="1"
|
|
|
+
|
|
|
+ action=""
|
|
|
+ :http-request="toUpload"
|
|
|
+
|
|
|
+ :on-exceed="handleExceed"
|
|
|
+ :show-file-list="false"
|
|
|
+
|
|
|
+ class="my-el-upload"
|
|
|
+ >
|
|
|
+ 水稻补贴上传
|
|
|
+ <!-- <template v-for="file in fileList" >-->
|
|
|
+ <!-- <span :key="file.name">{{ file.name }}</span>-->
|
|
|
+ <!-- </template>-->
|
|
|
+ </el-upload>
|
|
|
+
|
|
|
+ <!-- <el-upload ref="upload" :multiple="false" :limit="1" action="" :http-request="toUpload"-->
|
|
|
+<!-- :on-exceed="handleExceed" :show-file-list="false" class="my-el-upload">水稻补贴上传</el-upload>-->
|
|
|
</p>
|
|
|
<p v-show="!isShow" class="upload-view">
|
|
|
<router-link to="/subsidyView">水稻补贴查看</router-link>
|
|
@@ -38,12 +89,19 @@
|
|
|
|
|
|
<script setup>
|
|
|
import {ref, reactive, onMounted, computed} from 'vue'
|
|
|
-import { uploadSituationListData } from "../../../api/riceSubsidies";
|
|
|
-import { select_year } from '../../../utils/data/select-data'
|
|
|
+import {
|
|
|
+ addYearInfo, delYearInfo,
|
|
|
+ editYearInfo,
|
|
|
+ getBtMjSdReportFile,
|
|
|
+ getRiceSlideAllYear,
|
|
|
+ uploadSituationListData
|
|
|
+} from "../../../api/riceSubsidies";
|
|
|
+const select_year = ref([])
|
|
|
|
|
|
// import { subsidyTypeArr } from '../../../utils/data/select-data'
|
|
|
import { genFileId } from 'element-plus'
|
|
|
import {getRootFun} from "@/utils/data/getRootFun";
|
|
|
+import {elAlert, handleMes, showMessage} from "@/utils/tip";
|
|
|
|
|
|
const isShow = computed(() => {
|
|
|
return getRootFun('水稻补贴年份新增')
|
|
@@ -51,21 +109,97 @@ const isShow = computed(() => {
|
|
|
|
|
|
|
|
|
const form = reactive({
|
|
|
- region: '',
|
|
|
+ year: '',
|
|
|
status: false,//按钮状态
|
|
|
+ editYearName:'',
|
|
|
+ addYearName:'',
|
|
|
+ delYear:'',
|
|
|
+ editYearId:'',
|
|
|
})
|
|
|
// 下拉选项
|
|
|
function change(e) {
|
|
|
- console.log(e);
|
|
|
- console.log(form.region);
|
|
|
+ form.status = Boolean(select_year.value.find(i => i.sdbtnfId ===form.year)?.active)
|
|
|
+ // console.log(e);
|
|
|
+ // console.log(form.year);
|
|
|
+}
|
|
|
+function editYear(status) {
|
|
|
+ // if (!form.editYearId){
|
|
|
+ // elAlert('请选择要修改的年份')
|
|
|
+ // }else {
|
|
|
+ // editYearInfo(form.editYearId,form.editYearName).then(res => {
|
|
|
+ // handleMes(res,() => {
|
|
|
+ // getAllYear()
|
|
|
+ // })
|
|
|
+ // })
|
|
|
+ // }
|
|
|
+ editYearInfo(form.year,select_year.value.find(i => i.sdbtnfId === form.year)?.nf,status).then(res => {
|
|
|
+ handleMes(res,() => {
|
|
|
+ getAllYear()
|
|
|
+ })
|
|
|
+ })
|
|
|
}
|
|
|
+function addYear() {
|
|
|
+ addYearInfo(form.addYearName).then(res => {
|
|
|
+ handleMes(res,() => {
|
|
|
+ getAllYear()
|
|
|
+ },()=>{},'新增成功','新增失败')
|
|
|
+ })
|
|
|
+}
|
|
|
+function delYear() {
|
|
|
+ if (!form.delYear){
|
|
|
+ elAlert('请选择要删除的年份')
|
|
|
+ }else {
|
|
|
+ delYearInfo(form.delYear).then(res => {
|
|
|
+ handleMes(res,() => {
|
|
|
+ form.delYear = ''
|
|
|
+ form.editYearId = ''
|
|
|
+ form.year = ''
|
|
|
+ getAllYear()
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
|
|
|
+}
|
|
|
+function getF(){
|
|
|
+ if (!form.status){
|
|
|
+ elAlert('请先激活')
|
|
|
+ }
|
|
|
+ else if (!form.year){
|
|
|
+ elAlert('请选择激活年份')
|
|
|
+ return false
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+function getAllYear(){
|
|
|
+ getRiceSlideAllYear().then(res => {
|
|
|
+ select_year.value = res.data
|
|
|
+ console.log('飒飒撒',res.data)
|
|
|
+ })
|
|
|
+}
|
|
|
onMounted(() => {
|
|
|
+ getAllYear()
|
|
|
})
|
|
|
|
|
|
//上传模板下载
|
|
|
function getTemplate() {
|
|
|
- window.open(import.meta.env.VITE_APP_BASE_ADDR + '/res/muban.xlsx', "_blank")
|
|
|
+ // getBtMjSdReportFile(form.year).then(res => {
|
|
|
+ // let isSuccess = false
|
|
|
+ // try {
|
|
|
+ // isSuccess =res.code === 200
|
|
|
+ // }catch {
|
|
|
+ // isSuccess = false
|
|
|
+ // }
|
|
|
+ // if (!isSuccess){
|
|
|
+ // showMessage({
|
|
|
+ // type:'error',
|
|
|
+ // message:res.msg || '操作失败'
|
|
|
+ // })
|
|
|
+ // }else {
|
|
|
+ // window.open(res.data, "_blank")
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ window.open(import.meta.env.VITE_APP_MAP_RICE_MB, "_blank")
|
|
|
}
|
|
|
|
|
|
//补贴上传
|
|
@@ -81,29 +215,48 @@ function handleExceed(files) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-function toUpload(e, el) {
|
|
|
- console.log('s', e.file, el)
|
|
|
- uploadSituationListData(e.file).then(res => {
|
|
|
- getList()
|
|
|
- })
|
|
|
-}
|
|
|
+// function toUpload(e, el) {
|
|
|
+// console.log('s', e.file, el)
|
|
|
+// uploadSituationListData(e.file).then(res => {
|
|
|
+// getList()
|
|
|
+// })
|
|
|
+// }
|
|
|
+function toUpload(e,el) {
|
|
|
+
|
|
|
+ console.log('s',e.file,el)
|
|
|
+ uploadSituationListData(e.file,form.year).then(res => {
|
|
|
+ handleMes(res,() => {
|
|
|
|
|
|
+ })
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
//开关状态
|
|
|
function changeStatus(status) {
|
|
|
- if (status === true) {
|
|
|
+ editYear(status)
|
|
|
+/* if (status === true) {
|
|
|
// 镇级可上传
|
|
|
console.log(1)
|
|
|
} else {
|
|
|
//镇级不可上传
|
|
|
console.log(2)
|
|
|
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
</script>
|
|
|
<style scoped lang="scss">
|
|
|
+.m-t{
|
|
|
+ width: 6em;
|
|
|
+}
|
|
|
+.bj-btn{
|
|
|
+ position: relative;
|
|
|
+ left: 15px;
|
|
|
+}
|
|
|
.upload-box-background {
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
@@ -132,6 +285,7 @@ function changeStatus(status) {
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
|
|
.upload-title {
|
|
|
+
|
|
|
font-size: 48px;
|
|
|
font-family: YSBTH;
|
|
|
font-weight: 400;
|
|
@@ -139,14 +293,21 @@ function changeStatus(status) {
|
|
|
color: #404040;
|
|
|
position: absolute;
|
|
|
left: 136px;
|
|
|
- top: 116px;
|
|
|
+ top: 50px;
|
|
|
}
|
|
|
+ .m-y{
|
|
|
+ padding-left: 8%;
|
|
|
+ position: absolute;
|
|
|
|
|
|
+ left: 0;
|
|
|
+ width: max-content;
|
|
|
+ right: 0;
|
|
|
+ margin: auto;
|
|
|
+ top: 130px;
|
|
|
+ }
|
|
|
.select-year {
|
|
|
color: #404040;
|
|
|
- position: absolute;
|
|
|
- left: 136px;
|
|
|
- top: 208px;
|
|
|
+
|
|
|
|
|
|
span {
|
|
|
font-size: 18px;
|
|
@@ -156,8 +317,8 @@ function changeStatus(status) {
|
|
|
.isActivate {
|
|
|
color: #404040;
|
|
|
position: absolute;
|
|
|
- left: 136px;
|
|
|
- top: 290px;
|
|
|
+ left: 435px;
|
|
|
+ top: 131px;
|
|
|
|
|
|
span {
|
|
|
font-size: 18px;
|
|
@@ -165,12 +326,13 @@ function changeStatus(status) {
|
|
|
}
|
|
|
|
|
|
.upload-view-box {
|
|
|
- margin-top: 372px;
|
|
|
+ margin-top: 400px;
|
|
|
display: flex;
|
|
|
justify-content: space-evenly;
|
|
|
align-items: center;
|
|
|
|
|
|
.upload-view {
|
|
|
+ cursor: pointer;
|
|
|
font-size: 24px;
|
|
|
font-family: Microsoft YaHei UI;
|
|
|
font-weight: 400;
|