repositoryFilter.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. <template>
  2. <view class="container" @touchmove.stop.prevent v-if="pageData.pageRouter === 'default'">
  3. <view class="container_form">
  4. <view class="hospital">
  5. <text class="name">标题</text>
  6. <text class="value ellipsis">
  7. <input class="uni-input" v-model="searchData.title" placeholder="请输入标题" />
  8. </text>
  9. </view>
  10. <view class="category">
  11. <text class="name">故障现象</text>
  12. <text class="value">
  13. <uni-data-picker @change="categoryChange" v-model="searchData.category" :localdata="pageData.categoryList" popup-title="请选择故障信息" :map="{text:'category',value:'id'}">
  14. </uni-data-picker>
  15. </text>
  16. </view>
  17. </view>
  18. <view class="container_foot">
  19. <view class="clear" @click="clear">清除选项</view>
  20. <view class="foot_btns">
  21. <view class="cancel" @click="cancel">取消</view>
  22. <view class="confirm" @click="confirm">确认</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="mask" @touchmove.stop.prevent></view>
  27. <view class="line" @touchmove.stop.prevent></view>
  28. </template>
  29. <script setup>
  30. import { defineEmits, ref, reactive, defineProps } from 'vue'
  31. import { onLoad } from '@dcloudio/uni-app'
  32. import { useLoginUserStore } from '@/stores/loginUser'
  33. import { repositoryListSearchStore } from '@/stores/repositorySearch'
  34. import { api_area, api_incidentcategory } from "@/http/api.js"
  35. import { transform } from '@/utils/index.js'
  36. const emit = defineEmits(['cancelEmit', 'confirmEmit']);
  37. const loginUserStore = useLoginUserStore();
  38. const repositorySearchStore = repositoryListSearchStore();
  39. // 页面数据
  40. const pageData = reactive({
  41. pageRouter: 'default',
  42. areaList: [],
  43. categoryList: [],
  44. });
  45. const searchData = reactive({
  46. title:'',
  47. hospital: {},
  48. selected: 'todoingAll',
  49. area: {id: 0, area: '全部'},
  50. category: {},
  51. acceptDate: [],
  52. categoryChangeData:[]
  53. })
  54. // 清空
  55. function clear(){
  56. searchData.category = {};
  57. searchData.acceptDate = [];
  58. searchData.title = '';
  59. searchData.categoryChangeData = [];
  60. repositorySearchStore.clearRepositoryListSearchData()
  61. }
  62. // 取消
  63. function cancel(){
  64. emit('cancelEmit')
  65. }
  66. // 确认
  67. function confirm(){
  68. repositorySearchStore.setRepositoryListSearchData(searchData)
  69. emit('confirmEmit', searchData);
  70. }
  71. function categoryChange(val){
  72. searchData.categoryChangeData = val.detail.value
  73. }
  74. // 获取故障现象列表
  75. function getCategoryList(){
  76. uni.showLoading({
  77. title: "加载中",
  78. mask: true,
  79. });
  80. let postData = {
  81. idx: 0,
  82. sum: 9999,
  83. incidentcategory: {
  84. },
  85. }
  86. if(loginUserStore.loginUser.user.duty){
  87. postData.incidentcategory.duty = loginUserStore.loginUser.user.duty.id;
  88. }else if(loginUserStore.loginUser.user.branch){
  89. postData.incidentcategory.branch = loginUserStore.loginUser.user.branch.id;
  90. }
  91. api_incidentcategory(postData).then(res => {
  92. uni.hideLoading();
  93. if(res.status == 200){
  94. let list = res.list || [];
  95. list = list.map(i=> ({...i, parentid: i.parent?.id}))
  96. pageData.categoryList = transform(list, 'id', 'parentid')
  97. }else{
  98. uni.showToast({
  99. icon: 'none',
  100. title: res.msg || '请求数据失败!'
  101. });
  102. }
  103. })
  104. }
  105. // 页面路由跳转
  106. function clickPageRouter(type){
  107. pageData.pageRouter = type;
  108. switch(type){
  109. case 'category':
  110. getCategoryList('one');
  111. break;
  112. }
  113. }
  114. onLoad((option) => {
  115. getCategoryList()
  116. let data = repositorySearchStore.repositorySearch.data
  117. searchData.category = data && data.category;
  118. searchData.title = data && data.title;
  119. searchData.categoryChangeData = data && data.categoryChangeData
  120. })
  121. </script>
  122. <style lang="scss" scoped>
  123. .mask{
  124. position: fixed;
  125. left: 0;
  126. top: 0;
  127. right: 0;
  128. bottom: 0;
  129. background-color: rgba(0, 0, 0, 0.4);
  130. z-index: 999;
  131. }
  132. .line{
  133. content: '';
  134. position: fixed;
  135. top: 0;
  136. left: 0;
  137. z-index: 9999;
  138. height: 8rpx;
  139. width: 100%;
  140. background-color: #EBEBEB;
  141. }
  142. .container{
  143. position: fixed;
  144. left: 125rpx;
  145. top: 0;
  146. right: 0;
  147. bottom: 0;
  148. z-index: 9999;
  149. background-color: #F7F7F7;
  150. display: flex;
  151. flex-direction: column;
  152. justify-content: space-between;
  153. .container_form{
  154. height: 100%;
  155. display: flex;
  156. flex-direction: column;
  157. flex: 1;
  158. min-height: 0;
  159. .item{
  160. padding: 32rpx;
  161. }
  162. }
  163. .hospital{
  164. display: flex;
  165. align-items: center;
  166. padding: 32rpx 24rpx 24rpx;
  167. background-color: #fff;
  168. .name{
  169. font-size: 28rpx;
  170. flex-shrink: 0;
  171. margin-right: 24rpx;
  172. }
  173. .value{
  174. width: 100%;
  175. font-size: 22rpx;
  176. .uni-input{
  177. font-size: 26rpx;
  178. }
  179. }
  180. }
  181. .areas{
  182. flex: 1;
  183. min-height: 0;
  184. margin-top: 16rpx;
  185. background-color: #fff;
  186. .areas_item{
  187. padding: 24rpx;
  188. border-bottom: 1rpx solid #DEDEDE;
  189. }
  190. }
  191. .categorys{
  192. flex: 1;
  193. min-height: 0;
  194. margin-top: 16rpx;
  195. background-color: #fff;
  196. .categorys_item{
  197. padding: 24rpx;
  198. border-bottom: 1rpx solid #DEDEDE;
  199. }
  200. }
  201. .tabs{
  202. margin-top: 16rpx;
  203. background-color: #FBFBFB;
  204. display: flex;
  205. flex-wrap: wrap;
  206. justify-content: space-between;
  207. gap: 16rpx 0;
  208. padding: 24rpx 16rpx;
  209. .tab{
  210. width: 180rpx;
  211. height: 60rpx;
  212. display: flex;
  213. justify-content: center;
  214. align-items: center;
  215. background-color: #F7F7F7;
  216. font-size: 28rpx;
  217. position: relative;
  218. .newicon-xuanzejiaobiao{
  219. opacity: 0;
  220. position: absolute;
  221. right: 0;
  222. bottom: 0;
  223. font-size: 38rpx;
  224. color: #53B9BB;
  225. }
  226. &.active{
  227. background-color: rgba(149, 220, 231, 0.30);
  228. .newicon-xuanzejiaobiao{
  229. opacity: 1;
  230. }
  231. }
  232. }
  233. }
  234. .area,
  235. .category,
  236. .acceptDate{
  237. display: flex;
  238. justify-content: space-between;
  239. align-items: center;
  240. padding: 24rpx;
  241. background-color: #fff;
  242. margin-top: 24rpx;
  243. .name{
  244. font-size: 28rpx;
  245. flex-shrink: 0;
  246. margin-right: 24rpx;
  247. }
  248. .value{
  249. flex:1;
  250. }
  251. }
  252. .container_foot{
  253. .clear{
  254. padding: 24rpx;
  255. font-size: 28rpx;
  256. background-color: #fff;
  257. margin: 0 16rpx;
  258. display: flex;
  259. align-items: center;
  260. justify-content: center;
  261. }
  262. .foot_btns{
  263. margin-top: 24rpx;
  264. display: flex;
  265. border-top: 1rpx solid #BFBFBF;
  266. .cancel{
  267. flex: 1;
  268. background-color: #fff;
  269. font-size: 32rpx;
  270. padding: 24rpx;
  271. display: flex;
  272. justify-content: center;
  273. }
  274. .confirm{
  275. flex: 1;
  276. font-size: 32rpx;
  277. padding: 24rpx;
  278. background-color: $uni-primary;
  279. display: flex;
  280. justify-content: center;
  281. color: #fff;
  282. }
  283. }
  284. }
  285. }
  286. </style>