| | |
| | | <template>
|
| | | <div class="container">
|
| | | <view class="">
|
| | | <box-title title="基本信息"></box-title>
|
| | | <u-form labelWidth="70" :model="form" :rules="rules" ref="form" class="form">
|
| | | <u-form-item label="场所位置" required class="form-item" prop="localtion">
|
| | | <u--input border="none" v-model="form.localtion"></u--input>
|
| | | </u-form-item>
|
| | | <u-form-item label="场所名称" required class="form-item" prop="placeName">
|
| | | <u--input border="none" v-model="form.placeName"></u--input>
|
| | | </u-form-item>
|
| | | <u-form-item label="法人信息" required class="form-item" prop="legalPerson">
|
| | | <u--input border="none" v-model="form.legalPerson"></u--input>
|
| | | </u-form-item>
|
| | | <u-form-item label="法人电话" class="form-item">
|
| | | <u--input border="none" v-model="form.legalTel"></u--input>
|
| | | </u-form-item>
|
| | | </u-form>
|
| | | </view>
|
| | | <view class="">
|
| | | <box-title title="营业执照"></box-title>
|
| | | <view class="upload-img">
|
| | | <u-upload :fileList="form.imageUrls" :previewFullImage="uploadConfig.previewFullImage"
|
| | | :accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount"
|
| | | :capture="uploadConfig.capture" @afterRead="afterReadImg" @delete="deletePic">
|
| | | </u-upload>
|
| | | <view class="container">
|
| | | <view class="main-content">
|
| | | <view class="base">
|
| | | <box-title :title="'基本信息'"></box-title>
|
| | | <u-form labelWidth="70" :model="form" :rules="rules" ref="form" class="form">
|
| | | <u-form-item label="场所位置" required class="form-item" prop="location" @click="getLocation">
|
| | | <u--input border="none" v-model="form.location" placeholder="请选择场所位置"></u--input>
|
| | | <u-icon slot="right" name="arrow-right"></u-icon>
|
| | | </u-form-item>
|
| | | <u-form-item label="经纬度" required class="form-item">
|
| | | <u--input border="none" v-model="jwd" placeholder="请选择场所位置" disabled
|
| | | disabledColor="#ffffff"></u--input>
|
| | | </u-form-item>
|
| | | <u-form-item label="场所名称" required class="form-item" prop="placeName">
|
| | | <u--input border="none" v-model="form.placeName" placeholder="请填写场所名称"></u--input>
|
| | | </u-form-item>
|
| | | <u-form-item label="法人信息" required class="form-item" prop="legalPerson">
|
| | | <u--input border="none" v-model="form.legalPerson" placeholder="请填写法人信息"></u--input>
|
| | | </u-form-item>
|
| | | <u-form-item label="法人电话" class="form-item" prop="legalTel" required>
|
| | | <u--input border="none" type="number" v-model="form.legalTel" placeholder="请填写法人电话"></u--input>
|
| | | </u-form-item>
|
| | | </u-form>
|
| | | </view>
|
| | | <view class="license">
|
| | | <box-title title="营业执照"></box-title>
|
| | | <view class="upload-img">
|
| | | <u-upload :fileList="form.imageUrls" :previewFullImage="uploadConfig.previewFullImage"
|
| | | :accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple"
|
| | | uploadIcon="/static/icon/upload.png" :maxCount="uploadConfig.maxCount"
|
| | | :capture="uploadConfig.capture" @afterRead="afterReadImg($event,'imageUrls')"
|
| | | @delete="deletePic($event,'imageUrls')">
|
| | | </u-upload>
|
| | | </view>
|
| | | </view>
|
| | | <view class="upload">
|
| | | <box-title title="场所平面图"></box-title>
|
| | | <view class="upload-img">
|
| | | <u-upload :fileList="form.planImageUrls" :previewFullImage="uploadConfig.previewFullImage"
|
| | | :accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple"
|
| | | uploadIcon="/static/icon/upload.png" :maxCount="uploadConfig.maxCount"
|
| | | :capture="uploadConfig.capture" @afterRead="afterReadImg($event,'planImageUrls')"
|
| | | @delete="deletePic($event,'planImageUrls')">
|
| | | </u-upload>
|
| | | </view>
|
| | | </view>
|
| | | <view class="practitioner">
|
| | | <box-title title="从业人员信息"></box-title>
|
| | | <view class="info" v-for="(item, index) in personNum" :key="index">
|
| | | <view class="title">人员信息-#{{ index*1 + 1 }}</view>
|
| | | <formItem ref="formItemRef"></formItem>
|
| | | </view>
|
| | |
|
| | | <view class="add-person">
|
| | | <u-button type="success" plain @click="addPerson">再加一人</u-button>
|
| | | </view>
|
| | | </view>
|
| | | </view>
|
| | | <view class="">
|
| | | <box-title title="场所平面图"></box-title>
|
| | | <view class="upload-img">
|
| | | <u-upload :fileList="form.planImageUrls" :previewFullImage="uploadConfig.previewFullImage"
|
| | | :accept="uploadConfig.acceptImg" :multiple="uploadConfig.multiple" :maxCount="uploadConfig.maxCount"
|
| | | :capture="uploadConfig.capture" @afterRead="afterReadImg" @delete="deletePic">
|
| | | </u-upload>
|
| | |
|
| | |
|
| | | <footer-btn @click="submit"></footer-btn>
|
| | |
|
| | | <!-- <view class="btn-group">
|
| | | <view>
|
| | | <u-button type="primary" @click="submit">提交</u-button>
|
| | | </view>
|
| | | </view>
|
| | | <view class="practitioner">
|
| | | <box-title title="从业人员信息"></box-title>
|
| | | <view class="info" v-for="i in personNum" :key="i">
|
| | | <view class="title">人员信息-#{{ i }}</view>
|
| | | <formItem ref="formItemRef"></formItem>
|
| | | <view class="mt-20">
|
| | | <u-button @click="pushPage">我上报的事件</u-button>
|
| | | </view>
|
| | | </view>
|
| | | <u-button type="success" plain class="add-person" @click="addPerson">在加一人</u-button>
|
| | | <view class="btn-group">
|
| | | <u-button class="btn-item" type="primary" @click="submit">提交</u-button>
|
| | | <u-button class="btn-item" @click="pushPage">我上报的事件</u-button>
|
| | | </view>
|
| | | </div>
|
| | | </view> -->
|
| | | </view>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | |
| | | getPlaceDetail
|
| | | } from '@/api/placeExp/placeExp.js'
|
| | | import uploadMixin from "@/mixin/uploadMixin";
|
| | | import boxTtitle from '@/components/boxTitle/index.vue'
|
| | | import boxTitle from "@/subPackage/workbench/components/boxTitle/index.vue"
|
| | | import formItem from '../components/formItem.vue'
|
| | | import {
|
| | | minioBaseUrl
|
| | | } from '@/common/setting'
|
| | | export default {
|
| | | mixins: [uploadMixin],
|
| | | components: {
|
| | | formItem
|
| | | formItem,
|
| | | boxTitle
|
| | | },
|
| | | data() {
|
| | | return {
|
| | | form: {
|
| | | id: '',
|
| | | placeId: '',
|
| | | localtion: '',
|
| | | location: '',
|
| | | placeName: '',
|
| | | legalPerson: '',
|
| | | legalTel: '',
|
| | |
| | | planImageUrls: []
|
| | | },
|
| | | rules: {
|
| | | localtion: {
|
| | | "location": {
|
| | | required: true,
|
| | | message: '请选择地址',
|
| | | trigger: ['blur', 'change']
|
| | | },
|
| | | placeName: {
|
| | | "placeName": {
|
| | | required: true,
|
| | | message: '请填写场所名称',
|
| | | trigger: ['blur', 'change']
|
| | | },
|
| | | legalPerson: {
|
| | | "legalPerson": {
|
| | | required: true,
|
| | | message: '请填写法人信息',
|
| | | trigger: ['blur', 'change']
|
| | | }
|
| | | },
|
| | | "legalTel": [{
|
| | | required: true,
|
| | | message: '请填写法人电话',
|
| | | trigger: ['blur', 'change']
|
| | | },
|
| | | {
|
| | | validator: (rule, value, callback) => {
|
| | | return uni.$u.test.mobile(value);
|
| | | },
|
| | | message: '手机号码不正确',
|
| | | trigger: ['change', 'blur']
|
| | | }
|
| | | ]
|
| | | },
|
| | | personNum: 1,
|
| | | curSelectSite: {},
|
| | | jwd: ""
|
| | | }
|
| | | },
|
| | | onShow() {
|
| | | this.curSelectSite = uni.getStorageSync('siteInfo')
|
| | | this.getCsDetails()
|
| | | // this.getLocation()
|
| | |
|
| | | },
|
| | | onReady() {
|
| | | //onReady 为uni-app支持的生命周期之一
|
| | | this.$refs.form.setRules(this.rules)
|
| | | },
|
| | | mounted() {
|
| | | this.$nextTick(() => {
|
| | | this.getCsDetails()
|
| | | })
|
| | | },
|
| | | methods: {
|
| | | getLocation() {
|
| | | uni.chooseLocation({
|
| | | success: (res) => {
|
| | | console.log(res);
|
| | | const {
|
| | | address,
|
| | | latitude,
|
| | | longitude
|
| | | } = res
|
| | | this.form.location = address
|
| | | this.form.lat = latitude;
|
| | | this.form.lng = longitude;
|
| | | this.jwd = `${Number(longitude).toFixed(6)},${Number(latitude).toFixed(6)}`
|
| | | }
|
| | | })
|
| | | },
|
| | |
| | | })
|
| | | return
|
| | | }
|
| | | if (data.lat) {
|
| | | this.jwd = `${Number(data.lng).toFixed(6)},${Number(data.lat).toFixed(6)}`
|
| | | }
|
| | |
|
| | |
|
| | | const placePractitioner = data?.placePractitioner || []
|
| | | Object.keys(this.form).forEach(key => {
|
| | | this.form[key] = data[key]
|
| | | if (key === 'imageUrls' || key === 'planImageUrls') {
|
| | | this.form[key] = [] |
| | | !!data[key] && this.form[key].push(data[key])
|
| | | // Object.keys(this.form).forEach(key => {
|
| | | // this.form[key] = data[key]
|
| | | // if (key === 'imageUrls' || key === 'planImageUrls') {
|
| | | // data[key] = data[key] || ''
|
| | | // this.form[key] = []
|
| | | // if (!!data[key]) {
|
| | | // data[key] = JSON.parse(data[key])
|
| | | // if (Array.isArray(data[key])) {
|
| | | // this.form[key] = data[key]
|
| | | // } else {
|
| | | // this.form[key].push(data[key])
|
| | | // }
|
| | | // }
|
| | | // }
|
| | | // })
|
| | |
|
| | | for (let i in this.form) {
|
| | | if (i === 'imageUrls' || i === 'planImageUrls') {
|
| | | if (this.form[i]) {
|
| | | if (data[i]) {
|
| | | this.form[i] = this.setImageUrl(i, data[i].split('、'))
|
| | | } else {
|
| | | this.form[i] = []
|
| | | }
|
| | |
|
| | | }
|
| | | } else {
|
| | | this.form[i] = data[i]
|
| | | }
|
| | | })
|
| | | }
|
| | |
|
| | | this.personNum = placePractitioner.length
|
| | | this.$nextTick(() => {
|
| | | console.log(placePractitioner);
|
| | | this.$refs.formItemRef.forEach((item, index) => {
|
| | | item.form = placePractitioner[index]
|
| | | // const componetns = this.$refs.formItemRef || []
|
| | | placePractitioner.forEach((item, index) => {
|
| | | this.$nextTick(() => {
|
| | | this.$refs.formItemRef[index].form = item
|
| | | })
|
| | | })
|
| | |
|
| | | // this.$refs.formItemRef.forEach((item, index) => {
|
| | | // item.form = placePractitioner[index]
|
| | | // })
|
| | | })
|
| | | }
|
| | | },
|
| | | updatePlaceExt(data) {
|
| | | data['imageUrls'] = JSON.stringify(data['imageUrls'])
|
| | | data['planImageUrls'] = JSON.stringify(data['planImageUrls'])
|
| | | updatePlaceExtData({
|
| | | ...data
|
| | | }).then(res => {
|
| | | const {
|
| | | code
|
| | | } = res
|
| | | if (code !== 200) {
|
| | | uni.showToast({
|
| | | title: '提交失败',
|
| | | icon: 'error'
|
| | | },
|
| | |
|
| | |
|
| | | setImageUrl(key, arr) {
|
| | | let urls = [];
|
| | | for (let i of arr) {
|
| | | urls.push({
|
| | | name: i,
|
| | | url: `${minioBaseUrl}${i}`
|
| | | })
|
| | | return
|
| | | }
|
| | | uni.showToast({
|
| | | title: '提交成功',
|
| | | icon: 'success',
|
| | | complete() {
|
| | | setTimeout(() => {
|
| | | uni.navigateBack()
|
| | | }, 1500)
|
| | | return urls
|
| | | },
|
| | |
|
| | | getImageUrl(key) {
|
| | | if (this.form[key].length) {
|
| | | let urls = [];
|
| | | for (let i of this.form[key]) {
|
| | | urls.push(i.name)
|
| | | }
|
| | | return urls.join('、');
|
| | | } else {
|
| | | return "";
|
| | | }
|
| | | },
|
| | |
|
| | | updatePlaceExt(data) {
|
| | | data['imageUrls'] = this.getImageUrl('imageUrls')
|
| | | data['planImageUrls'] = this.getImageUrl('planImageUrls')
|
| | | data.confirmFlag = 1;
|
| | | // data['imageUrls'] = data['imageUrls'].join('、')
|
| | | // data['planImageUrls'] = data['planImageUrls'].join('、')
|
| | | updatePlaceExtData({
|
| | | ...data
|
| | | }).then(res => {
|
| | | const {
|
| | | code
|
| | | } = res
|
| | | if (code !== 200) {
|
| | | uni.showToast({
|
| | | title: '提交失败',
|
| | | icon: 'error'
|
| | | })
|
| | | return
|
| | | }
|
| | | uni.showToast({
|
| | | title: '提交成功',
|
| | | complete() {
|
| | | setTimeout(() => {
|
| | | uni.navigateBack()
|
| | | }, 1000)
|
| | | }
|
| | | })
|
| | | })
|
| | | })
|
| | | },
|
| | | addPerson() {
|
| | | this.personNum++
|
| | | },
|
| | | submit() {
|
| | | const placePractitioner = []
|
| | | this.$refs.formItemRef.forEach(item => {
|
| | | item.form.placeId = this.form.placeId
|
| | | placePractitioner.push(item.form)
|
| | | })
|
| | | this.form.placePractitioner = placePractitioner
|
| | | this.updatePlaceExt(this.form)
|
| | | },
|
| | | pushPage() {
|
| | | this.$u.func.globalNavigator('/subPackage/workbench/views/cshw')
|
| | | },
|
| | | addPerson() {
|
| | | this.personNum++
|
| | | },
|
| | | submit() {
|
| | | if (this.personNum > 0) {
|
| | | const placePractitioner = []
|
| | | this.$refs.formItemRef.forEach(item => {
|
| | | item.form.placeId = this.form.placeId
|
| | | placePractitioner.push(item.form)
|
| | | })
|
| | | this.form.placePractitioner = placePractitioner
|
| | | }
|
| | |
|
| | | this.$refs.form.validate().then(res => {
|
| | | this.updatePlaceExt(this.form)
|
| | | }).catch(errors => {
|
| | | uni.$u.toast('请完善基本信息')
|
| | | })
|
| | | },
|
| | |
|
| | | pushPage() {
|
| | | this.$u.func.globalNavigator(`/subPackage/workbench/views/cshw?placeId=${this.form.placeId}`)
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
|
| | | <style lang="scss" scoped>
|
| | | <style>
|
| | | page {
|
| | | background-color: #f6f6f6;
|
| | | background: #F5F5F5;
|
| | | }
|
| | |
|
| | | </style>
|
| | | <style lang="scss" scoped>
|
| | | .container {
|
| | | padding-bottom: 300rpx;
|
| | | height: 100%;
|
| | | display: flex;
|
| | | flex-direction: column;
|
| | |
|
| | | .form {
|
| | | margin-top: 20rpx;
|
| | | .main-content {
|
| | | // height: 0;
|
| | | // flex: 1;
|
| | | // overflow-y: auto;
|
| | | padding: 0 30rpx 250rpx 30rpx;
|
| | |
|
| | | .form-item {
|
| | | .base,
|
| | | .license,
|
| | | .upload,
|
| | | .practitioner {
|
| | | background-color: #fff;
|
| | | padding: 0 20rpx;
|
| | | border-bottom: 1rpx solid #f6f6f6;
|
| | | border-radius: 8rpx;
|
| | | margin-top: 20rpx;
|
| | | padding: 30rpx;
|
| | | }
|
| | |
|
| | | }
|
| | | .license,
|
| | | .upload {
|
| | | padding-bottom: 20rpx !important;
|
| | |
|
| | | .upload-img {
|
| | | background-color: #fff;
|
| | | padding: 20rpx;
|
| | | padding-bottom: 10rpx;
|
| | | margin-top: 20rpx;
|
| | | }
|
| | | .upload-img {
|
| | | margin-top: 20rpx;
|
| | | }
|
| | | }
|
| | |
|
| | | .add-person {
|
| | | width: 30%;
|
| | | margin: 20rpx auto;
|
| | | }
|
| | | .practitioner {
|
| | | .info {
|
| | | margin-top: 20rpx;
|
| | |
|
| | | .practitioner {
|
| | | .info {
|
| | | margin-top: 20rpx;
|
| | | .title {
|
| | | margin-bottom: 10rpx;
|
| | | text-align: center;
|
| | | }
|
| | | }
|
| | |
|
| | | .title {
|
| | | text-align: center;
|
| | | font-size: 30rpx;
|
| | | margin-bottom: 10rpx;
|
| | | .add-person {
|
| | | margin-top: 20rpx;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | .btn-group {
|
| | | background-color: #fff;
|
| | | position: fixed;
|
| | | bottom: 0;
|
| | | left: 0;
|
| | | width: calc(100% - 40rpx);
|
| | | padding: 20rpx;
|
| | | border-top: 1rpx solid #f6f6f6;
|
| | | z-index: 999;
|
| | |
|
| | | .btn-item {
|
| | | margin-top: 20rpx;
|
| | | }
|
| | |
|
| | | .btn-group {
|
| | | padding: 20rpx;
|
| | | z-index: 999;
|
| | | background-color: #fff;
|
| | | width: calc(100% - 40rpx);
|
| | | position: fixed;
|
| | | left: 0;
|
| | | bottom: 0;
|
| | | padding-bottom: calc(env(safe-area-inset-bottom) + 20rpx);
|
| | | z-index: 999;
|
| | | }
|
| | | }
|
| | |
|
| | | /deep/ .u-form-item {
|
| | | border-bottom: 1rpx solid #f5f5f5;
|
| | | }
|
| | |
|
| | | /deep/ .u-upload__button {
|
| | | border: 1rpx solid #EEEEEE;
|
| | | background-color: #fff;
|
| | | }
|
| | | </style> |