index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413
  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="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)" 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. return true
  195. if (item.status == 0) {
  196. return true
  197. }
  198. },
  199. //初始化
  200. init() {
  201. //获取数据字典
  202. this.getDictHandler('evaluate_status', res => {
  203. this.columnsList = res
  204. this.columns = res.map(item => item.dictLabel)
  205. this.columns.unshift('全部')
  206. })
  207. //获取分页列表
  208. this.selectListAppHandler()
  209. },
  210. selectListAppHandler(type = 0, callback = () => {}) {
  211. let obj = {
  212. evaluateName: this.evaluateName,
  213. pageNum: this.pageNum,
  214. pageSize: 10
  215. }
  216. if (!type) {
  217. obj.pageNum = 1
  218. this.taskList = []
  219. this.pageNum = 1
  220. }
  221. if (this.statusValue) {
  222. obj.status = this.statusValue
  223. }
  224. obj.orgId = this.cascaderValue || JSON.parse(window.sessionStorage.getItem('SET_USER_ORGID')) + '' || ''
  225. if (this.currentDate) {
  226. obj.date = this.currentDate
  227. }
  228. //获取任务列表
  229. getEvaluatePage(obj).then(res => {
  230. let { code, rows, total } = res
  231. if (code == 200) {
  232. if (type) {
  233. this.taskList.push(...rows)
  234. if (this.taskList.length >= total) {
  235. //已加载完全部数据
  236. this.finished = true
  237. } else {
  238. callback()
  239. }
  240. } else {
  241. this.taskList.push(...rows)
  242. this.finished = false
  243. this.loading = false
  244. if (this.taskList.length >= total) {
  245. //已加载完全部数据
  246. this.finished = true
  247. }
  248. // this.taskList = rows || []
  249. }
  250. } else {
  251. this.finished = true
  252. this.taskList = []
  253. }
  254. })
  255. },
  256. //搜索选择状态时触发
  257. onConfirm(value, index) {
  258. this.fieldValue = value
  259. this.columnsList.forEach(item => {
  260. if (value == item.dictLabel) {
  261. this.statusValue = item.dictValue
  262. }
  263. })
  264. if (value == '全部') {
  265. this.statusValue = ' '
  266. }
  267. this.selectListAppHandler()
  268. this.showStatus = false
  269. },
  270. //月份选中触发
  271. onDateConfirm(val) {
  272. this.currentDate = this.newDate(val + '')
  273. this.showDate = false
  274. this.selectListAppHandler()
  275. },
  276. //日期转换
  277. newDate(time) {
  278. var date = new Date(time)
  279. var y = date.getFullYear()
  280. var m = date.getMonth() + 1
  281. m = m < 10 ? '0' + m : m
  282. var d = date.getDate()
  283. d = d < 10 ? '0' + d : d
  284. return y + '-' + m + '-' + d
  285. },
  286. //onLoad下拉刷新
  287. onLoad() {
  288. if (this.pageNum == 1) {
  289. this.pageNum = 2
  290. }
  291. this.loading = true
  292. this.selectListAppHandler(1, () => {
  293. this.pageNum++
  294. this.loading = false
  295. })
  296. },
  297. //评价
  298. evaluate(id) {
  299. this.$router.push('/evaluate/' + id + '_add')
  300. },
  301. //跳转详情
  302. goInfo(id) {
  303. this.$router.push('/evaluate/' + id + '_info')
  304. },
  305. onCancel() {
  306. this.show = false
  307. this.typeStatus = false
  308. this.showDate = false
  309. this.showStatus = false
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="scss" scoped>
  315. .popup {
  316. height: 40vh;
  317. }
  318. .navBarclas {
  319. height: calc(100vh - 380px);
  320. overflow: scroll;
  321. }
  322. .btnf_box {
  323. background-color: #fff;
  324. }
  325. .card {
  326. margin: 20px;
  327. margin-bottom: 0px;
  328. box-shadow: 0 8px 12px #ebedf0;
  329. }
  330. .btn {
  331. float: right;
  332. margin-top: 24px;
  333. margin-right: 20px;
  334. box-sizing: border-box;
  335. }
  336. .titleClass {
  337. display: flex;
  338. align-items: center;
  339. height: 100%;
  340. padding: 20px;
  341. border-bottom: 1px solid #ccc;
  342. .title {
  343. font-size: 30px;
  344. flex: 1;
  345. line-height: 50px;
  346. }
  347. }
  348. .mainItem {
  349. display: flex;
  350. font-size: 28px;
  351. padding: 20px;
  352. justify-content: space-between;
  353. .condition {
  354. color: #1989fa;
  355. text-decoration: underline;
  356. }
  357. }
  358. .conditionCls {
  359. .title {
  360. color: #1989fa;
  361. margin-left: 30px;
  362. // margin-top: 30px;
  363. }
  364. .people {
  365. margin-left: 80px;
  366. margin-bottom: 30px;
  367. margin-top: 30px;
  368. }
  369. }
  370. .topBox {
  371. overflow: hidden;
  372. }
  373. :deep.van-field--disabled {
  374. color: #323233;
  375. }
  376. :deep.van-field--disabled .van-field__label {
  377. color: #323233;
  378. }
  379. :deep .van-field__control[disabled] {
  380. color: #323233;
  381. -webkit-text-fill-color: #323233;
  382. }
  383. .van-cell__value {
  384. color: black;
  385. text-align: left;
  386. }
  387. </style>