showModel.vue 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="showModel" v-show="disjunctor">
  3. <view class="showModel__wrap">
  4. <view class="showModel__header" v-if="title">
  5. <text
  6. v-if="icon"
  7. class="showModel__icon newicon"
  8. :class="[
  9. 'showModel__icon--' + icon,
  10. { 'newicon-duigou': icon === 'success' },
  11. // { 'newicon-shibai': icon === 'error' },
  12. { 'newicon-wenhao': icon === 'warn' },
  13. ]"
  14. ></text>{{ title }}
  15. <text v-if="operate.know == '返回'">({{ time }})</text>
  16. </view>
  17. <view class="showModel__article" :class="{ p0: textareaFlag, p1: radioInspectionDistanceItem.length, p2: childrenDeptList.length || busyContentList.length }">
  18. <view v-if="content" class="showModel__content" @click="tel()" v-html="content"></view>
  19. <view v-if="info" class="showModel__info">{{ info }}</view>
  20. <view class="specialCloseFlag" v-if="textareaFlag">
  21. <textarea
  22. style="width: 100%"
  23. placeholder="请输入5~100个文字方可提交!"
  24. maxlength="100"
  25. @input="textareaInput"
  26. />
  27. </view>
  28. <view class="radio-wrap" v-if="radioItem.length">
  29. <radio-group @change="radioChange">
  30. <view v-for="(item, index) in radioItem" :key="item.qrcode" class="radio-item">
  31. <label>
  32. <radio :value="item.qrcode" :checked="index === 0" />
  33. <text>{{ item.deptName }}</text>
  34. </label>
  35. </view>
  36. </radio-group>
  37. </view>
  38. <view class="radio-wrap" v-if="radioInspectionDistanceItem.length">
  39. <radio-group @change="radioChange">
  40. <view v-for="(item, index) in radioInspectionDistanceItem" :key="item.id" class="radio-item">
  41. <label>
  42. <radio :value="item.id" />
  43. <text>{{ item.inspectMode }}</text>
  44. </label>
  45. </view>
  46. </radio-group>
  47. </view>
  48. <view class="childrenDeptList" v-if="childrenDeptList.length">
  49. <view @click="clickHandler(item)" v-for="(item, index) in childrenDeptList" :key="item.id" class="childrenDeptItem">{{ item.dept }}</view>
  50. </view>
  51. <view class="busyContentList" v-if="busyContentList.length">
  52. <view @click="clickHandler(item)" v-for="(item, index) in busyContentList" :key="index" class="childrenDeptItem">{{ item.busyContent }}</view>
  53. </view>
  54. </view>
  55. <view class="showModel__footer">
  56. <view
  57. v-if="operate.ok"
  58. class="showModel__ok"
  59. @click="ok"
  60. hover-class="seimin-btn-hover"
  61. >{{ operate.ok || "" }}</view
  62. >
  63. <view
  64. v-if="operate.no"
  65. class="showModel__ok"
  66. @click="no"
  67. hover-class="seimin-btn-hover"
  68. >{{ operate.no || "" }}</view
  69. >
  70. <view
  71. v-if="operate.cancel"
  72. class="showModel__cancel"
  73. @click="cancel"
  74. hover-class="seimin-btn-hover"
  75. >{{ operate.cancel || "" }}</view
  76. >
  77. <view
  78. v-if="operate.know"
  79. class="showModel__know"
  80. @click="know"
  81. hover-class="seimin-btn-hover"
  82. >{{ operate.know || "" }}</view
  83. >
  84. <!-- <view
  85. v-if="operate.know && timerFlag"
  86. class="showModel__know"
  87. @click="cancelTimer"
  88. hover-class="seimin-btn-hover"
  89. >取消自动关闭</view
  90. > -->
  91. </view>
  92. </view>
  93. </view>
  94. </template>
  95. <script>
  96. export default {
  97. data() {
  98. return {
  99. time: 3, //5秒后自动关闭
  100. timer: null, //5秒后自动关闭,定时器
  101. timerFlag: false, //是否显示取消自动关闭按钮
  102. };
  103. },
  104. watch: {
  105. disjunctor(newValue) {
  106. if (newValue && this.operate.know == "返回") {
  107. this.time = 3;
  108. // this.timerFlag = true;
  109. this.timer = setInterval(() => {
  110. this.time--;
  111. if (this.time <= 0) {
  112. clearInterval(this.timer);
  113. this.know();
  114. }
  115. }, 1000);
  116. }
  117. },
  118. },
  119. props: {
  120. // 显示隐藏
  121. disjunctor: {
  122. type: Boolean,
  123. default: false,
  124. },
  125. // 标题
  126. title: {
  127. type: String,
  128. default: "提示",
  129. },
  130. // 图标
  131. icon: {
  132. type: String,
  133. default: "success",
  134. },
  135. // 内容
  136. content: {
  137. type: String,
  138. default: "",
  139. },
  140. // 说明
  141. info: {
  142. type: String,
  143. default: "",
  144. },
  145. // 拨打电话
  146. phone: {
  147. type: String,
  148. default: "",
  149. },
  150. // 特殊情况关闭原因
  151. textareaFlag: {
  152. type: Boolean,
  153. default: false,
  154. },
  155. // 单选框选项
  156. radioItem: {
  157. type: Array,
  158. default: () => {
  159. return [];
  160. },
  161. },
  162. // 单选框选项-陪检方式
  163. radioInspectionDistanceItem: {
  164. type: Array,
  165. default: () => {
  166. return [];
  167. },
  168. },
  169. // 子科室列表
  170. childrenDeptList: {
  171. type: Array,
  172. default: () => {
  173. return [];
  174. },
  175. },
  176. // 示忙原因
  177. busyContentList: {
  178. type: Array,
  179. default: () => {
  180. return [];
  181. },
  182. },
  183. // 操作按钮文字
  184. operate: {
  185. type: Object,
  186. default: () => {
  187. return {
  188. know: "返回",
  189. };
  190. },
  191. },
  192. },
  193. methods: {
  194. clickHandler(item){
  195. this.$emit('ok', item)
  196. },
  197. // 单选框选中
  198. radioChange(item){
  199. this.$emit('radioChange',item.target.value)
  200. },
  201. // 输入文字
  202. textareaInput(e) {
  203. this.$emit("textareaInput", e.detail.value);
  204. },
  205. // 确定
  206. ok() {
  207. this.$emit("ok");
  208. },
  209. // 否
  210. no() {
  211. this.$emit("no");
  212. },
  213. // 取消
  214. cancel() {
  215. this.$emit("cancel");
  216. },
  217. // 返回
  218. know() {
  219. clearInterval(this.timer);
  220. this.$emit("know");
  221. },
  222. // 取消自动关闭
  223. cancelTimer() {
  224. this.timerFlag = false;
  225. clearInterval(this.timer);
  226. },
  227. // 拨打电话
  228. tel() {
  229. if (this.phone) {
  230. uni.makePhoneCall({
  231. phoneNumber: this.phone,
  232. });
  233. }
  234. },
  235. },
  236. };
  237. </script>
  238. <style lang="less" scoped>
  239. .showModel__icon {
  240. font-size: 40rpx;
  241. margin-right: 8rpx;
  242. &.showModel__icon--success {
  243. color: rgb(52, 179, 73);
  244. }
  245. &.showModel__icon--warn {
  246. color: rgb(245, 165, 35);
  247. }
  248. &.showModel__icon--error {
  249. color: rgb(255, 58, 82);
  250. }
  251. }
  252. .showModel {
  253. position: fixed;
  254. left: 0;
  255. right: 0;
  256. top: 0;
  257. bottom: 0;
  258. background-color: rgba(0, 0, 0, 0.2);
  259. z-index: 999999;
  260. .showModel__wrap {
  261. width: 560rpx;
  262. position: absolute;
  263. left: 50%;
  264. top: 50%;
  265. transform: translate(-50%, -50%);
  266. background-color: #fff;
  267. border-radius: 12rpx;
  268. .showModel__header {
  269. font-size: 36rpx;
  270. color: #000;
  271. height: 84rpx;
  272. display: flex;
  273. justify-content: center;
  274. align-items: center;
  275. }
  276. .showModel__article {
  277. color: #000;
  278. margin: 0 auto 25rpx;
  279. width: 488rpx;
  280. padding: 60rpx 16rpx;
  281. background-color: rgb(249, 250, 251);
  282. border: 2rpx solid rgb(229, 233, 237);
  283. border-radius: 12rpx;
  284. box-sizing: border-box;
  285. display: flex;
  286. flex-direction: column;
  287. justify-content: center;
  288. align-items: center;
  289. text-align: justify;
  290. &.p0 {
  291. padding: 0;
  292. }
  293. &.p1 {
  294. text-align: left;
  295. }
  296. &.p2 {
  297. text-align: center;
  298. }
  299. .childrenDeptList, .busyContentList{
  300. width: 100%;
  301. max-height: 50vh;
  302. overflow-y: auto;
  303. .childrenDeptItem{
  304. background-color: #fff;
  305. height: 80rpx;
  306. line-height: 80rpx;
  307. border-radius: 80rpx;
  308. color: #49b856;
  309. margin-top: 24rpx;
  310. white-space: nowrap;
  311. overflow: hidden;
  312. text-overflow: ellipsis;
  313. }
  314. }
  315. .showModel__content {
  316. font-size: 36rpx;
  317. word-break: break-all;
  318. }
  319. .showModel__info {
  320. font-size: 32rpx;
  321. color: rgb(102, 102, 102);
  322. }
  323. .specialCloseFlag {
  324. width: 90%;
  325. height: 100%;
  326. padding: 16rpx;
  327. }
  328. .radio-wrap{
  329. .radio-item{
  330. margin-top: 16rpx;
  331. /deep/ .uni-radio-input-checked{
  332. background-color: #49b856!important;
  333. border-color: #49b856!important;
  334. }
  335. }
  336. }
  337. }
  338. .showModel__footer {
  339. box-sizing: border-box;
  340. height: 100rpx;
  341. border-top: 2rpx solid rgb(229, 233, 237);
  342. display: flex;
  343. align-items: center;
  344. view {
  345. height: 100%;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. font-size: 36rpx;
  350. color: rgb(102, 102, 102);
  351. position: relative;
  352. & ~ view::before {
  353. content: "";
  354. position: absolute;
  355. left: 0;
  356. bottom: 0;
  357. width: 2rpx;
  358. height: 87rpx;
  359. background-color: rgb(229, 233, 237);
  360. }
  361. }
  362. .showModel__ok {
  363. flex: 1;
  364. color: rgb(73, 184, 86);
  365. }
  366. .showModel__cancel {
  367. flex: 1;
  368. }
  369. .showModel__know {
  370. flex: 1;
  371. color: rgb(73, 184, 86);
  372. }
  373. }
  374. }
  375. }
  376. </style>