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.
 
 
 
 
 
 

462 lines
13 KiB

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