optimal.vue 11 KB

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