25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.
 
 
 
 
 
 

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