inspectRemoveModel.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <view class="changeHospital" v-show="disjunctor">
  3. <view class="changeHospital__wrap">
  4. <view class="changeHospital__header" v-if="title">
  5. <text v-if="icon" class="changeHospital__icon newicon" :class="[
  6. 'changeHospital__icon--' + icon,
  7. { 'newicon-duigou': icon === 'success' },
  8. { 'newicon-shibai': icon === 'error' },
  9. { 'newicon-wenhao': icon === 'warn' },
  10. ]"></text>{{ title }}
  11. </view>
  12. <view class="changeHospital__article">
  13. <view v-if="content" class="changeHospital__content" v-html="content"></view>
  14. <view class="uni-list-cell" v-show="remove">
  15. <view class="uni-list-cell-left">
  16. 移除原因:
  17. </view>
  18. <view class="uni-list-cell-db-text">
  19. <radio-group @change="radioChange">
  20. <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in removeReasons"
  21. :key="item.value">
  22. <view>
  23. <radio :value="item.value" :checked="index === current" />
  24. </view>
  25. <view>{{item.name}}</view>
  26. </label>
  27. </radio-group>
  28. </view>
  29. </view>
  30. <view class="uni-list-cell" v-show="current === 1 || !remove">
  31. <view class="uni-list-cell-left">
  32. 预约时间:
  33. </view>
  34. <view class="uni-list-cell-db-text">
  35. <uni-datetime-picker v-model="yyTime" returnType="date" :start="startTimestamp" @change="dateChange($event)"/>
  36. </view>
  37. </view>
  38. <view class="uni-list-cell" v-show="current === 1 || !remove">
  39. <view class="uni-list-cell-left">
  40. 结束时间:
  41. </view>
  42. <view class="uni-list-cell-db-text">
  43. {{yyEndTime}}
  44. </view>
  45. </view>
  46. </view>
  47. <view class="changeHospital__footer">
  48. <view v-if="operate.ok" class="changeHospital__ok" @click="ok" hover-class="seimin-btn-hover">
  49. {{ operate.ok || "" }}
  50. </view>
  51. <view v-if="operate.cancel" class="changeHospital__cancel" @click="cancel"
  52. hover-class="seimin-btn-hover">
  53. {{ operate.cancel || "" }}
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. import {
  61. post
  62. } from "../../http/http.js";
  63. import dayjs from 'dayjs';
  64. export default {
  65. data() {
  66. return {
  67. startTimestamp: Date.now(),
  68. removeReasons: [{
  69. value: '1',
  70. name: '检查已做',
  71. },
  72. {
  73. value: '2',
  74. name: '修改检查时间',
  75. },
  76. {
  77. value: '3',
  78. name: '错误建单申请',
  79. },
  80. ],
  81. current: -1,
  82. userData: null,
  83. hosId: null,
  84. timer: null,
  85. yyTime: '', //预约时间
  86. yyEndTime:'', //预约结束时间
  87. };
  88. },
  89. watch: {
  90. disjunctor(newValue) {
  91. if(newValue){
  92. this.startTimestamp = Date.now();
  93. this.current = -1;
  94. this.yyTime = this.yy ? new Date(this.yy) : dayjs().format('YYYY-MM-DD HH:mm:ss');
  95. this.setDate(this.yyTime)
  96. }
  97. if (newValue && this.operate.know == "返回") {
  98. this.time = 5;
  99. this.timer = setInterval(() => {
  100. this.time--;
  101. if (this.time <= 0) {
  102. clearInterval(this.timer);
  103. this.know();
  104. }
  105. }, 1000);
  106. }
  107. },
  108. },
  109. props: {
  110. // 预约时间
  111. yy: {
  112. type: String,
  113. default: '',
  114. },
  115. // 当前项
  116. currentInspect:{
  117. type: Object,
  118. default: {},
  119. },
  120. // 系统配置间隔时长
  121. yytimeGapMinute:{
  122. type: Number,
  123. default: 0,
  124. },
  125. // 是否移除检查
  126. remove: {
  127. type: Boolean,
  128. default: false,
  129. },
  130. // 显示隐藏
  131. disjunctor: {
  132. type: Boolean,
  133. default: false,
  134. },
  135. // 标题
  136. title: {
  137. type: String,
  138. default: "提示",
  139. },
  140. // 图标
  141. icon: {
  142. type: String,
  143. default: "success",
  144. },
  145. // 内容
  146. content: {
  147. type: String,
  148. default: "",
  149. },
  150. // 操作按钮文字
  151. operate: {
  152. type: Object,
  153. default: () => {
  154. return {
  155. ok: "确认",
  156. cancel: "取消",
  157. };
  158. },
  159. },
  160. name: {
  161. type: String,
  162. default: '交接人'
  163. }
  164. },
  165. methods: {
  166. dateChange(e){
  167. if(e){
  168. this.setDate(e)
  169. }else{
  170. this.yyEndTime = null
  171. }
  172. },
  173. // 设置预约结束时间
  174. setDate(yyTime){
  175. let date = dayjs(new Date(yyTime));
  176. let num = this.currentInspect.inspectCheckType.extra1?this.currentInspect.inspectCheckType.extra1:undefined
  177. let newDate = date.add(num ? num : this.yytimeGapMinute, 'minute');
  178. let endTime = new Date(newDate);
  179. this.yyEndTime = endTime.Format('yyyy-MM-dd hh:mm:ss')
  180. },
  181. radioChange: function(evt) {
  182. this.yyTime = '';
  183. this.startTimestamp = Date.now();
  184. for (let i = 0; i < this.removeReasons.length; i++) {
  185. if (this.removeReasons[i].value === evt.detail.value) {
  186. this.current = i;
  187. break;
  188. }
  189. }
  190. },
  191. // 确定
  192. ok() {
  193. let date = dayjs(new Date(this.yyTime));
  194. let num = this.currentInspect.inspectCheckType.extra1?this.currentInspect.inspectCheckType.extra1:undefined
  195. let newDate = date.add(num ? num : this.yytimeGapMinute, 'minute');
  196. let endTime = new Date(newDate);
  197. let e = {
  198. yyEndTime: endTime.getTime()
  199. };
  200. if (this.current > -1) {
  201. e.value = this.removeReasons[this.current].value;
  202. }
  203. if (this.yyTime) {
  204. e.yyTime = this.yyTime.Format("yyyy-MM-dd hh:mm:ss");
  205. }
  206. this.$emit("ok", e);
  207. },
  208. // 取消
  209. cancel() {
  210. this.$emit("cancel");
  211. },
  212. },
  213. created() {
  214. this.hosId = uni.getStorageSync('userData').user.currentHospital.id;
  215. }
  216. };
  217. </script>
  218. <style lang="less" scoped>
  219. .changeHospital__icon {
  220. font-size: 40rpx;
  221. margin-right: 8rpx;
  222. &.changeHospital__icon--success {
  223. color: rgb(52, 179, 73);
  224. }
  225. &.changeHospital__icon--warn {
  226. color: rgb(245, 165, 35);
  227. }
  228. &.changeHospital__icon--error {
  229. color: rgb(255, 58, 82);
  230. }
  231. }
  232. .changeHospital {
  233. position: fixed;
  234. left: 0;
  235. right: 0;
  236. top: 0;
  237. bottom: 0;
  238. background-color: rgba(0, 0, 0, 0.2);
  239. z-index: 999;
  240. .uni-list-cell {
  241. width: 95%;
  242. display: flex;
  243. flex-direction: row;
  244. // justify-content: space-evenly;
  245. align-items: center;
  246. text-align: center;
  247. margin-top: 32rpx;
  248. .uni-list-cell-left {
  249. flex: 2;
  250. font-size: 32rpx;
  251. color: #666;
  252. }
  253. .uni-list-cell-db {
  254. border: 1px solid #e5e9ed;
  255. background-color: #fff;
  256. padding: 16rpx 0;
  257. flex: 5;
  258. }
  259. .uni-list-cell-db-text {
  260. flex: 5;
  261. text-align: left;
  262. }
  263. }
  264. .changeHospital__wrap {
  265. width: 90vw;
  266. position: absolute;
  267. left: 50%;
  268. top: 50%;
  269. transform: translate(-50%, -50%);
  270. background-color: #fff;
  271. border-radius: 12rpx;
  272. color: #666;
  273. .changeHospital__header {
  274. font-size: 36rpx;
  275. color: #000;
  276. height: 84rpx;
  277. display: flex;
  278. justify-content: center;
  279. align-items: center;
  280. }
  281. .changeHospital__article {
  282. width: 90%;
  283. margin: 0 auto 25rpx;
  284. padding: 48rpx 0;
  285. background-color: rgb(249, 250, 251);
  286. border: 2rpx solid rgb(229, 233, 237);
  287. border-radius: 12rpx;
  288. box-sizing: border-box;
  289. display: flex;
  290. flex-direction: column;
  291. justify-content: center;
  292. align-items: center;
  293. &.p0 {
  294. padding: 0;
  295. }
  296. .changeHospital__content {
  297. font-size: 32rpx;
  298. }
  299. .changeHospital__info {
  300. font-size: 32rpx;
  301. color: rgb(102, 102, 102);
  302. }
  303. .specialCloseFlag {
  304. width: 90%;
  305. height: 100%;
  306. padding: 16rpx;
  307. }
  308. .radio-wrap {
  309. .radio-item {
  310. margin-top: 16rpx;
  311. /deep/ .uni-radio-input-checked {
  312. background-color: #49b856 !important;
  313. border-color: #49b856 !important;
  314. }
  315. }
  316. }
  317. }
  318. .changeHospital__footer {
  319. box-sizing: border-box;
  320. height: 100rpx;
  321. border-top: 2rpx solid rgb(229, 233, 237);
  322. display: flex;
  323. align-items: center;
  324. view {
  325. height: 100%;
  326. display: flex;
  327. align-items: center;
  328. justify-content: center;
  329. font-size: 36rpx;
  330. color: rgb(102, 102, 102);
  331. position: relative;
  332. &:nth-of-type(2)::before {
  333. content: "";
  334. position: absolute;
  335. left: 0;
  336. bottom: 0;
  337. width: 2rpx;
  338. height: 87rpx;
  339. background-color: rgb(229, 233, 237);
  340. }
  341. }
  342. .changeHospital__ok {
  343. flex: 1;
  344. color: rgb(73, 184, 86);
  345. }
  346. .changeHospital__cancel {
  347. flex: 1;
  348. }
  349. .changeHospital__know {
  350. flex: 1;
  351. color: rgb(73, 184, 86);
  352. }
  353. }
  354. }
  355. }
  356. </style>