123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658 |
- <template>
- <view class=" uni-container">
- <view class="example container" :style="'height: ' + (screenHeight - wheight - 75) + 'px'">
- <!-- 自定义表单校验 1-->
- <u--form ref="customForm" :model="formData" labelPosition="left" labelWidth="150" labelAlign="left">
- <view class=" flex flex-direction width100">
- <u-form-item label="楼宇名称" prop="buildingName" :required="true">
- <u-input v-model="formData.buildingName" placeholder="必填。请输入楼宇名称" />
- </u-form-item>
- <u-form-item label="所属单位" prop="orgName" :required="true" @click="
- showSex5 = true;
- hideKeyboard();
- ">
- <u--input v-model="formData.orgName" disabled disabledColor="#ffffff" placeholder="必选。请选择所属单位">
- </u--input>
- </u-form-item>
- <u-form-item label="楼宇编号 ">
- <u-input v-model="formData.buildingCode" placeholder="请输入楼宇编号" />
- </u-form-item>
- <u-form-item label="楼龄 ">
- <u-input v-model="formData.buildingAge" placeholder="请输入楼龄" />
- </u-form-item>
- <u-form-item label="楼层 ">
- <u-input v-model="formData.buildingFloor" placeholder="请输入楼层" />
- </u-form-item>
- <u-form-item label="档案负责人">
- <u-input v-model="formData.dafzr" placeholder="请输入档案负责人" />
- </u-form-item>
- <u-form-item label="占地面积">
- <u-input v-model="formData.zdmj" placeholder="请输入占地面积" />
- </u-form-item>
- <u-form-item label="产权信息 ">
- <u-input v-model="formData.ownership" placeholder="请输入产权信息" />
- </u-form-item>
- <u-form-item label="重点部位" prop="xfdts">
- <u-input v-model="formData.zdbw" placeholder="请输入重点部位" />
- </u-form-item>
- <u-form-item prop="dlwz" @tap="agree_poup()">
- <!-- <u-input v-model="formData.dlwz" placeholder="请输入地理位置" /> -->
- <!-- <input class="footer_content_input" type="text" v-model="formData.dlwz" placeholder="请选择地理位置"
- disabled @click="agree_poup()"></input> -->
- <view class="address-with-icon">
- <view class="address-label">
- <view class="main-label">
- 地理位置
- </view>
- <view class="address-sub-label">
- <view class="address-icon">
- <u-icon name="map-fill" color="#2979ff" size="20"></u-icon>
- </view>
- <view class="address-title">
- 更新地址
- </view>
- </view>
- </view>
- <view class="address-input">
- <u-input v-model="formData.dlwz" placeholder="请输入地理位置" />
- </view>
- </view>
- </u-form-item>
- <u-form-item label="有无避难层" prop="ywbnc" @click="
- showSex = true;
- hideKeyboard();
- ">
- <u--input v-model="formData.ywbnc" disabled disabledColor="#ffffff" placeholder="有无避难层">
- </u--input>
- </u-form-item>
- <u-form-item label="避难层层数">
- <u-input v-model="formData.bncsl" placeholder="请输入避难层层数 " />
- </u-form-item>
- <u-form-item label="避难层面积">
- <u-input v-model="formData.bncmj" placeholder="请输入避难层面积" />
- </u-form-item>
- <u-form-item label="避难层位置">
- <u-input v-model="formData.bncwz" placeholder="请输入避难层位置" />
- </u-form-item>
- <u-form-item label="安全出口数">
- <u-input v-model="formData.aqcks" placeholder="请输入安全出口数" />
- </u-form-item>
- <u-form-item label="建筑数量 ">
- <u-input v-model="formData.jzsl" placeholder="请输入建筑数量" />
- </u-form-item>
- <u-form-item label="建筑高度 ">
- <u-input v-model="formData.buildingHeight" placeholder="请输入建筑高度" />
- </u-form-item>
- <u-form-item label="建筑面积 ">
- <u-input v-model="formData.jzmj" placeholder="请输入建筑面积" />
- </u-form-item>
- <u-form-item label="建筑结构 ">
- <u-input v-model="formData.buildingStructure" placeholder="请输入建筑结构" />
- </u-form-item>
- <u-form-item label="消防车道数" prop="xfcds">
- <u-input v-model="formData.xfcds" placeholder="请输入消防车道数" />
- </u-form-item>
- <u-form-item label="消防电梯数" prop="xfdts">
- <u-input v-model="formData.xfdts" placeholder="请输入消防电梯数" />
- </u-form-item>
- <u-form-item prop="xfcdwz" @tap="popHighPosistion()">
- <view class="address-with-icon">
- <view class="address-label">
- <view class="main-label">
- 消防车登高操作场地位置
- </view>
- <view class="address-sub-label">
- <view class="address-icon">
- <u-icon name="map-fill" color="#2979ff" size="20"></u-icon>
- </view>
- <view class="address-title">
- 更新地址
- </view>
- </view>
- </view>
- <view class=".address-input">
- <u-input v-model="formData.xfcdwz" placeholder="请输入消防车登高操作场地位置" />
- </view>
- </view>
- <!-- <u-input v-model="formData.xfcdwz" placeholder="请输入消防车登高操作场地位置" /> -->
- </u-form-item>
- <u-form-item label="消防控制室位置" prop="xfkzswz">
- <u-input v-model="formData.xfkzswz" placeholder="请输入消防控制室位置" />
- </u-form-item>
- <u-form-item label="自动消防设施情况" @click="
- showSex4 = true;
- hideKeyboard();
- ">
- <u--input v-model="formData.zdxfss" disabled disabledColor="#ffffff" placeholder="自动消防设施情况">
- </u--input>
- </u-form-item>
- <u-form-item label="耐火等级 ">
- <u-input v-model="formData.fireRating" placeholder="请输入耐火等级" />
- </u-form-item>
- <u-form-item label="燃气类型 ">
- <u-input v-model="formData.rqlx" placeholder="请输入燃气类型" />
- </u-form-item>
- <u-form-item label="总平面图纸名称 ">
- <!-- 选择文件上传 -->
- <uni-file-picker v-model="formData.File" del-icon limit="1" auto-upload file-mediatype="all"
- @select="select" @delete="deleteFile">
- <button type="primary" class="selectBtn">选择文件</button>
- </uni-file-picker>
- </u-form-item>
- </view>
- </u--form>
- <u-action-sheet :show="showSex" :actions="actions2" title="有无避难层" @close="showSex = false"
- @select="sexSelect2"></u-action-sheet>
- <u-action-sheet :show="showSex4" :actions="actions4" title="自动消防设施情况" @close="showSex4 = false"
- @select="sexSelect4"></u-action-sheet>
- <u-action-sheet :show="showSex5" :actions="actions5" title="请选择单位" @close="showSex5 = false"
- @select="sexSelect5"></u-action-sheet>
- </view>
- <uni-row class="heigthButton">
- <u-button @click="submit('customForm')" type="primary" shape="circle" size="large" color="#4CB2B6"
- text="确认修改"></u-button>
- </uni-row>
- </view>
- </template>
- <script>
- import {
- updateArc, // 更新
- upload, //上传文件
- getOrgId
- } from '@/api/architecture';
- import {
- getAccessToken
- } from '@/utils/auth';
- import config from '@/config';
- import store from '@/store';
- import {
- uploadAvatar
- } from '@/api/system/user';
- const baseUrl = config.baseUrl;
- var that = null;
- export default {
- data() {
- return {
- screenHeight: this.$screenHeight,
- wheight: '',
- showSex: false, //有无避难层
- showSex3: false, //有无消防车道
- showSex4: false, //自动消防设施情况
- showSex5: false, //所属单位
- actions: [],
- actions2: [{
- id: 1,
- name: '有'
- },
- {
- id: 2,
- name: '无'
- }
- ],
- actions4: [{
- id: 1,
- name: '情况良好'
- },
- {
- id: 2,
- name: '情况一般'
- },
- {
- id: 3,
- name: '报废'
- }
- ],
- actions5: [],
- // 每页数据量
- pageSize: 5,
- // 当前页
- pageNo: 1,
- // 数据总量
- total: 0,
- // tableData数据加载中
- loading: false,
- title: '生成隐患',
- content: '确认将此检查项目生成为隐患',
- // 自定义表单数据
- formData: {
- status: '0',
- File: [],
- xfcdwz: ''
- },
- // 用于显示下拉确认内容,不作为提交
- fpdStatus: '',
- // 自定义表单校验规则
- customRules: {
- buildingName: {
- type: 'string',
- required: true,
- message: '建筑名称不能为空',
- trigger: ['blur', 'change']
- },
- xfdts: {
- type: 'number',
- message: '消防电梯数为数字',
- trigger: ['blur', 'change']
- },
- xfcds: {
- type: 'number',
- message: '消防车道数为数字',
- trigger: ['blur', 'change']
- },
- orgName: {
- required: true,
- message: '所属单位为必填项',
- trigger: ['blur', 'change']
- },
- }
- };
- },
- computed: {},
- mounted() {
- uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
- this.wheight = data.height
- }).exec()
- },
- // 在 vue页面,向起始页通过事件传递数据
- onLoad: function(option) {
- var data = option.id;
- that = this;
- const eventChannel = this.getOpenerEventChannel();
- eventChannel.on('acceptDataFromOpenerPage', function(val) {
- console.log("val: ", val);
- that.formData = val;
- var File = that.formData.File = []
- if (that.formData.dwpmtzmc != '') {
- File.push({
- url: that.formData.dwpmtzmc,
- name: that.formData.dwpmtzmc
- });
- } else {
- File = null
- }
- console.log('edit页面的val的值', that.formData);
- console.log("that.formData.File: ", that.formData.File);
- });
- // 获取单位id
- getOrgId({
- pageNo: this.pageNo,
- pageSize: this.pageSize,
- userId: this.$store.state.user.id
- }).then(response => {
- console.log(response, 'response');
- // 取到用户对应的单位名称与id
- response.data.map(v => {
- this.actions5.push({
- id: v.id,
- name: v.orgName
- });
- });
- });
- },
- onReady() {
- this.$refs.customForm.setRules(this.customRules);
- },
- methods: {
- //让底部选择框显示出来
- agree_poup() {
- console.log(this.formData.orgId);
- if (this.formData.orgId == undefined || this.formData.orgId == '' || this.formData.orgId == null) {
- uni.showToast({
- icon: 'error',
- title: '请选择所属单位'
- })
- } else {
- uni.chooseLocation({
- success: res => {
- this.formData.dlwz = res.address;
- }
- });
- }
- },
- // 弹出 消防车登高操作场地位置 选择地图
- popHighPosistion() {
- const that = this
- uni.chooseLocation({
- success: res => {
- console.log('详细地址撒法发:' + res.address);
- that.formData.xfcdwz = res.address;
- that.$forceUpdate()
- }
- });
- },
- submit(ref) {
- this.$refs[ref]
- .validate()
- .then(res => {
- console.log(this.formData.dwpmtzmc);
- this.formData['status'] = 0;
- console.log(this.formData);
- if (this.formData.File.length != 0) {
- this.formData.dwpmtzmc = this.formData.File[0].url.toString();
- } else {
- this.formData.dwpmtzmc = ''
- }
- var jsdata = JSON.stringify(this.formData);
- console.log(jsdata, 'jsdatajsdatajsdata');
- // 提交数据
- updateArc(jsdata).then(response => {
- console.log('response.data.msg,', response.data);
- uni.showLoading({
- title: response.data.msg
- });
- setTimeout(() => {
- console.log('修改成功!');
- uni.hideLoading();
- uni.navigateBack({
- delta: 2
- })
- }, 0);
- });
- })
- .catch(err => {
- console.log('err错误信息为:', err);
- uni.showToast({
- icon: 'none',
- title: '错误!' + err[0].message
- })
- });
- },
- // 上传图片 获取上传状态
- // 选择上传触发函数
- select(e) {
- // 根据所选图片的个数,多次调用上传函数
- let promises = [];
- for (let i = 0; i < e.tempFilePaths.length; i++) {
- const promise = this.uploadFiles(e.tempFilePaths, i);
- promises.push(promise);
- }
- Promise.all(promises).then(result => {});
- },
- // 上传函数
- async uploadFiles(tempFilePaths, i) {
- const that = this;
- await uni.uploadFile({
- url: baseUrl + '/admin-api/infra/file/upload', //后端用于处理图片并返回图片地址的接口
- filePath: tempFilePaths[i],
- name: 'file',
- header: {
- Authorization: 'Bearer ' + getAccessToken()
- }, //请求token
- success: res => {
- console.log('res', res);
- let data = JSON.parse(res.data);
- // 返回的url
- var fileLink = data.data;
- const code = data.code;
- // 如果成功,将返回的data数据给 formdata
- if (code == 0) {
- that.formData.File.push({
- url: fileLink,
- name: fileLink
- });
- uni.showToast({
- title: '文件上传成功!'
- });
- // that.formData.dwpmtzmc = fileLink
- }
- // this.formData.dwpmtzmc = this.formData.dwpmtzmc.toString();
- },
- fail: () => {
- console.log('err');
- uni.showToast({
- icon: 'error',
- title: '文件上传失败!'
- });
- }
- });
- },
- // 移出图片函数
- async deleteFile(e) {
- console.log(e);
- this.formData.dwpmtzmc = '';
- console.log('移除了:', this.formData.dwpmtzmc);
- },
- // 隐藏键盘
- hideKeyboard() {
- uni.hideKeyboard();
- },
- // 有无避难层
- sexSelect2(e) {
- this.formData.ywbnc = e.name;
- console.log(this.formData.ywbnc);
- },
- // 消防设施情况
- sexSelect4(e) {
- this.formData.zdxfss = e.name;
- console.log(this.formData.zdxfss);
- },
- // 所属单位
- sexSelect5(e) {
- this.formData.orgId = e.id;
- this.formData.orgName = e.name;
- console.log(this.formData.orgId);
- },
- // 生成隐患弹出层 //暂存为草稿箱弹出层
- cancel() {
- this.show = false;
- },
- confirm() {
- setTimeout(() => {
- // 0.5秒后自动关闭
- this.show = false;
- }, 500);
- },
- // 触底的事件
- scrolltolower() {
- // 判断是否还有下一页数据
- if (this.pageNo * this.pageSize >= this.total)
- return uni.showToast({
- title: `数据加载完毕`
- });
- // 判断是否正在请求其它数据,如果是,则不发起额外的请求
- if (this.loading) return;
- this.pageNo += 1;
- this.showCheckboxShow(this.pageNo);
- }
- }
- };
- </script>
- <style lang="scss" scoped>
- page {
- height: 100%;
- background-color: #f5f7f9;
- position: relative;
- }
- .buttomBorder {
- height: 0px;
- border: 1px dashed #cbd5e1;
- }
- /deep/ .uni-section .uni-section-header {
- padding: 0px;
- }
- /deep/ .u-form-item__body {
- font-weight: 500;
- flex-direction: column !important;
- }
- /deep/ .u-form-item__body__left__content__label {
- margin-bottom: 16rpx;
- font-size: 30rpx !important;
- color: #274647 !important;
- }
- .arrow-icon {
- //主动检查箭头
- position: absolute;
- right: 14px;
- top: 49px;
- transform: rotate(90deg);
- }
- /deep/ .u-input[data-v-fdbb9fe6],
- /deep/ .u-input.data-v-fdbb9fe6,
- /deep/.u-input {
- background-color: #fff;
- }
- /deep/.u-button[data-v-3bf2dba7],
- /deep/.u-button.data-v-3bf2dba7,
- /deep/.u-button {
- width: 60% !important;
- }
- //弹框样式
- .btnList {
- // width: 40%;
- display: flex;
- // display:flex;
- .u-button[data-v-3bf2dba7] {
- width: 30%;
- }
- }
- /deep/ .u-popup__content {
- //弹出的宽高
- height: 100%;
- }
- /deep/ .u-form-item__body__right__message {
- //校验的文字的位置
- margin-left: 10rpx !important;
- }
- /deep/ .uicon-close {
- //关闭按钮背景色
- background-color: rgba(199, 203, 210, 0.9);
- border-radius: 10%;
- }
- .checkbox {
- .checkbox-item {
- box-sizing: border-box;
- padding-top: 40px;
- }
- }
- //侧边联动
- .page-body {
- display: flex;
- background: #fff;
- overflow: hidden;
- }
- .nav {
- display: flex;
- width: 100%;
- }
- .nav-left {
- width: 25%;
- background: #fafafa;
- }
- .nav-left-item {
- height: 100upx;
- border-right: solid 1px #f1f1f1;
- border-bottom: solid 1px #f1f1f1;
- font-size: 30upx;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- /deep/.nav-right-item[data-v-73caef23],
- /deep/.nav-right-item {
- display: flex;
- flex-wrap: wrap;
- }
- .nav-left-item:last-child {
- border-bottom: none;
- }
- .nav-right {
- width: 75%;
- }
- .box {
- display: block;
- overflow: hidden;
- border-bottom: 20upx solid #f3f3f3;
- /* min-height: 100vh; */
- /*若您的子分类过少想使得每个子分类占满屏请放开上边注视 */
- }
- .box:last-child {
- border: none;
- // min-height: 100vh;
- }
- .nav-right-item {
- margin-top: 20px;
- // width: 28%;
- // min-height: 200upx;
- float: left;
- text-align: center;
- padding: 11upx;
- font-size: 28upx;
- background: #fff;
- /deep/.u-checkbox__icon-wrap[data-v-532d01c7],
- /deep/.u-checkbox__icon-wrap {
- //复选框的样式
- margin: 0 20rpx;
- }
- /deep/ uni-view[data-v-3d1b15f2] {
- //复选框上线的间距
- margin: 20rpx 0 !important;
- }
- // /deep/ .u-checkbox__icon-wrap--square{
- // margin: 20rpx;
- // }
- .u-checkbox-label--right[data-v-532d01c7],
- .u-checkbox-label--right {
- margin-right: 40rpx;
- }
- }
- .nav-right-item image {
- width: 150upx;
- height: 150upx;
- }
- .active {
- font-weight: 700;
- color: #274647;
- background: #fff;
- border-right: 0;
- }
- ::-webkit-scrollbar {
- /*取消小程序的默认导航条样式*/
- width: 0;
- height: 0;
- color: transparent;
- }
- .selectBtn {
- width: 200rpx;
- margin-left: 0;
- font-size: 30rpx;
- background-color: #4cb2b6;
- }
- .example{
- overflow-y: auto;
- }
- </style>
|