You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

list.vue 9.1 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. <template>
  2. <view class="page">
  3. <!-- 主列表页 -->
  4. <view :class="sideOpen ? 'show' : ''" class="mainpage" >
  5. <view class="timeTable_sec1">
  6. <view class="tSec1Box" id="weekTime">
  7. <text class="text-xxl cuIcon cuIcon-back" @click="timeTap(1)"></text>
  8. <text style="margin: 0;">{{searchData.IssueYear}}</text>
  9. <text>年</text>
  10. <text style="margin: 0;">{{searchData.IssueMonth}}</text>
  11. <text>月</text>
  12. <text class="text-xxl cuIcon cuIcon-right" @click="timeTap(2)"></text>
  13. </view>
  14. <view style="text-align: center;font-size: 60rpx;margin-top: 15rpx;color: #ffffff;">
  15. {{list.length > 0 ? list[0].PerformanceTotalScore + parseFloat(list[0].HolidayJobPerformance) || 0 : 0}}
  16. </view>
  17. <view style="text-align: center;font-size: 20rpx;margin-top: 15rpx;color: #94d4ff;">
  18. <text style="margin: 0;">{{searchData.IssueYear}}</text>
  19. <text>年</text>
  20. <text style="margin: 0;">{{searchData.IssueMonth}}</text>
  21. <text>月常规工作绩效</text>
  22. </view>
  23. </view>
  24. <view>
  25. <view class="item-titlewrap" @click="GoTosingle(1)">
  26. <text>月绩效考核分合计</text>
  27. <text>{{list.length > 0 ? list[0].PerformanceTotalScore || 0 : 0}} <text class="text-xxl cuIcon cuIcon-right" style="font-size: 16px;" ></text> </text>
  28. </view>
  29. <view class="item-titlewrap">
  30. <text>假期工作绩效</text>
  31. <text>{{list.length > 0 ? list[0].HolidayJobPerformance || 0 : 0}} <text class="text-xxl cuIcon cuIcon-right" style="font-size: 16px;" ></text> </text>
  32. </view>
  33. </view>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import moment from 'moment'
  39. import get from 'lodash/get'
  40. import set from 'lodash/set'
  41. import pickBy from 'lodash/pickBy'
  42. import mapValues from 'lodash/mapValues'
  43. import common from '@/common/js/common.js'
  44. export default {
  45. data() {
  46. return {
  47. // 表单结构
  48. scheme: {
  49. },
  50. // 筛选菜单值
  51. searchData: {
  52. Sqlparam: 1,
  53. IssueYear: '',
  54. IssueMonth: ''
  55. },
  56. defaultQueryData: {},
  57. queryData: {
  58. keyword: ''
  59. },
  60. // 数据源
  61. dataSource: {
  62. F_CustomerId: []
  63. },
  64. // 页面相关参数
  65. ready: false,
  66. tips: '加载中…',
  67. loadState: '向下翻以加载更多',
  68. sideOpen: false,
  69. // 列表条目与分页信息
  70. page: 1,
  71. total: 2,
  72. list: [],
  73. }
  74. },
  75. async onLoad() {
  76. await this.init()
  77. },
  78. onUnload() {
  79. this.OFF('invoice-list-change')
  80. },
  81. methods: {
  82. // 页面初始化
  83. async init() {
  84. let _this = this;
  85. let date = new Date()
  86. _this.searchData.IssueYear = date.getFullYear();
  87. _this.searchData.IssueMonth = date.getMonth()+1;
  88. this.ON('invoice-list-change', this.refreshList)
  89. await Promise.all([
  90. // 加载 F_CustomerId 字段的数据源:客户信息
  91. // this.FETCH_DATASOURCE('crmCustomer').then(result => {
  92. // this.dataSource.F_CustomerId = result.data.map(t => ({ text: t.f_fullname, value: t.f_customerid }))
  93. // }),
  94. // 拉取列表信息
  95. this.fetchList()
  96. ])
  97. this.defaultQueryData = this.COPY(this.queryData)
  98. this.ready = true
  99. },
  100. // 切换时间
  101. timeTap(num) {
  102. let _this = this;
  103. if (num == 1) {
  104. if(_this.searchData.IssueMonth == 1){
  105. _this.searchData.IssueYear = _this.searchData.IssueYear - 1;
  106. _this.searchData.IssueMonth = 12
  107. }else{
  108. _this.searchData.IssueMonth = _this.searchData.IssueMonth - 1;
  109. }
  110. } else {
  111. if(_this.searchData.IssueMonth == 12){
  112. _this.searchData.IssueYear = _this.searchData.IssueYear + 1;
  113. _this.searchData.IssueMonth = 1
  114. }else{
  115. _this.searchData.IssueMonth = _this.searchData.IssueMonth + 1;
  116. }
  117. }
  118. this.fetchList()
  119. },
  120. // 拉取列表
  121. async fetchList(isConcat = true) {
  122. // if (this.page > this.total) {
  123. // return
  124. // }
  125. const result = await this.HTTP_GET(
  126. 'learun/adms/JobPerformance/getlist', {
  127. pagination: {
  128. rows: 10,
  129. page: this.page,
  130. sidx: 'CreateTime',
  131. sord: 'DESC'
  132. },
  133. queryJson: JSON.stringify(this.searchData)
  134. },
  135. '加载数据时出错'
  136. )
  137. if (!result) {
  138. return
  139. }
  140. this.total = result.total
  141. // this.page = result.page + 1
  142. // this.list = isConcat ? this.list.concat(result.rows) : result.rows;
  143. this.list = result.rows
  144. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
  145. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
  146. },
  147. // 刷新清空列表
  148. async refreshList(isConcat = true) {
  149. this.page = 1
  150. this.total = 2
  151. this.list = []
  152. await this.fetchList(isConcat);
  153. },
  154. // 列表下拉
  155. pullDown() {
  156. this.refreshList().then(() => {
  157. this.$refs.list.stopPullDown()
  158. })
  159. },
  160. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  161. action(type, item) {
  162. switch (type) {
  163. default:
  164. case 'create':
  165. this.NAV_TO('./single?type=create')
  166. return
  167. case 'view':
  168. this.NAV_TO('./single?type=view&&id=' + item.Id, item, true)
  169. return
  170. case 'edit':
  171. this.NAV_TO('./single?type=edit', item, true)
  172. return
  173. }
  174. },
  175. // 显示列表中的标题项
  176. displayListItem(item, field) {
  177. const fieldItem = this.scheme[field]
  178. const value = item[field]
  179. switch (fieldItem.type) {
  180. case 'currentInfo':
  181. case 'organize':
  182. switch (fieldItem.dataType) {
  183. case 'user':
  184. return get(this.GET_GLOBAL('user'), `${value}.name`, '')
  185. case 'department':
  186. return get(this.GET_GLOBAL('department'), `${value}.name`, '')
  187. case 'company':
  188. return get(this.GET_GLOBAL('company'), `${value}.name`, '')
  189. default:
  190. return value || ''
  191. }
  192. case 'radio':
  193. case 'select':
  194. const selectItem = this.dataSource[field].find(t => t.value === value)
  195. return get(selectItem, 'text', '')
  196. case 'checkbox':
  197. if (!value || value.split(',').length <= 0) {
  198. return ''
  199. }
  200. const checkboxItems = value.split(',')
  201. return this.dataSource[field]
  202. .filter(t => checkboxItems.includes(t.value))
  203. .map(t => t.text)
  204. .join(',')
  205. case 'datetime':
  206. if (!value) {
  207. return ''
  208. }
  209. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' :
  210. 'YYYY-MM-DD HH:mm')
  211. default:
  212. return value || ''
  213. }
  214. },
  215. // 设置搜索条件
  216. async searchChange() {
  217. const result = {}
  218. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
  219. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  220. this.searchData = result
  221. await this.refreshList(false);
  222. },
  223. // 点击「清空搜索条件」按钮
  224. reset() {
  225. this.queryData = this.COPY(this.defaultQueryData)
  226. this.searchChange()
  227. },
  228. // 点击跳转到详情页
  229. GoTosingle(type){
  230. let _this = this
  231. if(_this.list.length>0){
  232. uni.navigateTo({
  233. url: './single?type='+type+'&item='+encodeURIComponent(JSON.stringify(_this.list))
  234. });
  235. }else{
  236. uni.showToast({
  237. title: '当月无绩效',
  238. icon: 'none',
  239. duration: 2000
  240. })
  241. }
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="less" scoped>
  247. @import '~@/common/css/sidepage.less';
  248. @import '~@/common/css/customlist.less';
  249. .customlist-item{
  250. // padding: 0;
  251. padding-left: 0;
  252. padding-right: 0;
  253. padding-top: 0;
  254. padding-bottom: 0;
  255. border-top: none !important;
  256. }
  257. .customlist-item-field{
  258. padding-left: 10px;
  259. padding-right: 10px;
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: center;
  263. min-height: 52px;
  264. background-color: #ffffff;
  265. justify-content: space-between;
  266. border-bottom: 0.5px solid #eee;
  267. }
  268. .page {
  269. background: #fff;
  270. }
  271. .timeTable_sec1 {
  272. padding: 14px 12px;
  273. text-align: center;
  274. background: #0075c4;
  275. color: #94d4ff;
  276. font-size: 0;
  277. }
  278. .tSec1Box>* {
  279. display: inline-block;
  280. vertical-align: middle;
  281. }
  282. .tSec1Line {
  283. height: 13px;
  284. width: 1px;
  285. background: #94d4ff;
  286. margin: 0 10px;
  287. }
  288. .tSec1Box {
  289. font-size: 15px;
  290. overflow: hidden;
  291. white-space: nowrap;
  292. text-overflow: ellipsis;
  293. }
  294. #semester {
  295. margin-bottom: 10px;
  296. }
  297. #weekTime {}
  298. #weekTime text {
  299. margin: 0 10px;
  300. }
  301. .tSec1Box>text {
  302. width: auto;
  303. text-align: center;
  304. line-height: 22px;
  305. }
  306. .tSec1Box image {
  307. width: 15px;
  308. margin-right: 2px;
  309. }
  310. .tSec1Box text:after {
  311. display: none;
  312. }
  313. .item-title{
  314. color: #000;
  315. font-size: 16px;
  316. line-height: 36px;
  317. background: #f1f1f1;
  318. padding-left: 5px;
  319. }
  320. .item-titlewrap{
  321. color: #000;
  322. font-size: 16px;
  323. line-height: 50px;
  324. background: #f1f1f1;
  325. padding:0 10px;
  326. border-bottom: 1rpx solid #ddd;
  327. display: flex;
  328. justify-content: space-between;
  329. }
  330. </style>