人民医院前端

setting.vue 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <page-meta :root-font-size="getFontSizeValue"></page-meta>
  3. <view class="content">
  4. <view class="userInfo" @click="infoHandle">
  5. <view class="userInfoLeft">
  6. <image src="/static/person.png" mode=""></image>
  7. </view>
  8. <view class="userInfoRight">
  9. <view>{{userName}}--{{userCode}}</view>
  10. <view>{{deptName}}</view>
  11. </view>
  12. </view>
  13. <view class="userList">
  14. <view class="listCell" v-for="(item,index) in listCell" :key="index">
  15. <image :src="item.imgPath"></image>
  16. <text>{{item.itemText}}</text>
  17. <uni-icons class="fontIcon" type="arrowright" color="#d6d6d4" size="18"></uni-icons>
  18. </view>
  19. <view class="listCell" @click="trunFontSizeSetting">
  20. <image src="/static/Wd.png"></image>
  21. <text>设置字体大小</text>
  22. <text class="versionNum">{{fontSizeString}}</text>
  23. </view>
  24. <view class="listCell" @touchend="touchHandle">
  25. <image src="/static/Wd.png"></image>
  26. <text>版本</text>
  27. <text class="versionNum">{{version}}</text>
  28. </view>
  29. <view class="listCell" @touchend="btnChange" v-if="isAllowDept==1">
  30. <image src="/static/Wd.png"></image>
  31. <text>切换科室</text>
  32. <text class="versionNum">{{deptName}}</text>
  33. </view>
  34. </view>
  35. <!-- <view class="btnExit" v-if="isAllowDept==1">
  36. <button type="primary" @click="btnChange">切换科室</button>
  37. </view> -->
  38. <view class="btnExit">
  39. <button type="primary" @click="btnExit">退出登录</button>
  40. </view>
  41. <view>
  42. <uni-popup ref="inputDialogs" type="dialog">
  43. <uni-popup-dialog ref="inputClose" mode="input" :title="title" @confirm="dialogInputConfirm">
  44. <view style="width:100%;">
  45. <uni-table ref="table" border stripe type="selection" emptyText="暂无更多数据"
  46. @selection-change="selectionChange">
  47. <uni-tr>
  48. <uni-th align="center">科室</uni-th>
  49. </uni-tr>
  50. <uni-tr v-for="(item, index) in allowData" :key="index">
  51. <uni-td align="center">{{ $mHelper.findParents(departList, item.deptid) }}</uni-td>
  52. </uni-tr>
  53. </uni-table>
  54. </view>
  55. </uni-popup-dialog>
  56. </uni-popup>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import { debuggerModule, installDebugger } from 'uni_modules/imengyu-IMDebuggerWindow/common/debuggerExtern.js'
  62. import {
  63. mapGetters
  64. } from 'vuex';
  65. import store from '@/store';
  66. export default {
  67. data() {
  68. return {
  69. isAllowDept:0,
  70. onchangedept:"",
  71. selectedIndexs:[],
  72. departList:[],
  73. allowData:[],
  74. title:'允用科室',
  75. getFontSizeValue:'1rem',
  76. version: '1.1.8',
  77. fontSizeString:'',
  78. touchHandleTime:0,
  79. listCell: [
  80. // {
  81. // imgPath:'../../static/Wa.png',
  82. // itemText:'服务守则'
  83. // },
  84. ]
  85. }
  86. },
  87. onLoad() {
  88. if(uni.getStorageSync('storageAllowUserDept').indexOf(",")>=0){
  89. this.isAllowDept = 1
  90. }
  91. this.departList = JSON.parse(uni.getStorageSync("deptTreeData"));
  92. this.getFontSizeValue = uni.getStorageSync('fontSizeValue')+'rem'
  93. if(uni.getStorageSync('fontSizeValue') === 1){
  94. this.fontSizeString = '小'
  95. }else if (uni.getStorageSync('fontSizeValue') === 1.2){
  96. this.fontSizeString = '中'
  97. }else if (uni.getStorageSync('fontSizeValue') === 1.4){
  98. this.fontSizeString = '大'
  99. }
  100. store.dispatch("GetInfo")
  101. // 页面
  102. this.updateList()
  103. // #ifdef APP-PLUS
  104. this.version = 'v' + plus.runtime.version
  105. // #endif
  106. },
  107. methods: {
  108. selectionChange(e){
  109. this.selectedIndexs = e.detail.index
  110. this.onchangedept = this.allowData[e.detail.index].deptid
  111. console.log(this.allowData[e.detail.index])
  112. },
  113. dialogInputConfirm(){
  114. if(this.selectedIndexs.length!=1){
  115. this.$mHelper.toast("请选择一行数据");
  116. return;
  117. }
  118. const params={
  119. deptId:this.onchangedept,
  120. userid:uni.getStorageSync('userId')
  121. }
  122. this.$http.get('UserAccount/ChangeDeptId', params).then(res=>{
  123. if(res.state == "success"){
  124. this.$mHelper.toast(res.message);
  125. this.$refs.inputDialogs.close()
  126. this.$mStore.dispatch("GetInfo").then((e)=>{
  127. if(e.data.Dept){
  128. uni.setStorageSync('deptId', e.data.Dept.F_DeptId)
  129. uni.setStorageSync('deptName', e.data.Dept.F_DeptName)
  130. }
  131. })
  132. }
  133. })
  134. },
  135. updateList(){
  136. uni.$on("updateList", (res) => {
  137. store.dispatch("GetInfo")
  138. })
  139. },
  140. trunFontSizeSetting(){
  141. uni.navigateTo({
  142. url: "/pages/setting/fontSizeSetting/fontSizeSetting"
  143. })
  144. },
  145. touchHandle(e) {
  146. this.touchHandleTime++
  147. console.log(this.touchHandleTime)
  148. if(this.touchHandleTime === 5){
  149. this.touchHandleTime = 0
  150. installDebugger({
  151. enableRequestInterceptor: true, //默认为false,指示是否拦截网络请求,参见下一条
  152. showGlobalFloatWindow: true //默认为true,指定是否添加一个全局的调试按钮,点击可跳转至窗口
  153. });
  154. }
  155. },
  156. btnChange(){
  157. var str = uni.getStorageSync('storageAllowUserDept')//获取允用科室ids
  158. var arr = []
  159. if (str.indexOf(',') >= 0) {
  160. for (var i = 0; i < str.split(",").length; i++) {
  161. arr.push({
  162. deptname: '',
  163. deptid: str.split(",")[i]
  164. })
  165. }
  166. this.allowData = arr
  167. console.log(arr)
  168. }
  169. this.$refs.inputDialogs.open()
  170. },
  171. btnExit() {
  172. uni.showModal({
  173. title: '确定退出吗?',
  174. content: '退出到登录页面',
  175. success: function(res) {
  176. if (res.confirm) {
  177. uni.setStorageSync('Username', '');
  178. uni.setStorageSync('Password', '');
  179. uni.setStorageSync('token', '');
  180. uni.reLaunch({
  181. url: '/pages/login/login'
  182. });
  183. } else if (res.cancel) {
  184. console.log('用户点击取消');
  185. }
  186. }
  187. });
  188. },
  189. infoHandle(){
  190. uni.navigateTo({
  191. url:"personDetail/personDetail?userCode="+this.userCode
  192. })
  193. }
  194. },
  195. computed: {
  196. ...mapGetters([
  197. "userCode", // 用户工号
  198. "userName", // 用户名称
  199. "deptName", // 部门名称
  200. ])
  201. }
  202. }
  203. </script>
  204. <style lang="scss">
  205. .equipmentInfo {
  206. width: 100%;
  207. margin-top: 15px;
  208. border: 1px solid rgb(229, 229, 229);
  209. box-shadow: 0px 4px 16px 0px rgba(69, 91, 99, 0.05);
  210. margin-bottom: 20px;
  211. border-radius: 5px;
  212. .trCon {
  213. width: 100%;
  214. // font-size: 14px;
  215. .tdCon {
  216. display: inline-block;
  217. padding: 10px 0px;
  218. color: rgb(102, 102, 102);
  219. width: 48%;
  220. padding-right: 5px;
  221. text-align: center;
  222. }
  223. }
  224. }
  225. .userInfo {
  226. // background: url(/static/setting_banner.png) no-repeat;
  227. background-color: rgb(0, 122, 255);
  228. background-size: 100% 100%;
  229. width: 100%;
  230. height: 260rpx;
  231. display: flex;
  232. .userInfoLeft {
  233. width: 150rpx;
  234. height: 150rpx;
  235. border-radius: 75rpx;
  236. margin: 30rpx 30rpx 0rpx 30rpx;
  237. background: #FFFFFF;
  238. image {
  239. width: 100%;
  240. height: 100%;
  241. padding: 30rpx 20rpx 30rpx 35rpx;
  242. box-sizing: border-box;
  243. }
  244. }
  245. .userInfoRight {
  246. margin-top: 50rpx;
  247. view {
  248. color: #FFFFFF;
  249. }
  250. }
  251. }
  252. .userList {
  253. width: 100%;
  254. border-top: 1rpx solid #d6d6d4;
  255. border-bottom: 1rpx solid #d6d6d4;
  256. background: #FFFFFF;
  257. margin-top: 40rpx;
  258. overflow: hidden;
  259. .listCell {
  260. width: 720rpx;
  261. margin-left: 30rpx;
  262. height: 84rpx;
  263. line-height: 84rpx;
  264. border-bottom: 1rpx solid #d6d6d4;
  265. position: relative;
  266. display: flex;
  267. image {
  268. width: 40rpx;
  269. height: 40rpx;
  270. margin: 22rpx 22rpx 0 22rpx;
  271. box-sizing: border-box;
  272. }
  273. .fontIcon {
  274. position: absolute;
  275. right: 40rpx;
  276. }
  277. .versionNum {
  278. position: absolute;
  279. right: 80rpx;
  280. color: #999998;
  281. }
  282. }
  283. .listCell:last-child {
  284. border: none;
  285. }
  286. }
  287. .btnExit {
  288. width: 80%;
  289. margin: 30rpx auto;
  290. }
  291. </style>