edit_archive6.vue 8.3 KB

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