edit_architecture.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640
  1. <template>
  2. <view class=" uni-container">
  3. <view class="example container" :style="'height: ' + (screenHeight - wheight - 75) + 'px'">
  4. <!-- 自定义表单校验 1-->
  5. <u--form ref="customForm" :model="formData" labelPosition="left" labelWidth="150" labelAlign="left">
  6. <view class=" flex flex-direction width100">
  7. <u-form-item label="楼宇名称" prop="buildingName" :required="true">
  8. <u-input v-model="formData.buildingName" placeholder="必填。请输入楼宇名称" />
  9. </u-form-item>
  10. <u-form-item label="所属单位" prop="orgName" :required="true" @click="
  11. showSex5 = true;
  12. hideKeyboard();
  13. ">
  14. <u--input v-model="formData.orgName" disabled disabledColor="#ffffff" placeholder="必选。请选择所属单位">
  15. </u--input>
  16. </u-form-item>
  17. <u-form-item label="楼宇编号 ">
  18. <u-input v-model="formData.buildingCode" placeholder="请输入楼宇编号" />
  19. </u-form-item>
  20. <u-form-item label="楼龄 ">
  21. <u-input v-model="formData.buildingAge" placeholder="请输入楼龄" />
  22. </u-form-item>
  23. <u-form-item label="楼层 ">
  24. <u-input v-model="formData.buildingFloor" placeholder="请输入楼层" />
  25. </u-form-item>
  26. <u-form-item label="档案负责人">
  27. <u-input v-model="formData.dafzr" placeholder="请输入档案负责人" />
  28. </u-form-item>
  29. <u-form-item label="占地面积">
  30. <u-input v-model="formData.zdmj" placeholder="请输入占地面积" />
  31. </u-form-item>
  32. <u-form-item label="产权信息 ">
  33. <u-input v-model="formData.ownership" placeholder="请输入产权信息" />
  34. </u-form-item>
  35. <u-form-item label="重点部位" prop="zdbwpic">
  36. <u-input v-model="formData.zdbwpic" placeholder="请输入重点部位" />
  37. </u-form-item>
  38. <u-form-item prop="dlwz" @tap="agree_poup()">
  39. <!-- <u-input v-model="formData.dlwz" placeholder="请输入地理位置" /> -->
  40. <!-- <input class="footer_content_input" type="text" v-model="formData.dlwz" placeholder="请选择地理位置"
  41. disabled @click="agree_poup()"></input> -->
  42. <view class="address-with-icon">
  43. <view class="address-label">
  44. <view class="main-label">
  45. 地理位置
  46. </view>
  47. <view class="address-sub-label">
  48. <view class="address-icon">
  49. <u-icon name="map-fill" color="#2979ff" size="20"></u-icon>
  50. </view>
  51. <view class="address-title">
  52. 更新地址
  53. </view>
  54. </view>
  55. </view>
  56. <view class="address-input">
  57. <u-input v-model="formData.dlwz" placeholder="请输入地理位置" />
  58. </view>
  59. </view>
  60. </u-form-item>
  61. <u-form-item label="有无避难层" prop="ywbnc" @click="
  62. showSex = true;
  63. hideKeyboard();
  64. ">
  65. <u--input v-model="formData.ywbnc" disabled disabledColor="#ffffff" placeholder="有无避难层">
  66. </u--input>
  67. </u-form-item>
  68. <u-form-item label="避难层层数">
  69. <u-input v-model="formData.bncsl" placeholder="请输入避难层层数 " />
  70. </u-form-item>
  71. <u-form-item label="避难层面积">
  72. <u-input v-model="formData.bncmj" placeholder="请输入避难层面积" />
  73. </u-form-item>
  74. <u-form-item label="避难层位置">
  75. <u-input v-model="formData.bncwz" placeholder="请输入避难层位置" />
  76. </u-form-item>
  77. <u-form-item label="安全出口数">
  78. <u-input v-model="formData.aqcks" placeholder="请输入安全出口数" />
  79. </u-form-item>
  80. <u-form-item label="建筑数量 ">
  81. <u-input v-model="formData.jzsl" placeholder="请输入建筑数量" />
  82. </u-form-item>
  83. <u-form-item label="建筑高度 ">
  84. <u-input v-model="formData.buildingHeight" placeholder="请输入建筑高度" />
  85. </u-form-item>
  86. <u-form-item label="建筑面积 ">
  87. <u-input v-model="formData.jzmj" placeholder="请输入建筑面积" />
  88. </u-form-item>
  89. <u-form-item label="建筑结构 ">
  90. <u-input v-model="formData.buildingStructure" placeholder="请输入建筑结构" />
  91. </u-form-item>
  92. <u-form-item label="消防车道数" prop="xfcds">
  93. <u-input v-model="formData.xfcds" placeholder="请输入消防车道数" />
  94. </u-form-item>
  95. <u-form-item label="消防电梯数" prop="xfdts">
  96. <u-input v-model="formData.xfdts" placeholder="请输入消防电梯数" />
  97. </u-form-item>
  98. <u-form-item prop="xfcdwz" @tap="popHighPosistion()">
  99. <view class="address-with-icon">
  100. <view class="address-label">
  101. <view class="main-label">
  102. 消防车登高操作场地位置
  103. </view>
  104. <view class="address-sub-label">
  105. <view class="address-icon">
  106. <u-icon name="map-fill" color="#2979ff" size="20"></u-icon>
  107. </view>
  108. <view class="address-title">
  109. 更新地址
  110. </view>
  111. </view>
  112. </view>
  113. <view class=".address-input">
  114. <u-input v-model="formData.xfcdwz" placeholder="请输入消防车登高操作场地位置" />
  115. </view>
  116. </view>
  117. <!-- <u-input v-model="formData.xfcdwz" placeholder="请输入消防车登高操作场地位置" /> -->
  118. </u-form-item>
  119. <u-form-item label="消防控制室位置" prop="xfkzswz">
  120. <u-input v-model="formData.xfkzswz" placeholder="请输入消防控制室位置" />
  121. </u-form-item>
  122. <u-form-item label="自动消防设施情况" @click="
  123. showSex4 = true;
  124. hideKeyboard();
  125. ">
  126. <u--input v-model="formData.zdxfss" disabled disabledColor="#ffffff" placeholder="自动消防设施情况">
  127. </u--input>
  128. </u-form-item>
  129. <u-form-item label="耐火等级 ">
  130. <u-input v-model="formData.fireRating" placeholder="请输入耐火等级" />
  131. </u-form-item>
  132. <u-form-item label="燃气类型 ">
  133. <u-input v-model="formData.rqlx" placeholder="请输入燃气类型" />
  134. </u-form-item>
  135. <u-form-item label="总平面图纸名称" v-if="formData.File">
  136. <!-- 选择文件上传 -->
  137. <uni-file-picker v-model="formData.File" del-icon limit="1" auto-upload file-mediatype="all"
  138. @select="select" @delete="deleteFile">
  139. <button type="primary" class="selectBtn">选择文件</button>
  140. </uni-file-picker>
  141. </u-form-item>
  142. </view>
  143. </u--form>
  144. <u-action-sheet :show="showSex" :actions="actions2" title="有无避难层" @close="showSex = false"
  145. @select="sexSelect2"></u-action-sheet>
  146. <u-action-sheet :show="showSex4" :actions="actions4" title="自动消防设施情况" @close="showSex4 = false"
  147. @select="sexSelect4"></u-action-sheet>
  148. <u-action-sheet :show="showSex5" :actions="actions5" title="请选择单位" @close="showSex5 = false"
  149. @select="sexSelect5"></u-action-sheet>
  150. </view>
  151. <uni-row class="heigthButton">
  152. <u-button @click="submit('customForm')" type="primary" shape="circle" size="large" color="#4CB2B6"
  153. text="确认修改"></u-button>
  154. </uni-row>
  155. </view>
  156. </template>
  157. <script>
  158. import {
  159. updateArc, // 更新
  160. upload, //上传文件
  161. getOrgId
  162. } from '@/api/architecture';
  163. import {
  164. getAccessToken
  165. } from '@/utils/auth';
  166. import config from '@/config';
  167. import store from '@/store';
  168. import {
  169. uploadAvatar
  170. } from '@/api/system/user';
  171. const baseUrl = config.baseUrl;
  172. var that = null;
  173. export default {
  174. data() {
  175. return {
  176. screenHeight: this.$screenHeight,
  177. wheight: '',
  178. showSex: false, //有无避难层
  179. showSex3: false, //有无消防车道
  180. showSex4: false, //自动消防设施情况
  181. showSex5: false, //所属单位
  182. actions: [],
  183. actions2: [{
  184. id: 1,
  185. name: '有'
  186. },
  187. {
  188. id: 2,
  189. name: '无'
  190. }
  191. ],
  192. actions4: [{
  193. id: 1,
  194. name: '情况良好'
  195. },
  196. {
  197. id: 2,
  198. name: '情况一般'
  199. },
  200. {
  201. id: 3,
  202. name: '报废'
  203. }
  204. ],
  205. actions5: [],
  206. // 每页数据量
  207. pageSize: 5,
  208. // 当前页
  209. pageNo: 1,
  210. // 数据总量
  211. total: 0,
  212. // tableData数据加载中
  213. loading: false,
  214. title: '生成隐患',
  215. content: '确认将此检查项目生成为隐患',
  216. // 自定义表单数据
  217. formData: {
  218. status: '0',
  219. File: [],
  220. xfcdwz: ''
  221. },
  222. // 用于显示下拉确认内容,不作为提交
  223. fpdStatus: '',
  224. // 自定义表单校验规则
  225. customRules: {
  226. buildingName: {
  227. type: 'string',
  228. required: true,
  229. message: '建筑名称不能为空',
  230. trigger: ['blur', 'change']
  231. },
  232. xfdts: {
  233. type: 'number',
  234. message: '消防电梯数为数字',
  235. trigger: ['blur', 'change']
  236. },
  237. xfcds: {
  238. type: 'number',
  239. message: '消防车道数为数字',
  240. trigger: ['blur', 'change']
  241. },
  242. orgName: {
  243. required: true,
  244. message: '所属单位为必填项',
  245. trigger: ['blur', 'change']
  246. },
  247. }
  248. };
  249. },
  250. computed: {},
  251. mounted() {
  252. uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
  253. this.wheight = data.height
  254. }).exec()
  255. },
  256. // 在 vue页面,向起始页通过事件传递数据
  257. onLoad: function(option) {
  258. var data = option.id;
  259. that = this;
  260. const eventChannel = this.getOpenerEventChannel();
  261. eventChannel.on('acceptDataFromOpenerPage', function(val) {
  262. that.formData = val;
  263. var File = that.formData.File = []
  264. if (that.formData.dwpmtzmc != '') {
  265. File.push({
  266. url: that.formData.dwpmtzmc,
  267. name: that.formData.dwpmtzmc
  268. });
  269. } else {
  270. File = null
  271. }
  272. });
  273. // 获取单位id
  274. getOrgId({
  275. pageNo: this.pageNo,
  276. pageSize: this.pageSize,
  277. userId: this.$store.state.user.id
  278. }).then(response => {
  279. // 取到用户对应的单位名称与id
  280. response.data.map(v => {
  281. this.actions5.push({
  282. id: v.id,
  283. name: v.orgName
  284. });
  285. });
  286. });
  287. },
  288. onReady() {
  289. this.$refs.customForm.setRules(this.customRules);
  290. },
  291. methods: {
  292. //让底部选择框显示出来
  293. agree_poup() {
  294. if (this.formData.orgId == undefined || this.formData.orgId == '' || this.formData.orgId == null) {
  295. uni.showToast({
  296. icon: 'error',
  297. title: '请选择所属单位'
  298. })
  299. } else {
  300. uni.chooseLocation({
  301. success: res => {
  302. this.formData.dlwz = res.address;
  303. }
  304. });
  305. }
  306. },
  307. // 弹出 消防车登高操作场地位置 选择地图
  308. popHighPosistion() {
  309. const that = this
  310. uni.chooseLocation({
  311. success: res => {
  312. that.formData.xfcdwz = res.address;
  313. that.$forceUpdate()
  314. }
  315. });
  316. },
  317. submit(ref) {
  318. this.$refs[ref]
  319. .validate()
  320. .then(res => {
  321. this.formData['status'] = 0;
  322. if (this.formData.File.length != 0) {
  323. this.formData.dwpmtzmc = this.formData.File[0]?.url?.toString();
  324. } else {
  325. this.formData.dwpmtzmc = ''
  326. }
  327. var jsdata = JSON.stringify(this.formData);
  328. // 提交数据
  329. updateArc(jsdata).then(response => {
  330. uni.showLoading({
  331. title: response.data.msg
  332. });
  333. setTimeout(() => {
  334. uni.hideLoading();
  335. uni.navigateBack({
  336. delta: 2
  337. })
  338. }, 0);
  339. });
  340. })
  341. .catch(err => {
  342. console.log(err,'err');
  343. uni.showToast({
  344. icon: 'none',
  345. title: '错误!' + err[0].message
  346. })
  347. });
  348. },
  349. // 上传图片 获取上传状态
  350. // 选择上传触发函数
  351. select(e) {
  352. // 根据所选图片的个数,多次调用上传函数
  353. let promises = [];
  354. for (let i = 0; i < e.tempFilePaths.length; i++) {
  355. const promise = this.uploadFiles(e.tempFilePaths, i);
  356. promises.push(promise);
  357. }
  358. Promise.all(promises).then(result => {});
  359. },
  360. // 上传函数
  361. async uploadFiles(tempFilePaths, i) {
  362. const that = this;
  363. await uni.uploadFile({
  364. url: baseUrl + '/admin-api/infra/file/upload', //后端用于处理图片并返回图片地址的接口
  365. filePath: tempFilePaths[i],
  366. name: 'file',
  367. header: {
  368. Authorization: 'Bearer ' + getAccessToken()
  369. }, //请求token
  370. success: res => {
  371. let data = JSON.parse(res.data);
  372. // 返回的url
  373. var fileLink = data.data;
  374. const code = data.code;
  375. // 如果成功,将返回的data数据给 formdata
  376. if (code == 0) {
  377. that.formData.File.push({
  378. url: fileLink,
  379. name: fileLink
  380. });
  381. uni.showToast({
  382. title: '文件上传成功!'
  383. });
  384. // that.formData.dwpmtzmc = fileLink
  385. }
  386. // this.formData.dwpmtzmc = this.formData.dwpmtzmc.toString();
  387. },
  388. fail: () => {
  389. uni.showToast({
  390. icon: 'error',
  391. title: '文件上传失败!'
  392. });
  393. }
  394. });
  395. },
  396. // 移出图片函数
  397. async deleteFile(e) {
  398. this.formData.dwpmtzmc = '';
  399. },
  400. // 隐藏键盘
  401. hideKeyboard() {
  402. uni.hideKeyboard();
  403. },
  404. // 有无避难层
  405. sexSelect2(e) {
  406. this.formData.ywbnc = e.name;
  407. },
  408. // 消防设施情况
  409. sexSelect4(e) {
  410. this.formData.zdxfss = e.name;
  411. },
  412. // 所属单位
  413. sexSelect5(e) {
  414. this.formData.orgId = e.id;
  415. this.formData.orgName = e.name;
  416. },
  417. // 生成隐患弹出层 //暂存为草稿箱弹出层
  418. cancel() {
  419. this.show = false;
  420. },
  421. confirm() {
  422. setTimeout(() => {
  423. // 0.5秒后自动关闭
  424. this.show = false;
  425. }, 500);
  426. },
  427. // 触底的事件
  428. scrolltolower() {
  429. // 判断是否还有下一页数据
  430. if (this.pageNo * this.pageSize >= this.total)
  431. return uni.showToast({
  432. title: `数据加载完毕`
  433. });
  434. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  435. if (this.loading) return;
  436. this.pageNo += 1;
  437. this.showCheckboxShow(this.pageNo);
  438. }
  439. }
  440. };
  441. </script>
  442. <style lang="scss" scoped>
  443. page {
  444. height: 100%;
  445. background-color: #f5f7f9;
  446. position: relative;
  447. }
  448. .buttomBorder {
  449. height: 0px;
  450. border: 1px dashed #cbd5e1;
  451. }
  452. /deep/ .uni-section .uni-section-header {
  453. padding: 0px;
  454. }
  455. /deep/ .u-form-item__body {
  456. font-weight: 500;
  457. flex-direction: column !important;
  458. }
  459. /deep/ .u-form-item__body__left__content__label {
  460. margin-bottom: 16rpx;
  461. font-size: 30rpx !important;
  462. color: #274647 !important;
  463. }
  464. .arrow-icon {
  465. //主动检查箭头
  466. position: absolute;
  467. right: 14px;
  468. top: 49px;
  469. transform: rotate(90deg);
  470. }
  471. /deep/ .u-input[data-v-fdbb9fe6],
  472. /deep/ .u-input.data-v-fdbb9fe6,
  473. /deep/.u-input {
  474. background-color: #fff;
  475. }
  476. /deep/.u-button[data-v-3bf2dba7],
  477. /deep/.u-button.data-v-3bf2dba7,
  478. /deep/.u-button {
  479. width: 60% !important;
  480. }
  481. //弹框样式
  482. .btnList {
  483. // width: 40%;
  484. display: flex;
  485. // display:flex;
  486. .u-button[data-v-3bf2dba7] {
  487. width: 30%;
  488. }
  489. }
  490. /deep/ .u-popup__content {
  491. //弹出的宽高
  492. height: 100%;
  493. }
  494. /deep/ .u-form-item__body__right__message {
  495. //校验的文字的位置
  496. margin-left: 10rpx !important;
  497. }
  498. /deep/ .uicon-close {
  499. //关闭按钮背景色
  500. background-color: rgba(199, 203, 210, 0.9);
  501. border-radius: 10%;
  502. }
  503. .checkbox {
  504. .checkbox-item {
  505. box-sizing: border-box;
  506. padding-top: 40px;
  507. }
  508. }
  509. //侧边联动
  510. .page-body {
  511. display: flex;
  512. background: #fff;
  513. overflow: hidden;
  514. }
  515. .nav {
  516. display: flex;
  517. width: 100%;
  518. }
  519. .nav-left {
  520. width: 25%;
  521. background: #fafafa;
  522. }
  523. .nav-left-item {
  524. height: 100upx;
  525. border-right: solid 1px #f1f1f1;
  526. border-bottom: solid 1px #f1f1f1;
  527. font-size: 30upx;
  528. display: flex;
  529. align-items: center;
  530. justify-content: center;
  531. }
  532. /deep/.nav-right-item[data-v-73caef23],
  533. /deep/.nav-right-item {
  534. display: flex;
  535. flex-wrap: wrap;
  536. }
  537. .nav-left-item:last-child {
  538. border-bottom: none;
  539. }
  540. .nav-right {
  541. width: 75%;
  542. }
  543. .box {
  544. display: block;
  545. overflow: hidden;
  546. border-bottom: 20upx solid #f3f3f3;
  547. /* min-height: 100vh; */
  548. /*若您的子分类过少想使得每个子分类占满屏请放开上边注视 */
  549. }
  550. .box:last-child {
  551. border: none;
  552. // min-height: 100vh;
  553. }
  554. .nav-right-item {
  555. margin-top: 20px;
  556. // width: 28%;
  557. // min-height: 200upx;
  558. float: left;
  559. text-align: center;
  560. padding: 11upx;
  561. font-size: 28upx;
  562. background: #fff;
  563. /deep/.u-checkbox__icon-wrap[data-v-532d01c7],
  564. /deep/.u-checkbox__icon-wrap {
  565. //复选框的样式
  566. margin: 0 20rpx;
  567. }
  568. /deep/ uni-view[data-v-3d1b15f2] {
  569. //复选框上线的间距
  570. margin: 20rpx 0 !important;
  571. }
  572. // /deep/ .u-checkbox__icon-wrap--square{
  573. // margin: 20rpx;
  574. // }
  575. .u-checkbox-label--right[data-v-532d01c7],
  576. .u-checkbox-label--right {
  577. margin-right: 40rpx;
  578. }
  579. }
  580. .nav-right-item image {
  581. width: 150upx;
  582. height: 150upx;
  583. }
  584. .active {
  585. font-weight: 700;
  586. color: #274647;
  587. background: #fff;
  588. border-right: 0;
  589. }
  590. ::-webkit-scrollbar {
  591. /*取消小程序的默认导航条样式*/
  592. width: 0;
  593. height: 0;
  594. color: transparent;
  595. }
  596. .selectBtn {
  597. width: 200rpx;
  598. margin-left: 0;
  599. font-size: 30rpx;
  600. background-color: #4cb2b6;
  601. }
  602. .example{
  603. overflow-y: auto;
  604. }
  605. </style>