edit_archive3.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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="300" labelAlign="left">
  6. <view class=" flex flex-direction width100">
  7. <u-form-item label="名称 (示例:Xx宾馆)" :required="true" prop="mc">
  8. <u-input v-model="formData.mc" placeholder="必填。请输入名称" />
  9. </u-form-item>
  10. <u-form-item label="所在建筑名称 (示例:Xx商住楼)" :required="true">
  11. <u-input v-model="formData.szjzmc" placeholder="必填。所在建筑名称" />
  12. </u-form-item>
  13. <u-form-item label="消防安全管理人及联系电话" :required="true" prop="xfaqglr">
  14. <u-input v-model="formData.xfaqglr" placeholder="请输入消防安全管理人及联系电话" />
  15. </u-form-item>
  16. <u-form-item label="消防安全责任人及联系电话 " :required="true" prop="xfaqzrr">
  17. <u-input v-model="formData.xfaqzrr" placeholder="请输入消防安全责任人及联系电话" />
  18. </u-form-item>
  19. <u-form-item label="类别 (示例:宾馆)">
  20. <u-input v-model="formData.lb" placeholder="请输入类别" />
  21. </u-form-item>
  22. <u-form-item label="性质 (示例:其他个体工商户)">
  23. <u-input v-model="formData.xz" placeholder="请输入性质" />
  24. </u-form-item>
  25. <u-form-item label="地址"><u-input v-model="formData.dz" placeholder="请输入地址" /></u-form-item>
  26. <u-form-item label="使用楼层、面积">
  27. <u-input v-model="formData.sylcmj" placeholder="请输入使用楼层、面积" />
  28. </u-form-item>
  29. <u-form-item label="消防设施器材情况">
  30. <u-input v-model="formData.xfssqc" placeholder="请输入消防设施器材情况" />
  31. </u-form-item>
  32. <!-- <u-form-item label="*所属乡镇街道" @click="hideKeyboard()" prop="streetName">
  33. <u--input
  34. v-model="formData.streetName"
  35. disabled
  36. disabledColor="#ffffff"
  37. placeholder="请选择所属乡镇街道"
  38. ></u--input>
  39. </u-form-item> -->
  40. <u-form-item label="备注">
  41. <u-textarea auto-height maxlength="-1" v-model="formData.remark"
  42. placeholder="请输入备注"></u-textarea>
  43. </u-form-item>
  44. </view>
  45. </u--form>
  46. </view>
  47. <uni-row class="heigthButton">
  48. <u-button @click="submit('customForm')" type="primary" shape="circle" size="large" color="#4CB2B6"
  49. text="确认修改"></u-button>
  50. </uni-row>
  51. </view>
  52. </template>
  53. <script>
  54. import {
  55. updateArchive, // 更新
  56. getDepartment //获取登陆人的部门信息
  57. } from '@/api/archive/index3.js';
  58. var that = null;
  59. export default {
  60. data() {
  61. return {
  62. screenHeight: this.$screenHeight,
  63. wheight: '',
  64. // 每页数据量
  65. pageSize: 5,
  66. // 当前页
  67. pageNo: 1,
  68. // 数据总量
  69. total: 0,
  70. unitTime: false,
  71. loading: false,
  72. title: '生成隐患',
  73. content: '确认将此检查项目生成为隐患',
  74. // 自定义表单数据
  75. formData: {
  76. status: '0'
  77. },
  78. // 自定义表单校验规则
  79. customRules: {
  80. mc: {
  81. type: 'string',
  82. required: true,
  83. message: '名称不能为空',
  84. trigger: ['blur', 'change']
  85. },
  86. lxdh: {
  87. pattern: /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/,
  88. required: true,
  89. message: '联系电话输入不正确',
  90. trigger: ['blur', 'change']
  91. },
  92. xfaqglr: {
  93. type: 'string',
  94. required: true,
  95. message: '消防安全管理人及联系电话不能为空',
  96. trigger: ['blur', 'change']
  97. },
  98. xfaqzrr: {
  99. type: 'string',
  100. required: true,
  101. message: '消防安全责任人人及联系电话不能为空',
  102. trigger: ['blur', 'change']
  103. }
  104. }
  105. };
  106. },
  107. computed: {},
  108. mounted() {
  109. uni.createSelectorQuery().in(this).select('.heigthButton').boundingClientRect(data => {
  110. this.wheight = data.height
  111. }).exec()
  112. },
  113. onLoad: function(option) {
  114. that = this
  115. var data = option.id;
  116. // 接收来自上个页面传递的参数
  117. const eventChannel = this.getOpenerEventChannel();
  118. eventChannel.on('acceptDataFromOpenerPage', function(val) {
  119. that.formData = val;
  120. });
  121. // 以下内容都是为了 选择街道
  122. const deptValue = uni.getStorageSync('getDepartment_key'); //所有街道
  123. const deptId = uni.getStorageSync('getUserInfo_key').userInfo.deptId; //登录用户的街道id
  124. var newArrar = {}; //新对象
  125. // 如果存在街道id,就直接取出对应的名称
  126. if (deptId) {
  127. newArrar = deptValue.find((item) => {
  128. if (item.id === deptId) {
  129. this.formData.streetId = item.id;
  130. this.formData.streetName = item.name;
  131. }
  132. })
  133. }
  134. },
  135. onReady() {
  136. this.$refs.customForm.setRules(this.customRules);
  137. },
  138. methods: {
  139. submit(ref) {
  140. this.$refs[ref]
  141. .validate()
  142. .then(res => {
  143. this.formData['status'] = 0;
  144. var jsdata = JSON.stringify(this.formData);
  145. console.log(jsdata, 'jsdatajsdatajsdata');
  146. updateArchive(jsdata).then(response => {
  147. console.log('response.data.msg,', response.data);
  148. uni.showLoading({
  149. title: response.data.msg
  150. });
  151. uni.hideLoading();
  152. uni.navigateBack({
  153. delta: 2
  154. });
  155. });
  156. })
  157. .catch(err => {
  158. uni.showToast({
  159. icon: 'none',
  160. title: '错误!' + err[0].message
  161. })
  162. console.log('err错误信息为:', err);
  163. });
  164. },
  165. // 隐藏键盘
  166. hideKeyboard() {
  167. uni.hideKeyboard();
  168. },
  169. // 单位成立时间
  170. ActiveUnitTime(e) {
  171. this.unitTime = false;
  172. let value = new Date(e.value);
  173. console.log(e.value, e.mode);
  174. this.formData.jzsj = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
  175. },
  176. changetime(e) {
  177. console.log('change', e);
  178. },
  179. // 生成隐患弹出层 //暂存为草稿箱弹出层
  180. cancel() {
  181. this.show = false;
  182. },
  183. confirm() {
  184. setTimeout(() => {
  185. // 0.5秒后自动关闭
  186. this.show = false;
  187. }, 500);
  188. },
  189. // 触底的事件
  190. scrolltolower() {
  191. // 判断是否还有下一页数据
  192. if (this.pageNo * this.pageSize >= this.total)
  193. return uni.showToast({
  194. title: `数据加载完毕`
  195. });
  196. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  197. if (this.loading) return;
  198. this.pageNo += 1;
  199. this.showCheckboxShow(this.pageNo);
  200. }
  201. }
  202. };
  203. </script>
  204. <style lang="scss" scoped>
  205. page {
  206. height: 100%;
  207. background-color: #f5f7f9;
  208. position: relative;
  209. }
  210. body {
  211. background-color: #f5f7f9;
  212. }
  213. .buttomBorder {
  214. height: 0px;
  215. border: 1px dashed #cbd5e1;
  216. }
  217. /deep/ .uni-section .uni-section-header {
  218. padding: 0px;
  219. }
  220. /deep/ .u-form-item__body {
  221. font-weight: 500;
  222. flex-direction: column !important;
  223. }
  224. /deep/ .u-form-item__body__left__content__label {
  225. margin-bottom: 16rpx;
  226. font-size: 30rpx !important;
  227. color: #274647 !important;
  228. }
  229. .arrow-icon {
  230. //主动检查箭头
  231. position: absolute;
  232. right: 14px;
  233. top: 49px;
  234. transform: rotate(90deg);
  235. }
  236. /deep/ .u-input[data-v-fdbb9fe6],
  237. /deep/ .u-input.data-v-fdbb9fe6,
  238. /deep/ .u-input {
  239. background-color: #fff;
  240. }
  241. /deep/.u-button[data-v-3bf2dba7],
  242. /deep/.u-button.data-v-3bf2dba7,
  243. /deep/.u-button {
  244. width: 60% !important;
  245. }
  246. //弹框样式
  247. .btnList {
  248. // width: 40%;
  249. display: flex;
  250. // display:flex;
  251. .u-button[data-v-3bf2dba7],
  252. .u-button {
  253. width: 30%;
  254. }
  255. }
  256. /deep/ .u-popup__content {
  257. //弹出的宽高
  258. height: 100%;
  259. }
  260. /deep/ .u-form-item__body__right__message {
  261. //校验的文字的位置
  262. margin-left: 10rpx !important;
  263. }
  264. /deep/ .uicon-close {
  265. //关闭按钮背景色
  266. background-color: rgba(199, 203, 210, 0.9);
  267. border-radius: 10%;
  268. }
  269. .checkbox {
  270. .checkbox-item {
  271. box-sizing: border-box;
  272. padding-top: 40px;
  273. }
  274. }
  275. //侧边联动
  276. .page-body {
  277. display: flex;
  278. background: #fff;
  279. overflow: hidden;
  280. }
  281. .nav {
  282. display: flex;
  283. width: 100%;
  284. }
  285. .nav-left {
  286. width: 25%;
  287. background: #fafafa;
  288. }
  289. .nav-left-item {
  290. height: 100upx;
  291. border-right: solid 1px #f1f1f1;
  292. border-bottom: solid 1px #f1f1f1;
  293. font-size: 30upx;
  294. display: flex;
  295. align-items: center;
  296. justify-content: center;
  297. }
  298. /deep/.nav-right-item[data-v-73caef23] {
  299. display: flex;
  300. flex-wrap: wrap;
  301. }
  302. .nav-left-item:last-child {
  303. border-bottom: none;
  304. }
  305. .nav-right {
  306. width: 75%;
  307. }
  308. .box {
  309. display: block;
  310. overflow: hidden;
  311. border-bottom: 20upx solid #f3f3f3;
  312. /* min-height: 100vh; */
  313. /*若您的子分类过少想使得每个子分类占满屏请放开上边注视 */
  314. }
  315. .box:last-child {
  316. border: none;
  317. // min-height: 100vh;
  318. }
  319. .nav-right-item {
  320. margin-top: 20px;
  321. // width: 28%;
  322. // min-height: 200upx;
  323. float: left;
  324. text-align: center;
  325. padding: 11upx;
  326. font-size: 28upx;
  327. background: #fff;
  328. /deep/.u-checkbox__icon-wrap[data-v-532d01c7],
  329. /deep/.u-checkbox__icon-wrap {
  330. //复选框的样式
  331. margin: 0 20rpx;
  332. }
  333. /deep/ uni-view[data-v-3d1b15f2] {
  334. //复选框上线的间距
  335. margin: 20rpx 0 !important;
  336. }
  337. // /deep/ .u-checkbox__icon-wrap--square{
  338. // margin: 20rpx;
  339. // }
  340. .u-checkbox-label--right[data-v-532d01c7],
  341. .u-checkbox-label--right {
  342. margin-right: 40rpx;
  343. }
  344. }
  345. .nav-right-item image {
  346. width: 150upx;
  347. height: 150upx;
  348. }
  349. .active {
  350. font-weight: 700;
  351. color: #274647;
  352. background: #fff;
  353. border-right: 0;
  354. }
  355. ::-webkit-scrollbar {
  356. /*取消小程序的默认导航条样式*/
  357. width: 0;
  358. height: 0;
  359. color: transparent;
  360. }
  361. .selectBtn {
  362. width: 200rpx;
  363. margin-left: 0;
  364. font-size: 30rpx;
  365. background-color: #4cb2b6;
  366. }
  367. .example {
  368. overflow-y: auto;
  369. }
  370. </style>