edit_archive5.vue 9.0 KB

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