SelectExamine.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324
  1. <template>
  2. <el-dialog title="历史考核记录" :visible.sync="dialogVisible" width="800px" :before-close="dialogBeforeClose" append-to-body >
  3. <div>
  4. <!-- 搜索框 -->
  5. <div class="search-box">
  6. <div class="flex-box-ce">
  7. <el-input v-model="params.keyword" placeholder="考核表名称" prefix-icon="el-icon-search"
  8. style="width: 200px; " size="small"></el-input>
  9. <el-select v-model="cycleType" placeholder="周期类型" @change="changeCircle"
  10. style="width: 100px; margin: 0 10px;" size="small">
  11. <el-option v-for="item in cycleOptions" :key="item.value" :label="item.label"
  12. :value="item.value">
  13. </el-option>
  14. </el-select>
  15. <el-date-picker v-model="date" type="daterange" align="right" unlink-panels range-separator="至"
  16. start-placeholder="开始日期" end-placeholder="结束日期" value-format="yyyy-MM-dd"
  17. :picker-options="pickerOptions" @change="changeDate" style="width: 300px; margin-right: 10px;"
  18. size="small">
  19. </el-date-picker>
  20. <!-- <el-select v-model="params.cateId" placeholder="请选择考核分类" style="width: 180px; margin-right: 10px;"
  21. size="small" @chang="changeCateId">
  22. <el-option v-for="item in cateList" :key="item.cateId" :label="item.name" :value="item.cateId">
  23. </el-option>
  24. </el-select> -->
  25. <el-button type="primary" size="mini" @click="getTemplateList()">查询</el-button>
  26. <el-button size="mini" @click="resetSearch()">重置</el-button>
  27. </div>
  28. </div>
  29. <!-- 考核模板列表 -->
  30. <div class="perform-list scroll-bar" style="margin-top: 10px; height: 450px; overflow-y: auto;">
  31. <template v-if="performList && performList.length > 0">
  32. <div class="perform-item" v-for="item in performList" :key="item.reviewId"
  33. @click="choosePerformItem(item)">
  34. <div class="perform-item-title">{{ item.title }}</div>
  35. <div class="perform-item-date">
  36. {{ item.startTime | formatDate }} 至 {{ item.endTime | formatDate }}
  37. </div>
  38. <div class="perform-item-status" :class="item.status == 1 ? 'green-color' : 'orange-color'">
  39. {{
  40. item.status == 1 ? '考核结束' : '考核中' }}</div>
  41. <div class="perform-item-progress">{{ item.progress }}</div>
  42. <div class="perform-item-score">{{ item.score ? item.score + '分' : '--' }} </div>
  43. </div>
  44. </template>
  45. <noData v-else content="暂无数据" imgW="200px" imgH="200px"></noData>
  46. </div>
  47. <div v-if="performList && performList.length > 0" class="flex-box-ce"
  48. style="justify-content: center; margin-top: 10px;">
  49. <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
  50. :current-page="params.page" :page-sizes="[15, 30, 45, 60]" :page-size="params.pageSize"
  51. layout="total, sizes, prev, pager, next" :total="total">
  52. </el-pagination>
  53. </div>
  54. </div>
  55. </el-dialog>
  56. </template>
  57. <script>
  58. import { mapGetters } from 'vuex';
  59. import moment from 'moment';
  60. import _ from 'lodash';
  61. export default {
  62. model: {
  63. prop: 'dialogVisible',
  64. event: 'close-dialog'
  65. },
  66. props: {
  67. dialogVisible: {
  68. type: Boolean,
  69. default: false
  70. },
  71. searchOptions: {
  72. type: Object,
  73. default: () => {}
  74. }
  75. },
  76. watch: {
  77. dialogVisible(v) {
  78. if (v) {
  79. if (!_.isEmpty(this.searchOptions)) {
  80. let { employeeId, cycleType, cateId } = this.searchOptions
  81. this.params.employeeId = employeeId
  82. this.params.cycleType = cycleType
  83. this.params.cateId = cateId + ''
  84. }
  85. this.getTemplateList()
  86. }
  87. }
  88. },
  89. data() {
  90. return {
  91. params: {
  92. keyword: '',
  93. page: 1,
  94. pageSize: 15,
  95. cateId: '',
  96. startDate: '',
  97. endDate: '',
  98. employeeId: '',
  99. },
  100. // 周期类型 -1全部 0-未定义 1-年度 2-半年度 3-季度 4-月度
  101. cycleType: '-1',
  102. cycleOptions: [
  103. { label: "全部", value: '-1' },
  104. { label: "未定义", value: '0' },
  105. { label: "年度", value: '1' },
  106. { label: "半年度", value: '2' },
  107. { label: "季度", value: '3' },
  108. { label: "月度", value: '4' },
  109. ],
  110. pickerOptions: {
  111. shortcuts: [{
  112. text: '最近一周',
  113. onClick(picker) {
  114. const end = new Date();
  115. const start = new Date();
  116. start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
  117. picker.$emit('pick', [start, end]);
  118. }
  119. }, {
  120. text: '最近一个月',
  121. onClick(picker) {
  122. const end = new Date();
  123. const start = new Date();
  124. start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
  125. picker.$emit('pick', [start, end]);
  126. }
  127. }, {
  128. text: '最近三个月',
  129. onClick(picker) {
  130. const end = new Date();
  131. const start = new Date();
  132. start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
  133. picker.$emit('pick', [start, end]);
  134. }
  135. }]
  136. },
  137. date: [],
  138. performList: [],
  139. cateList: [],
  140. total: 0
  141. }
  142. },
  143. filters: {
  144. formatDate(val) {
  145. if (val) return moment(val).format('YYYY-MM-DD')
  146. else return "--"
  147. }
  148. },
  149. computed: {
  150. ...mapGetters(['user_info'])
  151. },
  152. created() {
  153. if (!_.isEmpty(this.searchOptions)) {
  154. let { employeeId, cycleType } = this.searchOptions
  155. this.params.employeeId = employeeId
  156. this.params.cycleType = cycleType
  157. this.cycleType = cycleType
  158. } else {
  159. this.params.employeeId = this.user_info.id
  160. }
  161. // this.getCateList()
  162. this.getTemplateList()
  163. },
  164. methods: {
  165. // 考核分类列表
  166. getCateList() {
  167. let url = `/performance/cate/list/${this.user_info.site_id}`;
  168. this.$axiosUser('get', url).then(res => {
  169. let { data: { code, data: { list, total } } } = res
  170. if (code == 1) {
  171. this.cateList = list
  172. }
  173. })
  174. },
  175. getTemplateList() {
  176. let that = this
  177. let url = `/performance/statistics/reviews/${that.user_info.site_id}`
  178. let requestdata;
  179. if (that.cycleType == '-1') requestdata = { ...that.params }
  180. else requestdata = { ...that.params, cycleType: that.cycleType }
  181. that.$axiosUser('get', url, requestdata).then(res => {
  182. let { data: { data: { list, total }, code } } = res;
  183. if (code == 1) {
  184. that.performList = list;
  185. that.total = total
  186. } else {
  187. that.performList = [];
  188. }
  189. });
  190. },
  191. choosePerformItem(item) {
  192. this.$emit('chooseExamine', item)
  193. this.$emit('close-dialog', false)
  194. },
  195. dialogBeforeClose() {
  196. this.$emit('close-dialog', false)
  197. },
  198. changeCateId(v) {
  199. this.getTemplateList();
  200. },
  201. resetSearch() {
  202. this.params = {
  203. keyword: '',
  204. page: 1,
  205. pageSize: 10,
  206. startDate: '',
  207. endDate: ''
  208. };
  209. this.cycleType = '-1'
  210. this.date = []
  211. if (this.searchOptions && this.searchOptions.employeeId) {
  212. this.params.employeeId = this.searchOptions.employeeId
  213. } else {
  214. this.params.employeeId = this.user_info.id
  215. }
  216. this.getTemplateList();
  217. },
  218. // 日期选择时间
  219. changeDate(v) {
  220. this.params.page = 1;
  221. if (this.date[0]) this.params.startDate = this.date[0] || ''
  222. if (this.date[1]) this.params.endDate = this.date[1] || ''
  223. },
  224. changeCircle(v) {
  225. this.params.page = 1;
  226. this.cycleType = v;
  227. },
  228. handleSizeChange(v) {
  229. this.params.pageSize = v
  230. this.getTemplateList();
  231. },
  232. handleCurrentChange(v) {
  233. this.params.page = v
  234. this.getTemplateList();
  235. },
  236. }
  237. }
  238. </script>
  239. <style scoped lang="scss">
  240. .green-color {
  241. color: #67c23a;
  242. }
  243. .orange-color {
  244. color: #e6a23c;
  245. }
  246. .perform-list {
  247. width: 100%;
  248. padding: 0 20px;
  249. box-sizing: border-box;
  250. display: flex;
  251. flex-direction: column;
  252. position: relative;
  253. background-color: #fff;
  254. .perform-item {
  255. width: 100%;
  256. height: 50px;
  257. padding: 10px;
  258. box-sizing: border-box;
  259. display: flex;
  260. align-items: center;
  261. justify-content: space-around;
  262. font-size: 14px;
  263. margin-bottom: 10px;
  264. border-bottom: 1px solid #ddd;
  265. &:hover {
  266. background-color: #f7f7f7;
  267. cursor: pointer;
  268. }
  269. &-title {
  270. width: 240px;
  271. font-weight: 600;
  272. }
  273. &-name {
  274. width: 80px;
  275. }
  276. &-date {
  277. width: 200px;
  278. }
  279. &-score {
  280. width: 60px;
  281. }
  282. &-status {
  283. width: 80px;
  284. }
  285. }
  286. }
  287. </style>