edit_archive5.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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').userInfo.deptId; //登录用户的街道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. console.log(jsdata, 'jsdatajsdatajsdata');
  130. updateArchive(jsdata).then(response => {
  131. console.log('response.data.msg,', response.data);
  132. uni.showLoading({
  133. title: response.data.msg
  134. });
  135. uni.hideLoading();
  136. uni.navigateBack({
  137. delta: 2
  138. });
  139. });
  140. })
  141. .catch(err => {
  142. uni.showToast({
  143. icon: 'none',
  144. title: '错误!' + err[0].message
  145. })
  146. console.log('err错误信息为:', err);
  147. });
  148. },
  149. // 隐藏键盘
  150. hideKeyboard() {
  151. uni.hideKeyboard();
  152. },
  153. // 单位成立时间
  154. ActiveUnitTime(e) {
  155. this.unitTime = false;
  156. let value = new Date(e.value);
  157. console.log(e.value, e.mode);
  158. this.formData.jcsj = uni.$u.timeFormat(e.value, 'yyyy-mm-dd');
  159. },
  160. changetime(e) {
  161. console.log('change', e);
  162. },
  163. // 生成隐患弹出层 //暂存为草稿箱弹出层
  164. cancel() {
  165. this.show = false;
  166. },
  167. confirm() {
  168. setTimeout(() => {
  169. // 0.5秒后自动关闭
  170. this.show = false;
  171. }, 500);
  172. },
  173. // 触底的事件
  174. scrolltolower() {
  175. // 判断是否还有下一页数据
  176. if (this.pageNo * this.pageSize >= this.total)
  177. return uni.showToast({
  178. title: `数据加载完毕`
  179. });
  180. // 判断是否正在请求其它数据,如果是,则不发起额外的请求
  181. if (this.loading) return;
  182. this.pageNo += 1;
  183. this.showCheckboxShow(this.pageNo);
  184. }
  185. }
  186. };
  187. </script>
  188. <style lang="scss" scoped>
  189. page {
  190. height: 100%;
  191. background-color: #f5f7f9;
  192. position: relative;
  193. }
  194. body {
  195. background-color: #f5f7f9;
  196. }
  197. .buttomBorder {
  198. height: 0px;
  199. border: 1px dashed #cbd5e1;
  200. }
  201. /deep/ .uni-section .uni-section-header {
  202. padding: 0px;
  203. }
  204. /deep/ .u-form-item__body {
  205. font-weight: 500;
  206. flex-direction: column !important;
  207. }
  208. /deep/ .u-form-item__body__left__content__label {
  209. margin-bottom: 16rpx;
  210. font-size: 30rpx !important;
  211. color: #274647 !important;
  212. }
  213. .arrow-icon {
  214. //主动检查箭头
  215. position: absolute;
  216. right: 14px;
  217. top: 49px;
  218. transform: rotate(90deg);
  219. }
  220. /deep/ .u-input[data-v-fdbb9fe6],
  221. /deep/ .u-input.data-v-fdbb9fe6,
  222. /deep/ .u-input {
  223. background-color: #fff;
  224. }
  225. /deep/.u-button[data-v-3bf2dba7],
  226. /deep/.u-button.data-v-3bf2dba7,
  227. /deep/.u-button {
  228. width: 60% !important;
  229. }
  230. //弹框样式
  231. .btnList {
  232. // width: 40%;
  233. display: flex;
  234. // display:flex;
  235. .u-button[data-v-3bf2dba7] {
  236. width: 30%;
  237. }
  238. }
  239. /deep/ .u-popup__content {
  240. //弹出的宽高
  241. height: 100%;
  242. }
  243. /deep/ .u-form-item__body__right__message {
  244. //校验的文字的位置
  245. margin-left: 10rpx !important;
  246. }
  247. /deep/ .uicon-close {
  248. //关闭按钮背景色
  249. background-color: rgba(199, 203, 210, 0.9);
  250. border-radius: 10%;
  251. }
  252. .checkbox {
  253. .checkbox-item {
  254. box-sizing: border-box;
  255. padding-top: 40px;
  256. }
  257. }
  258. //侧边联动
  259. .page-body {
  260. display: flex;
  261. background: #fff;
  262. overflow: hidden;
  263. }
  264. .nav {
  265. display: flex;
  266. width: 100%;
  267. }
  268. .nav-left {
  269. width: 25%;
  270. background: #fafafa;
  271. }
  272. .nav-left-item {
  273. height: 100upx;
  274. border-right: solid 1px #f1f1f1;
  275. border-bottom: solid 1px #f1f1f1;
  276. font-size: 30upx;
  277. display: flex;
  278. align-items: center;
  279. justify-content: center;
  280. }
  281. /deep/.nav-right-item[data-v-73caef23],
  282. /deep/.nav-right-item {
  283. display: flex;
  284. flex-wrap: wrap;
  285. }
  286. .nav-left-item:last-child {
  287. border-bottom: none;
  288. }
  289. .nav-right {
  290. width: 75%;
  291. }
  292. .box {
  293. display: block;
  294. overflow: hidden;
  295. border-bottom: 20upx solid #f3f3f3;
  296. /* min-height: 100vh; */
  297. /*若您的子分类过少想使得每个子分类占满屏请放开上边注视 */
  298. }
  299. .box:last-child {
  300. border: none;
  301. // min-height: 100vh;
  302. }
  303. .nav-right-item {
  304. margin-top: 20px;
  305. // width: 28%;
  306. // min-height: 200upx;
  307. float: left;
  308. text-align: center;
  309. padding: 11upx;
  310. font-size: 28upx;
  311. background: #fff;
  312. /deep/.u-checkbox__icon-wrap[data-v-532d01c7],
  313. /deep/.u-checkbox__icon-wrap {
  314. //复选框的样式
  315. margin: 0 20rpx;
  316. }
  317. /deep/ uni-view[data-v-3d1b15f2] {
  318. //复选框上线的间距
  319. margin: 20rpx 0 !important;
  320. }
  321. // /deep/ .u-checkbox__icon-wrap--square{
  322. // margin: 20rpx;
  323. // }
  324. .u-checkbox-label--right[data-v-532d01c7],
  325. .u-checkbox-label--right {
  326. margin-right: 40rpx;
  327. }
  328. }
  329. .nav-right-item image {
  330. width: 150upx;
  331. height: 150upx;
  332. }
  333. .active {
  334. font-weight: 700;
  335. color: #274647;
  336. background: #fff;
  337. border-right: 0;
  338. }
  339. ::-webkit-scrollbar {
  340. /*取消小程序的默认导航条样式*/
  341. width: 0;
  342. height: 0;
  343. color: transparent;
  344. }
  345. .selectBtn {
  346. width: 200rpx;
  347. margin-left: 0;
  348. font-size: 30rpx;
  349. background-color: #4cb2b6;
  350. }
  351. .my-label {
  352. margin-bottom: 10px;
  353. }
  354. .example {
  355. overflow-y: auto;
  356. }
  357. </style>