index.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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="value" 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 { getdrillTask } from '@/api/drillTask.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. value:'',
  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. typeValue: ' ', //类型值
  120. yearSelect: null,
  121. value1: JSON.parse(sessionStorage.getItem('SET_USER_ID')) || '', //输入框model
  122. showStatus: false, //状态显示隐藏
  123. showDate: false, //月份显示隐藏
  124. fieldValue: '全部', //状态名称
  125. statusValue: ' ', //状态值
  126. columns: ['全部'], //状态数组
  127. columnsList: [], //状态数组
  128. currentDate: newDateYear(), //年份
  129. conditionShow: false //机构弹框显示隐藏
  130. }
  131. },
  132. components: {
  133. NavBar,
  134. OrgTree,
  135. Dialog,
  136. Icon,
  137. DatetimePicker,
  138. Picker,
  139. Col,
  140. Row,
  141. Cascader
  142. },
  143. created() {
  144. this.presentDate = new Date(newDateYear())
  145. this.yearData()
  146. },
  147. mounted() {
  148. this.init()
  149. this.cascaderValue = JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + ''
  150. },
  151. methods: {
  152. //机构搜索
  153. getDataList(val) {
  154. this.cascaderValue = val.id
  155. this.orgName = val.name
  156. this.selectListAppHandler()
  157. },
  158. //判断评价按钮是否展示
  159. evaluateTure(item) {
  160. return true
  161. if (item.status == 2 && window.sessionStorage.getItem('SET_USER_ORGTYPE') != 4) {
  162. return true
  163. }
  164. },
  165. //初始化
  166. init() {
  167. //获取数据字典
  168. this.getDictHandler('drill_task_status', res => {
  169. this.columnsList = res
  170. this.columns = res.map(item => item.dictLabel)
  171. this.columns.unshift('全部')
  172. })
  173. //获取分页列表
  174. this.selectListAppHandler()
  175. },
  176. selectListAppHandler(type = 0, callback = () => {}) {
  177. let obj = {
  178. isAppSelect: 1,
  179. pageNum: this.pageNum,
  180. pageSize: 10
  181. }
  182. if (!type) {
  183. obj.pageNum = 1
  184. this.pageNum = 1
  185. }
  186. if (this.statusValue) {
  187. obj.status = this.statusValue
  188. }
  189. obj.orgId = this.cascaderValue || JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + '' || ''
  190. if (this.currentDate) {
  191. obj.date = this.currentDate + '-' + this.active
  192. }
  193. if (this.typeValue) {
  194. obj.type = this.typeValue
  195. }
  196. //获取任务列表
  197. getdrillTask(obj).then(res => {
  198. let { code, rows, msg } = res
  199. if (code == 200) {
  200. if (type) {
  201. this.taskList.push(...rows)
  202. if (rows.length == 0 || rows.length < 10) {
  203. //已加载完全部数据
  204. this.finished = true
  205. }
  206. callback()
  207. } else {
  208. this.finished = false
  209. this.taskList = rows
  210. }
  211. }
  212. })
  213. },
  214. //搜索选择状态时触发
  215. onConfirm(value, index) {
  216. this.fieldValue = value
  217. this.columnsList.forEach(item => {
  218. if (value == item.dictLabel) {
  219. this.statusValue = item.dictValue
  220. }
  221. })
  222. if (value == '全部') {
  223. this.statusValue = ' '
  224. }
  225. this.selectListAppHandler()
  226. this.showStatus = false
  227. },
  228. //月份选中触发
  229. onDateConfirm(val) {
  230. this.currentDate = this.newDate(val + '')
  231. this.showDate = false
  232. this.selectListAppHandler()
  233. },
  234. yearData() {
  235. // 获取默认显示的时间
  236. var nowTime = new Date()
  237. let year = nowTime.getFullYear()
  238. let month = nowTime.getMonth()
  239. let day = nowTime.getDate()
  240. // 循环数组 填写最小时间和最大时间范围
  241. for (let i = 1980; i < 2099; i++) {
  242. this.yearColumns.push(i)
  243. }
  244. // 格式化时间并截取
  245. var years = this.formatDate(new Date(year, month, day))
  246. var Year = years.slice(0, 4)
  247. // 将截取的年份赋值给绑定值 用于点击弹出日期窗口后显示当前的时间
  248. this.yearSelect = this.yearColumns.indexOf(Number(Year))
  249. }, //日期转换
  250. newDate(time) {
  251. var date = new Date(time)
  252. var y = date.getFullYear()
  253. var m = date.getMonth() + 1
  254. m = m < 10 ? '0' + m : m
  255. var d = date.getDate()
  256. d = d < 10 ? '0' + d : d
  257. return y
  258. },
  259. //日期格式
  260. formatDate(date) {
  261. return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`
  262. },
  263. //onLoad下拉刷新
  264. onLoad() {
  265. if (this.pageNum == 1) {
  266. this.pageNum = 2
  267. }
  268. this.loading = true
  269. this.selectListAppHandler(1, () => {
  270. this.pageNum++
  271. this.loading = false
  272. console.log(1)
  273. })
  274. },
  275. onSearch(){
  276. },
  277. //评价
  278. evaluate(id) {
  279. this.$router.push('/evaluate/' + id )
  280. },
  281. //跳转详情
  282. goInfo(id) {
  283. this.$router.push('/rehearsalTasinfo/' + id + '_info')
  284. },
  285. onCancel() {
  286. this.show = false
  287. this.typeStatus = false
  288. this.showDate = false
  289. this.showStatus = false
  290. }
  291. }
  292. }
  293. </script>
  294. <style lang="scss" scoped>
  295. .popup {
  296. height: 40vh;
  297. }
  298. .navBarclas {
  299. height: calc(100vh - 380px);
  300. overflow: scroll;
  301. }
  302. .btnf_box {
  303. background-color: #fff;
  304. }
  305. .card {
  306. margin: 20px;
  307. margin-bottom: 0px;
  308. box-shadow: 0 8px 12px #ebedf0;
  309. }
  310. .btn {
  311. float: right;
  312. margin-top: 24px;
  313. margin-right: 20px;
  314. box-sizing: border-box;
  315. }
  316. .titleClass {
  317. display: flex;
  318. align-items: center;
  319. height: 100%;
  320. padding: 20px;
  321. border-bottom: 1px solid #ccc;
  322. .title {
  323. font-size: 30px;
  324. flex: 1;
  325. line-height: 50px;
  326. }
  327. }
  328. .mainItem {
  329. display: flex;
  330. font-size: 28px;
  331. padding: 20px;
  332. justify-content: space-between;
  333. .condition {
  334. color: #1989fa;
  335. text-decoration: underline;
  336. }
  337. }
  338. .conditionCls {
  339. .title {
  340. color: #1989fa;
  341. margin-left: 30px;
  342. // margin-top: 30px;
  343. }
  344. .people {
  345. margin-left: 80px;
  346. margin-bottom: 30px;
  347. margin-top: 30px;
  348. }
  349. }
  350. .topBox {
  351. overflow: hidden;
  352. }
  353. :deep.van-field--disabled {
  354. color: #323233;
  355. }
  356. :deep.van-field--disabled .van-field__label {
  357. color: #323233;
  358. }
  359. :deep .van-field__control[disabled] {
  360. color: #323233;
  361. -webkit-text-fill-color: #323233;
  362. }
  363. </style>