inspectRemoveModel.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  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, 'load')
  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, 'change')
  169. }else{
  170. this.yyEndTime = null
  171. }
  172. },
  173. // 设置预约结束时间
  174. setDate(yyTime, type){
  175. let date = null
  176. let num = null
  177. let newDate = null
  178. let endTime = null
  179. if(type=='change'){
  180. date = dayjs(new Date(yyTime));
  181. num = this.currentInspect.inspectCheckType && this.currentInspect.inspectCheckType.extra1?this.currentInspect.inspectCheckType.extra1:undefined
  182. newDate = date.add(num ? num : this.yytimeGapMinute, 'minute');
  183. endTime = new Date(newDate);
  184. this.yyEndTime = endTime.Format('yyyy-MM-dd hh:mm:ss')
  185. }else{
  186. if(this.currentInspect.endCheckTime){
  187. date = dayjs(new Date(this.currentInspect.endCheckTime))
  188. this.yyEndTime = date.format('YYYY-MM-DD HH:mm:ss')
  189. }else{
  190. this.yyEndTime = null
  191. }
  192. }
  193. },
  194. radioChange: function(evt) {
  195. this.yyTime = '';
  196. this.startTimestamp = Date.now();
  197. for (let i = 0; i < this.removeReasons.length; i++) {
  198. if (this.removeReasons[i].value === evt.detail.value) {
  199. this.current = i;
  200. break;
  201. }
  202. }
  203. },
  204. // 确定
  205. ok() {
  206. // let date = dayjs(new Date(this.yyTime));
  207. // let num = this.currentInspect.inspectCheckType.extra1?this.currentInspect.inspectCheckType.extra1:undefined
  208. // let newDate = date.add(num ? num : this.yytimeGapMinute, 'minute');
  209. // let endTime = new Date(newDate);
  210. let e = {
  211. yyEndTime: this.yyEndTime
  212. };
  213. if (this.current > -1) {
  214. e.value = this.removeReasons[this.current].value;
  215. }
  216. if (this.yyTime) {
  217. e.yyTime = this.yyTime.Format("yyyy-MM-dd hh:mm:ss");
  218. }
  219. this.$emit("ok", e);
  220. },
  221. // 取消
  222. cancel() {
  223. this.$emit("cancel");
  224. },
  225. },
  226. created() {
  227. this.hosId = uni.getStorageSync('userData').user.currentHospital.id;
  228. }
  229. };
  230. </script>
  231. <style lang="less" scoped>
  232. .changeHospital__icon {
  233. font-size: 40rpx;
  234. margin-right: 8rpx;
  235. &.changeHospital__icon--success {
  236. color: rgb(52, 179, 73);
  237. }
  238. &.changeHospital__icon--warn {
  239. color: rgb(245, 165, 35);
  240. }
  241. &.changeHospital__icon--error {
  242. color: rgb(255, 58, 82);
  243. }
  244. }
  245. .changeHospital {
  246. position: fixed;
  247. left: 0;
  248. right: 0;
  249. top: 0;
  250. bottom: 0;
  251. background-color: rgba(0, 0, 0, 0.2);
  252. z-index: 999;
  253. .uni-list-cell {
  254. width: 95%;
  255. display: flex;
  256. flex-direction: row;
  257. // justify-content: space-evenly;
  258. align-items: center;
  259. text-align: center;
  260. margin-top: 32rpx;
  261. .uni-list-cell-left {
  262. flex: 2;
  263. font-size: 32rpx;
  264. color: #666;
  265. }
  266. .uni-list-cell-db {
  267. border: 1px solid #e5e9ed;
  268. background-color: #fff;
  269. padding: 16rpx 0;
  270. flex: 5;
  271. }
  272. .uni-list-cell-db-text {
  273. flex: 5;
  274. text-align: left;
  275. }
  276. }
  277. .changeHospital__wrap {
  278. width: 90vw;
  279. position: absolute;
  280. left: 50%;
  281. top: 50%;
  282. transform: translate(-50%, -50%);
  283. background-color: #fff;
  284. border-radius: 12rpx;
  285. color: #666;
  286. .changeHospital__header {
  287. font-size: 36rpx;
  288. color: #000;
  289. height: 84rpx;
  290. display: flex;
  291. justify-content: center;
  292. align-items: center;
  293. }
  294. .changeHospital__article {
  295. width: 90%;
  296. margin: 0 auto 25rpx;
  297. padding: 48rpx 0;
  298. background-color: rgb(249, 250, 251);
  299. border: 2rpx solid rgb(229, 233, 237);
  300. border-radius: 12rpx;
  301. box-sizing: border-box;
  302. display: flex;
  303. flex-direction: column;
  304. justify-content: center;
  305. align-items: center;
  306. &.p0 {
  307. padding: 0;
  308. }
  309. .changeHospital__content {
  310. font-size: 32rpx;
  311. }
  312. .changeHospital__info {
  313. font-size: 32rpx;
  314. color: rgb(102, 102, 102);
  315. }
  316. .specialCloseFlag {
  317. width: 90%;
  318. height: 100%;
  319. padding: 16rpx;
  320. }
  321. .radio-wrap {
  322. .radio-item {
  323. margin-top: 16rpx;
  324. /deep/ .uni-radio-input-checked {
  325. background-color: #49b856 !important;
  326. border-color: #49b856 !important;
  327. }
  328. }
  329. }
  330. }
  331. .changeHospital__footer {
  332. box-sizing: border-box;
  333. height: 100rpx;
  334. border-top: 2rpx solid rgb(229, 233, 237);
  335. display: flex;
  336. align-items: center;
  337. view {
  338. height: 100%;
  339. display: flex;
  340. align-items: center;
  341. justify-content: center;
  342. font-size: 36rpx;
  343. color: rgb(102, 102, 102);
  344. position: relative;
  345. &:nth-of-type(2)::before {
  346. content: "";
  347. position: absolute;
  348. left: 0;
  349. bottom: 0;
  350. width: 2rpx;
  351. height: 87rpx;
  352. background-color: rgb(229, 233, 237);
  353. }
  354. }
  355. .changeHospital__ok {
  356. flex: 1;
  357. color: rgb(73, 184, 86);
  358. }
  359. .changeHospital__cancel {
  360. flex: 1;
  361. }
  362. .changeHospital__know {
  363. flex: 1;
  364. color: rgb(73, 184, 86);
  365. }
  366. }
  367. }
  368. }
  369. </style>