dialog.info.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <div class="edu-training-edit">
  3. <DialogCom title="教育培训详情" :visible.sync="isShow" width="960px">
  4. <div class="page-body">
  5. <el-form :model="formData" size="small" ref="form" label-position="right" label-width="120px"
  6. label-suffix=":">
  7. <el-row>
  8. <!-- 培训主题 -->
  9. <el-col :span="12">
  10. <el-form-item prop="type" label="培训主题">{{
  11. formData.title
  12. }}</el-form-item>
  13. </el-col>
  14. <!-- 机构 -->
  15. <el-col :span="12">
  16. <el-form-item label="培训机构">{{
  17. formData.orgName
  18. }}</el-form-item>
  19. </el-col>
  20. <!-- 执行角色 -->
  21. <!-- <el-col :span="12">
  22. <el-form-item prop="eduJobId" label="执行角色">{{
  23. formData.eduJobNames
  24. }}</el-form-item>
  25. </el-col> -->
  26. <!-- 类型 -->
  27. <el-col :span="12">
  28. <el-form-item label="类型">
  29. <template>
  30. <dict-tag :options="dict.type.edu_type" :value="formData.type" />
  31. </template>
  32. </el-form-item>
  33. </el-col>
  34. <!-- 主持人 -->
  35. <el-col :span="12">
  36. <el-form-item prop="hostId" label="主持人">{{
  37. formData.hostName
  38. }}</el-form-item>
  39. </el-col>
  40. <!-- 记录人 -->
  41. <el-col :span="24">
  42. <el-form-item prop="recorderId" label="记录人">{{
  43. formData.recorderName
  44. }}</el-form-item>
  45. </el-col>
  46. <!-- 培训开始时间 -->
  47. <el-col :span="12">
  48. <el-form-item prop="trainingStartDateTime" label="培训开始时间">{{
  49. formData.trainingStartDateTime
  50. }}</el-form-item>
  51. </el-col>
  52. <!-- 培训截止时间 -->
  53. <el-col :span="12">
  54. <el-form-item prop="trainingEndDateTime" label="培训截止时间">{{
  55. formData.trainingEndDateTime
  56. }}</el-form-item>
  57. </el-col>
  58. <!-- 开始日期 -->
  59. <!-- <el-col :span="12">
  60. <el-form-item prop="dateTime" label="开始日期">{{
  61. formData.startDate
  62. }}</el-form-item>
  63. </el-col> -->
  64. <!-- 截止日期 -->
  65. <!-- <el-col :span="12">
  66. <el-form-item prop="dateTime" label="截止日期">{{
  67. formData.endDate
  68. }}</el-form-item>
  69. </el-col> -->
  70. <!-- 内容 -->
  71. <el-col :span="24">
  72. <el-form-item prop="content" label="培训内容">{{
  73. formData.content
  74. }}</el-form-item>
  75. </el-col>
  76. <!-- 总结 -->
  77. <el-col :span="24">
  78. <el-form-item prop="note" label="总结">{{
  79. formData.note
  80. }}</el-form-item>
  81. </el-col>
  82. <!-- 参与人数 -->
  83. <el-col :span="12">
  84. <el-form-item prop="dueCount" label="参与人员">{{
  85. formData.taskUserList ? formData.taskUserList.filter((x) => x.type === 1)
  86. .map((v) => v.userName).join(",") : ""
  87. }}</el-form-item>
  88. </el-col>
  89. <el-col :span="12">
  90. <el-form-item prop="dueCount" label="缺席人员">{{
  91. formData.taskUserList ? formData.taskUserList.filter((x) => x.type === 2)
  92. .map((v) => v.userName).join(",") : ""
  93. }}</el-form-item>
  94. </el-col>
  95. <!-- 图片 -->
  96. <el-col :span="24">
  97. <el-form-item prop="imageList" label="培训图片">
  98. <ImageListPreview v-model="formData.imageList"></ImageListPreview>
  99. <!-- <k-multi-upload :disabled="!!id" v-model="formData.imageList" limit="4" byModule
  100. moduleName="edu-training" v-if="isShow" /> -->
  101. </el-form-item>
  102. </el-col>
  103. <!-- 图片 -->
  104. <el-col :span="24">
  105. <el-form-item prop="imageList" label="签名图片">
  106. <ImageListPreview v-model="formData.signImageList"></ImageListPreview>
  107. <!-- <k-multi-upload :disabled="!!id" v-model="formData.imageList" limit="4" byModule
  108. moduleName="edu-training" v-if="isShow" /> -->
  109. </el-form-item>
  110. </el-col>
  111. <!-- 文件 -->
  112. <el-col :span="24">
  113. <el-form-item prop="fileList" label="文件" :disabled="true">
  114. <div v-for="(v, i) in formData.fileList" :key="i">
  115. <a class="downloadLink" @click="onDownload(JSON.parse(v).url, JSON.parse(v).name)">
  116. {{ JSON.parse(v).name }}
  117. </a>
  118. </div>
  119. </el-form-item>
  120. </el-col>
  121. </el-row>
  122. </el-form>
  123. </div>
  124. <div slot="footer" class="dialog-footer">
  125. <el-button @click="onHide">关闭</el-button>
  126. </div>
  127. </DialogCom>
  128. </div>
  129. </template>
  130. <script>
  131. import { mapState, mapMutations } from "vuex";
  132. import { getEduTask } from "@/api/core/edu/eduTask";
  133. export default {
  134. components: {},
  135. dicts: ['edu_type', 'edu_task_status'],
  136. data() {
  137. const params = this.$route.params;
  138. return {
  139. id: params ? params.id : null,
  140. isShow: false,
  141. formData: this.reset(),
  142. };
  143. },
  144. props: {},
  145. watch: {},
  146. computed: {
  147. ...mapState(["loginUser"]),
  148. },
  149. methods: {
  150. ...mapMutations([]),
  151. reset(other = {}) {
  152. return {
  153. id: null,
  154. type: null,
  155. host: {},
  156. recorder: {},
  157. dateTime: null,
  158. dueCount: null,
  159. actualCount: null,
  160. content: null,
  161. imageList: null,
  162. signImageList:null,
  163. org: {},
  164. ...other,
  165. };
  166. },
  167. async refresh(id, other) {
  168. if (!id) {
  169. this.reset(other);
  170. }
  171. else {
  172. getEduTask(id).then(response => {
  173. this.formData = response.data;
  174. this.formData.signImageList=this.getSingImageList();
  175. this.loading = false;
  176. })
  177. }
  178. },
  179. async show(id, other = {}) {
  180. this.id = id;
  181. await this.refresh(id, other);
  182. this.isShow = true;
  183. },
  184. // 事件
  185. onHide() {
  186. this.isShow = false;
  187. },
  188. onDownload(url, filename) {
  189. let this_ = this;
  190. this.getBlob(url, function (blob) {
  191. this_.saveAs(blob, filename);
  192. });
  193. },
  194. getSingImageList() {
  195. let res = this.formData.taskUserList ? this.formData.taskUserList.filter((x) => x.type === 1 && x.sign == 1)
  196. .map((v) => v.signImage).join(",") : null;
  197. return res;
  198. },
  199. getBlob(url, cb) {
  200. var xhr = new XMLHttpRequest();
  201. xhr.open("GET", url, true);
  202. xhr.responseType = "blob";
  203. xhr.onload = function () {
  204. if (xhr.status === 200) {
  205. cb(xhr.response);
  206. }
  207. };
  208. xhr.send();
  209. },
  210. saveAs(blob, filename) {
  211. // if (window.navigator.msSaveOrOpenBlob) {
  212. // navigator.msSaveBlob(blob, filename);
  213. // } else {
  214. // var link = document.createElement("a");
  215. //var body = document.querySelector("body");
  216. // link.href = window.URL.createObjectURL(blob);
  217. // link.download = filename;
  218. //
  219. // // fix Firefox
  220. // link.style.display = "none";
  221. // body.appendChild(link);
  222. //
  223. // link.click();
  224. // body.removeChild(link);
  225. // window.URL.revokeObjectURL(link.href);
  226. // }
  227. },
  228. // 事件
  229. //apimark//
  230. },
  231. mounted() { },
  232. };
  233. </script>
  234. <!-- <style lang="less">
  235. .edu-training-edit {
  236. }
  237. </style> -->