xnzt/xnzt-h5/pages/formPages/enterprise/intellectualPropertyForm/index.vue

264 lines
6.3 KiB
Vue
Raw Normal View History

2024-11-11 10:27:27 +08:00
<template>
<!-- <div class="intellectualPropertyForm">intellectualPropertyForm</div> -->
<view class="intellectualPropertyForm">
<view>
<uni-forms
ref="form"
:model="form"
class="form"
label-position="top"
label-width="100%"
>
<uni-forms-item label="无公害认证" name="isNuisanceless" v-if="false">
<uni-data-select
v-model="form.isNuisanceless"
:localdata="dictLists['sys_yes_no']"
placeholder="请选择无公害认证"
/>
</uni-forms-item>
<uni-forms-item label="绿色产品认证" name="isGreen">
<uni-data-select
v-model="form.isGreen"
:localdata="dictLists['sys_yes_no']"
placeholder="请选择绿色产品认证"
/>
</uni-forms-item>
<uni-forms-item label="有机产品认证" name="isOrganic">
<uni-data-select
v-model="form.isOrganic"
:localdata="dictLists['sys_yes_no']"
placeholder="请选择有机产品认证"
/>
</uni-forms-item>
<uni-forms-item label="注册商标(名称)" name="trademark">
<uni-easyinput
v-model="form.trademark"
placeholder="请输入注册商标(名称)"
/>
</uni-forms-item>
</uni-forms>
</view>
<view style="height: 44px">
<button v-if="false">
<text>{{ "测 试" }}</text>
</button>
</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 {
addIntellectualProperty,
updateIntellectualProperty,
selectIntellectualProperty,
} from "@/api/enterprise/intellectualProperty";
export default {
name: "intellectualPropertyForm",
components: {},
props: {},
data() {
return {
form: {},
dictLists: {},
};
},
computed: {},
methods: {
async initializeDict() {
this.dictByType("sys_yes_no");
},
dictByType(type) {
this.getDicts(type).then((response) => {
let dicts = [];
for (let dict of response.data) {
let element = {};
element["value"] = dict.dictValue;
element["text"] = dict.dictLabel;
element["label"] = dict.dictLabel;
dicts.push(element);
}
this.$set(this.dictLists, type, dicts);
});
},
getIntellectualProperty() {
selectIntellectualProperty().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,
isNuisanceless: null,
isGreen: null,
isOrganic: null,
trademark: null,
};
},
cencel() {
this.naviBack();
},
submitForm() {
let isNew =
this.form.id === null ||
this.form.id === undefined ||
this.form.id === "";
if (isNew) {
addIntellectualProperty(this.form).then((response) => {
this.naviBack(isNew);
});
} else {
updateIntellectualProperty(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.getIntellectualProperty();
});
this.initializeDict();
},
// 页面周期函数--监听页面初次渲染完成
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>
page {
background: white;
}
.intellectualPropertyForm {
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>