More.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. <template>
  2. <div style="width: 100%; height: 100%;" :class="{ bg_fff: skeletonLoad }">
  3. <!-- <van-nav-bar title="更多考核数据" left-text="返回" left-arrow @click-left="$route_back" /> -->
  4. <van-search placeholder="请输入考核表名称" v-model="params.keyword" @input="keyVal()" />
  5. <!-- 条件筛选 -->
  6. <div class="flex-box-ce search-box" style="">
  7. <!-- 周期筛选 -->
  8. <div class="flex-1 flex-box-ce flex-center-center" style="border-right: 1px solid #f1f1f1;">
  9. <div class="cycle-select-box fontColorC flex-box-ce flex-center-center" @click="openPanel()">
  10. <div class="cycle-name">{{ dateParameter.name }}</div>
  11. <van-icon name="arrow-down" size="12"/>
  12. </div>
  13. </div>
  14. <!-- 周期筛选 -->
  15. <!-- 时间筛选 -->
  16. <div class="flex-1 flex-box-ce flex-center-center" style="border-right: 1px solid #f1f1f1;">
  17. <div class="cycle-select-box fontColorC flex-box-ce flex-center-center" @click="calendarOpen()">
  18. <div class="cycle-name" v-html="timeStr"></div>
  19. <van-icon name="arrow-down" size="12"/>
  20. </div>
  21. </div>
  22. <!-- 时间筛选 -->
  23. <!-- 状态筛选 -->
  24. <div class="flex-1 flex-box-ce flex-center-center">
  25. <div class="cycle-select-box fontColorC flex-box-ce flex-center-center" @click="showStatus = true">
  26. <div class="cycle-name">{{ statusName }}</div>
  27. <van-icon name="arrow-down" size="12"/>
  28. </div>
  29. </div>
  30. <!-- 状态筛选 -->
  31. </div>
  32. <!-- 条件筛选 -->
  33. <!-- 骨架屏 -->
  34. <VanSkeleton :skeLoad="skeletonLoad">
  35. <scroller class="scroller-box" ref="scroller" :isInitRefresh="false" :on-refresh="refresh" :on-infinite="infinite" noDataText="没有了噢" :list="examineList">
  36. <div class="examine-list" v-if="filterExamineList && filterExamineList.length > 0">
  37. <div class="examine-item" v-for="(item, index) in filterExamineList" :key="item.reviewId" @click="handleChooseItem(item)">
  38. <div v-if="item.status == 1" class="examine-item-status" style="background-color: #FF9600;">
  39. 已结束
  40. </div>
  41. <div v-if="item.status == 0" class="examine-item-status" >
  42. 进行中
  43. </div>
  44. <div class="flex-1 flex-box-ce flex-d-center">
  45. <div class="examine-item-title font-flex-word">
  46. {{ item.title }}
  47. </div>
  48. <div class="examine-item-info">
  49. {{ item.score == null ? '-' : item.score }} / <span style="color: #ff9600;">{{ item.levelName || '-' }}</span>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. <noData v-else content="无考核记录"></noData>
  55. </scroller>
  56. </VanSkeleton>
  57. <!-- 骨架屏 -->
  58. <!-- 周期选择弹框 -->
  59. <van-action-sheet v-model="pullonThePanel" :closeable="false">
  60. <div class="content">
  61. <van-picker ref="van_picker" show-toolbar :columns="columns" @cancel="pullonThePanel = false" value-key="name" @confirm="onConfirm" confirm-button-text="完成" />
  62. </div>
  63. </van-action-sheet>
  64. <!-- 日期选择框 -->
  65. <van-calendar
  66. v-model="showCalendar"
  67. type="range"
  68. :allow-same-day="true"
  69. :min-date="minDate"
  70. :max-date="maxDate"
  71. :default-date="timeScope"
  72. :show-confirm="false"
  73. color="#26A2FF"
  74. @close="calendarClose"
  75. @confirm="calendarConfirm"
  76. >
  77. <template v-slot:title>
  78. <van-row>
  79. <van-col span="20">
  80. <van-row type="flex" justify="space-between" style="height: 1rem;">
  81. <van-col span="6" style="text-align: center; align-self: center;">
  82. <van-tag type="success" size="medium" @click="timeScopeThisWeek">本周</van-tag>
  83. </van-col>
  84. <van-col span="6" style="text-align: center; align-self: center;">
  85. <van-tag type="success" size="medium" @click="timeScopeLastWeek">上周</van-tag>
  86. </van-col>
  87. <van-col span="6" style="text-align: center; align-self: center;">
  88. <van-tag type="primary" size="medium" @click="timeScopeThisMoth">本月</van-tag>
  89. </van-col>
  90. <van-col span="6" style="text-align: center; align-self: center;">
  91. <van-tag type="primary" size="medium" @click="timeScopeLastMonth">上月</van-tag>
  92. </van-col>
  93. </van-row>
  94. </van-col>
  95. </van-row>
  96. </template>
  97. </van-calendar>
  98. <!-- 状态 -->
  99. <van-dialog v-model="showStatus" title="" width="300" confirm-button-text="确定" @confirm="handleConfirm" @cancel="handleCancel" :show-confirm-button="true" closeOnClickOverlay>
  100. <van-radio-group v-model="statusId">
  101. <div v-for="(item, index) in statusList" :key="index">
  102. <van-radio :name="item.value" style="margin:.3rem 0 .3rem .4rem;font-size:.3rem" icon-size="16px">
  103. <span style="margin-left:.3rem">{{ item.text }}</span>
  104. </van-radio>
  105. </div>
  106. </van-radio-group>
  107. </van-dialog>
  108. </div>
  109. </template>
  110. <script>
  111. import Vue from 'vue';
  112. import { _debounce, _throttle } from '@/utils/auth';
  113. import VanSkeleton from '@/performance/components/public/VanSkeleton';
  114. import { DropdownMenu, DropdownItem, Calendar, Switch} from 'vant';
  115. import moment from "moment/moment";
  116. Vue.use(DropdownMenu)
  117. .use(DropdownItem)
  118. .use(Switch)
  119. .use(Calendar);
  120. export default {
  121. components: { VanSkeleton },
  122. props: {
  123. employeeId: {
  124. type: String | Number,
  125. default: ''
  126. }
  127. },
  128. data() {
  129. let startDate = new Date();
  130. startDate.setTime(startDate.getTime() - 3600 * 1000 * 24 * 7);
  131. startDate = moment(startDate).format('YYYY-MM-DD');
  132. let endDate = moment().format('YYYY-MM-DD');
  133. let today = new Date();
  134. let minDate = new Date();
  135. minDate.setTime(today.getTime() - 3600 * 1000 * 24 * 30 * 6);
  136. let maxDate = new Date(today.getFullYear(),today.getMonth(),1);
  137. maxDate.setMonth(maxDate.getMonth() + 1);
  138. maxDate.setDate(0);
  139. return {
  140. skeletonLoad: true,
  141. keyword: '',
  142. examineList: [],
  143. filterExamineList: [],
  144. pullonThePanel: false,
  145. columns: [
  146. {
  147. value: "-1",
  148. name: "全部",
  149. text: "全部"
  150. },
  151. {
  152. value: "0",
  153. name: "自定义",
  154. text: "自定义"
  155. },
  156. {
  157. value: "1",
  158. name: "年度",
  159. text: "年度"
  160. },
  161. {
  162. value: "2",
  163. name: "半年度",
  164. text: "半年度"
  165. },
  166. {
  167. value: "3",
  168. name: "季度",
  169. text: "季度"
  170. },
  171. {
  172. value: "4",
  173. name: "月度",
  174. text: "月度"
  175. }
  176. ],
  177. selectPftiTheEcho: [0, 0], // 选项回显
  178. dateParameter: {
  179. cycleType: '-1',
  180. name: '全部'
  181. },
  182. showCalendar: false,
  183. minDate: minDate,
  184. maxDate: maxDate,
  185. timeScope: [new Date(startDate),new Date(endDate)],
  186. userInfo: this.$userInfo(),
  187. timeStr: "选择时间",
  188. from: "me",
  189. statusList: [
  190. {
  191. id: 0, text: "全部", value: "-1"
  192. },
  193. {
  194. id: 1, text: "进行中", value: "0"
  195. },
  196. {
  197. id: 2, text: "已结束", value: "1"
  198. },
  199. ],
  200. showStatus: false,
  201. statusId: 0,
  202. statusName: "状态",
  203. params: {
  204. keyword: '',
  205. page: 1,
  206. pageSize: 15,
  207. cateId: '',
  208. startDate: '',
  209. endDate: '',
  210. employeeId: '',
  211. },
  212. }
  213. },
  214. beforeDestroy() {
  215. this.params = {
  216. keyword: '',
  217. page: 1,
  218. pageSize: 15,
  219. cateId: '',
  220. startDate: '',
  221. endDate: '',
  222. employeeId: '',
  223. };
  224. this.from = 'me'
  225. this.timeStr = "选择时间";
  226. // this.timeScope = [new Date(startDate),new Date(endDate)];
  227. },
  228. mounted() {
  229. this.params.employeeId = this.employeeId
  230. this.params.employeeId = this.params.employeeId ? this.params.employeeId : this.$userInfo().id
  231. this.getExamineList();
  232. },
  233. methods: {
  234. // 周期选择事件
  235. handleCellClick(e) {
  236. console.log(e.currentTarget.id)
  237. },
  238. // 搜索
  239. keyVal: _debounce(function() {
  240. this.pullDown();
  241. // console.log(123)
  242. }),
  243. handleChooseItem(item) {
  244. // if(this.from == 'me') this.goMePage(item)
  245. // else this.goOrgExaminePage(item)
  246. this.$emit("onConfirm", { reviewId: item.reviewId, employeeId: item.employeeId })
  247. },
  248. goOrgExaminePage(item) {
  249. this.$router.push({ path: "/orgExamine", query: { reviewId: item.reviewId } })
  250. },
  251. goMePage(item) {
  252. this.$router.push({ path: "/newMe", query: { reviewId: item.reviewId, employeeId: item.employeeId } })
  253. },
  254. // 获取考核表列表
  255. getExamineList(is, callback) {
  256. let that = this;
  257. let url = `/performance/statistics/reviews/${that.$userInfo().site_id}`
  258. let requestdata;
  259. if (that.dateParameter.cycleType == '-1') requestdata = { ...that.params }
  260. else requestdata = { ...that.params, cycleType: that.dateParameter.cycleType }
  261. let hasMore = false
  262. is ? '' : that.params.page = 1;
  263. that.$axiosUser('get', url, requestdata).then(res => {
  264. this.skeletonLoad = false;
  265. let { data: { data: { list, total }, code } } = res;
  266. if (code == 1) {
  267. if (requestdata.page === 1) {
  268. that.examineList = list
  269. } else {
  270. that.examineList = that.examineList.concat(list)
  271. }
  272. hasMore = list.length !== 10
  273. callback && callback(hasMore)
  274. } else {
  275. that.examineList = [];
  276. }
  277. that.filterExamineList = that.examineList;
  278. });
  279. },
  280. // 打开周期选择弹框
  281. openPanel(){
  282. this.pullonThePanel = true;
  283. this.$nextTick(() => {
  284. this.theEchoVanPicker()
  285. })
  286. },
  287. // 回显
  288. theEchoVanPicker() {
  289. this.$refs.van_picker.setIndexes(this.selectPftiTheEcho);
  290. },
  291. // 确认周期选择-考核包搜索
  292. onConfirm (data, value) {
  293. // let columns = this.columns[list[0]];
  294. // let options = this.cycleTypeArr[list[1]]
  295. // this.selectPftiTheEcho = list
  296. this.dateParameter = {
  297. cycleType: data.value,
  298. name: data.name
  299. };
  300. // console.log(this.dateParameter);
  301. this.pullDown();
  302. this.pullonThePanel = false
  303. },
  304. // 上拉刷新
  305. refresh (done) {
  306. this.getExamineList(false, done)
  307. },
  308. // 下拉加载
  309. infinite (done) {
  310. this.params.page ++;
  311. this.getExamineList(true, done)
  312. },
  313. pullDown(){
  314. setTimeout(() => {
  315. this.$refs.scroller.triggerPullToRefresh();
  316. }, 50);
  317. },
  318. // 日期选择
  319. changeDateGetList() {
  320. if(this.timeScope && this.timeScope.length > 0) {
  321. this.params.startDate = moment(this.timeScope[0]).format('YYYY-MM-DD')
  322. this.params.endDate = moment(this.timeScope[1]).format('YYYY-MM-DD')
  323. this.timeStr = this.params.startDate + "<br/>" + this.params.endDate
  324. this.getExamineList();
  325. }
  326. },
  327. // 本周
  328. timeScopeThisWeek(){
  329. this.timeScope = [new Date(moment().startOf('week').format('YYYY-MM-DD')),new Date(moment().endOf('week').format('YYYY-MM-DD'))]
  330. this.showCalendar= false
  331. this.changeDateGetList()
  332. },
  333. // 上周
  334. timeScopeLastWeek(){
  335. this.timeScope = [new Date(moment().subtract(1,'week').startOf('week').format('YYYY-MM-DD')),new Date(moment().subtract(1,'week').endOf('week').format('YYYY-MM-DD'))]
  336. this.showCalendar = false
  337. this.changeDateGetList()
  338. },
  339. // 本月
  340. timeScopeThisMoth(){
  341. this.timeScope = [new Date(moment().startOf('month').format('YYYY-MM-DD')),new Date(moment().endOf('month').format('YYYY-MM-DD'))]
  342. this.showCalendar = false
  343. this.changeDateGetList()
  344. },
  345. // 上周
  346. timeScopeLastMonth(){
  347. this.timeScope = [new Date(moment().subtract(1,'month').startOf('month').format('YYYY-MM-DD')),new Date(moment().subtract(1,'month').endOf('month').format('YYYY-MM-DD'))]
  348. this.showCalendar = false
  349. this.changeDateGetList()
  350. },
  351. calendarOpen(){
  352. this.showCalendar = true;
  353. },
  354. calendarClose(){
  355. this.showCalendar = false;
  356. },
  357. calendarConfirm(event){
  358. const [start,end] = event;
  359. this.timeScope = [start, end];
  360. this.showCalendar = false;
  361. this.changeDateGetList();
  362. },
  363. handleConfirm() {
  364. if(this.statusId !== '-1') this.filterExamineList = this.examineList.filter(item => item.status == this.statusId)
  365. else this.filterExamineList = this.examineList
  366. this.statusName = this.statusList.find(item => item.value == this.statusId).text || '状态'
  367. this.showStatus = false
  368. },
  369. handleCancel() {
  370. this.showStatus = false
  371. }
  372. }
  373. }
  374. </script>
  375. <style lang="less" scoped>
  376. /deep/ .van-calendar__header-subtitle {
  377. width: 100%;
  378. font-size: 0.28rem;
  379. display: flex;
  380. align-items: center;
  381. justify-content: center;
  382. }
  383. .cycle-select-box {
  384. width: 100%;
  385. padding: 0.2rem 0.1rem;
  386. box-sizing: border-box;
  387. background-color: #fff;
  388. box-sizing: border-box;
  389. .icon {
  390. margin-right: 6px;
  391. width: 0.32rem;
  392. height: 0.32rem;
  393. }
  394. .cycle-name {
  395. margin: 0 6px;
  396. font-size: 0.3rem;
  397. }
  398. }
  399. .search-box {
  400. background-color: white;
  401. border-top: 1px solid #f1f1f1;
  402. border-bottom: 1px solid #f1f1f1;
  403. margin-bottom: 0.2rem;
  404. }
  405. .scroller-box {
  406. height: calc(100% - 2.08rem) !important;
  407. position: relative !important;
  408. background-color: #f5f7fa;
  409. box-sizing: border-box;
  410. .examine-list {
  411. width: 100%;
  412. .examine-item {
  413. width: 100%;
  414. height: 1rem;
  415. padding: 0 0.2rem;
  416. background-color: #fff;
  417. box-sizing: border-box;
  418. display: flex;
  419. align-items: center;
  420. border-bottom: 1px solid #f1f1f1;
  421. &-status{
  422. padding:0.01rem 0.1rem;
  423. color: #fff;
  424. border-radius: 2px;
  425. font-size: 0.26rem;
  426. background-color: #67c23a;
  427. margin-right: 0.14rem;
  428. }
  429. &-info {
  430. font-size: 0.26rem;
  431. }
  432. }
  433. }
  434. }
  435. </style>