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.
 
 
 
 
 
 

471 lines
13 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 = true">{{
  7. tips
  8. }}</l-customlist-banner>
  9. <!-- 滚动列表,跨端支持上拉/下拉 -->
  10. <l-scroll-list v-if="ready" @pullDown="pullDown" @toBottom="fetchList()" ref="list">
  11. <l-customlist :tips="loadState" showTips>
  12. <!-- 单条记录 -->
  13. <view class="customlist-item" v-for="item of list" :key="item.Id">
  14. <view class="customlist-item-field">
  15. <text class="customlist-item-field-title">审核状态:</text>
  16. {{ CheckStatusitem(displayListItem(item, "CheckStatus")) }}
  17. </view>
  18. <view class="customlist-item-field">
  19. <text class="customlist-item-field-title">审核备注:</text>
  20. {{ displayListItem(item, "CheckRemark") }}
  21. </view>
  22. <view class="customlist-item-field">
  23. <text class="customlist-item-field-title">审核人:</text>
  24. {{ displayListItem(item, "CheckUserNo") }}
  25. </view>
  26. <view class="customlist-item-field">
  27. <text class="customlist-item-field-title">请假类型:</text>
  28. {{ displayListItem(item, "LeaveType") }}
  29. </view>
  30. <view class="customlist-item-field">
  31. <text class="customlist-item-field-title">开始时间:</text>
  32. {{ displayListItem(item, "StartTime") }}
  33. </view>
  34. <view class="customlist-item-field">
  35. <text class="customlist-item-field-title">结束时间:</text>
  36. {{ displayListItem(item, "EndTime") }}
  37. </view>
  38. <view class="customlist-item-field">
  39. <text class="customlist-item-field-title">请假天数:</text>
  40. {{ displayListItem(item, "LeaveDay") }}
  41. </view>
  42. <view class="customlist-item-field">
  43. <text class="customlist-item-field-title">请假事由:</text>
  44. {{ displayListItem(item, "LeaveReason") }}
  45. </view>
  46. <view class="customlist-item-field">
  47. <text class="customlist-item-field-title">学号:</text>
  48. {{ displayListItem(item, "CreateUserNo") }}
  49. </view>
  50. <view class="customlist-item-field">
  51. <text class="customlist-item-field-title">姓名:</text>
  52. {{ displayListItem(item, "CreateUserName") }}
  53. </view>
  54. <view class="customlist-item-field">
  55. <text class="customlist-item-field-title">申请时间:</text>
  56. {{ displayListItem(item, "CreateTime") }}
  57. </view>
  58. <view class="customlist-item-field">
  59. <text class="customlist-item-field-title">班级:</text>
  60. {{ displayListItem(item, "ClassNo") }}
  61. </view>
  62. <view class="customlist-item-field">
  63. <text class="customlist-item-field-title">系部:</text>
  64. {{ displayListItem(item, "DeptNo") }}
  65. </view>
  66. <view class="customlist-item-field">
  67. <text class="customlist-item-field-title">专业:</text>
  68. {{ displayListItem(item, "MajorNo") }}
  69. </view>
  70. <view class="customlist-item-field">
  71. <text class="customlist-item-field-title">班主任:</text>
  72. {{ displayListItem(item, "ClassDiredctorNo") }}
  73. </view>
  74. <view class="customlist-item-field">
  75. <text class="customlist-item-field-title">辅导员:</text>
  76. {{ displayListItem(item, "ClassTutorNo") }}
  77. </view>
  78. <l-customlist-action @join="action('join', item.Id)" :showEdit="!item.CheckStatus"
  79. @edit="action('edit', item.Id)" :showDelete="!item.CheckStatus"
  80. @delete="action('delete', item.Id)" @view="action('view', item.Id)" />
  81. </view>
  82. </l-customlist>
  83. </l-scroll-list>
  84. </view>
  85. <!-- 关闭侧边抽屉按钮 -->
  86. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
  87. <l-icon type="pullright" color="blue" />
  88. </view>
  89. <!-- 侧边栏,用于设置查询条件 -->
  90. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  91. <view v-if="ready" class="padding">
  92. <l-select v-model="queryData.LeaveType" @change="searchChange" :range="dataSource.LeaveType"
  93. title="请假类型" placeholder="按请假类型查询" />
  94. <l-select v-model="queryData.CheckStatus" @change="searchChange" :range="dataSource.CheckStatus"
  95. title="审核状态" placeholder="按审核状态查询" />
  96. <!-- 重置查询条件按钮 -->
  97. <view class="padding-tb">
  98. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  99. </view>
  100. </view>
  101. </scroll-view>
  102. <l-customlist-add v-if="!sideOpen" @click="action('add')" />
  103. </view>
  104. </template>
  105. <script>
  106. /*
  107. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  108. * Copyright (c) 2013-2021 上海力软信息技术有限公司
  109. * 创建人:超级管理员
  110. * 日 期:2021-02-21 10:07
  111. * 描 述:会议管理
  112. */
  113. /**
  114. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  115. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  116. * { "path": "pages/PersonnelManagement/MeetingManagement/list", "style": { "navigationBarTitleText": "表单列表页" } }
  117. *
  118. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  119. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  120. */
  121. import moment from "moment";
  122. import get from "lodash/get";
  123. import set from "lodash/set";
  124. import pickBy from "lodash/pickBy";
  125. import mapValues from "lodash/mapValues";
  126. export default {
  127. data() {
  128. return {
  129. // 数据项的数据类型、结构
  130. scheme: {
  131. CheckStatus: {
  132. type: "text"
  133. },
  134. CheckRemark: {
  135. type: "text"
  136. },
  137. CheckTime: {
  138. type: "text"
  139. },
  140. CheckUserNo: {
  141. type: "text"
  142. },
  143. LeaveType: {
  144. type: "select",dataSource: '1', dataSourceId: 'LeaveType'
  145. },
  146. StartTime: {
  147. type: "text"
  148. },
  149. EndTime: {
  150. type: "text"
  151. },
  152. LeaveDay: {
  153. type: "text"
  154. },
  155. LeaveReason: {
  156. type: "text"
  157. },
  158. CreateUserNo: {
  159. type: "text"
  160. },
  161. CreateUserName: {
  162. type: "text"
  163. },
  164. CreateTime: {
  165. type: "text"
  166. },
  167. ClassNo: {
  168. type: "select",dataSource: '1', dataSourceId: 'ClassNo'
  169. },
  170. DeptNo: {
  171. type: "select",dataSource: '1', dataSourceId: 'DeptNo'
  172. },
  173. MajorNo: {
  174. type: "select",dataSource: '1', dataSourceId: 'MajorNo'
  175. },
  176. ClassDiredctorNo: {
  177. type: "select",dataSource: '1', dataSourceId: 'ClassDiredctorNo'
  178. },
  179. ClassTutorNo: {
  180. type: "text"
  181. }
  182. },
  183. // 查询条件
  184. searchData: {},
  185. defaultQueryData: {},
  186. queryData: {
  187. LeaveType: "",
  188. CheckStatus: '',
  189. // CreateUser: "",
  190. },
  191. // 数据源
  192. dataSource: {
  193. ClassNo:[],
  194. DeptNo:[],
  195. MajorNo:[],
  196. ClassDiredctorNo:[],
  197. LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({
  198. value: t.value,
  199. text: t.text
  200. })),
  201. CheckStatus: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({
  202. value: t.value,
  203. text: t.text
  204. })),
  205. },
  206. // 页面相关参数
  207. ready: false,
  208. tips: "加载中...",
  209. loadState: "向下翻以加载更多",
  210. sideOpen: false,
  211. // 列表与分页信息
  212. page: 1,
  213. total: 2,
  214. list: [],
  215. user: null,
  216. };
  217. },
  218. async onLoad() {
  219. await this.init();
  220. },
  221. onUnload() {
  222. this.OFF("EducationalAdministrationStuLeaveManagement-list-change");
  223. },
  224. methods: {
  225. // 页面初始化
  226. async init() {
  227. this.ON(
  228. "EducationalAdministrationStuLeaveManagement-list-change",
  229. this.refreshList
  230. );
  231. // 拉取加载列表和数据源
  232. await Promise.all([
  233. this.FETCH_DATASOURCE('bjsj').then(result => {
  234. this.dataSource.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
  235. }),
  236. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  237. this.dataSource.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  238. }),
  239. this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
  240. this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno }));
  241. }),
  242. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  243. this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }));
  244. }),
  245. ]);
  246. await this.fetchList();
  247. // 初始化查询条件
  248. this.defaultQueryData = this.COPY(this.queryData);
  249. this.ready = true;
  250. },
  251. // 拉取列表
  252. async fetchList(isConcat = true) {
  253. if (this.page > this.total) {
  254. return;
  255. }
  256. const result = await this.HTTP_GET(
  257. "/Learun/adms/EducationalAdministration/StuLeaveManagement/pagelist", {
  258. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  259. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  260. pagination: {
  261. rows: 10,
  262. page: this.page,
  263. sidx: "CreateTime",
  264. sord: "DESC"
  265. },
  266. queryJson: JSON.stringify(Object.assign(this.searchData, {
  267. StuNo: this.user.account
  268. })),
  269. },
  270. "加载数据时出错"
  271. );
  272. if (!result) {
  273. return;
  274. }
  275. this.total = result.total;
  276. this.page = result.page + 1;
  277. this.list = isConcat ? this.list.concat(result.rows) : result.rows;
  278. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${
  279. result.total
  280. } 页,共 ${result.records} 项`;
  281. this.loadState =
  282. result.page >= result.total ? "已加载所有项目" : "向下翻以加载更多";
  283. },
  284. // 刷新清空列表
  285. async refreshList(isConcat = true) {
  286. this.page = 1;
  287. this.total = 2;
  288. this.list = [];
  289. await this.fetchList(isConcat);
  290. },
  291. // 列表下拉
  292. pullDown() {
  293. this.refreshList().then(() => {
  294. this.$refs.list.stopPullDown();
  295. });
  296. },
  297. // 设置搜索条件
  298. async searchChange() {
  299. const result = {};
  300. // 将其他查询项添加到查询 JSON 中
  301. const queryObj = pickBy(this.queryData, (t) =>
  302. Array.isArray(t) ? t.length > 0 : t
  303. );
  304. Object.assign(
  305. result,
  306. mapValues(queryObj, (t) => (Array.isArray(t) ? t.join(",") : t))
  307. );
  308. this.searchData = result;
  309. await this.refreshList(false);
  310. },
  311. // 点击「清空查询条件」按钮
  312. reset() {
  313. this.queryData = this.COPY(this.defaultQueryData);
  314. this.searchChange();
  315. },
  316. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  317. async action(type, id = "") {
  318. switch (type) {
  319. case "view":
  320. this.NAV_TO(`./single?type=view&id=${id}`);
  321. return;
  322. case "add":
  323. this.NAV_TO("./single?type=create");
  324. return;
  325. case "edit":
  326. this.NAV_TO(`./single?type=edit&id=${id}`);
  327. return;
  328. case "join":
  329. // console.log(123);
  330. this.NAV_TO(`/pages/EducationalAdministration/StuLeaveManagement/list?meetId=${id}`);
  331. return;
  332. case "delete":
  333. if (!(await this.CONFIRM("删除项目", "确定要删除该项吗?", true))) {
  334. return;
  335. }
  336. this.HTTP_POST(
  337. "/Learun/adms/EducationalAdministration/StuLeaveManagement/delete",
  338. id,
  339. "删除失败"
  340. ).then((success) => {
  341. if (!success) {
  342. return;
  343. }
  344. this.TOAST("删除成功", "success");
  345. this.refreshList();
  346. });
  347. return;
  348. default:
  349. return;
  350. }
  351. },
  352. // 显示列表中的标题项
  353. displayListItem(item, field) {
  354. const fieldItem = this.scheme[field];
  355. const value = item[field];
  356. switch (fieldItem.type) {
  357. case "currentInfo":
  358. case "organize":
  359. return fieldItem.dataType === "time" ?
  360. value :
  361. get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, "");
  362. case "radio":
  363. case "select":
  364. const selectItem = this.dataSource[field].find(
  365. (t) => t.value === String(value)
  366. );
  367. return get(selectItem, "text", "");
  368. case "checkbox":
  369. if (!value || value.split(",").length <= 0) {
  370. return "";
  371. }
  372. const checkboxItems = value.split(",");
  373. return this.dataSource[field]
  374. .filter((t) => checkboxItems.includes(t.value))
  375. .map((t) => t.text)
  376. .join(",");
  377. case "datetime":
  378. if (!value) {
  379. return "";
  380. }
  381. return moment(value).format(
  382. Number(fieldItem.dateformat) === 0 ?
  383. "YYYY年 M月 D日" :
  384. "YYYY-MM-DD HH:mm"
  385. );
  386. default:
  387. return value === null || value === undefined ? "" : value;
  388. }
  389. },
  390. // 审核状态
  391. CheckStatusitem(data) {
  392. if (data) {
  393. return data == '1' ? '通过' : '不通过'
  394. } else {
  395. return '申请中'
  396. }
  397. },
  398. // 请假类型审核
  399. LeaveTypeItem(data) {
  400. },
  401. },
  402. created() {
  403. this.user = this.GET_GLOBAL('loginUser');
  404. }
  405. };
  406. </script>
  407. <style lang="less" scoped>
  408. @import "~@/common/css/sidepage.less";
  409. @import "~@/common/css/customlist.less";
  410. </style>