optimal.vue 12 KB

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