operForm.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <u-popup :show="isShow" @close="close" mode="bottom" :closeOnClickOverlay="false" round="10"
  3. :customStyle="{
  4. overflow: 'hidden'
  5. }"
  6. >
  7. <view class="page-container">
  8. <scroll-view
  9. scroll-y style="max-height: 90vh" enable-back-to-top
  10. >
  11. <view class="page-head">
  12. </view>
  13. <view class="page-body">
  14. <u--form label-width="auto" labelAlign="left"
  15. ref="uForm"
  16. :model="model"
  17. :rules="rules"
  18. :labelStyle="{
  19. fontSize: '28rpx',
  20. fontWeight: '500',
  21. }"
  22. >
  23. <u-cell-group :border="false">
  24. <view class="input-box">
  25. <template>
  26. <u-cell title="" :border="true" :isLink="false" :clickable="true" class="hidde-cell-title"
  27. @click="$refs.dueTimeRef.show()"
  28. >
  29. <view slot="value" class="value">
  30. <u-form-item :label="labelTitle" labelPosition="" prop="form.dueTime" :required="true">
  31. <u--input
  32. :value="model.form.dueTime"
  33. placeholder="请选择"
  34. border="none"
  35. inputAlign="right"
  36. :disabled="true"
  37. disabledColor="none"
  38. :customStyle="{
  39. pointerEvents: 'none',
  40. }"
  41. >
  42. </u--input>
  43. </u-form-item>
  44. </view>
  45. </u-cell>
  46. <tq-date-time ref="dueTimeRef"
  47. mode="date"
  48. format="YYYY-MM-DD"
  49. @confirm="(data) => {
  50. model.form.dueTime = data
  51. $refs.uForm.validateField('form.dueTime')
  52. }"
  53. >
  54. </tq-date-time>
  55. </template>
  56. </view>
  57. <view class="box" v-if="model.form.msgType == 4">
  58. <u-cell title="" :border="false" :isLink="false" :clickable="false" class="hidde-cell-title">
  59. <view slot="value" class="value">
  60. <u-form-item labelPosition="top" prop="form.photo" :required="true">
  61. <view slot="label" class="item-label">
  62. <view class="item-label-left">
  63. <!-- <text>*</text> -->
  64. 驾驶证照片
  65. </view>
  66. <view class="item-label-right">{{model.form.photo?model.form.photo.split(',').length:0}}/1</view>
  67. </view>
  68. <view style="margin-top: 30rpx;">
  69. <tq-upload-img
  70. v-model="model.form.photo"
  71. :maxCount="1"
  72. width="80"
  73. height="80"
  74. uploadText=""
  75. >
  76. </tq-upload-img>
  77. </view>
  78. </u-form-item>
  79. </view>
  80. </u-cell>
  81. </view>
  82. </u-cell-group>
  83. </u--form>
  84. </view>
  85. </scroll-view>
  86. <view class="page-footer">
  87. <u-row style="">
  88. <u-col :span="6">
  89. <u-button type="info" shape="" :hairline="false" :custom-style="{
  90. width: '100%',
  91. borderRadius: '0',
  92. background: '#FFF',
  93. height: '100rpx',
  94. fontSize: '32rpx',
  95. fontWeight: '500',
  96. }" @click="close">取消
  97. </u-button>
  98. </u-col>
  99. <u-col :span="6">
  100. <u-button type="primary" shape="" :hairline="false" :custom-style="{
  101. width: '100%',
  102. borderRadius: '0',
  103. height: '100rpx',
  104. fontSize: '32rpx',
  105. fontWeight: '500',
  106. background: '#0075F7',
  107. }" @click="handleSubmit">确认
  108. </u-button>
  109. </u-col>
  110. </u-row>
  111. </view>
  112. </view>
  113. </u-popup>
  114. </template>
  115. <script>
  116. import { updateObjDueTime } from "@/api/system/sysMessage.js";
  117. import {copyProps,clearProps} from '@/utils/gdtq.js'
  118. export default {
  119. data() {
  120. return {
  121. isShow: false,
  122. model: {
  123. form: {
  124. objIds: '',
  125. msgType: '',
  126. dueTime: '',
  127. photo: '',
  128. }
  129. },
  130. rules: {
  131. 'form.dueTime': {
  132. type: 'string',
  133. required: true,
  134. message: '请选择到期时间',
  135. trigger: ['blur', 'change']
  136. },
  137. },
  138. copyInfo: null,
  139. labelTitle: '',
  140. }
  141. },
  142. mounted() {
  143. },
  144. onReady() {
  145. this.$refs.uForm.setRules(this.rules)
  146. },
  147. methods: {
  148. show(e) {
  149. console.log(e,'eeee')
  150. this.model.form.objIds = e.objId
  151. this.model.form.msgType = e.msgType
  152. this.model.form.dueTime = e.dueTime
  153. this.model.form.photo = e.photo
  154. if (this.model.form.msgType == 1) {
  155. this.labelTitle = '下次保险到期时间'
  156. } else if (this.model.form.msgType == 2) {
  157. this.labelTitle = '下次年检到期时间'
  158. } else if (this.model.form.msgType == 3) {
  159. this.labelTitle = '下次保养到期时间'
  160. } else if (this.model.form.msgType == 4) {
  161. this.labelTitle = '下次驾驶证到期时间'
  162. }
  163. this.copyInfo = e;
  164. this.isShow= true;
  165. },
  166. close() {
  167. clearProps(this.model.form)
  168. this.isShow = false
  169. },
  170. // 提交
  171. async handleSubmit() {
  172. this.$refs.uForm.validate().then(async res => {
  173. let ajaxData = {
  174. ...this.model.form,
  175. }
  176. let { data, code,msg } = await updateObjDueTime(ajaxData)
  177. if (code == 0) {
  178. this.$modal.msg(msg)
  179. this.$emit('getList')
  180. this.close()
  181. } else {
  182. this.$modal.msgError(msg)
  183. }
  184. }).catch(errors => {
  185. console.log('校验失败',errors)
  186. })
  187. },
  188. }
  189. }
  190. </script>
  191. <style lang="scss" scoped>
  192. .disflex {
  193. display: flex;
  194. }
  195. .page-container {
  196. min-width: 600rpx;
  197. font-size: 28rpx;
  198. min-height: 100%;
  199. position: relative;
  200. .input-box {
  201. margin: 24rpx 24rpx 0;
  202. padding: 0 0rpx;
  203. }
  204. .box {
  205. margin: 24rpx 24rpx 0;
  206. border-radius: 20rpx;
  207. background: #fff;
  208. // padding: 0 20rpx;
  209. // border: 1rpx solid #EBEDF0;
  210. .item-label {
  211. display: flex;
  212. justify-content: space-between;
  213. align-items: center;
  214. &-left {
  215. font-family: PingFangSC, PingFang SC;
  216. font-weight: 400;
  217. font-size: 28rpx;
  218. color: #333333;
  219. position: relative;
  220. text {
  221. color: #f56c6c;
  222. font-size: 40rpx;
  223. position: absolute;
  224. left: -18rpx;
  225. }
  226. }
  227. &-right {
  228. font-family: PingFangSC, PingFang SC;
  229. font-weight: 400;
  230. font-size: 20rpx;
  231. color: #999999;
  232. }
  233. }
  234. }
  235. .page-head {
  236. text-align: center;
  237. font-size: 34rpx;
  238. font-weight: 700;
  239. // padding: 20rpx 0;
  240. }
  241. .page-body {
  242. padding-bottom: 120rpx;
  243. height: auto;
  244. // height: calc(100vh - 200rpx);
  245. // overflow-y: scroll;
  246. }
  247. .page-footer {
  248. position: absolute;
  249. width: 100%;
  250. left: 0;
  251. bottom: 0;
  252. }
  253. }
  254. ::v-deep {
  255. .u-cell-group {
  256. .u-radio+.u-radio {
  257. margin-left: 30rpx;
  258. }
  259. .u-cell__title-text {
  260. font-family: PingFangSC, PingFang SC;
  261. font-weight: 400;
  262. font-size: 28rpx;
  263. color: #333333;
  264. }
  265. .u-form-item__body__right__content__slot {
  266. font-family: PingFangSC, PingFang SC;
  267. font-weight: 400;
  268. font-size: 28rpx;
  269. color: #333333;
  270. .u-input__content__field-wrapper__field {
  271. font-family: PingFangSC, PingFang SC !important;
  272. font-weight: 400 !important;
  273. font-size: 26rpx !important;
  274. color: #333333 !important;
  275. }
  276. }
  277. }
  278. .u-form-item__body {
  279. padding: 0;
  280. }
  281. .hidde-cell-title {
  282. .u-cell__body__content {
  283. width: auto;
  284. flex: none;
  285. }
  286. .u-cell__body {
  287. .value {
  288. flex: 1;
  289. }
  290. }
  291. }
  292. }
  293. </style>