From 52d463e03c1f074099ed8e8a6b7c3ddde52d2708 Mon Sep 17 00:00:00 2001
From: quanyawei <401863037@qq.com>
Date: Fri, 27 Oct 2023 14:50:28 +0800
Subject: [PATCH] fix:小程序初版
---
pages/actionChange/newPage/index.vue | 597 +++++++++++++++++++++++++++--------------------------------
1 files changed, 273 insertions(+), 324 deletions(-)
diff --git a/pages/actionChange/newPage/index.vue b/pages/actionChange/newPage/index.vue
index e33c5bf..e84ee88 100644
--- a/pages/actionChange/newPage/index.vue
+++ b/pages/actionChange/newPage/index.vue
@@ -1,173 +1,61 @@
<template>
<view class="mianContent">
<p class="title">������������</p>
- <u-form
- ref="uForm"
- label-width="65"
- :model="form"
- :rules="rules"
- >
- <u-form-item
- border-bottom
- label="������������:"
- prop="unitId"
- required
- @click="
+ <u-form ref="uForm" label-width="80" :model="form" :rules="rules" :labelStyle="labelStyle">
+ <u-form-item border-bottom label="������������:" prop="escalationTime" required @click="showeEscalationTime = true">
+ <u-input v-model="form.escalationTime" border="none" disabled disabled-color="#ffffff" placeholder="���������"
+ type="select" />
+ <u-icon slot="right" name="arrow-right" />
+ <u-datetime-picker ref="datetimePicker" v-model="timeFormet" mode="date" :show="showeEscalationTime"
+ @confirm="checkTime" @cancel='showeEscalationTime=false' />
+ </u-form-item>
+ <u-form-item border-bottom label="������������:" prop="pollutePosition" required>
+ <u-input v-model="form.pollutePosition" border="none" placeholder="���������" type="text" />
+ </u-form-item>
+ <u-form-item border-bottom label="������������:" prop="unitId" required @click="
showCheckBox = true;
hideKeyboard('unitList', 'unitId');
- "
- >
- <u--input
- v-model="form.unitId"
- border="none"
- disabled
- disabled-color="#ffffff"
- placeholder="���������"
- />
+ ">
+ <u--input v-model="form.unitId" border="none" disabled disabled-color="#ffffff" placeholder="���������" />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
-
- <u-form-item
- border-bottom
- label="������������:"
- prop="polluteType"
- required
- @click="
+ <u-form-item border-bottom label="������������:" prop="polluteType" required @click="
showCheckBox = true;
hideKeyboard('polluteList', 'polluteType');
- "
- >
- <u-input
- v-model="form.polluteType"
- border="none"
- disabled
- disabled-color="#ffffff"
- placeholder="���������"
- type="select"
- />
+ ">
+ <u-input v-model="form.polluteType" border="none" disabled disabled-color="#ffffff" placeholder="���������"
+ type="select" />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
- <u-form-item
- border="none"
- border-bottom
- label="������������:"
- prop="changeType"
- required
- @click="
+ <u-form-item border="none" border-bottom label="������������:" prop="changeType" required @click="
showCheckBox = true;
hideKeyboard('changeEnum', 'changeType');
- "
- >
- <u-input
- v-model="form.changeType"
- border="none"
- disabled
- disabled-color="#ffffff"
- placeholder="���������"
- type="select"
- />
+ ">
+ <u-input v-model="form.changeType" border="none" disabled disabled-color="#ffffff" placeholder="���������"
+ type="select" />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
- <u-form-item
- border-bottom
- label="������������:"
- placeholder="���������"
- required
- >
+ <u-form-item border-bottom label="������������:" placeholder="���������" required>
<u-input v-model="form.changeDay" border="none" type="number" />
</u-form-item>
- <u-form-item
- border-bottom
- label="������������:"
- prop="escalationUnitId"
- required
- @click="
+ <u-form-item border-bottom label="������������:" prop="escalationUnitId" required @click="
showCheckBox = true;
hideKeyboard('unitList', 'escalationUnitId');
- "
- >
- <u-input
- v-model="form.escalationUnitId"
- border="none"
- disabled
- disabled-color="#ffffff"
- placeholder="���������"
- type="select"
- />
+ ">
+ <u-input v-model="form.escalationUnitId" border="none" disabled disabled-color="#ffffff"
+ placeholder="���������" type="select" />
<u-icon slot="right" name="arrow-right" />
</u-form-item>
- <u-form-item
- border-bottom
- label="���������:"
- prop="escalationName"
- required
- >
- <u-input
- v-model="form.escalationName"
- border="none"
- placeholder="���������"
- type="text"
- />
+ <u-form-item border-bottom label="���������:" prop="escalationName" required>
+ <u-input v-model="form.escalationName" border="none" placeholder="���������" type="text" />
</u-form-item>
- <u-form-item
- border-bottom
- label="������������:"
- prop="investigationType"
- required
- >
+ <u-form-item border-bottom label="������������:" prop="investigationType" required>
<u-radio-group v-model="form.investigationType" style="font-size: 13px;">
- <u-radio
- :key="index"
- v-for="(item, index) in Dic.investigationEnum"
- :custom-style="{marginRight: '8px'}"
- :label="item.name"
- :name="item.value"
- />
+ <u-radio :key="index" v-for="(item, index) in Dic.investigationEnum"
+ :custom-style="{marginRight: '8px'}" :label="item.name" :name="item.value" />
</u-radio-group>
</u-form-item>
- <u-form-item
- border-bottom
- label="������������:"
- prop="escalationTime"
- required
- @click="showeEscalationTime = true"
- >
- <u-input
- v-model="form.escalationTime"
- border="none"
- disabled
- disabled-color="#ffffff"
- placeholder="���������"
- type="select"
- />
- <u-icon slot="right" name="arrow-right" />
- <u-datetime-picker
- ref="datetimePicker"
- v-model="timeFormet"
- mode="date"
- :show="showeEscalationTime"
- @confirm="checkTime"
- />
- </u-form-item>
- <u-form-item
- border-bottom
- label="������������:"
- prop="pollutePosition"
- required
- >
- <u-input
- v-model="form.pollutePosition"
- border="none"
- placeholder="���������"
- type="text"
- />
- </u-form-item>
- <u-form-item
- border-bottom
- label="������������:"
- prop="problemDescribe"
- required
- >
+ <u-form-item border-bottom label="������������:" prop="problemDescribe" required>
<u--textarea v-model="form.problemDescribe" border="none" placeholder="���������������" />
</u-form-item>
<u-form-item border-bottom label="������������:">
@@ -176,185 +64,230 @@
</view>
</u-form-item>
</u-form>
- <u-action-sheet
- v-if="actionOptionList.length > 0"
- :actions="actionOptionList"
- :show="showCheckBox"
- title="���������"
- @close="showCheckBox = false"
- @select="selectBack"
- />
+ <u-picker :show="showCheckBox" keyName="label" :columns="actionOptionList" @cancel="showCheckBox = false"
+ @confirm="selectBack"></u-picker>
+ <!-- <u-action-sheet v-if="actionOptionList.length > 0" :actions="actionOptionList" :show="showCheckBox" title="���������"
+ @close="showCheckBox = false" @select="selectBack" /> -->
<view class="bunts">
- <u-button shape="square" @click="close">������</u-button>
- <u-button shape="square" type="primary" @click="submit">������</u-button>
+ <view class="but butRight">
+ <u-button shape="square" @click="close">������</u-button>
+ </view>
+ <view class="but butleft">
+ <u-button shape="square" type="primary" @click="submit">������</u-button>
+ </view>
</view>
</view>
</template>
-
<script>
-import fileUpload from '../components/fileUpload.vue'
-export default {
- components: {
- fileUpload
- },
- data() {
- return {
- sysCode: '1010201', //
- showCheckBox: false,
- showeEscalationTime: false,
- actionOptionList: [],
- rules: {
- 'unitId': {
- required: true,
- message: '���������',
- trigger: ['blur', 'change']
- },
- 'polluteType': {
- required: true,
- message: '���������',
- trigger: ['blur', 'change']
- },
- 'changeType': {
- required: true,
- message: '���������',
- trigger: ['blur', 'change']
- },
- 'changeDay': {
- required: true,
- message: '���������',
- trigger: ['blur', 'change']
- },
- 'escalationName': {
- required: true,
- message: '���������',
- trigger: ['blur']
- },
- 'escalationUnitId': {
- required: true,
- message: '���������',
- trigger: ['blur', 'change']
- },
- 'escalationTime': {
- required: true,
- message: '���������',
- trigger: ['blur']
- }, 'problemDescribe': {
- required: true,
- message: '���������',
- trigger: ['blur']
- }, 'pollutePosition': {
- required: true,
- message: '���������',
- trigger: ['blur']
- },
- },
- currentKey: '',
- Dic: this.$storage.getJson('dict'),
- changeEnum: [],
- timeFormet: Number(new Date()),
- form: {
- unitId: '',
- polluteType: '',
- changeType: '',
- changeDay: '',
- escalationName: '',
- escalationUnitId: '',
- escalationTime: '',
- problemDescribe: '',
- pollutePosition: '',
- },
- sumbitForm: {
- unitId: '',
- polluteType: '',
- changeType: '',
- changeDay: '',
- escalationName: '',
- escalationUnitId: '',
- escalationTime: '',
- problemDescribe: '',
- pollutePosition: '',
- },
- unitList: [],
- polluteList: [],
- fileBaseList: [],
- }
- },
- onReady() {
- //onReady ���uni-app���������������������������
- this.$refs.uForm.setRules(this.rules)
- },
- onShow(){
- uni.hideTabBar()
- },
- created() {
- this.changeEnum = this.Dic.changeEnum
- this.getUnitList()
- this.getContaminateList()
- },
- methods: {
- handleFile(data){
- this.fileBaseList=data
+ import fileUpload from '../components/fileUpload.vue'
+ export default {
+ components: {
+ fileUpload
},
- close(){
- uni.reLaunch({
- url: '/pages/actionChange/agencyPage/index',
+ data() {
+ return {
+ sysCode: '1010201', //
+ showCheckBox: false,
+ labelStyle: {
+ fontSize: '30.77rpx'
+ },
+ showeEscalationTime: false,
+ actionOptionList: [],
+ rules: {
+ 'unitId': {
+ required: true,
+ message: '���������',
+ trigger: ['blur', 'change']
+ },
+ 'polluteType': {
+ required: true,
+ message: '���������',
+ trigger: ['blur', 'change']
+ },
+ 'changeType': {
+ required: true,
+ message: '���������',
+ trigger: ['blur', 'change']
+ },
+ 'changeDay': {
+ required: true,
+ message: '���������',
+ trigger: ['blur', 'change']
+ },
+ 'escalationName': {
+ required: true,
+ message: '���������',
+ trigger: ['blur']
+ },
+ 'escalationUnitId': {
+ required: true,
+ message: '���������',
+ trigger: ['blur', 'change']
+ },
+ 'escalationTime': {
+ required: true,
+ message: '���������',
+ trigger: ['blur']
+ },
+ 'problemDescribe': {
+ required: true,
+ message: '���������',
+ trigger: ['blur']
+ },
+ 'pollutePosition': {
+ required: true,
+ message: '���������',
+ trigger: ['blur']
+ },
+ },
+ currentKey: '',
+ Dic: [],
+ changeEnum: [],
+ timeFormet: Number(new Date()),
+ form: {
+ unitId: '',
+ polluteType: '',
+ changeType: '',
+ changeDay: '',
+ escalationName: '',
+ escalationUnitId: '',
+ escalationTime: '',
+ problemDescribe: '',
+ pollutePosition: '',
+ },
+ sumbitForm: {
+ unitId: '',
+ polluteType: '',
+ changeType: '',
+ changeDay: '',
+ escalationName: '',
+ escalationUnitId: '',
+ escalationTime: '',
+ problemDescribe: '',
+ pollutePosition: '',
+ },
+ unitList: [],
+ polluteList: [],
+ fileBaseList: [],
+ }
+ },
+ onReady() {
+ //onReady ���uni-app���������������������������
+ this.$refs.uForm.setRules(this.rules)
+ },
+ onShow() {
+ uni.hideTabBar()
+ },
+ created() {
+ this.getUnitList()
+ this.getContaminateList()
+ },
+ onBackPress(e) {
+ uni.navigateBack({
+ delta: 1, //������������������������������������������2
})
+ return false
},
- hideKeyboard(data, key) {
- this.actionOptionList = []
- let list = this[data]
-
- this.currentKey = key
- list.forEach((item)=> {
- item.name = item.dataValue || item.name || item.unitName
- item.value = item.dataKey || item.value|| item.unitId
- })
-
- this.actionOptionList = list
- },
- selectBack(e) {
- this.form[this.currentKey] = e.name
- this.sumbitForm[this.currentKey] = e.value
-
- },
- checkTime(e) {
- this.showeEscalationTime = false
- let data = this.$utils.dateFormatter(e.value)
- this.form.escalationTime = data
- this.sumbitForm.escalationTime = data
- },
- submit() {
- this.$refs.uForm.validate().then(res=> {
- this.sumbitForm.problemDescribe=this.form.problemDescribe
- this.sumbitForm.pollutePosition=this.form.pollutePosition
- this.sumbitForm.changeDay=this.form.changeDay
- this.sumbitForm.escalationName=this.form.escalationName
- this.sumbitForm.fileBaseList=this.fileBaseList
- this.sumbitForm.state='10'
- console.log('this.sumbitForm', this.sumbitForm)
- this.$http.httpPost('/allocation/insert', {...this.sumbitForm}).then((res)=> {
- uni.$u.toast('������������')
- this.close()
+ methods: {
+ handleFile(data) {
+ this.fileBaseList = data
+ },
+ close() {
+ uni.$emit('currIndex', {
+ data: {
+ index: '0',
+ showTabBar: true
+ }
})
- }).catch(errors=> {
- uni.$u.toast('������������')
- })
+ uni.navigateBack({
+ delta: 1, //������������������������������������������2
+ })
+ },
+ hideKeyboard(data, key) {
+ this.actionOptionList = []
+ let list = this[data]
+ this.currentKey = key
+ list.forEach(item => {
+ item.label = item.dataValue || item.name || item.unitName
+ item.id = item.dataKey || item.value || item.unitId
+ })
+ console.log('list', list)
+ this.$set(this.actionOptionList, 0, list)
+ },
+ selectBack(e) {
+ console.log(e)
+ this.form[this.currentKey] = e.value[0].label
+ this.sumbitForm[this.currentKey] = e.value[0].id
+ this.showCheckBox = false
+ },
+ checkTime(e) {
+ this.showeEscalationTime = false
+ let data = this.$utils.dateFormatter(e.value)
+ console.log('e.value', e.value)
+ this.form.escalationTime = data
+ this.sumbitForm.escalationTime = data
+ },
+ submit() {
+ this.$refs.uForm.validate().then(res => {
+ this.sumbitForm.problemDescribe = this.form.problemDescribe
+ this.sumbitForm.pollutePosition = this.form.pollutePosition
+ this.sumbitForm.changeDay = this.form.changeDay
+ this.sumbitForm.escalationName = this.form.escalationName
+ this.sumbitForm.investigationType = this.form.investigationType
+ this.sumbitForm.fileBaseList = this.fileBaseList
+ this.sumbitForm.state = '20'
+ console.log('this.sumbitForm', this.sumbitForm)
+ this.$http.httpPost('/allocation/insert', {
+ ...this.sumbitForm
+ }).then(res => {
+ uni.$u.toast('������������')
+ this.close()
+ })
+ }).catch(errors => {
+ uni.$u.toast('������������')
+ })
+ },
+ setDefaultValue() {
+ let time = new Date().getTime()
+ let data = this.$utils.dateFormatter(time)
+ this.form.escalationTime = data
+ this.sumbitForm.escalationTime = data
+ if (this.changeEnum.length > 0) {
+ this.form.changeType = this.changeEnum[0].name
+ this.sumbitForm.changeType = this.changeEnum[0].value
+ }
+ let userInfor = JSON.parse(uni.getStorageSync('userInfor') || '{}')
+ if (userInfor.unitId && this.unitList.length > 0) {
+ let data = this.unitList && this.unitList.find(a => Number(a.unitId) === Number(userInfor.unitId))
+ .unitName
+ this.form.unitId = data
+ this.sumbitForm.unitId = userInfor.unitId
+ this.form.escalationUnitId = data
+ this.sumbitForm.escalationUnitId = userInfor.unitId
+ }
+ this.form.escalationName = userInfor.name || ''
+ this.sumbitForm.escalationName = userInfor.name || ''
+ this.form.investigationType = 1
+ this.sumbitForm.investigationType = 1
+ console.log('this.sumbitForm', this.sumbitForm)
+ },
+ // ������������������list
+ getUnitList() {
+ this.$http.httpGet('/allocation/unit').then(res => {
+ this.unitList = res.data
+ this.Dic = JSON.parse(uni.getStorageSync('dict') || '[]')
+ this.changeEnum = this.Dic.changeEnum
+ this.setDefaultValue()
+ })
+ },
+ getContaminateList() {
+ this.$http.httpGet('/allocation/contaminate').then(res => {
+ this.polluteList = res.data
+ })
+ },
},
- // ������������������list
- getUnitList() {
- this.$http.httpGet('/allocation/unit').then((res)=> {
- this.unitList = res.data
- })
- },
- getContaminateList() {
- this.$http.httpGet('/allocation/contaminate').then((res)=> {
- this.polluteList = res.data
- })
- },
- },
-}
+ }
</script>
-
<style scoped lang="scss">
uni-page-body {
padding-top: 10px;
@@ -363,6 +296,8 @@
.mianContent {
margin: 19.23rpx;
border-radius: 5px;
+ padding-bottom: 38.46rpx;
+
.title {
padding: 9.62rpx;
font-size: 16px;
@@ -375,24 +310,38 @@
padding-left: 10px;
}
- /deep/.u-form-item__body {
- padding: 5px 0px !important;
- font-size: 13px!important;
- }
- /deep/.u-form-item__body__left__content__label,/deep/.u-input__content__field-wrapper__field,/deep/.u-radio__text{
- font-size: 13px!important;
- }
+ // /deep/.u-form-item__body {
+ // padding: 8px 0px !important;
+ // font-size: 15px !important;
+ // }
+ // /deep/.u-form-item__body__left__content__label,
+ // /deep/.u-input__content__field-wrapper__field,
+ // /deep/.u-radio__text {
+ // font-size: 15px !important;
+ // }
}
+
.bunts {
display: flex;
margin-top: 20px;
margin-bottom: 96.15rpx;
- padding-bottom: 20px;
- .u-button {
- width: 288.46rpx;
+ padding: 0 20px;
+ justify-content: center;
+
+ .but {
+ width: 50%;
+ }
+
+ .butRight {
+ padding-right: 20px;
+ }
+
+ .butleft {
+ padding-left: 20px;
}
}
- .fileBox{
+
+ .fileBox {
display: -webkit-box;
display: -webkit-flex;
display: flex;
--
Gitblit v1.8.0