| | |
| | | <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="mt-20 b-c-w">
|
| | | <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="mt-20 b-c-w">
|
| | | <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>
|
| | | </view>
|
| | | <view class="mt-20 b-c-w">
|
| | | <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>
|
| | | </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>
|
| | |
|
| | | <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>
|
| | | </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>
|
| | | </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>
|
| | | <u-button type="primary" @click="submit">提交</u-button>
|
| | | </view>
|
| | | <view class="mt-20">
|
| | | <u-button @click="pushPage">我上报的事件</u-button>
|
| | | </view>
|
| | | </view>
|
| | | </div>
|
| | | </view>
|
| | | </template>
|
| | |
|
| | | <script>
|
| | | import {
|
| | | updatePlaceExtData, |
| | | updatePlaceExtData,
|
| | | 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'
|
| | | export default {
|
| | | mixins: [uploadMixin],
|
| | | components: {
|
| | | formItem
|
| | | formItem,
|
| | | boxTitle
|
| | | },
|
| | | data() {
|
| | | return {
|
| | | form: { |
| | | id: '', |
| | | form: {
|
| | | id: '',
|
| | | placeId: '',
|
| | | localtion: '',
|
| | | placeName: '',
|
| | |
| | | }
|
| | | },
|
| | | onShow() {
|
| | | this.curSelectSite = uni.getStorageSync('siteInfo') |
| | | this.curSelectSite = uni.getStorageSync('siteInfo')
|
| | | this.getCsDetails()
|
| | | // this.getLocation()
|
| | | },
|
| | | methods: { |
| | | methods: {
|
| | | // getLocation() {
|
| | | // uni.chooseLocation({
|
| | | // success: (res) => {
|
| | | // console.log(res);
|
| | | // }
|
| | | // })
|
| | | // },
|
| | | getCsDetails() { |
| | | getPlaceDetail({ |
| | | placeId: this.curSelectSite.id |
| | | }).then(detailRes => { |
| | | const { code, data } = detailRes |
| | | if (code !== 200) { |
| | | uni.showToast({ |
| | | title: '数据请求失败', |
| | | icon: 'error' |
| | | }) |
| | | return |
| | | } |
| | | 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() |
| | | } |
| | | }) |
| | | this.personNum = placePractitioner.length |
| | | this.$nextTick(() => { |
| | | console.log(placePractitioner); |
| | | this.$refs.formItemRef.forEach((item, index) => { |
| | | item.form = placePractitioner[index] |
| | | }) |
| | | }) |
| | | }) |
| | | const that = this
|
| | | getPlaceDetail({
|
| | | placeId: this.curSelectSite.id
|
| | | }).then(detailRes => {
|
| | | const {
|
| | | code,
|
| | | data
|
| | | } = detailRes
|
| | | if (code !== 200) {
|
| | | uni.showToast({
|
| | | title: '数据请求失败',
|
| | | icon: 'error'
|
| | | })
|
| | | return
|
| | | }
|
| | | const placePractitioner = data?.placePractitioner || []
|
| | | console.log(data);
|
| | | 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])
|
| | | }
|
| | | }
|
| | | }
|
| | | })
|
| | |
|
| | | that.personNum = placePractitioner.length
|
| | | // that.$nextTick(() => {
|
| | | console.log(placePractitioner);
|
| | | setTimeout(() => { |
| | | const componetns = that.$refs.formItemRef || [] |
| | | that.$refs.formItemRef.forEach((item, index) => { |
| | | item.form = placePractitioner[index] |
| | | }) |
| | | }, 0)
|
| | | // })
|
| | | })
|
| | | },
|
| | | 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' |
| | | }) |
| | | return |
| | | } |
| | | uni.showToast({ |
| | | title: '提交成功', |
| | | icon: 'success', |
| | | complete() { |
| | | setTimeout(() => { |
| | | uni.navigateBack() |
| | | }, 1500) |
| | | } |
| | | }) |
| | | updatePlaceExt(data) {
|
| | | 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: '提交成功',
|
| | | icon: 'success',
|
| | | complete() {
|
| | | setTimeout(() => {
|
| | | uni.navigateBack()
|
| | | }, 1500)
|
| | | }
|
| | | })
|
| | | })
|
| | | },
|
| | | addPerson() {
|
| | |
| | | },
|
| | | submit() {
|
| | | const placePractitioner = []
|
| | | this.$refs.formItemRef.forEach(item => { |
| | | this.$refs.formItemRef.forEach(item => {
|
| | | item.form.placeId = this.form.placeId
|
| | | placePractitioner.push(item.form)
|
| | | })
|
| | | this.form.placePractitioner = placePractitioner |
| | | this.form.placePractitioner = placePractitioner
|
| | | this.updatePlaceExt(this.form)
|
| | | }, |
| | | pushPage() { |
| | | this.$u.func.globalNavigator('/subPackage/workbench/views/cshw') |
| | | },
|
| | | pushPage() {
|
| | | this.$u.func.globalNavigator('/subPackage/workbench/views/cshw')
|
| | | }
|
| | | }
|
| | | }
|
| | | </script>
|
| | |
|
| | | <style lang="scss" scoped>
|
| | | page {
|
| | | background-color: #f6f6f6;
|
| | | }
|
| | |
|
| | | .container {
|
| | | padding-bottom: 300rpx;
|
| | | width: 100%;
|
| | | height: 100vh;
|
| | |
|
| | | display: flex;
|
| | | flex-direction: column;
|
| | | background: #F9F9FA;
|
| | | color: #fff;
|
| | | font-size: 32rpx;
|
| | |
|
| | | .main-content {
|
| | | height: 0;
|
| | | flex: 1;
|
| | | overflow-y: auto;
|
| | | }
|
| | |
|
| | | .btn-group {
|
| | | padding: 20rpx;
|
| | | z-index: 999;
|
| | | background-color: #fff;
|
| | | }
|
| | |
|
| | |
|
| | | .form {
|
| | | 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;
|
| | | }
|
| | | }
|
| | | }
|
| | | </style> |