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.
 
 
 
 
 
 

239 lines
7.9 KiB

  1. <template>
  2. <view class="page">
  3. <view v-if="ready">
  4. <l-input
  5. @input="setValue('Sys_ReceiveFile.Sender', $event)"
  6. :value="getValue('Sys_ReceiveFile.Sender')"
  7. :disabled="!edit"
  8. title="发送人"
  9. />
  10. <!-- <l-organize-picker
  11. @input="setValue('Sys_ReceiveFile.Sender', $event)"
  12. :value="getValue('Sys_ReceiveFile.Sender')"
  13. :readonly="!edit"
  14. type="user"
  15. title="发送人"
  16. /> -->
  17. <l-input
  18. @input="setValue('Sys_ReceiveFile.Title', $event)"
  19. :value="getValue('Sys_ReceiveFile.Title')"
  20. :disabled="!edit"
  21. title="主题"
  22. />
  23. <l-date-picker
  24. @input="setValue('Sys_ReceiveFile.SendTime', $event)"
  25. :value="getValue('Sys_ReceiveFile.SendTime')"
  26. :disabled="!edit"
  27. title="发送时间"
  28. />
  29. <l-select
  30. @input="setValue('Sys_ReceiveFile.SendType', $event)"
  31. :value="getValue('Sys_ReceiveFile.SendType')"
  32. :disabled="!edit"
  33. :range="dataSource.Sys_ReceiveFile.SendType"
  34. title="接收对象"
  35. />
  36. <!-- <l-upload-file
  37. @input="setValue('Sys_ReceiveFile.RUrl', $event)"
  38. :value="getValue('Sys_ReceiveFile.RUrl')"
  39. :readonly="!edit"
  40. :number="9"
  41. title="附件上传"
  42. /> -->
  43. <l-upload-file
  44. v-if="ready"
  45. :value="fileList"
  46. :readonly="!edit"
  47. :number="9"
  48. title="附件上传"
  49. />
  50. <!-- <l-textarea
  51. @input="setValue('Sys_ReceiveFile.Contents', $event)"
  52. :value="getValue('Sys_ReceiveFile.Contents')"
  53. :disabled="!edit"
  54. readonly="readonly"
  55. :range="dataSource.Sys_ReceiveFile.Contents"
  56. title="内容"
  57. /> -->
  58. <view class="bg-white" style="padding: 15px;color: #333333;font-size: 15px;">内容</view>
  59. <view class="bg-white" style="padding: 15px;padding-top: 0px;">
  60. <u-parse v-if="ready" :imageProp="{ domain: apiRoot }" :content="getValue('Sys_ReceiveFile.Contents')" noData="暂无内容"></u-parse>
  61. </view>
  62. </view>
  63. <!-- <view v-if="ready" class="bg-white margin-tb padding" style="padding-top: 0; overflow: hidden;">
  64. <l-button v-if="edit" @click="action('save')" size="lg" color="green" class="block margin-top" block>
  65. 提交保存
  66. </l-button>
  67. <l-button v-if="!edit && mode !== 'create'" @click="action('edit')" size="lg" line="orange" class="block margin-top" block>
  68. 编辑本页
  69. </l-button>
  70. <l-button v-if="edit && mode !== 'create'" @click="action('reset')" size="lg" line="red" class="block margin-top" block>
  71. 取消编辑
  72. </l-button>
  73. <l-button v-if="!edit && mode !== 'create'" @click="action('delete')" size="lg" line="red" class="block margin-top" block>
  74. 删除
  75. </l-button>
  76. </view> -->
  77. </view
  78. >
  79. </template>
  80. <script>
  81. /*
  82. * 版 本 Learun-ADMS V7.0.3 力软敏捷开发框架(http://www.learun.cn)
  83. * Copyright (c) 2013-2020 上海力软信息技术有限公司
  84. * 创建人:超级管理员
  85. * 日 期:2020-10-19 09:24
  86. * 描 述:公文查看
  87. */
  88. /**
  89. * 本段代码由移动端代码生成器输出,移动端须 2.2.0 版本及以上可以使用
  90. * 请在移动端 /pages.json 中的 pages 字段中添加一条记录:
  91. * { "path": "pages/EducationalAdministration/Sys_ReceiveFile/single", "style": { "navigationBarTitleText": "表单详情页" } }
  92. *
  93. * (navigationBarTitleText 字段为本页面的标题文本,可以修改)
  94. * (必须自行操作该步骤,力软代码生成器不会自动帮您修改 /pages.json 文件)
  95. */
  96. import get from "lodash/get";
  97. import set from "lodash/set";
  98. import moment from "moment";
  99. import customPageMixins from "@/common/custompage.js";
  100. export default {
  101. mixins: [customPageMixins],
  102. data() {
  103. return {
  104. // 页面相关参数
  105. id: null,
  106. mode: null,
  107. edit: null,
  108. ready: false, // 表单数据
  109. current: {},
  110. fileList:[],
  111. origin: {}, // 表单项数据结构
  112. scheme: {
  113. Sys_ReceiveFile: {
  114. Sender: { type: "text", title: "发送人" },
  115. Title: { type: "text", title: "主题" },
  116. SendTime: { type: "datetime", title: "发送时间", dateformat: "1" },
  117. SendType: {
  118. type: "select",
  119. title: "接收对象",
  120. itemCode: "FileSendType",
  121. dataSource: "0",
  122. },
  123. Contents: { type: "textarea", title: "内容" },
  124. ReadFlag: { type: "select", title: "状态", dataSource: "0" },
  125. ReadTime: { type: "datetime", title: "查阅时间", dateformat: "1" },
  126. },
  127. }, // 数据源
  128. dataSource: {
  129. Sys_ReceiveFile: {
  130. SendType: Object.values(
  131. this.GET_GLOBAL("dataDictionary").FileSendType
  132. ).map((t) => ({ value: t.value, text: t.text })),
  133. ReadFlag: [],
  134. },
  135. },
  136. };
  137. },
  138. async onLoad({ type, id }) {
  139. await this.init(type, id);
  140. },
  141. methods: {
  142. // 页面初始化
  143. async init(type, id) {
  144. this.LOADING("加载数据中...");
  145. this.id = id;
  146. this.mode = type;
  147. this.edit = ["create", "edit"].includes(this.mode); // 拉取表单数据,同时拉取所有来自数据源的选单数据
  148. await Promise.all([() => {}]);
  149. await this.fetchForm();
  150. this.ready = true;
  151. this.HIDE_LOADING();
  152. }, // 加载表单数据
  153. async fetchForm() {
  154. if (this.mode === "create") {
  155. this.origin = await this.getDefaultForm();
  156. } else {
  157. const result = await this.HTTP_GET(
  158. "learun/adms/EducationalAdministration/Sys_ReceiveFile/form",
  159. this.id
  160. );
  161. this.fileList = await this.getFileListById(result.Sys_ReceiveFile.FilePath)
  162. this.origin = await this.formatFormData(result);
  163. }
  164. this.current = this.COPY(this.origin);
  165. }, // 点击 「编辑」、「重置」、「保存」、「删除」 按钮
  166. async action(type) {
  167. switch (type) {
  168. case "edit":
  169. this.edit = true;
  170. break;
  171. case "reset":
  172. this.current = this.COPY(this.origin);
  173. this.edit = false;
  174. break;
  175. case "save":
  176. const verifyResult = this.verifyForm();
  177. if (verifyResult.length > 0) {
  178. this.CONFIRM("表单验证失败", verifyResult.join("\n"));
  179. return;
  180. }
  181. if (
  182. !(await this.CONFIRM(
  183. "提交确认",
  184. "确定要提交本页表单内容吗?",
  185. true
  186. ))
  187. ) {
  188. return;
  189. }
  190. this.LOADING("正在提交...");
  191. const postData = await this.getPostData(this.id);
  192. this.HTTP_POST(
  193. "learun/adms/EducationalAdministration/Sys_ReceiveFile/save",
  194. postData,
  195. "表单提交保存失败"
  196. ).then((success) => {
  197. this.HIDE_LOADING();
  198. if (!success) {
  199. return;
  200. }
  201. this.EMIT("EducationalAdministrationSys_ReceiveFile-list-change");
  202. this.NAV_BACK();
  203. this.TOAST("提交保存成功");
  204. });
  205. break;
  206. case "delete":
  207. if (!(await this.CONFIRM("删除项目", "确定要删除本项吗?", true))) {
  208. return;
  209. }
  210. this.LOADING("提交删除中...");
  211. this.HTTP_POST(
  212. "learun/adms/EducationalAdministration/Sys_ReceiveFile/delete",
  213. this.id,
  214. "删除失败"
  215. ).then((success) => {
  216. this.HIDE_LOADING();
  217. if (!success) {
  218. return;
  219. }
  220. this.EMIT("EducationalAdministrationSys_ReceiveFile-list-change");
  221. this.NAV_BACK();
  222. this.this.TOAST("删除成功", "success");
  223. });
  224. break;
  225. default:
  226. break;
  227. }
  228. }, // 获取表单值
  229. getValue(path) {
  230. return get(this.current, path);
  231. }, // 设置表单值
  232. setValue(path, val) {
  233. set(this.current, path, val);
  234. },
  235. },
  236. };
  237. </script>