index.vue 10 KB

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