learning.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div>
  3. <div class="topBox">
  4. <NavBar :go="{ type: 'push', path: '/menu' }" />
  5. <van-row>
  6. <van-col span="24">
  7. <org-tree v-model="cascaderValue" :name="'sss'" @changeItem="getDataList"></org-tree>
  8. </van-col>
  9. </van-row>
  10. <van-row>
  11. <van-col span="9">
  12. <van-field
  13. v-model="currentDate"
  14. clearable
  15. label-width="3em"
  16. label="年份"
  17. placeholder=""
  18. :disabled="showDate"
  19. @click="showDate = true"
  20. >
  21. <van-icon name="arrow-down" slot="button"
  22. /></van-field>
  23. <van-popup v-model="showDate" round position="bottom">
  24. <van-picker
  25. v-model="presentDate"
  26. show-toolbar
  27. @cancel="onCancel"
  28. :columns="yearColumns"
  29. @confirm="onDateConfirm"
  30. confirm-button-text="确定"
  31. :default-index="yearSelect"
  32. title="年份"
  33. />
  34. </van-popup>
  35. </van-col>
  36. <van-col span="15">
  37. <van-tabs v-model="active" @click="tbsHandler">
  38. <van-tab name="01-01" title="Q1"></van-tab>
  39. <van-tab name="04-01" title="Q2"></van-tab>
  40. <van-tab name="07-01" title="Q3"></van-tab>
  41. <van-tab name="10-01" title="Q4"></van-tab>
  42. </van-tabs>
  43. </van-col>
  44. </van-row>
  45. <van-row>
  46. <van-col span="24">
  47. <van-tabs v-model="activeAl" @click="tbsAlHandler">
  48. <van-tab name="1" title="行社优秀案例"></van-tab>
  49. <van-tab name="3" title="地区优秀案例"></van-tab>
  50. <van-tab name="5" title="省级优秀案例"></van-tab>
  51. </van-tabs>
  52. </van-col>
  53. </van-row>
  54. </div>
  55. <!-- //卡片内容区域 -->
  56. <div class="navBarclas">
  57. <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
  58. <van-panel :title="item.title" v-for="item in taskList" :key="item.id" class="card" status="状态">
  59. <template #header>
  60. <div class="titleClass">
  61. <div class="title">{{ item.title }}</div>
  62. </div>
  63. </template>
  64. <div>
  65. <div class="mainItem" @click="goInfo(item.id)">
  66. <div>单位名称</div>
  67. <div>{{ item.orgName }}</div>
  68. </div>
  69. <div class="mainItem" @click="goInfo(item.id)">
  70. <div>演练项目</div>
  71. <div>{{ item.typeText }}</div>
  72. </div>
  73. <div class="mainItem" @click="goInfo(item.id)">
  74. <div>演练时间</div>
  75. <div>{{ item.drillTime }}</div>
  76. </div>
  77. </div>
  78. </van-panel>
  79. </van-list>
  80. </div>
  81. </div>
  82. </template>
  83. <script>
  84. import NavBar from '@/components/NavBar'
  85. import { Col, Row, Cascader, Dialog, DatetimePicker, Icon, Picker } from 'vant'
  86. import { getRecTaskList } from '@/api/optimalLearning.js'
  87. import { deptTreeList } from '@/api/toConsult.js'
  88. import { Toast } from 'vant'
  89. import OrgTree from '@/components/orgTree'
  90. import { newDateMonth, newDateYear } from '@/utils/date.js'
  91. export default {
  92. data() {
  93. return {
  94. orgName: '',
  95. orgShow: false,
  96. presentDate: '', //默认时间
  97. pageNum: 1,
  98. loading: false, //加载状态
  99. finished: false, //是否全部加载完毕
  100. yearColumns: [],
  101. orgName: JSON.parse(sessionStorage.getItem('SET_USER_ORGNAME')) || '', //机构名称
  102. cascaderValue: '', //机构ID
  103. show: false, //机构弹框显示隐藏
  104. active: '01-01',
  105. activeAl: '1',
  106. fieldNames: {
  107. text: 'name',
  108. value: 'id',
  109. children: 'children'
  110. },
  111. taskList: [], //列表数据
  112. typeValue: ' ', //类型值
  113. yearSelect: null,
  114. value1: JSON.parse(sessionStorage.getItem('SET_USER_ID')) || '', //输入框model
  115. showStatus: false, //状态显示隐藏
  116. showDate: false, //月份显示隐藏
  117. fieldValue: '全部', //状态名称
  118. statusValue: ' ', //状态值
  119. columns: ['全部'], //状态数组
  120. columnsList: [], //状态数组
  121. currentDate: newDateYear(), //年份
  122. }
  123. },
  124. components: {
  125. NavBar,
  126. OrgTree,
  127. Dialog,
  128. Icon,
  129. DatetimePicker,
  130. Picker,
  131. Col,
  132. Row,
  133. Cascader
  134. },
  135. created() {
  136. this.presentDate = new Date(newDateYear())
  137. this.getNewMonth()
  138. this.yearData()
  139. },
  140. mounted() {
  141. this.init()
  142. this.cascaderValue = JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
  143. },
  144. methods: {
  145. getNewMonth() {
  146. //获取当前月份
  147. let date = new Date().getMonth() + 1
  148. console.log(date)
  149. //默认填充当前季度
  150. if (date > 7 && date < 10) {
  151. this.active='07-01'
  152. //三季度
  153. }else if(date > 4 && date < 7){
  154. //二季度
  155. this.active='04-01'
  156. }else if(date > 1 && date < 4){
  157. //一季度
  158. this.active='01-01'
  159. }else{
  160. this.active='10-01'
  161. // 四季度
  162. }
  163. },
  164. //机构搜索
  165. getDataList(val) {
  166. this.cascaderValue = val.id
  167. this.orgName = val.name
  168. this.selectListAppHandler()
  169. },
  170. //初始化
  171. init() {
  172. //获取数据字典
  173. this.getDictHandler('drill_task_status', res => {
  174. this.columnsList = res
  175. this.columns = res.map(item => item.dictLabel)
  176. this.columns.unshift('全部')
  177. })
  178. //获取分页列表
  179. this.selectListAppHandler()
  180. },
  181. selectListAppHandler(type = 0, callback = () => {}) {
  182. let obj = {
  183. pageNum: this.pageNum,
  184. pageSize: 10
  185. }
  186. if (!type) {
  187. obj.pageNum = 1
  188. this.pageNum = 1
  189. }
  190. // if (this.statusValue) {
  191. // obj.status = this.statusValue
  192. // }
  193. obj.orgId = this.cascaderValue || JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + '' || ''
  194. if (this.currentDate) {
  195. obj.date = this.currentDate + '-' + this.active
  196. }
  197. if (this.activeAl) {
  198. obj.recStatus = this.activeAl
  199. }
  200. //获取任务列表
  201. getRecTaskList(obj).then(res => {
  202. let { code, rows, msg } = res
  203. if (code == 200) {
  204. if (type) {
  205. this.taskList.push(...rows)
  206. if (rows.length == 0 || rows.length < 10) {
  207. //已加载完全部数据
  208. this.finished = true
  209. }
  210. callback()
  211. } else {
  212. this.finished = false
  213. this.taskList = rows
  214. }
  215. }
  216. })
  217. },
  218. tbsHandler() {
  219. this.selectListAppHandler()
  220. },
  221. tbsAlHandler() {
  222. this.selectListAppHandler()
  223. },
  224. //年份选中触发
  225. onDateConfirm(val) {
  226. this.currentDate = this.newDate(val + '')
  227. this.showDate = false
  228. this.selectListAppHandler()
  229. },
  230. yearData() {
  231. // 获取默认显示的时间
  232. var nowTime = new Date()
  233. let year = nowTime.getFullYear()
  234. let month = nowTime.getMonth()
  235. let day = nowTime.getDate()
  236. // 循环数组 填写最小时间和最大时间范围
  237. for (let i = 1980; i < 2099; i++) {
  238. this.yearColumns.push(i)
  239. }
  240. // 格式化时间并截取
  241. var years = this.formatDate(new Date(year, month, day))
  242. var Year = years.slice(0, 4)
  243. // 将截取的年份赋值给绑定值 用于点击弹出日期窗口后显示当前的时间
  244. this.yearSelect = this.yearColumns.indexOf(Number(Year))
  245. }, //日期转换
  246. newDate(time) {
  247. var date = new Date(time)
  248. var y = date.getFullYear()
  249. var m = date.getMonth() + 1
  250. m = m < 10 ? '0' + m : m
  251. var d = date.getDate()
  252. d = d < 10 ? '0' + d : d
  253. return y
  254. },
  255. //日期格式
  256. formatDate(date) {
  257. return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
  258. },
  259. //onLoad下拉刷新
  260. onLoad() {
  261. if (this.pageNum == 1) {
  262. this.pageNum = 2
  263. }
  264. this.loading = true
  265. this.selectListAppHandler(1, () => {
  266. this.pageNum++
  267. this.loading = false
  268. console.log(1)
  269. })
  270. },
  271. //跳转详情
  272. goInfo(id) {
  273. this.$router.push('/rehearsalTasinfo/' + id + '_learning')
  274. },
  275. onCancel() {
  276. this.show = false
  277. this.typeStatus = false
  278. this.showDate = false
  279. this.showStatus = false
  280. }
  281. }
  282. }
  283. </script>
  284. <style lang="scss" scoped>
  285. .popup {
  286. height: 40vh;
  287. }
  288. .navBarclas {
  289. height: calc(100vh - 380px);
  290. overflow: scroll;
  291. }
  292. .btnf_box {
  293. background-color: #fff;
  294. }
  295. .card {
  296. margin: 20px;
  297. margin-bottom: 0px;
  298. box-shadow: 0 8px 12px #ebedf0;
  299. }
  300. .btn {
  301. float: right;
  302. margin-top: 24px;
  303. margin-right: 20px;
  304. box-sizing: border-box;
  305. }
  306. .titleClass {
  307. display: flex;
  308. align-items: center;
  309. height: 100%;
  310. padding: 20px;
  311. // border-bottom: 1px solid #1989fa;
  312. .title {
  313. font-size: 30px;
  314. flex: 1;
  315. line-height: 50px;
  316. }
  317. }
  318. .mainItem {
  319. display: flex;
  320. font-size: 28px;
  321. padding: 20px;
  322. justify-content: space-between;
  323. .condition {
  324. color: #1989fa;
  325. text-decoration: underline;
  326. }
  327. }
  328. .conditionCls {
  329. .title {
  330. color: #1989fa;
  331. margin-left: 30px;
  332. // margin-top: 30px;
  333. }
  334. .people {
  335. margin-left: 80px;
  336. margin-bottom: 30px;
  337. margin-top: 30px;
  338. }
  339. }
  340. .topBox {
  341. // overflow: hidden;
  342. }
  343. :deep.van-field--disabled {
  344. color: #323233;
  345. }
  346. :deep.van-field--disabled .van-field__label {
  347. color: #323233;
  348. }
  349. :deep .van-field__control[disabled] {
  350. color: #323233;
  351. -webkit-text-fill-color: #323233;
  352. }
  353. </style>