5a0d3771a34419a00e12ea8d1088617cdc1e102b.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <div>
  3. <el-dialog :title="dialogTitle" :visible.sync="dialogFormVisible" @close="dialogClose" :append-to-body="true" width="60%" class="jqmm">
  4. <el-row style="text-align:right;">
  5. <el-button :type="!addPicPanel ? 'primary' : 'danger'"
  6. :icon="!addPicPanel ? 'el-icon-circle-plus-outline':'el-icon-circle-close-outline'"
  7. @click="addPic"
  8. >{{ !addPicPanel ? "添加" : "取消" }}
  9. </el-button>
  10. </el-row>
  11. <el-row v-if="addPicPanel" style="text-align:center;">
  12. <upload ref="uploadFile" :url="`/pdcApi/file/insert?bizId=`" @uploadOver="removeNewSupervision"></upload>
  13. <el-button type="primary" @click="onSubmit">保 存</el-button>
  14. </el-row>
  15. <el-row>
  16. <el-tabs style="overflow-y: auto;margin:5px;">
  17. <el-tab-pane :label="picturetabName" style="height: 400px;">
  18. <el-carousel :interval="4000" height="350px" id="imgView">
  19. <el-carousel-item v-for="(item,index) in pictureArray" :key="index">
  20. <img v-if="item.filePath.indexOf('http')>-1" style="height:100%;" :src="`${item.filePath}`">
  21. <img v-if="item.filePath.indexOf('http')<0" style="height:100%;width: 100%;" :src="`${hostUrl}/${item.filePath}`">
  22. <div class="image-preview-action">
  23. <i @click="removeFile(item.id)" class="el-icon-delete"></i>
  24. </div>
  25. </el-carousel-item>
  26. <p v-if="pictureArray.length==0" class="noPic">暂无图片信息</p>
  27. </el-carousel>
  28. </el-tab-pane>
  29. <el-tab-pane :label="videotabName">
  30. <el-carousel :interval="4000" height="350px">
  31. <el-carousel-item v-for="(item,index) in videoArray" :key="index">
  32. <video-player
  33. class="vjs-custom-skin"
  34. ref="videoPlayer"
  35. :options="item"
  36. :playsinline="true"
  37. ></video-player>
  38. <div class="image-preview-action">
  39. <i @click="removeFile(item.id)" class="el-icon-delete"></i>
  40. </div>
  41. </el-carousel-item>
  42. <el-carousel-item v-if="videoArray.length==0">
  43. <p class="noPic">暂无视频信息</p>
  44. </el-carousel-item>
  45. </el-carousel>
  46. </el-tab-pane>
  47. <el-tab-pane :label="audiotabName">
  48. <el-table border :data="audioArray" style="width: 100%;margin: 0 auto;" :height="testHeight">
  49. <el-table-column header-align="center" align="center" label="音频">
  50. <template slot-scope="scope">
  51. <elaudio
  52. style="margin-left:15%;width:100px;height:30px;"
  53. :theUrl="`${hostUrl}/${scope.row.filePath}`"
  54. ></elaudio>
  55. <!-- <span>{{scope.row.fileTitle}}</span> -->
  56. </template>
  57. </el-table-column>
  58. <el-table-column header-align="center" align="center" label="操作">
  59. <template slot-scope="scope">
  60. <el-button
  61. size="mini"
  62. @click="removeFile(scope.row.id,scope.$index)"
  63. type="danger"
  64. >删除
  65. </el-button>
  66. </template>
  67. </el-table-column>
  68. </el-table>
  69. </el-tab-pane>
  70. <el-tab-pane :label="filetabName">
  71. <el-table border :data="fileArray" style="width: 100%;margin: 0 auto;" :height="testHeight">
  72. <el-table-column header-align="center" align="center" label="文档">
  73. <template slot-scope="scope">
  74. <p>
  75. <a :href="`${hostUrl}/${scope.row.filePath}`" target="_blank"
  76. rel="noopener noreferrer">
  77. {{scope.row.fileName}}
  78. </a>
  79. </p>
  80. </template>
  81. </el-table-column>
  82. <el-table-column header-align="center" align="center" label="操作">
  83. <template slot-scope="scope">
  84. <el-button
  85. size="mini"
  86. @click="removeFile(scope.row.id,scope.$index)"
  87. type="danger"
  88. >删除
  89. </el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. </el-tab-pane>
  94. </el-tabs>
  95. </el-row>
  96. </el-dialog>
  97. </div>
  98. </template>
  99. <script>
  100. import request from '../../../utils/gw_ajax_request'
  101. import upload from '../../../widgets/uploadFilePblmConfirm'
  102. import {deleteFileById} from "../../../api/duChaAPI.js";
  103. import {hostUrl} from "@util/global_variable.js";
  104. import elaudio from "../../../widgets/elAudioShort.vue";
  105. import Viewer from 'viewerjs';
  106. import 'viewerjs/dist/viewer.css';
  107. export default {
  108. name: "theRecentAppearance",
  109. props: ['jqmmShow', 'pblmId', 'dialogTitle', 'currentObjectName','openType','type','step'],
  110. components: {
  111. upload,
  112. elaudio
  113. },
  114. data() {
  115. return {
  116. isCounty:this.$route.params.type,
  117. bizType:"",
  118. testHeight:350,
  119. dialogFormVisible: true,
  120. addPicPanel: false,
  121. pictureArray: [],
  122. videoArray: [],
  123. videoArray: [],
  124. audioArray: [],
  125. fileArray:[],
  126. picturetabName: "",
  127. videotabName: "",
  128. audiotabName: "",
  129. filetabName: "",
  130. }
  131. },
  132. computed: {
  133. hostUrl() {
  134. return hostUrl
  135. }
  136. },
  137. mounted() {
  138. this.getPicArray();
  139. },
  140. watch: {
  141. currentObjectId: function () {
  142. this.picturetabName = "";
  143. this.videotabName = "";
  144. this.audiotabName = "";
  145. this.filetabName = "";
  146. this.pictureArray = [];
  147. this.videoArray = [];
  148. this.audioArray = [];
  149. this.fileArray = [];
  150. this.getPicArray();
  151. }
  152. },
  153. methods: {
  154. dialogClose() {
  155. this.$emit('jqmmDialogClose');
  156. },
  157. addPic() {
  158. this.addPicPanel = !this.addPicPanel;
  159. },
  160. getPicArray() {
  161. var params = {
  162. bizId:this.pblmId
  163. }
  164. var _this = this;
  165. request.post(`/file/findAllFile`,params).then(res => {
  166. if (res.success) {
  167. this.pictureArray = [];
  168. this.videoArray = [];
  169. this.audioArray = [];
  170. this.fileArray = [];
  171. res.data.forEach(item => {
  172. if (
  173. item.fileExt == "jpg" ||
  174. item.fileExt == "JPG" ||
  175. item.fileExt == "png" ||
  176. item.fileExt == "PNG" ||
  177. item.fileExt == "JPEG" ||
  178. item.fileExt == "jpeg"
  179. ) {
  180. this.pictureArray.push(item);
  181. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  182. this.videoArray.push({
  183. height: "320",
  184. width: "500",
  185. id: item.id,
  186. bizId: item.bizId,
  187. autoplay: false,
  188. muted: true,
  189. language: "en",
  190. playbackRates: [0.7, 1.0, 1.5, 2.0],
  191. sources: [
  192. {
  193. type: "video/mp4",
  194. src: this.hostUrl + item.filePath
  195. }
  196. ]
  197. });
  198. }else if (
  199. item.fileExt == "mp3" ||
  200. item.fileExt == "MP3" ||
  201. item.fileExt == "m4a"
  202. ) {
  203. this.audioArray.push(item);
  204. }else{
  205. this.fileArray.push(item);
  206. }
  207. });
  208. _this.$nextTick(function(){
  209. var ViewerDom = document.getElementById('imgView');
  210. var viewer = new Viewer(ViewerDom, {})
  211. });
  212. this.picturetabName = "图片资料(" + this.pictureArray.length + ")";
  213. this.videotabName = "视频资料(" + this.videoArray.length + ")";
  214. this.audiotabName = "音频资料(" + this.audioArray.length + ")";
  215. this.filetabName = "其他资料(" + this.fileArray.length + ")";
  216. }
  217. })
  218. },
  219. onSubmit() {
  220. this.submitUpload();
  221. },
  222. // 文件上传
  223. submitUpload() {
  224. if (this.$refs.uploadFile.submitUpload(this.pblmId)) {
  225. this.removeNewSupervision();
  226. }
  227. },
  228. removeNewSupervision(arg) {
  229. if (arg) {
  230. this.$message.success('上传成功');
  231. this.addPicPanel = false;
  232. this.getPicArray();
  233. // this.$emit('jqmmDialogClose');
  234. // this.pictureArray = [];
  235. this.$refs.uploadFile.init();
  236. } else {
  237. this.$message.error('上传有误');
  238. }
  239. },
  240. // 删除多媒体文件
  241. removeFile(id, index) {
  242. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  243. confirmButtonText: "确定",
  244. cancelButtonText: "返回",
  245. type: "warning"
  246. }).then(
  247. res => {
  248. if (res === "confirm") {
  249. deleteFileById(id, localStorage.getItem("userid")).then(res => {
  250. if (res.success) {
  251. this.getPicArray();
  252. } else {
  253. this.$message.error(res.message);
  254. }
  255. });
  256. }
  257. }
  258. );
  259. },
  260. },
  261. }
  262. </script>
  263. <style lang="scss">
  264. .noPic{
  265. text-align: center;
  266. }
  267. .image-preview-action {
  268. position: absolute;
  269. top:0;
  270. width: 100%;
  271. height: 30px;
  272. text-align: center;
  273. opacity: 0;
  274. font-size: 20px;
  275. background-color: rgba(0, 0, 0, 0.5);
  276. transition: opacity 0.3s;
  277. cursor: pointer;
  278. line-height: 30px;
  279. }
  280. .image-preview-action .el-icon-delete {
  281. font-size: 25px;
  282. }
  283. .image-preview-action:hover {
  284. opacity: 1;
  285. }
  286. .jqmm {
  287. .image-preview-action {
  288. position: absolute;
  289. bottom:0;
  290. width: 100%;
  291. height: 30px;
  292. text-align: center;
  293. opacity: 0;
  294. font-size: 20px;
  295. background-color: rgba(0, 0, 0, 0.5);
  296. transition: opacity 0.3s;
  297. cursor: pointer;
  298. line-height: 30px;
  299. }
  300. .image-preview-action .el-icon-delete {
  301. font-size: 25px;
  302. color:white;
  303. }
  304. .image-preview-action:hover {
  305. opacity: 1;
  306. }
  307. .noPic {
  308. width: 100%;
  309. height: 100%;
  310. text-align: center;
  311. line-height: 300px;
  312. font-size: 17px;
  313. font-weight: bold;
  314. }
  315. .jqmm span.el-dialog__title {
  316. font-weight: bold;
  317. }
  318. /*.el-carousel.el-carousel--horizontal {*/
  319. /*text-align: center;*/
  320. /*}*/
  321. .el-dialog__body {
  322. padding: 0 30px 20px;
  323. }
  324. }
  325. </style>