deptSelect.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view class="mine">
  3. <scroll-view scroll-y class="body">
  4. <view class="bottom">
  5. <checkbox-group @change="checkboxChange" :value="optionData">
  6. <label class="litem-list" v-for="item in deptData" :key="item.value">
  7. <view>{{item.text}}</view>
  8. <checkbox :value="item.value" color="#49b856" :checked="item.checked" />
  9. </label>
  10. </checkbox-group>
  11. </view>
  12. </scroll-view>
  13. <view class="foot_common_btns">
  14. <button @click="goBackOrToList" type="default" class="cancelButton btn">返回</button>
  15. <button @click="submit" type="default" class="primaryButton btn">确认</button>
  16. </view>
  17. </view>
  18. </template>
  19. <script setup>
  20. import { ref, reactive } from 'vue'
  21. import { onLoad, onTabItemTap } from '@dcloudio/uni-app'
  22. import { api_incident_count, api_department, api_branch} from "@/http/api.js"
  23. import { defaultColor } from '@/static/js/theme.js'
  24. import { useSetTitle } from '@/share/useSetTitle.js'
  25. import { useMakePhoneCall } from '@/share/useMakePhoneCall.js'
  26. import { useLoginUserStore } from '@/stores/loginUser'
  27. import { useIncidentNumStore } from '@/stores/incidentNum'
  28. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  29. import { useSetTabbar } from '@/share/useSetTabbar.js'
  30. import { useGoBack } from '@/share/useGoBack.js'
  31. useSetTitle();
  32. const loginUserStore = useLoginUserStore();
  33. const incidentNumStore = useIncidentNumStore();
  34. const { makePhoneCall } = useMakePhoneCall();
  35. const repositorySearchStore = repositoryListSearchStore();
  36. const { setTabbar } = useSetTabbar();
  37. const { goBack } = useGoBack();
  38. const deptData = ref([])
  39. const dataForm = reactive({
  40. dept: '',
  41. branch:''
  42. })
  43. const deptSelectData = ref(null)
  44. const deptSelectName = ref(null)
  45. const checkBox = ref([])
  46. const optionData = ref(null)
  47. // 是否提交
  48. const isSubmit = ref(false)
  49. // 上一步或者返回列表
  50. function goBackOrToList(){
  51. goBack();
  52. }
  53. function checkboxChange (e) {
  54. var items = deptData.value;
  55. let values = e.detail.value;
  56. deptSelectName.value = []
  57. for (var i = 0, lenI = items.length; i < lenI; ++i) {
  58. const item = items[i]
  59. if(values.includes(item.value)){
  60. deptSelectName.value.push(item)
  61. }
  62. }
  63. }
  64. // 获取科室列表
  65. function getRepairTypes(){
  66. uni.showLoading({
  67. title: "加载中",
  68. mask: true,
  69. });
  70. let postData = {
  71. department: {
  72. hospital: loginUserStore.loginUser.user.currentHospital.id,
  73. },
  74. idx:0,
  75. sum:9999
  76. }
  77. // if(loginUserStore.loginUser.user.duty){
  78. // postData.department.branch = loginUserStore.loginUser.user.duty.id;
  79. // }else if(loginUserStore.loginUser.user.branch){
  80. // postData.department.branch = loginUserStore.loginUser.user.branch.id;
  81. // }
  82. api_department(postData).then(res => {
  83. uni.hideLoading();
  84. res = res.list || [];
  85. deptData.value = res.map(v => ({
  86. text: v.dept,
  87. value: v.id+'',
  88. checked: false
  89. }));
  90. for(let i of deptData.value){
  91. for(let t of optionData.value){
  92. if(i.value == Number(t)){
  93. i.checked = true
  94. }
  95. }
  96. }
  97. if(optionData.value){
  98. checkBox.value = optionData.value
  99. }
  100. })
  101. }
  102. function submit(){
  103. if(!deptSelectName.value){
  104. uni.showToast({
  105. icon: 'none',
  106. title: '请先选择科室'
  107. });
  108. return
  109. }
  110. let id = []
  111. let name = []
  112. for(let i of deptSelectName.value){
  113. id.push(i.value)
  114. name.push(i.text)
  115. }
  116. let data = {
  117. data:id,
  118. name:name
  119. }
  120. uni.reLaunch({
  121. url: '/pages/repair/config?data='+JSON.stringify(data)
  122. })
  123. }
  124. // 初始化
  125. function onLoadFn(){
  126. getRepairTypes()
  127. }
  128. onLoad((option) => {
  129. console.log(888,option)
  130. if(option.data!='none'){
  131. let data = JSON.parse(option.data).split(',')
  132. optionData.value = data
  133. }
  134. onLoadFn();
  135. })
  136. onTabItemTap(e => {
  137. onLoadFn();
  138. })
  139. </script>
  140. <style scoped>
  141. >>> .uni-data-tree-input{
  142. width: 100% !important;
  143. }
  144. >>> .input-value-border{
  145. border: none !important;
  146. }
  147. >>> .input-value{
  148. padding:0 !important;
  149. flex-direction: row-reverse !important;
  150. }
  151. >>> .selected-list{
  152. flex-direction: row-reverse !important;
  153. }
  154. >>> .arrow-area{
  155. display: none !important;
  156. }
  157. </style>
  158. <style lang="scss" scoped>
  159. .uni-checkbox-input:hover{
  160. border-color:#49b856;
  161. }
  162. .mine{
  163. display: flex;
  164. flex-direction: column;
  165. justify-content: space-between;
  166. background: #fff;
  167. .phone-filled{
  168. margin-right: 5rpx;
  169. }
  170. .newicon-xinjian2,
  171. .newicon-zhishiku{
  172. margin-right: 10rpx;
  173. }
  174. .body{
  175. height: 88vh;
  176. // padding: 0 30rpx;
  177. box-sizing: border-box;
  178. border-radius: 8rpx;
  179. .top{
  180. padding: 30rpx;
  181. background-color: #fff;
  182. .top_name{
  183. font-size: 28rpx;
  184. font-weight: bold;
  185. }
  186. .top_count{
  187. margin-top: 45rpx;
  188. display: flex;
  189. align-items: center;
  190. justify-content: space-between;
  191. .top_count_item{
  192. text-align: center;
  193. .name{
  194. color: #949494;
  195. font-size: 22rpx;
  196. }
  197. .value{
  198. font-size: 50rpx;
  199. font-weight: bold;
  200. margin-top: 15rpx;
  201. }
  202. }
  203. }
  204. }
  205. .bottom{
  206. background-color: #fff;
  207. margin-top: 15rpx;
  208. .litem-list{
  209. display: flex;
  210. justify-content: space-between;
  211. height: 70rpx;
  212. align-items: center;
  213. border-bottom: 1px solid #f5f5f5;
  214. padding: 0 20rpx;
  215. font-size: 28rpx;
  216. }
  217. .bottom_name{
  218. font-size: 26rpx;
  219. color: $uni-primary;
  220. padding: 21rpx 24rpx;
  221. }
  222. .bottom_list{
  223. .bottom_list_item{
  224. border-top: 1rpx solid #DEDEDE;
  225. padding: 30rpx 30rpx 30rpx 30rpx;
  226. display: flex;
  227. justify-content: space-between;
  228. align-items: center;
  229. font-size: 24rpx;
  230. position: relative;
  231. .value{
  232. max-width: 380rpx;
  233. color: #333;
  234. display: flex;
  235. align-items: center;
  236. text-align: justify;
  237. margin-right: 30rpx;
  238. }
  239. .no-mar{
  240. margin-right:0 !important;
  241. }
  242. .icon{
  243. position: absolute;
  244. right: 20rpx;
  245. }
  246. }
  247. }
  248. }
  249. }
  250. }
  251. </style>