showModel.vue 9.9 KB

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