index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <!-- 头部 -->
  3. <nav-bar height="120" backPath="workspace" title="教师专业发展" :showHeaderborder="true" :showFilterPicker="false" :showTabs="false" :onlyTitle="false" rightWidth="0rpx" @CommonFilterData="CommonFilterData"></nav-bar>
  4. <view class="page_content">
  5. <view class="count_list">
  6. <view class="count_item">
  7. <text class="title">全部荣誉</text>
  8. <text class="count">{{state.countList.honorCount}}</text>
  9. </view>
  10. <view class="count_item">
  11. <text class="title">待审核</text>
  12. <text class="count">{{state.countList.reViewCount}}</text>
  13. </view>
  14. <view class="count_item">
  15. <text class="title">已完成</text>
  16. <text class="count">{{state.countList.overCount}}</text>
  17. </view>
  18. <view class="count_item">
  19. <text class="title">已驳回</text>
  20. <text class="count">{{state.countList.overruleCount}}</text>
  21. </view>
  22. </view>
  23. <view class="list_title">
  24. <view class="title">荣誉类型</view>
  25. <view class="add_btn" v-if="roleCodes?.includes('SCHOOL_MANAGER')" @click="AddEditHonorType('add')">
  26. <uni-icons class="btn_icon" type="plusempty"></uni-icons>
  27. <text class="btn_text">新建类型</text>
  28. </view>
  29. </view>
  30. <view class="honor_list">
  31. <template v-if="state.tableData.length > 0">
  32. <view class="list_item" v-for="item in state.tableData" :key="item.honorTypeId" @click="HonorTypeAuditDetail(item.honorTypeId,item.reviewStatus,item.honorTypeName)">
  33. <view class="item_name">
  34. <text class="name">{{item.honorTypeName}}</text>
  35. <view class="more_icon" v-if="roleCodes?.includes('SCHOOL_MANAGER') || roleCodes?.includes('SCHOOL_MASTER')" @click.stop="ShowMorePopupDialog(item.honorTypeName,item.honorTypeId,item.deleteStatus)">
  36. <uni-icons type="more-filled" style="color: #999999;font-size: 32rpx;"></uni-icons>
  37. </view>
  38. </view>
  39. <view class="item_sum">
  40. <image class="cup" src="@/static/image/icon/honor_cup.png"></image>
  41. <view class="sum">共{{item.number}}项</view>
  42. <template v-if="Number(item.reviewStatus) === 0">
  43. <image class="seal" src="@/static/image/icon/honor_seal.png"></image>
  44. <view class="audit">需审核</view>
  45. </template>
  46. </view>
  47. </view>
  48. </template>
  49. <noData v-if="!state.isLoading && state.tableData.length == 0" />
  50. </view>
  51. </view>
  52. <customPopupDialog ref="popupDialogRef" :title="state.popupDialog.title" :isMaskClick="true" :showDialogClose="false" :showDialogFooter="false">
  53. <view class="popup_content">
  54. <view class="content_item" @click="AddEditHonorType('edit')">
  55. <view class="content_item_left">
  56. <image class="img" src="@/static/image/icon/edit.png"></image>
  57. <text class="text">编辑</text>
  58. </view>
  59. <uni-icons class="content_item_right" type="right" style="color: #333333;font-size: 36rpx;"></uni-icons>
  60. </view>
  61. <view class="content_item" v-if="state.popupDelDialog.deleteStatus!=1" @click="DeleteHonorTypeItem">
  62. <view class="content_item_left">
  63. <image class="img" src="@/static/image/icon/delete.png"></image>
  64. <text :class="['text',{'red':state.popupDelDialog.deleteStatus!=1,'disabled':state.popupDelDialog.deleteStatus==1}]">删除</text>
  65. </view>
  66. </view>
  67. </view>
  68. </customPopupDialog>
  69. <!-- 删除确认框 -->
  70. <popupDialog ref="popupDelDialogRef" :showFootBorder="true" :content="state.popupDelDialog.content" @DialogConfirm="DialogDelConfirm" />
  71. </template>
  72. <script setup>
  73. import navBar from '@/components/navBar.vue';
  74. import noData from '@/components/noData.vue';
  75. import customPopupDialog from '@/components/customPopupDialog.vue';
  76. import popupDialog from '@/components/popupDialog.vue';
  77. import uniIcons from '@/uni_modules/uni-icons/components/uni-icons/uni-icons.vue';
  78. import {queryHonorTypeOverView,deleteHonorType} from '@/reqApi/teacherHonor.js';
  79. import { onShow } from '@dcloudio/uni-app';
  80. import {
  81. reactive,
  82. ref,
  83. onMounted,
  84. onUnmounted,
  85. nextTick,
  86. computed
  87. } from 'vue';
  88. import { useStore } from 'vuex';
  89. const store = useStore();
  90. const state = reactive({
  91. queryStr: '',
  92. countList:{
  93. honorCount:'',//全部荣誉
  94. reViewCount:'',//待审核
  95. overCount:'',//已完成
  96. overruleCount:''//已驳回
  97. },
  98. isLoading:true,//加载中
  99. tableData:[],
  100. popupDialog:{
  101. title:'',
  102. id:'',//荣誉id
  103. deleteStatus:0//0 可删 1 不可删
  104. },
  105. popupDelDialog:{
  106. content:''
  107. }
  108. })
  109. //提示框
  110. const popupDialogRef = ref(null);
  111. const popupDelDialogRef = ref(null);
  112. const roleCodes = computed(()=>store.state?.userStore?.userInfo?.roleCodes || []);
  113. onShow(()=>{
  114. const isLoadHonorOverview = uni.getStorageSync('isLoadHonorOverview');
  115. if(isLoadHonorOverview){
  116. OnLoadData();
  117. }
  118. })
  119. onMounted(() => {
  120. OnLoadData();
  121. });
  122. onUnmounted(()=>{
  123. uni.setStorageSync('isLoadHonorOverview', false);
  124. })
  125. const OnLoadData = () => {
  126. state.isLoading = true;
  127. queryHonorTypeOverView({
  128. queryStr:state.queryStr
  129. }).then(res=>{
  130. if(res.code == 200 && res.data){
  131. const { honorCount, reViewCount, overCount, overruleCount,tableData } = res.data;
  132. state.countList.honorCount = honorCount || 0;
  133. state.countList.reViewCount = reViewCount || 0;
  134. state.countList.overCount = overCount || 0;
  135. state.countList.overruleCount = overruleCount || 0;
  136. state.tableData = tableData || [];
  137. }else{
  138. state.countList.honorCount = '';
  139. state.countList.reViewCount = '';
  140. state.countList.overCount = '';
  141. state.countList.overruleCount = '';
  142. state.tableData = [];
  143. }
  144. }).finally(()=>{
  145. state.isLoading = false;
  146. })
  147. }
  148. //搜索
  149. const CommonFilterData = (filterOptions,type) => {
  150. if(type=='search'){
  151. state.queryStr = filterOptions.searchWord;
  152. OnLoadData();
  153. }
  154. }
  155. //编辑 删除
  156. const ShowMorePopupDialog = (title,id,deleteStatus) => {
  157. state.popupDialog.title = title;
  158. state.popupDialog.id = id;
  159. state.popupDelDialog.deleteStatus = deleteStatus;
  160. popupDialogRef.value.OpenDialog('bottom');
  161. }
  162. //删除弹框
  163. const DeleteHonorTypeItem = () => {
  164. if(state.popupDelDialog.deleteStatus == 1) return false
  165. state.popupDelDialog.content = `确定要删除【${state.popupDialog.title}】吗?`;
  166. popupDelDialogRef.value.OpenDialog();
  167. }
  168. //确定删除
  169. const DialogDelConfirm = () => {
  170. deleteHonorType(state.popupDialog.id).then(res=>{
  171. if(res.code == 200){
  172. uni.showToast({
  173. title: '删除成功!',
  174. icon: 'none'
  175. });
  176. popupDialogRef.value.CloseDialog();
  177. OnLoadData();
  178. }else{
  179. uni.showToast({
  180. title: res.msg,
  181. icon: 'none'
  182. });
  183. }
  184. })
  185. }
  186. //新建或编辑荣誉类型
  187. const AddEditHonorType = (type) => {
  188. const id = type=='add'?'':state.popupDialog.id;
  189. if(type=='edit'){
  190. popupDialogRef.value.CloseDialog();
  191. }
  192. uni.navigateTo({
  193. url: `/pages/teacherHonor/honorOverview/honorTypeDetail?id=${id}`
  194. });
  195. }
  196. //查看荣誉详情
  197. const HonorTypeAuditDetail = (honorTypeId,reviewStatus,honorTypeName) => {
  198. uni.navigateTo({
  199. url: `/pages/teacherHonor/honorOverview/honorTypeAuditDetail?honorTypeId=${honorTypeId}&reviewStatus=${reviewStatus}&honorTypeName=${encodeURIComponent(honorTypeName)}`
  200. });
  201. }
  202. </script>
  203. <style lang="scss" scoped>
  204. .count_list{
  205. width: 100%;
  206. display: flex;
  207. margin-top: 32rpx;
  208. gap: 20rpx;
  209. .count_item{
  210. display: flex;
  211. align-items: center;
  212. flex-direction: column;
  213. width: calc((100% - 60rpx) / 4);
  214. background-color: #F7FAFF;
  215. border-radius: 20rpx;
  216. border: 2rpx solid #E4E7ED;
  217. padding: 18rpx 16rpx 16rpx;
  218. height: 136rpx;
  219. box-sizing: border-box;
  220. .title{
  221. font-weight: 400;
  222. font-size: 28rpx;
  223. color: #666666;
  224. text-align: center;
  225. }
  226. .count{
  227. margin-top: 6rpx;
  228. font-weight: 600;
  229. font-size: 48rpx;
  230. color: #333333;
  231. }
  232. }
  233. }
  234. .list_title{
  235. width: 100%;
  236. display: flex;
  237. margin-top: 40rpx;
  238. justify-content: space-between;
  239. align-items: center;
  240. .title{
  241. font-weight: 500;
  242. font-size: 32rpx;
  243. color: #333333;
  244. }
  245. .add_btn{
  246. width: 204rpx;
  247. height: 72rpx;
  248. display: flex;
  249. align-items: center;
  250. justify-content: center;
  251. background-color: #2E64FA;
  252. border-radius: 8rpx;
  253. border: 2rpx solid #2E64FA;
  254. color: #FFFFFF;
  255. .btn_icon{
  256. color: #FFFFFF !important;
  257. font-size: 28rpx !important;
  258. margin-right: 8rpx;
  259. }
  260. .btn_text{
  261. font-size: 28rpx;
  262. color: #FFFFFF;
  263. line-height: 44rpx;
  264. }
  265. }
  266. }
  267. .honor_list{
  268. width: 100%;
  269. display: flex;
  270. flex-wrap: wrap;
  271. gap: 22rpx;
  272. padding: 22rpx 0;
  273. .list_item{
  274. display: flex;
  275. flex-direction: column;
  276. width: calc((100% - 22rpx) / 2);
  277. background: linear-gradient( 180deg, #EDF4FF 0%, #FFFFFF 100%);
  278. border-radius: 20rpx;
  279. border: 2rpx solid #E4E7ED;
  280. margin-top: 10rpx;
  281. padding: 24rpx;
  282. box-sizing: border-box;
  283. .item_name{
  284. display: flex;
  285. align-items: center;
  286. width: 100%;
  287. .name{
  288. font-weight: 500;
  289. font-size: 36rpx;
  290. color: #333333;
  291. margin-right: 8rpx;
  292. flex:1;
  293. white-space: nowrap;
  294. overflow: hidden;
  295. text-overflow: ellipsis;
  296. }
  297. .more_icon{
  298. display: inline-flex;
  299. align-items: center;
  300. justify-content: center;
  301. width: 32rpx;
  302. height: 32rpx;
  303. }
  304. }
  305. .item_sum{
  306. display: flex;
  307. align-items: center;
  308. flex-wrap: wrap;
  309. width: 100%;
  310. margin-top: 38rpx;
  311. .cup,.seal{
  312. width: 32rpx;
  313. height: 32rpx;
  314. margin-right: 8rpx;
  315. }
  316. .sum,.audit{
  317. font-weight: 400;
  318. font-size: 28rpx;
  319. }
  320. .sum{
  321. color: #2E64FA;
  322. margin-right: 24rpx;
  323. }
  324. .audit{
  325. color: #F56C6C;
  326. }
  327. }
  328. }
  329. }
  330. .popup_content{
  331. display: flex;
  332. width: 100%;
  333. height: 360rpx;
  334. flex-direction: column;
  335. margin-top: 8rpx;
  336. .content_item{
  337. display: flex;
  338. width: 100%;
  339. height: 88rpx;
  340. padding: 0 48rpx;
  341. box-sizing: border-box;
  342. margin-top: 16rpx;
  343. align-items: center;
  344. justify-content: space-between;
  345. .content_item_left{
  346. display: flex;
  347. height:100%;
  348. align-items: center;
  349. .img{
  350. width: 32rpx;
  351. height: 32rpx;
  352. margin-right: 16rpx;
  353. }
  354. .text{
  355. font-weight: 400;
  356. font-size: 32rpx;
  357. color: #333333;
  358. &.red{
  359. color: #F56C6C;
  360. }
  361. &.disabled{
  362. color: #bbb;
  363. }
  364. }
  365. }
  366. }
  367. }
  368. </style>