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.
 
 
 
 
 
 

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