index.vue 9.6 KB

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