xnzt/xnzt-h5/pages/formPages/enterprise/enterpriseDevelopmentForm/index.vue
2024-11-11 10:27:27 +08:00

313 lines
8.1 KiB
Vue

<template>
<!-- <div class="enterpriseDevelopmentForm">enterpriseDevelopmentForm</div> -->
<view class="enterpriseDevelopmentForm">
<view>
<uni-forms
ref="form"
:model="form"
class="form"
label-position="top"
label-width="100%"
>
<uni-forms-item label="社员规模(户)" name="memberSize">
<uni-easyinput
v-model="form.memberSize"
placeholder="请输入社员规模(户)"
type="number"
/>
</uni-forms-item>
<uni-forms-item
class="flex-radio"
label="股金规模(万元)"
name="capitalScale"
>
<uni-easyinput
v-model="form.capitalScale"
placeholder="请输入股金规模(万元)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="产业投入(万元)" name="inputFee">
<uni-easyinput
v-model="form.inputFee"
placeholder="请输入产业投入(万元)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="流转土地(亩)" name="circulatingLand">
<uni-easyinput
v-model="form.circulatingLand"
placeholder="请输入流转土地(亩)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="产业规模" name="industrialScale">
<uni-easyinput
v-model="form.industrialScale"
placeholder="请输入产业规模"
/>
</uni-forms-item>
<uni-forms-item label="种植土地规模(亩)" name="plantingLandScale">
<uni-easyinput
v-model="form.plantingLandScale"
placeholder="请输入种植土地规模(亩)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="种植品种" name="plantingArieties">
<uni-easyinput
v-model="form.plantingArieties"
placeholder="请输入种植品种"
/>
</uni-forms-item>
<uni-forms-item label="种植产量(吨)" name="plantingYield">
<uni-easyinput
v-model="form.plantingYield"
placeholder="请输入种植产量(吨)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="养殖区(平方米)" name="breedingArea">
<uni-easyinput
v-model="form.breedingArea"
placeholder="请输入养殖区(平方米)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="养殖品种" name="breed">
<uni-easyinput v-model="form.breed" placeholder="请输入养殖品种" />
</uni-forms-item>
<uni-forms-item label="年出栏(存栏)(头)" name="yearOut">
<uni-easyinput
v-model="form.yearOut"
placeholder="请输入年出栏(存栏)(头)"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="种(养)植面积" name="measureArea">
<uni-easyinput
v-model="form.measureArea"
placeholder="请输入种(养)植面积"
type="number"
/>
</uni-forms-item>
<uni-forms-item label="主体服务范围" name="serviceScope">
<uni-easyinput
v-model="form.serviceScope"
placeholder="请输入主体服务范围"
/>
</uni-forms-item>
</uni-forms>
<view style="height: 44px">
<button v-if="false">
<text>{{ "测 试" }}</text>
</button>
</view>
</view>
<view v-if="true" class="foot">
<button @click="cencel" :plain="false" class="cencel">
<text>{{ "取 消" }}</text>
</button>
<button @click="showConfirm" type="primary" class="confirm">
<text>{{ "确 认" }}</text>
</button>
</view>
</view>
</template>
<script>
import {
addEnterpriseDevelopment,
updateEnterpriseDevelopment,
selectEnterpriseDevelopment,
} from "@/api/enterprise/enterpriseDevelopment";
export default {
name: "enterpriseDevelopmentForm",
components: {},
props: {},
data() {
return {
form: {},
};
},
computed: {},
methods: {
getEnterpriseDevelopment() {
selectEnterpriseDevelopment().then((response) => {
let form = response.data;
if (!(form === undefined || form.id === null || form.id === "")) {
this.form = response.data;
}
this.$modal.closeLoading();
});
},
naviBack(isNew) {
let pages = getCurrentPages(); //关于获取页面的官方文档https://uniapp.dcloud.io/api/window/window
let prevPage = pages[pages.length - 2];
uni.navigateBack({
delta: 1,
success: () => {
if (isNew !== undefined) {
setTimeout(function () {
prevPage.$vm.getMsg(isNew);
}, 200);
}
},
});
},
async reset() {
this.form = {
id: null,
baseId: null,
memberSize: null,
capitalScale: null,
inputFee: null,
circulatingLand: null,
industrialScale: null,
plantingLandScale: null,
plantingArieties: null,
plantingYield: null,
breedingArea: null,
breed: null,
yearOut: null,
measureArea: null,
serviceScope: null,
};
},
cencel() {
this.naviBack();
},
submitForm() {
//法人信息表单提交
let isNew =
this.form.id === null ||
this.form.id === undefined ||
this.form.id === "";
if (isNew) {
addEnterpriseDevelopment(this.form).then((response) => {
this.naviBack(isNew);
});
} else {
updateEnterpriseDevelopment(this.form).then((response) => {
this.naviBack(isNew);
});
}
},
showConfirm() {
this.$refs["form"].validate().then((res) => {
this.$cus_modal.confirm().then((conf_res) => {
if (conf_res.confirm === true) {
this.submitForm();
}
});
});
},
},
watch: {},
// 页面周期函数--监听页面加载
onLoad() {
this.$modal.loading("加载中,请耐心等待...");
this.reset().then(() => {
this.getEnterpriseDevelopment();
});
},
// 页面周期函数--监听页面初次渲染完成
onReady() {},
// 页面周期函数--监听页面显示(not-nvue)
onShow() {},
// 页面周期函数--监听页面隐藏
onHide() {},
// 页面周期函数--监听页面卸载
onUnload() {
const that = this
return that.$listenOB.goBack()
},
// 页面处理函数--监听用户下拉动作
// onPullDownRefresh() { uni.stopPullDownRefresh(); },
// 页面处理函数--监听用户上拉触底
// onReachBottom() {},
// 页面处理函数--监听页面滚动(not-nvue)
// onPageScroll(event) {},
// 页面处理函数--用户点击右上角分享
// onShareAppMessage(options) {},
};
</script>
<style lang="scss" scoped>
.enterpriseDevelopmentForm {
background-color: white;
height: calc(100%);
.foot {
width: 100vw;
height: 44px;
bottom: 0px;
display: flex;
position: fixed;
z-index: 2;
.cencel {
border-radius: 0px;
border: 0px;
width: 50%;
background-color: white;
}
.confirm {
border-radius: 0px;
border: 0px;
width: 50%;
color: white;
}
}
}
.form {
text-align: center;
margin: auto;
width: 80%;
/deep/ .flex-radio {
uni-radio-group {
width: 100%;
.checklist-group {
display: flex;
justify-content: space-evenly;
}
}
}
/deep/ .uni-forms-item {
.uni-forms-item__content {
.uni-file-picker {
.uni-file-picker__header {
.file-title {
span {
color: #ff0000a6;
}
}
}
}
.uni-mt-5 {
.uni-icons {
background: #007aff21;
line-height: 35px;
height: 35px;
}
}
.uni-select-cy {
z-index: 1;
.uni-select-cy-select {
z-index: -500;
}
}
}
}
}
</style>