optimal.vue 12 KB

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