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.
 
 
 
 
 
 

485 lines
14 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 @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: "select",dataSource: '1', dataSourceId: 'CheckUserNo'
  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: "checkbox",dataSource: '1', dataSourceId: 'ClassTutorNo'
  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. CheckUserNo:[],
  198. ClassTutorNo:[],
  199. LeaveType: Object.values(this.GET_GLOBAL('dataDictionary').LeaveType).map(t => ({
  200. value: t.value,
  201. text: t.text
  202. })),
  203. CheckStatus: Object.values(this.GET_GLOBAL('dataDictionary').LeaveCheck).map(t => ({
  204. value: t.value,
  205. text: t.text
  206. })),
  207. },
  208. // 页面相关参数
  209. ready: false,
  210. tips: "加载中...",
  211. loadState: "向下翻以加载更多",
  212. sideOpen: false,
  213. // 列表与分页信息
  214. page: 1,
  215. total: 2,
  216. list: [],
  217. user: null,
  218. };
  219. },
  220. async onLoad() {
  221. await this.init();
  222. },
  223. onUnload() {
  224. this.OFF("EducationalAdministrationStuLeaveManagement-list-change");
  225. },
  226. methods: {
  227. // 页面初始化
  228. async init() {
  229. this.ON(
  230. "EducationalAdministrationStuLeaveManagement-list-change",
  231. this.refreshList
  232. );
  233. // 拉取加载列表和数据源
  234. await Promise.all([
  235. this.FETCH_DATASOURCE('bjsj').then(result => {
  236. this.dataSource.ClassNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.classname, value: t.classno }))
  237. }),
  238. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  239. this.dataSource.ClassDiredctorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  240. }),
  241. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  242. this.dataSource.ClassTutorNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  243. }),
  244. this.FETCH_DATASOURCE('EmpInfo').then(result => {
  245. this.dataSource.CheckUserNo = result.data.sort((a,b)=>{return b.classno-a.classno}).map(t => ({ text: t.empname, value: t.empno }));
  246. }),
  247. this.FETCH_DATASOURCE('CdDeptInfo').then(result => {
  248. this.dataSource.DeptNo = result.data.map(t => ({ text: t.deptname, value: t.deptno }));
  249. }),
  250. this.FETCH_DATASOURCE('CdMajorInfo').then(result => {
  251. this.dataSource.MajorNo = result.data.map(t => ({ text: t.majorname, value: t.majorno }));
  252. }),
  253. ]);
  254. await this.fetchList();
  255. // 初始化查询条件
  256. this.defaultQueryData = this.COPY(this.queryData);
  257. this.ready = true;
  258. },
  259. // 拉取列表
  260. async fetchList(isConcat = true) {
  261. if (this.page > this.total) {
  262. return;
  263. }
  264. const result = await this.HTTP_GET(
  265. "/Learun/adms/EducationalAdministration/StuLeaveManagement/pagelist", {
  266. // 这里 sidx 表示排序字段,sord 表示排序方式(DESC=降序,ASC=升序)
  267. // 代码生成器生成时默认按照主键排序,您可以修改成按创建时间的字段降序
  268. pagination: {
  269. rows: 10,
  270. page: this.page,
  271. sidx: "CreateTime",
  272. sord: "DESC"
  273. },
  274. queryJson: JSON.stringify(Object.assign(this.searchData, {
  275. StuNo: this.user.account
  276. })),
  277. },
  278. "加载数据时出错"
  279. );
  280. if (!result) {
  281. return;
  282. }
  283. this.total = result.total;
  284. this.page = result.page + 1;
  285. this.list = isConcat ? this.list.concat(result.rows) : result.rows;
  286. this.tips = `已加载 ${Math.min(result.page, result.total)} / ${
  287. result.total
  288. } 页,共 ${result.records} 项`;
  289. this.loadState =
  290. result.page >= result.total ? "已加载所有项目" : "向下翻以加载更多";
  291. },
  292. // 刷新清空列表
  293. async refreshList(isConcat = true) {
  294. this.page = 1;
  295. this.total = 2;
  296. this.list = [];
  297. await this.fetchList(isConcat);
  298. },
  299. // 列表下拉
  300. pullDown() {
  301. this.refreshList().then(() => {
  302. this.$refs.list.stopPullDown();
  303. });
  304. },
  305. // 设置搜索条件
  306. async searchChange() {
  307. const result = {};
  308. // 将其他查询项添加到查询 JSON 中
  309. const queryObj = pickBy(this.queryData, (t) =>
  310. Array.isArray(t) ? t.length > 0 : t
  311. );
  312. Object.assign(
  313. result,
  314. mapValues(queryObj, (t) => (Array.isArray(t) ? t.join(",") : t))
  315. );
  316. this.searchData = result;
  317. await this.refreshList(false);
  318. },
  319. // 点击「清空查询条件」按钮
  320. reset() {
  321. this.queryData = this.COPY(this.defaultQueryData);
  322. this.searchChange();
  323. },
  324. // 点击「编辑」、「查看」、「添加」、「删除」按钮
  325. async action(type, id = "") {
  326. switch (type) {
  327. case "view":
  328. this.NAV_TO(`./single?type=view&id=${id}`);
  329. return;
  330. case "add":
  331. this.NAV_TO("./single?type=create");
  332. return;
  333. case "edit":
  334. this.NAV_TO(`./single?type=edit&id=${id}`);
  335. return;
  336. case "join":
  337. // console.log(123);
  338. this.NAV_TO(`/pages/EducationalAdministration/StuLeaveManagement/list?meetId=${id}`);
  339. return;
  340. case "delete":
  341. if (!(await this.CONFIRM("删除项目", "确定要删除该项吗?", true))) {
  342. return;
  343. }
  344. this.HTTP_POST(
  345. "/Learun/adms/EducationalAdministration/StuLeaveManagement/delete",
  346. id,
  347. "删除失败"
  348. ).then((success) => {
  349. if (!success) {
  350. return;
  351. }
  352. this.TOAST("删除成功", "success");
  353. this.refreshList();
  354. });
  355. return;
  356. default:
  357. return;
  358. }
  359. },
  360. // 显示列表中的标题项
  361. displayListItem(item, field) {
  362. const fieldItem = this.scheme[field];
  363. const value = item[field];
  364. switch (fieldItem.type) {
  365. case "currentInfo":
  366. case "organize":
  367. return fieldItem.dataType === "time" ?
  368. value :
  369. get(this.GET_GLOBAL(fieldItem.dataType), `${value}.name`, "");
  370. case "radio":
  371. case "select":
  372. const selectItem = this.dataSource[field].find(
  373. (t) => t.value === String(value)
  374. );
  375. return get(selectItem, "text", "");
  376. case "checkbox":
  377. if (!value || value.split(",").length <= 0) {
  378. return "";
  379. }
  380. const checkboxItems = value.split(",");
  381. return this.dataSource[field]
  382. .filter((t) => checkboxItems.includes(t.value))
  383. .map((t) => t.text)
  384. .join(",");
  385. case "datetime":
  386. if (!value) {
  387. return "";
  388. }
  389. return moment(value).format(
  390. Number(fieldItem.dateformat) === 0 ?
  391. "YYYY年 M月 D日" :
  392. "YYYY-MM-DD HH:mm"
  393. );
  394. default:
  395. return value === null || value === undefined ? "" : value;
  396. }
  397. },
  398. // 审核状态
  399. CheckStatusitem(data) {
  400. if (data) {
  401. return data == '1' ? '通过' : '不通过'
  402. } else {
  403. return '申请中'
  404. }
  405. },
  406. // 请假类型审核
  407. LeaveTypeItem(data) {
  408. },
  409. itmeDel(data){
  410. var newDate = /\d{4}-\d{1,2}-\d{1,2}/g.exec(data)
  411. return newDate[0]
  412. }
  413. },
  414. created() {
  415. this.user = this.GET_GLOBAL('loginUser');
  416. }
  417. };
  418. </script>
  419. <style lang="less" scoped>
  420. @import "~@/common/css/sidepage.less";
  421. @import "~@/common/css/customlist.less";
  422. </style>