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.
 
 
 
 
 
 

568 lines
16 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. {{ itmeDel(displayListItem(item, "StartTime")) }}
  33. </view>
  34. <view class="customlist-item-field">
  35. <text class="customlist-item-field-title">结束时间:</text>
  36. {{ itmeDel(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. <view class="customlist-item-field">
  79. <text class="customlist-item-field-title">编号:</text>
  80. {{ displayListItem(item, "Code") }}
  81. </view>
  82. <view class="customlist-item-field">
  83. <text class="customlist-item-field-title">区队:</text>
  84. {{ displayListItem(item, "DistrictTeam") }}
  85. </view>
  86. <view class="customlist-item-field">
  87. <text class="customlist-item-field-title">校内/外出:</text>
  88. {{ displayListItem(item, "IsCampus") }}
  89. </view>
  90. <view class="customlist-item-field" v-show="item.IsCampus == 1">
  91. <text class="customlist-item-field-title">过夜:</text>
  92. {{ displayListItem(item, "IsStay") }}
  93. </view>
  94. <l-customlist-action
  95. :showButton="item.CheckStatus ==0 && user.userId == item.CreateUserId" buttonText="提交" @join="action('join', item.Id)"
  96. :showEdit="item.CheckStatus ==0 && user.userId == item.CreateUserId" @edit="action('edit', item.Id)"
  97. :showDelete="item.CheckStatus ==0 && user.userId == item.CreateUserId" @delete="action('delete', item.Id)"
  98. @view="action('view', item.Id)" />
  99. </view>
  100. </l-customlist>
  101. </l-scroll-list>
  102. </view>
  103. <!-- 关闭侧边抽屉按钮 -->
  104. <view @click="sideOpen = false" :class="sideOpen ? 'show' : ''" class="sideclose">
  105. <l-icon type="pullright" color="blue" />
  106. </view>
  107. <!-- 侧边栏,用于设置查询条件 -->
  108. <scroll-view :class="sideOpen ? 'show' : ''" class="sidepage" scroll-y>
  109. <view v-if="ready" class="padding">
  110. <l-select v-model="queryData.LeaveType" @change="searchChange" :range="dataSource.LeaveType"
  111. title="请假类型" placeholder="按请假类型查询" />
  112. <l-select v-model="queryData.CheckStatus" @change="searchChange" :range="dataSource.CheckStatus"
  113. title="审核状态" placeholder="按审核状态查询" />
  114. <!-- 重置查询条件按钮 -->
  115. <view class="padding-tb">
  116. <l-button @click="reset" line="orange" class="block" block>重置查询条件</l-button>
  117. </view>
  118. </view>
  119. </scroll-view>
  120. <l-customlist-add v-if="!sideOpen" @click="action('add')" />
  121. </view>
  122. </template>
  123. <script>
  124. /*
  125. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  126. * Copyright (c) 2013-2021 上海力软信息技术有限公司
  127. * 创建人:超级管理员
  128. * 日 期:2021-02-21 10:07
  129. * 描 述:会议管理
  130. */
  131. /**
  132. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  133. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  134. * { "path": "pages/PersonnelManagement/MeetingManagement/list", "style": { "navigationBarTitleText": "表单列表页" } }
  135. *
  136. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  137. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  138. */
  139. import moment from "moment";
  140. import get from "lodash/get";
  141. import set from "lodash/set";
  142. import pickBy from "lodash/pickBy";
  143. import mapValues from "lodash/mapValues";
  144. export default {
  145. data() {
  146. return {
  147. // 数据项的数据类型、结构
  148. scheme: {
  149. CheckStatus: {
  150. type: "text"
  151. },
  152. CheckRemark: {
  153. type: "text"
  154. },
  155. CheckTime: {
  156. type: "text"
  157. },
  158. CheckUserNo: {
  159. type: "select",dataSource: '1', dataSourceId: 'CheckUserNo'
  160. },
  161. LeaveType: {
  162. type: "select",dataSource: '1', dataSourceId: 'LeaveType'
  163. },
  164. StartTime: {
  165. type: "text"
  166. },
  167. EndTime: {
  168. type: "text"
  169. },
  170. LeaveDay: {
  171. type: "text"
  172. },
  173. LeaveReason: {
  174. type: "text"
  175. },
  176. CreateUserNo: {
  177. type: "text"
  178. },
  179. CreateUserName: {
  180. type: "text"
  181. },
  182. CreateTime: {
  183. type: "text"
  184. },
  185. ClassNo: {
  186. type: "select",dataSource: '1', dataSourceId: 'ClassNo'
  187. },
  188. DeptNo: {
  189. type: "select",dataSource: '1', dataSourceId: 'DeptNo'
  190. },
  191. MajorNo: {
  192. type: "select",dataSource: '1', dataSourceId: 'MajorNo'
  193. },
  194. ClassDiredctorNo: {
  195. type: "select",dataSource: '1', dataSourceId: 'ClassDiredctorNo'
  196. },
  197. ClassTutorNo: {
  198. type: "select",dataSource: '1', dataSourceId: 'ClassTutorNo'
  199. },
  200. Code: {
  201. type: "text"
  202. },
  203. DistrictTeam: {
  204. type: "text"
  205. },
  206. IsCampus: {
  207. type: "select",dataSource: '1'
  208. },
  209. IsStay: {
  210. type: "select",dataSource: '1'
  211. },
  212. },
  213. // 查询条件
  214. searchData: {},
  215. defaultQueryData: {},
  216. queryData: {
  217. LeaveType: "",
  218. CheckStatus: '',
  219. // CreateUser: "",
  220. },
  221. // 数据源
  222. dataSource: {
  223. ClassNo:[],
  224. DeptNo:[],
  225. MajorNo:[],
  226. ClassDiredctorNo:[],
  227. CheckUserNo:[],
  228. ClassTutorNo:[],
  229. LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({
  230. value: t.value,
  231. text: t.text
  232. })),
  233. IsCampus:[{ text: "外出假", value: "1" }, { text: "校内假", value: "0" }],
  234. IsStay: Object.values(this.GET_GLOBAL('dataDictionary').YesOrNoInt).map(t => ({
  235. value: t.value,
  236. text: t.text
  237. })),
  238. CheckStatus:[
  239. {
  240. value:'0',
  241. text:'草稿'
  242. },
  243. {
  244. value:'1',
  245. text:'审核中'
  246. },
  247. {
  248. value:'2',
  249. text:'审核通过'
  250. },
  251. {
  252. value:'3',
  253. text:'审核未通过'
  254. }
  255. ],
  256. },
  257. // 页面相关参数
  258. ready: false,
  259. tips: "加载中...",
  260. loadState: "向下翻以加载更多",
  261. sideOpen: false,
  262. // 列表与分页信息
  263. page: 1,
  264. total: 2,
  265. list: [],
  266. user: null,
  267. };
  268. },
  269. async onLoad() {
  270. await this.init();
  271. },
  272. onUnload() {
  273. this.OFF("EducationalAdministrationStuLeaveManagement-list-change");
  274. },
  275. methods: {
  276. // 页面初始化
  277. async init() {
  278. this.ON(
  279. "EducationalAdministrationStuLeaveManagement-list-change",
  280. this.refreshList
  281. );
  282. // 拉取加载列表和数据源
  283. await Promise.all([
  284. this.FETCH_DATASOURCE('bjsj').then(result => {
  285. this.dataSource.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
  286. }),
  287. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  288. this.dataSource.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  289. }),
  290. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  291. this.dataSource.ClassTutorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  292. }),
  293. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  294. this.dataSource.CheckUserNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  295. }),
  296. this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
  297. this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno }));
  298. }),
  299. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  300. this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }));
  301. }),
  302. ]);
  303. await this.fetchList();
  304. // 初始化查询条件
  305. this.defaultQueryData = this.COPY(this.queryData);
  306. this.ready = true;
  307. },
  308. // 拉取列表
  309. async fetchList(isConcat = true) {
  310. if (this.page > this.total) {
  311. return;
  312. }
  313. const result = await this.HTTP_GET(
  314. "/Learun/adms/EducationalAdministration/StuLeaveManagement/pagelist", {
  315. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  316. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  317. pagination: {
  318. rows: 10,
  319. page: this.page,
  320. sidx: "CreateTime",
  321. sord: "DESC"
  322. },
  323. queryJson: JSON.stringify(Object.assign(this.searchData, {
  324. StuNo: this.user.account
  325. })),
  326. },
  327. "加载数据时出错"
  328. );
  329. if (!result) {
  330. return;
  331. }
  332. this.total = result.total;
  333. this.page = result.page + 1;
  334. this.list = isConcat ? this.list.concat(result.rows) : result.rows;
  335. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${
  336. result.total
  337. } 页,共 ${result.records} 项`;
  338. this.loadState =
  339. result.page >= result.total ? "已加载所有项目" : "向下翻以加载更多";
  340. },
  341. // 刷新清空列表
  342. async refreshList(isConcat = true) {
  343. this.page = 1;
  344. this.total = 2;
  345. this.list = [];
  346. await this.fetchList(isConcat);
  347. },
  348. // 列表下拉
  349. pullDown() {
  350. this.refreshList().then(() => {
  351. this.$refs.list.stopPullDown();
  352. });
  353. },
  354. // 设置搜索条件
  355. async searchChange() {
  356. const result = {};
  357. // 将其他查询项添加到查询 JSON 中
  358. const queryObj = pickBy(this.queryData, (t) =>
  359. Array.isArray(t) ? t.length > 0 : t
  360. );
  361. Object.assign(
  362. result,
  363. mapValues(queryObj, (t) => (Array.isArray(t) ? t.join(",") : t))
  364. );
  365. this.searchData = result;
  366. await this.refreshList(false);
  367. },
  368. // 点击「清空查询条件」按钮
  369. reset() {
  370. this.queryData = this.COPY(this.defaultQueryData);
  371. this.searchChange();
  372. },
  373. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  374. async action(type, id = "") {
  375. switch (type) {
  376. case "view":
  377. this.NAV_TO(`./single?type=view&id=${id}`);
  378. return;
  379. case "add":
  380. this.NAV_TO("./single?type=create");
  381. return;
  382. case "edit":
  383. this.NAV_TO(`./single?type=edit&id=${id}`);
  384. return;
  385. case "join":
  386. if (!(await this.CONFIRM('提交项目', '确定要提交该项吗?', true))) {
  387. return
  388. }
  389. this.HTTP_POST('/Learun/adms/EducationalAdministration/StuLeaveManagement/submit', id, '提交失败')
  390. .then(success => {
  391. if (!success) {
  392. return
  393. }
  394. this.TOAST('提交成功', 'success')
  395. this.refreshList()
  396. })
  397. return
  398. case "delete":
  399. if (!(await this.CONFIRM("删除项目", "确定要删除该项吗?", true))) {
  400. return;
  401. }
  402. this.HTTP_POST(
  403. "/Learun/adms/EducationalAdministration/StuLeaveManagement/delete",
  404. id,
  405. "删除失败"
  406. ).then((success) => {
  407. if (!success) {
  408. return;
  409. }
  410. this.TOAST("删除成功", "success");
  411. this.refreshList();
  412. });
  413. return;
  414. case 'check':
  415. if (!(await this.CONFIRM('提交项目', '确定要提交该项吗?', true))) {
  416. return
  417. }
  418. this.HTTP_POST('/learun/adms/FundsApply/submit', id, '提交失败')
  419. .then(success => {
  420. if (!success) {
  421. return
  422. }
  423. this.TOAST('提交成功', 'success')
  424. this.refreshList()
  425. })
  426. return
  427. default:
  428. return;
  429. }
  430. },
  431. // 显示列表中的标题项
  432. displayListItem(item, field) {
  433. const fieldItem = this.scheme[field];
  434. const value = item[field];
  435. switch (fieldItem.type) {
  436. case "currentInfo":
  437. case "organize":
  438. return fieldItem.dataType === "time" ?
  439. value :
  440. get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, "");
  441. case "radio":
  442. case "select":
  443. const selectItem = this.dataSource[field].find(
  444. (t) => t.value === String(value)
  445. );
  446. return get(selectItem, "text", "");
  447. case "checkbox":
  448. if (!value || value.split(",").length <= 0) {
  449. return "";
  450. }
  451. const checkboxItems = value.split(",");
  452. return this.dataSource[field]
  453. .filter((t) => checkboxItems.includes(t.value))
  454. .map((t) => t.text)
  455. .join(",");
  456. case "datetime":
  457. if (!value) {
  458. return "";
  459. }
  460. return moment(value).format(
  461. Number(fieldItem.dateformat) === 0 ?
  462. "YYYY年 M月 D日" :
  463. "YYYY-MM-DD HH:mm"
  464. );
  465. default:
  466. return value === null || value === undefined ? "" : value;
  467. }
  468. },
  469. // 审核状态
  470. CheckStatusitem(data) {
  471. if (data == '0') {
  472. return '草稿'
  473. } else if(data == '1') {
  474. return '审核中'
  475. } else if(data == '2') {
  476. return '审核通过'
  477. } else if(data == '3') {
  478. return '审核未通过'
  479. } else {
  480. return data
  481. }
  482. },
  483. // 请假类型审核
  484. LeaveTypeItem(data) {
  485. },
  486. itmeDel(data){
  487. var newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(data)
  488. return newDate[0]
  489. }
  490. },
  491. created() {
  492. this.user = this.GET_GLOBAL('loginUser');
  493. }
  494. };
  495. </script>
  496. <style lang="less" scoped>
  497. @import "~@/common/css/sidepage.less";
  498. @import "~@/common/css/customlist.less";
  499. </style>