Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

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