dialog.info.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <template>
  2. <div class="edu-training-edit">
  3. <DialogCom title="培训任务详情" :visible.sync="isShow" width="1200px" >
  4. <div class="page-body">
  5. <el-descriptions class="margin-top" :column="2" size="medium" border :label-style="labelStyle" :contentStyle="content_style">
  6. <el-descriptions-item labelClassName="gx_info_label" label="任务名称" >
  7. {{
  8. formData.title
  9. }}
  10. </el-descriptions-item>
  11. <el-descriptions-item labelClassName="gx_info_label" label="培训类型" >
  12. {{
  13. formData.typeText
  14. }}
  15. </el-descriptions-item>
  16. <el-descriptions-item labelClassName="gx_info_label" label="任务进度" >
  17. {{
  18. formData.statusText
  19. }}
  20. </el-descriptions-item>
  21. <el-descriptions-item labelClassName="gx_info_label" label="任务时间" >
  22. {{formData.startDate}}-{{formData.endDate}}
  23. </el-descriptions-item>
  24. <el-descriptions-item labelClassName="gx_info_label" label="受训机构" >
  25. {{formData.orgName}}
  26. </el-descriptions-item>
  27. <el-descriptions-item labelClassName="gx_info_label" label="主持人" >
  28. {{
  29. formData.hostName
  30. }}
  31. </el-descriptions-item>
  32. <el-descriptions-item labelClassName="gx_info_label" label="登记人" >
  33. {{
  34. formData.recorderName
  35. }}
  36. </el-descriptions-item>
  37. <el-descriptions-item labelClassName="gx_info_label" label="培训开始时间" >
  38. {{
  39. formData.trainingStartDateTime
  40. }}
  41. </el-descriptions-item>
  42. <el-descriptions-item labelClassName="gx_info_label" label="培训结束时间" >
  43. {{
  44. formData.trainingEndDateTime
  45. }}
  46. </el-descriptions-item>
  47. <el-descriptions-item labelClassName="gx_info_label" label="" >
  48. </el-descriptions-item>
  49. <el-descriptions-item span="2" labelClassName="gx_info_label" label="培训内容" >
  50. {{
  51. formData.content
  52. }}
  53. </el-descriptions-item>
  54. <el-descriptions-item span="2" labelClassName="gx_info_label" label="培训总结" >
  55. {{
  56. formData.note
  57. }}
  58. </el-descriptions-item>
  59. <el-descriptions-item labelClassName="gx_info_label" label="参会人员" >
  60. {{
  61. formData.taskUserList ? formData.taskUserList.filter((x) => x.type === 1)
  62. .map((v) => v.userName).join(",") : ""
  63. }}
  64. </el-descriptions-item>
  65. <el-descriptions-item labelClassName="gx_info_label" label="缺席人员" >
  66. {{
  67. formData.taskUserList ? formData.taskUserList.filter((x) => x.type === 2)
  68. .map((v) => v.userName).join(",") : ""
  69. }}
  70. </el-descriptions-item>
  71. <el-descriptions-item span="2" labelClassName="gx_info_label" label="培训图片" >
  72. <ImageListPreview v-model="formData.imageList"></ImageListPreview>
  73. </el-descriptions-item>
  74. <el-descriptions-item span="2" labelClassName="gx_info_label" label="参会人员签名" >
  75. <ImageListPreview v-model="formData.signImageList"></ImageListPreview>
  76. </el-descriptions-item>
  77. <el-descriptions-item labelClassName="gx_info_label" label="资料文件" >
  78. <K-file-upload ref="upload" :isShowUploadBtn="false"
  79. :defaultValue="formFileListDefualtValue"
  80. v-model="formData.fileList"/>
  81. </el-descriptions-item>
  82. </el-descriptions>
  83. </div>
  84. <div slot="footer" class="dialog-footer">
  85. <el-button @click="onHide">关闭</el-button>
  86. </div>
  87. </DialogCom>
  88. </div>
  89. </template>
  90. <script>
  91. import { mapState, mapMutations } from "vuex";
  92. import { getEduTask } from "@/api/core/edu/eduTask";
  93. import KFileUpload from "@/components/K-FileUpload/index.vue";
  94. export default {
  95. components: {KFileUpload},
  96. dicts: ['edu_type', 'edu_task_status'],
  97. data() {
  98. const params = this.$route.params;
  99. return {
  100. id: params ? params.id : null,
  101. isShow: false,
  102. formData: this.reset(),
  103. formFileListDefualtValue: [],
  104. labelStyle: {
  105. 'color': '#000',
  106. 'text-align': 'center',
  107. 'height': '40px',
  108. 'min-width': '200px',
  109. 'word-break': 'keep-all'
  110. },
  111. content_style: {
  112. 'text-align': 'left',
  113. 'min-width': '300px',
  114. 'word-break': 'break-all'
  115. },
  116. };
  117. },
  118. props: {},
  119. watch: {},
  120. computed: {
  121. ...mapState(["loginUser"]),
  122. },
  123. methods: {
  124. ...mapMutations([]),
  125. reset(other = {}) {
  126. return {
  127. id: null,
  128. type: null,
  129. host: {},
  130. recorder: {},
  131. dateTime: null,
  132. dueCount: null,
  133. actualCount: null,
  134. content: null,
  135. imageList: null,
  136. signImageList: null,
  137. typeText: null,
  138. org: {},
  139. ...other,
  140. };
  141. },
  142. async refresh(id, other) {
  143. if (!id) {
  144. this.reset(other);
  145. } else {
  146. getEduTask(id).then(response => {
  147. this.formData = response.data;
  148. this.formFileListDefualtValue = response.data.fileList;
  149. this.formData.signImageList = this.getSingImageList();
  150. this.loading = false;
  151. })
  152. }
  153. },
  154. async show(id, other = {}) {
  155. this.id = id;
  156. await this.refresh(id, other);
  157. this.isShow = true;
  158. },
  159. // 事件
  160. onHide() {
  161. this.isShow = false;
  162. },
  163. onDownload(url, filename) {
  164. let this_ = this;
  165. this.getBlob(url, function (blob) {
  166. this_.saveAs(blob, filename);
  167. });
  168. },
  169. getSingImageList() {
  170. let res = this.formData.taskUserList ? this.formData.taskUserList.filter((x) => x.type === 1 && x.sign == 1)
  171. .map((v) => v.signImage).join(",") : null;
  172. return res;
  173. },
  174. getBlob(url, cb) {
  175. var xhr = new XMLHttpRequest();
  176. xhr.open("GET", url, true);
  177. xhr.responseType = "blob";
  178. xhr.onload = function () {
  179. if (xhr.status === 200) {
  180. cb(xhr.response);
  181. }
  182. };
  183. xhr.send();
  184. },
  185. saveAs(blob, filename) {
  186. console.log("saveAs", blob, filename)
  187. if (window.navigator.msSaveOrOpenBlob) {
  188. navigator.msSaveBlob(blob, filename);
  189. } else {
  190. let link = document.createElement("a");
  191. let body = document.querySelector("body");
  192. link.href = URL.createObjectURL(blob);
  193. link.download = filename;
  194. // fix Firefox
  195. link.style.display = "none";
  196. body.appendChild(link);
  197. link.click();
  198. body.removeChild(link);
  199. window.URL.revokeObjectURL(link.href);
  200. }
  201. },
  202. // 事件
  203. //apimark//
  204. },
  205. mounted() {
  206. },
  207. };
  208. </script>