Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

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