人民医院前端

myTask.vue 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490
  1. <template>
  2. <view style="overflow: hidden;">
  3. <page-meta :root-font-size="getFontSizeValue"></page-meta>
  4. <view class="uni-margin-wrap">
  5. <swiper class="swiper" circular :indicator-dots="indicatorDots" :autoplay="autoplay" :interval="interval"
  6. :duration="duration">
  7. <swiper-item v-for="item in bannnerData" :key="item.id">
  8. <image :src="item.imgPath" mode=""></image>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. <view class="orderManage">
  13. <view class="orderTit" style="padding-left: 15px;color: rgb(126, 131, 125);">
  14. <text
  15. style="width: 4px;background-color: rgb(26, 188, 156);height: 20px;margin-top: 10px;margin-right: 5px;"></text>
  16. <text>工单模块</text>
  17. </view>
  18. <view class="orderCon">
  19. <view class="orderList" v-for="item in orderListData" :key="item.id" @click="workOrderListClick(item)">
  20. <image :style="{ background: item.imageBg }" :src="item.imagePath" mode=""></image>
  21. <text>{{ item.text }}</text>
  22. </view>
  23. </view>
  24. <view class="orderTit" @click="changeStore" v-if="noticState">
  25. <image style="background: #ff9600" src="/static/icon_noticefi.png"></image>
  26. <text>公告通知</text>
  27. </view>
  28. <view class="notification">
  29. <view class="notifiList" v-for="item in noticListData" :key="item.id">
  30. <image :style="{ background: item.imageBg }" :src="item.imagePath" mode=""></image>
  31. <view class="">
  32. <text>{{ item.textTit }}</text>
  33. <text>{{ item.textCon }}</text>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <!-- 弹框 -->
  39. <view>
  40. <uni-popup ref="inputDialogs" type="dialog">
  41. <uni-popup-dialog ref="inputClose" mode="input" :title="title" @confirm="dialogInputConfirm">
  42. <view>
  43. <!-- <uni-table style="height: 600rpx;" ref="table" border stripe type="selection" emptyText="暂无更多数据"
  44. @selection-change="selectionChange">
  45. <uni-tr>
  46. <uni-th align="center">科室</uni-th>
  47. </uni-tr>
  48. <uni-tr v-for="(item, index) in allowData" :key="index">
  49. <uni-td align="center">{{ $mHelper.findParents(departList, item.deptid) }}</uni-td>
  50. </uni-tr>
  51. </uni-table> -->
  52. <uni-table style="height: 600rpx;" ref="table" border stripe emptyText="暂无更多数据">
  53. <uni-tr>
  54. <uni-th align="center">请选择</uni-th>
  55. </uni-tr>
  56. <uni-tr>
  57. <uni-td align="center">
  58. <radio-group @change="radioChange">
  59. <label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in allowData"
  60. :key="index">
  61. <view style="padding: 5px 0;position: relative;">
  62. <radio style="width: 30px;position: absolute;left: 0;"
  63. :value="item.deptid" :checked="index === current" />
  64. <text style="margin-left: 30px;">{{ $mHelper.findParents(departList, item.deptid) }}</text>
  65. </view>
  66. </label>
  67. </radio-group>
  68. </uni-td>
  69. </uni-tr>
  70. </uni-table>
  71. </view>
  72. </uni-popup-dialog>
  73. </uni-popup>
  74. </view>
  75. </view>
  76. </template>
  77. <script>
  78. import {
  79. mapGetters
  80. } from "vuex"
  81. import store from '@/store';
  82. import {
  83. getToken
  84. } from '@/utils/auth'
  85. import listUrl from '@/utils/listUrl.js'
  86. import pageData from '../myTask/repairList/addRepair/pageData.js'
  87. export default {
  88. data() {
  89. return {
  90. indicatorDots: true,
  91. getFontSizeValue: '1rem',
  92. autoplay: true,
  93. interval: 2000,
  94. noticState: false,
  95. duration: 500,
  96. bannnerData: [],
  97. orderListData: [],
  98. noticListData: [],
  99. departList: [],
  100. allowData: [],
  101. title: "允用科室",
  102. selectedIndexs: [],
  103. current:"",
  104. onchangedept: ''
  105. }
  106. },
  107. computed: {
  108. ...mapGetters([
  109. "State",
  110. "deptId"
  111. ])
  112. },
  113. onLoad() {
  114. // this.getStodept()
  115. this.init()
  116. this.saveDept()
  117. this.getFontSizeValue = uni.getStorageSync('fontSizeValue') + 'rem'
  118. // this.getFontSizeValue = '1.5rem'
  119. if (uni.getStorageSync("roleCode") === "APRY") {
  120. uni.hideTabBar()
  121. }
  122. if (uni.getStorageSync("isAllow") === "1") {
  123. var str = uni.getStorageSync('storageAllowUserDept') //获取允用科室ids
  124. var arr = []
  125. if (str.indexOf(',') >= 0) {
  126. for (var i = 0; i < str.split(",").length; i++) {
  127. arr.push({
  128. deptname: "",
  129. deptid: str.split(",")[i]
  130. })
  131. if(uni.getStorageSync('deptId') == str.split(",")[i]){
  132. this.current = i;
  133. }
  134. }
  135. this.allowData = arr
  136. }
  137. this.$nextTick(function() {
  138. // DOM 更新了
  139. this.$refs.inputDialogs.open()
  140. })
  141. }
  142. // uni.hideTabBar()
  143. },
  144. methods: {
  145. radioChange: function(evt) {
  146. this.onchangedept = evt.detail.value;
  147. console.log(evt.detail.value)
  148. for (let i = 0; i < this.allowData.length; i++) {
  149. if (this.allowData[i].deptid === evt.detail.value) {
  150. this.current = i;
  151. break;
  152. }
  153. }
  154. },
  155. selectionChange(e) {
  156. this.selectedIndexs = e.detail.index
  157. this.onchangedept = this.allowData[e.detail.index].deptid
  158. console.log(this.allowData[e.detail.index])
  159. },
  160. dialogInputConfirm() {
  161. // if (this.selectedIndexs.length != 1) {
  162. // this.$mHelper.toast("请选择一行数据");
  163. // return;
  164. // }
  165. const params = {
  166. deptId: this.onchangedept,
  167. userid: uni.getStorageSync('userId')
  168. }
  169. this.$http.get('UserAccount/ChangeDeptId', params).then(res => {
  170. if (res.state == "success") {
  171. this.$mHelper.toast(res.message);
  172. this.$refs.inputDialogs.close()
  173. this.$mStore.dispatch("GetInfo").then((e) => {
  174. if (e.data.Dept) {
  175. uni.setStorageSync('deptId', e.data.Dept.F_DeptId)
  176. uni.setStorageSync('deptName', e.data.Dept.F_DeptName)
  177. }
  178. })
  179. }
  180. })
  181. },
  182. init() {
  183. // #ifdef APP-PLUS
  184. let timer
  185. timer = setInterval(() => {
  186. plus.push.getClientInfoAsync((info) => {
  187. let cid = info["clientid"];
  188. if (cid) {
  189. clearInterval(timer)
  190. this.clienGet(cid) //获取cid
  191. }
  192. });
  193. }, 5000)
  194. this.upData()
  195. // #endif
  196. this.bannnerData = this.$mConstDataConfig.bannnerData
  197. this.getMenuPermissions() //获取用户权限
  198. },
  199. //重新存储部门数据
  200. // getStodept(){
  201. // this.$mStore.dispatch("GetInfo").then((e)=>{
  202. // if(e.data.Dept){
  203. // uni.setStorageSync('deptId', e.data.Dept.F_DeptId)
  204. // uni.setStorageSync('deptName', e.data.Dept.F_DeptName)
  205. // }
  206. // })
  207. // },
  208. saveDept() {
  209. pageData.getDet((res, data) => {
  210. this.departList = data
  211. uni.setStorageSync('deptTreeData', JSON.stringify(res))
  212. uni.setStorageSync('deptAllList', JSON.stringify(data))
  213. })
  214. },
  215. changeStore() {
  216. this.$mStore.dispatch("STATE", 3)
  217. },
  218. workOrderListClick(item) {
  219. uni.navigateTo({
  220. url: item.navigateToUrl,
  221. })
  222. },
  223. clienGet(cid) {
  224. let apptype
  225. if (plus.device.model.indexOf('iPhone') > -1) {
  226. apptype = 2;
  227. } else {
  228. apptype = 1;
  229. }
  230. const params = {
  231. apptype: apptype,
  232. clientid: cid,
  233. token: uni.getStorageSync("token"),
  234. }
  235. this.$http.get("PushMessage/PutAppClientIdAsync", params).then((response) => {
  236. if (response.state.toLowerCase() === "success") {
  237. let data = response.message
  238. }
  239. })
  240. .catch((e) => {
  241. console.log(e)
  242. })
  243. },
  244. upData() {
  245. plus.runtime.getProperty(plus.runtime.appid, function(wgtinfo) {
  246. uni.setStorageSync('versionCode', wgtinfo.version)
  247. });
  248. let typeUp = ''
  249. if (plus.device.model.indexOf('iPhone') > -1) {
  250. typeUp = 1;
  251. } else {
  252. typeUp = 0;
  253. }
  254. const params = {
  255. type: typeUp,
  256. isNew: true,
  257. }
  258. this.$http.get('/ApplicationsVersion/GetAndroid', params).then((response) => {
  259. if (response.state == "success") {
  260. let data = response.data
  261. console.log(data)
  262. //NewCode_ = data.data.F_VersionCode;
  263. const nowVersionCode = uni.getStorageSync('versionCode')
  264. const serveVersionCode = data.F_VersionCode
  265. console.log(nowVersionCode + "---" + serveVersionCode)
  266. if (nowVersionCode !== serveVersionCode) {
  267. if (typeUp === 0) {
  268. uni.showModal({
  269. title: '更新',
  270. content: '是否更新',
  271. showCancel: false,
  272. success: function(res) {
  273. if (res.confirm) {
  274. plus.runtime.openURL(data.FileUrl[0].F_FileUrl, err => {
  275. plus.runtime.openURL(data.FileUrl[0]
  276. .F_FileUrl);
  277. }, 'com.android.browser');
  278. } else if (res.cancel) {
  279. this.$mHelper.toast("取消更新");
  280. }
  281. }
  282. });
  283. } else if (typeUp === 1) {
  284. uni.showModal({
  285. title: '更新',
  286. content: '是否更新',
  287. showCancel: false,
  288. success: function(res) {
  289. if (res.confirm) {
  290. plus.runtime.openURL(data.F_Url);
  291. } else if (res.cancel) {
  292. this.$mHelper.toast("取消更新");
  293. }
  294. }
  295. });
  296. }
  297. }
  298. }
  299. }).catch((e) => {
  300. console.log(e);
  301. })
  302. },
  303. getMenuPermissions() {
  304. let code = uni.getStorageSync("roleCode")
  305. this.$http.get("InternalMessages/GetCount").then((response) => {
  306. if (response.state.toLowerCase() === "success") {
  307. if (response.IsRead == 1) {
  308. uni.showTabBarRedDot({
  309. index: 2
  310. })
  311. } else {
  312. uni.hideTabBarRedDot({
  313. index: 2
  314. })
  315. }
  316. }
  317. })
  318. .catch((e) => {
  319. console.log(e)
  320. })
  321. this.$http.get("Index/GetMenu").then((response) => {
  322. if (response.state.toLowerCase() === "success") {
  323. if (response.data.length > 0) {
  324. this.orderListData = listUrl.getMenuData(response.data, code)
  325. // console.log(this.orderListData)
  326. }
  327. }
  328. })
  329. .catch((e) => {
  330. console.log(e)
  331. })
  332. },
  333. },
  334. }
  335. </script>
  336. <style lang="scss">
  337. .equipmentInfo {
  338. width: 100%;
  339. margin-top: 15px;
  340. border: 1px solid rgb(229, 229, 229);
  341. box-shadow: 0px 4px 16px 0px rgba(69, 91, 99, 0.05);
  342. margin-bottom: 20px;
  343. border-radius: 5px;
  344. .trCon {
  345. width: 100%;
  346. // font-size: 14px;
  347. .tdCon {
  348. display: inline-block;
  349. padding: 10px 0px;
  350. color: rgb(102, 102, 102);
  351. width: 48%;
  352. padding-right: 5px;
  353. text-align: center;
  354. }
  355. }
  356. }
  357. .uni-margin-wrap {
  358. width: 690rpx;
  359. width: 100%;
  360. }
  361. .swiper {
  362. height: 225px;
  363. image {
  364. width: 100%;
  365. height: 100%;
  366. }
  367. }
  368. .orderManage {
  369. .orderTit {
  370. margin-top: 15rpx;
  371. width: 100%;
  372. height: 80rpx;
  373. line-height: 80rpx;
  374. background: #ffffff;
  375. display: flex;
  376. border-bottom: 1rpx solid #eeeeee;
  377. text {
  378. font-size: 1rem;
  379. }
  380. image {
  381. width: 24rpx;
  382. height: 24rpx;
  383. padding: 8rpx;
  384. border-radius: 12px;
  385. background: #1972c2;
  386. margin: 20rpx 10rpx 20rpx 26rpx;
  387. }
  388. }
  389. .orderCon {
  390. background: #ffffff;
  391. display: flex;
  392. flex-wrap: wrap;
  393. .orderList {
  394. width: 186rpx;
  395. height: 206rpx;
  396. text-align: center;
  397. border-right: 2rpx solid #eeeeee;
  398. border-bottom: 2rpx solid #eeeeee;
  399. image {
  400. width: 40rpx;
  401. height: 40rpx;
  402. margin: 0 auto;
  403. display: block;
  404. border-radius: 35rpx;
  405. padding: 15rpx;
  406. margin-top: 45rpx;
  407. }
  408. text {
  409. line-height: 60rpx;
  410. }
  411. }
  412. .orderList:nth-child(4n + 4) {
  413. border-right: none;
  414. }
  415. .orderList:last-child {
  416. border-right: none;
  417. }
  418. }
  419. .notification {
  420. background: #ffffff;
  421. margin-bottom: 100rpx;
  422. display: flex;
  423. flex-wrap: wrap;
  424. border-bottom: 1rpx solid #eeeeee;
  425. .notifiList {
  426. width: 375rpx;
  427. height: 172rpx;
  428. padding: 46rpx 30rpx 46rpx 30rpx;
  429. text-align: left;
  430. border-right: 1rpx solid #eeeeee;
  431. border-bottom: 1rpx solid #eeeeee;
  432. box-sizing: border-box;
  433. display: flex;
  434. image {
  435. width: 48rpx;
  436. height: 48rpx;
  437. box-sizing: border-box;
  438. border-radius: 24rpx;
  439. padding: 10rpx;
  440. margin: 19rpx;
  441. }
  442. text {
  443. font-size: 24rpx;
  444. line-height: 30rpx;
  445. }
  446. }
  447. .notifiList:nth-child(2n + 2) {
  448. border-right: none;
  449. }
  450. }
  451. }
  452. </style>