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.
 
 
 
 
 
 

354 lines
11 KiB

  1. <template>
  2. <view class="page">
  3. <!-- 主列表页 -->
  4. <view :class="sideOpen ? 'show' : ''" class="mainpage" style="padding-top: 80rpx;">
  5. <!-- 顶部条目/分页信息栏 -->
  6. <l-customlist-banner @buttonClick="sideOpen = false">{{ tips }}</l-customlist-banner>
  7. <!-- 滚动列表,跨端支持上拉/下拉 -->
  8. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
  9. <l-customlist :tips="loadState" showTips>
  10. <!-- 单条记录 -->
  11. <view class="customlist-item" v-for="item of list" :key="item.Id">
  12. <view class="customlist-item-field">
  13. <text class="customlist-item-field-title">姓名:</text>
  14. {{ displayListItem(item, 'empname') }}
  15. </view>
  16. <view class="customlist-item-field">
  17. <text class="customlist-item-field-title">党员编号:</text>
  18. {{ displayListItem(item, 'empno') }}
  19. </view>
  20. <view class="customlist-item-field">
  21. <text class="customlist-item-field-title">年度:</text>
  22. {{ displayListItem(item, 'ScoreYear') }}
  23. </view>
  24. <view class="customlist-item-field">
  25. <text class="customlist-item-field-title">季度:</text>
  26. {{ displayListItem(item, 'ScoreQuarter') }}
  27. </view>
  28. <view class="customlist-item-field">
  29. <text class="customlist-item-field-title">分值:</text>
  30. {{ displayListItem(item, 'Score') }}
  31. </view>
  32. <view class="customlist-item-field">
  33. <text class="customlist-item-field-title">状态:</text>
  34. {{ displayListItem(item, 'Status') }}
  35. </view>
  36. <l-customlist-action showButton icontype='friendaddfill' buttonText='提交' @join="action('submit', item.Id,item)" showEdit editText='打分' @edit="action('edit', item.Id,item)" hideView/>
  37. </view>
  38. </l-customlist>
  39. </l-scroll-list>
  40. </view>
  41. <!-- 关闭侧边抽屉按钮 -->
  42. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
  43. <l-icon type="pullright" color="blue" />
  44. </view>
  45. <!-- 侧边栏,用于设置查询条件 -->
  46. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  47. <view v-if="ready" class="padding">
  48. <l-customlist-sidepage-datefilter
  49. v-model="dateRange"
  50. @change="searchChange"
  51. title="按时间日期查询: "
  52. ref="datefilter"
  53. class="margin-bottom"
  54. />
  55. <l-select
  56. v-model="queryData.ScoreYear"
  57. @change="searchChange"
  58. :range="dataSource.ScoreYear"
  59. title ="年度"
  60. placeholder="按年度查询"
  61. />
  62. <l-select
  63. v-model="queryData.ScoreQuarter"
  64. @change="searchChange"
  65. :range="dataSource.ScoreQuarter"
  66. title ="季度"
  67. placeholder="按季度查询"
  68. />
  69. <!-- 重置查询条件按钮 -->
  70. <view class="padding-tb">
  71. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  72. </view>
  73. </view>
  74. </scroll-view>
  75. <!-- <l-customlist-add v-if="!sideOpen" @click="action('add')" /> -->
  76. </view>
  77. </template>
  78. <script>
  79. /*
  80. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  81. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  82. * 创建人:超级管理员
  83. * 日 期:2020-10-20 09:37
  84. * 描 述:班级工作记事
  85. */
  86. /**
  87. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  88. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  89. * { "path": "pages/partyevaluatxz/list", "style": { "navigationBarTitleText": "表单列表页" } }
  90. *
  91. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  92. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  93. */
  94. import moment from 'moment'
  95. import get from 'lodash/get'
  96. import set from 'lodash/set'
  97. import pickBy from 'lodash/pickBy'
  98. import mapValues from 'lodash/mapValues'
  99. export default {
  100. data() {
  101. return {
  102. // 数据项的数据类型、结构
  103. scheme: {
  104. empname: { type: 'text'},
  105. empno: { type: 'text'},
  106. ScoreYear: { type: 'text'},
  107. ScoreQuarter: { type: 'text' },
  108. Score: { type: 'text' },
  109. Status: { type: 'needFormat'},
  110. },
  111. // 查询条件
  112. searchData: {},
  113. defaultQueryData: {},
  114. queryData: {
  115. ScoreYear: '',
  116. ScoreQuarter: '',
  117. },
  118. // 数据源
  119. dataSource: {
  120. ScoreYear: [],
  121. ScoreQuarter: [],
  122. },
  123. // 时间查询参数
  124. dateRange: null,
  125. // 页面相关参数
  126. ready: false,
  127. tips: '加载中...',
  128. loadState: '向下翻以加载更多',
  129. sideOpen: false,
  130. // 列表与分页信息
  131. page: 1,
  132. total: 2,
  133. list: []
  134. }
  135. },
  136. async onLoad() {
  137. await this.init()
  138. },
  139. onUnload() {
  140. this.OFF('partyevaluatxz-list-change')
  141. },
  142. methods: {
  143. // 页面初始化
  144. async init() {
  145. this.ON('partyevaluatxz-list-change', this.refreshList)
  146. // 拉取加载列表和数据源
  147. await Promise.all([
  148. // this.FETCH_DATASOURCE('bjsj').then(result => {
  149. // this.dataSource.ClassNo = result.data.map(t => ({ text: t.classname, value: t.classno }))
  150. // }),
  151. () => {}
  152. ])
  153. await this.fetchList()
  154. // 初始化查询条件
  155. this.defaultQueryData = this.COPY(this.queryData)
  156. this.ready = true
  157. },
  158. // 拉取列表
  159. async fetchList() {
  160. if (this.page > this.total) { return }
  161. const result = await this.HTTP_GET(
  162. 'learun/adms/evaluatingindicator/GetEvaluationListForXZ',
  163. {
  164. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  165. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  166. pagination: { rows: 10, page: this.page, sidx: 'ScoreYear desc,ScoreQuarter desc,empno asc', sord: 'DESC' },
  167. queryJson: JSON.stringify({ account: this.GET_GLOBAL('loginUser').account })
  168. },
  169. '加载数据时出错'
  170. )
  171. if (!result) { return }
  172. this.total = result.total
  173. this.page = result.page + 1
  174. this.list = this.list.concat(result.rows)
  175. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${result.total} 页,共 ${result.records} 项`
  176. this.loadState = result.page >= result.total ? '已加载所有项目' : '向下翻以加载更多'
  177. },
  178. // 刷新清空列表
  179. async refreshList() {
  180. this.page = 1
  181. this.total = 2
  182. this.list = []
  183. await this.fetchList()
  184. },
  185. // 列表下拉
  186. pullDown() {
  187. this.refreshList().then(() => {
  188. this.$refs.list.stopPullDown()
  189. })
  190. },
  191. // 设置搜索条件
  192. async searchChange() {
  193. const result = {}
  194. // 时间查询相关参数
  195. if (this.dateRange) {
  196. result.StartTime = this.dateRange.start
  197. result.EndTime = this.dateRange.end
  198. }
  199. // 将其他查询项添加到查询 JSON 中
  200. const queryObj = pickBy(this.queryData, t => (Array.isArray(t) ? t.length > 0 : t))
  201. Object.assign(result, mapValues(queryObj, t => (Array.isArray(t) ? t.join(',') : t)))
  202. this.searchData = result
  203. await this.refreshList()
  204. },
  205. // 点击「清空查询条件」按钮
  206. reset() {
  207. this.$refs.datefilter.changeDateRange('all')
  208. this.queryData = this.COPY(this.defaultQueryData)
  209. this.searchChange()
  210. },
  211. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  212. async action(type, id = '',item) {
  213. var status = item.Status;
  214. switch (type) {
  215. case 'view':
  216. this.NAV_TO(`./single?type=view&id=${id}`)
  217. return
  218. case 'add':
  219. this.NAV_TO('./single?type=create')
  220. return
  221. case 'edit':
  222. if (status == '1') {
  223. this.TOAST("当前项目已提交!");
  224. return;
  225. }
  226. //进入党员评价页面
  227. this.NAV_TO(`./PartyevaluatQuestionsXZ?Id=${item.Id}`)
  228. return
  229. case 'delete':
  230. if (!(await this.CONFIRM('删除项目', '确定要删除该项吗?', true))) {
  231. return
  232. }
  233. this.HTTP_POST('learun/adms/PersonnelManagement/ClassWork/delete', id, '删除失败').then(success => {
  234. if(!success) { return }
  235. this.TOAST('删除成功', 'success')
  236. this.refreshList()
  237. })
  238. return
  239. case 'submit':
  240. if (status == '-1') {
  241. this.TOAST("当前项目未打分,无法提交!");
  242. return;
  243. }
  244. else if (status != '0') {
  245. this.TOAST("当前项目已提交!");
  246. return;
  247. }
  248. if (!(await this.CONFIRM('提交项目', '确定要提交该项数据吗?', true))) {
  249. return
  250. }
  251. this.HTTP_POST('learun/adms/evaluatingindicator/submitevaluationforxz',{Id:item.Id,Status:1}, '提交失败').then(success => {
  252. if(!success) { return }
  253. this.TOAST('提交成功', 'success')
  254. this.refreshList()
  255. })
  256. return
  257. default:
  258. return
  259. }
  260. },
  261. // 显示列表中的标题项
  262. displayListItem(item, field) {
  263. const fieldItem = this.scheme[field]
  264. const value = item[field]
  265. switch (fieldItem.type) {
  266. case 'currentInfo':
  267. case 'organize':
  268. return fieldItem.dataType === 'time' ? value : get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, '')
  269. case 'radio':
  270. case 'select':
  271. const selectItem = this.dataSource[field].find(t => t.value === String(value))
  272. return get(selectItem, 'text', '')
  273. case 'checkbox':
  274. if (!value || value.split(',').length <= 0) { return '' }
  275. const checkboxItems = value.split(',')
  276. return this.dataSource[field].filter(t => checkboxItems.includes(t.value)).map(t => t.text).join(',')
  277. case 'datetime':
  278. if (!value) { return '' }
  279. return moment(value).format(Number(fieldItem.dateformat) === 0 ? 'YYYY年 M月 D日' : 'YYYY-MM-DD HH:mm')
  280. case 'needFormat':
  281. return value=='-1'?'未打分':(value=='0'?'草稿':(value=='1'?'已提交':''))
  282. default: return value === null || value === undefined ? '' : value
  283. }
  284. }
  285. }
  286. }
  287. </script>
  288. <style lang="less" scoped>
  289. @import '~@/common/css/sidepage.less';
  290. @import '~@/common/css/customlist.less';
  291. </style>