c9f3efa4ff3ce7f04cb3ce1ec8504e037d332403.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  1. <template>
  2. <!-- 修改弹框 -->
  3. <el-dialog
  4. width="60%"
  5. class="outerDialog file_modify_dialog"
  6. title="修改资料"
  7. @close="closeModal"
  8. append-to-body
  9. :close-on-click-modal="false"
  10. :visible.sync="changeSupervisionVisible">
  11. <div class="scroll_wrapper">
  12. <div
  13. style="width:49%;overflow-y:auto;min-height: 50vh;max-height:58vh;float:left;border:1px solid #d5d5ff;margin-right:5px;">
  14. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">基本信息</p>
  15. <el-form ref="changeSupFrom" :model="changeSupervision" label-width="120px">
  16. <el-form-item label="资料名称">
  17. <el-input v-model="changeSupervision.catalogName" clearable autocomplete="off"></el-input>
  18. </el-form-item>
  19. <el-form-item label="编制单位">
  20. <el-input v-model="changeSupervision.estUnit" clearable autocomplete="off"></el-input>
  21. </el-form-item>
  22. <el-form-item label="编制时间">
  23. <el-date-picker
  24. v-model="changeSupervision.estTm"
  25. type="date"
  26. value-format="yyyy-MM-dd"
  27. placeholder="选择日期">
  28. </el-date-picker>
  29. </el-form-item>
  30. </el-form>
  31. </div>
  32. <div
  33. style="width: 49%;float: left;border: 1px solid rgb(213, 213, 255);margin-right: 5px;overflow-y: auto;min-height: 50vh;max-height: 58vh;">
  34. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">多媒体信息</p>
  35. <el-tabs style="margin:0px 5px">
  36. <el-tab-pane :label="filetabName">
  37. <el-row style="text-align:right;">
  38. <el-button
  39. :v-if="!addPicPanel?addPicPanel:addPicPanel"
  40. size="large"
  41. type="text"
  42. :icon="!addPicPanel?'el-icon-circle-plus-outline':'el-icon-circle-close-outline'"
  43. @click="addPic"
  44. >{{!addPicPanel?"添加":"取消"}}</el-button>
  45. </el-row>
  46. <el-row v-show="addPicPanel">
  47. <upload
  48. ref="uploadFile"
  49. :url="`/pdcApi/file/insert?bizId=`"
  50. @uploadOver="removeNewSupervision"
  51. ></upload>
  52. </el-row>
  53. <el-row>
  54. <el-table border :data="fileArray" style="width: 100%;margin: 0 auto;">
  55. <el-table-column header-align="center" align="center" label="文档">
  56. <template slot-scope="scope">
  57. <p>
  58. <a :href="`${hostUrl}/${scope.row.filePath}`" target="_blank" rel="noopener noreferrer">
  59. {{scope.row.fileName}}
  60. </a>
  61. </p>
  62. </template>
  63. </el-table-column>
  64. <el-table-column header-align="center" align="center" label="操作">
  65. <template slot-scope="scope">
  66. <el-button
  67. size="mini"
  68. @click="removeFile(scope.row.id,scope.$index)"
  69. type="danger"
  70. >删除</el-button>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. </el-row>
  75. </el-tab-pane>
  76. <el-tab-pane :label="picturetabName">
  77. <el-row>
  78. <div style="overflow-y:auto;overflow-x:hidden;max-height:30vh;padding:10px;">
  79. <div class="upload-container">
  80. <div
  81. v-for="(item, index) in pictureArray"
  82. :key="index"
  83. class="image-preview image-app-preview"
  84. >
  85. <div class="image-preview-wrapper">
  86. <img :src="`${hostUrl}/${item.filePath}`">
  87. <div class="image-preview-action">
  88. <i @click="removeFile(item.id)" class="el-icon-delete"></i>
  89. </div>
  90. </div>
  91. </div>
  92. </div>
  93. </div>
  94. </el-row>
  95. </el-tab-pane>
  96. <el-tab-pane :label="audiotabName">
  97. <el-table border :data="audioArray" style="width: 100%;margin: 0 auto;">
  98. <el-table-column header-align="center" align="center" label="音频">
  99. <template slot-scope="scope">
  100. <elaudio
  101. style="margin-left:15%;width:100px;height:30px;"
  102. :theUrl="`${hostUrl}/${scope.row.filePath}`"
  103. ></elaudio>
  104. </template>
  105. </el-table-column>
  106. <el-table-column header-align="center" align="center" label="操作">
  107. <template slot-scope="scope">
  108. <el-button
  109. size="mini"
  110. @click="removeFile(scope.row.id,scope.$index)"
  111. type="danger"
  112. >删除</el-button>
  113. </template>
  114. </el-table-column>
  115. </el-table>
  116. </el-tab-pane>
  117. <el-tab-pane :label="videotabName">
  118. <el-table border :data="videoArray" style="width: 100%;margin: 0 auto;">
  119. <el-table-column header-align="center" align="center" label="视频">
  120. <template slot-scope="scope">
  121. <video-player
  122. class="vjs-custom-skin"
  123. ref="videoPlayer"
  124. :options="scope.row"
  125. :playsinline="true"
  126. ></video-player>
  127. </template>
  128. </el-table-column>
  129. <el-table-column header-align="center" align="center" label="操作">
  130. <template slot-scope="scope">
  131. <el-button
  132. size="mini"
  133. @click="removeFile(scope.row.id,scope.$index)"
  134. type="danger"
  135. >删除</el-button>
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. </el-tab-pane>
  140. </el-tabs>
  141. </div>
  142. </div>
  143. <span slot="footer">
  144. <el-button type="primary" @click="submitFile">保存</el-button>
  145. <el-button @click="closeModal">取消</el-button>
  146. </span>
  147. </el-dialog>
  148. </template>
  149. <script>
  150. import {updatelist,deleteFileById} from "@api/duChaAPI.js";
  151. import {showDetailsApi,addFileApi} from "@api/InspectionReport.js";
  152. import request from "@util/gw_ajax_request.js";
  153. import { hostUrl } from "@util/global_variable.js";
  154. import elaudio from "../../../widgets/elAudioShort.vue";
  155. export default {
  156. props: ['fileId'], //fileId 资料id
  157. data(){
  158. return{
  159. changeSupervisionVisible: true,
  160. changeSupervisionLoading: false,
  161. changeSupervision: {},
  162. addPicPanel: false,
  163. gwComFileList: [],
  164. picturetabName: "",
  165. audiotabName: "",
  166. videotabName: "",
  167. filetabName: "",
  168. pictureArray: [],
  169. audioArray: [],
  170. videoArray: [],
  171. fileArray: [],
  172. updateIdXiuGai: "",
  173. pblmId: "",
  174. //稽察添加问题用到的参数
  175. }
  176. },
  177. components:{
  178. elaudio: elaudio,
  179. upload: resolve => {
  180. require(["../../../widgets/uploadFile.vue"], resolve);
  181. },
  182. },
  183. computed:{
  184. hostUrl(){
  185. return hostUrl
  186. },
  187. persId() {
  188. return localStorage.getItem("userid") ? localStorage.getItem("userid") : "1098101939614724096";
  189. }
  190. },
  191. mounted(){
  192. this.changeSup(this.fileId)
  193. },
  194. methods:{
  195. // 修改弹窗显示
  196. changeSup(id) {
  197. this.pictureArray = [];
  198. this.audioArray = [];
  199. this.videoArray = [];
  200. this.fileArray = [];
  201. this.updateIdXiuGai = id;
  202. let _this = this
  203. showDetailsApi(this.updateIdXiuGai).then(res => {
  204. // if(this.usersId==)
  205. this.changeSupervision = res.data;
  206. res.data.gwComFileList.forEach(item => {
  207. if (
  208. item.fileExt == "mp3" ||
  209. item.fileExt == "MP3" ||
  210. item.fileExt == "m4a"
  211. ) {
  212. this.audioArray.push(item);
  213. } else if (
  214. item.fileExt == "jpg" ||
  215. item.fileExt == "JPG" ||
  216. item.fileExt == "png" ||
  217. item.fileExt == "PNG" ||
  218. item.fileExt == "JPEG" ||
  219. item.fileExt == "jpeg"
  220. ) {
  221. this.pictureArray.push(item);
  222. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  223. this.videoArray.push({
  224. width: "130",
  225. height: "130",
  226. autoplay: false,
  227. muted: true,
  228. language: "en",
  229. playbackRates: [0.7, 1.0, 1.5, 2.0],
  230. sources: [
  231. {
  232. type: "video/mp4",
  233. src: this.hostUrl + item.filePath
  234. }
  235. ],
  236. id: item.id
  237. });
  238. } else if (
  239. item.fileExt == "pdf" ||
  240. item.fileExt == "doc" ||
  241. item.fileExt == "docx" ||
  242. item.fileExt == "txt" ||
  243. item.fileExt == "xls" ||
  244. item.fileExt == "xlsx"
  245. ) {
  246. this.fileArray.push(item);
  247. }
  248. });
  249. this.picturetabName = "图片资料(" + this.pictureArray.length + ")";
  250. this.audiotabName = "音频资料(" + this.audioArray.length + ")";
  251. this.videotabName = "视频资料(" + this.videoArray.length + ")";
  252. this.filetabName = "文档资料(" + this.fileArray.length + ")";
  253. });
  254. },
  255. // 提交修改信息
  256. submitFile(){
  257. addFileApi(this.changeSupervision).then(res=>{
  258. if(res.success){
  259. this.gwComFileList = [];
  260. if (this.$refs.uploadFile.submitUpload(res.data.id)) {
  261. this.removeNewSupervision();
  262. }
  263. this.$message.success('修改成功')
  264. }else{
  265. this.$message.error(res.message)
  266. }
  267. }).catch(err=>{
  268. this.$message.error(err)
  269. })
  270. },
  271. removeNewSupervision(arg) {
  272. if (arg) {
  273. var args = this.gwComFileList.concat(arg);
  274. }
  275. this.changeSup(this.fileId)
  276. this.$emit('dialogClose')
  277. this.gwComFileList = [];
  278. },
  279. changeSupervisionVisiblefalse() {
  280. this.$emit('closeEditDialog')
  281. this.$refs.uploadFile.init();
  282. this.addPicPanel = false;
  283. },
  284. addPic() {
  285. this.addPicPanel = !this.addPicPanel;
  286. },
  287. // 删除图片文件
  288. removeFile(id, index) {
  289. // this.updateIdXiuGai = this.updateIdXiuGai;
  290. var _self = this;
  291. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  292. confirmButtonText: "确定",
  293. cancelButtonText: "返回",
  294. type: "warning"
  295. }).then(
  296. res => {
  297. if (res === "confirm") {
  298. deleteFileById(id, this.persId).then(res => {
  299. if (res.success) {
  300. this.changeSupervision.gwComFileList.forEach(item => {
  301. if (
  302. item.fileExt == "mp3" ||
  303. item.fileExt == "MP3" ||
  304. item.fileExt == "m4a"
  305. ) {
  306. this.audioArray.splice(index, 1);
  307. } else if (
  308. item.fileExt == "jpg" ||
  309. item.fileExt == "JPG" ||
  310. item.fileExt == "png" ||
  311. item.fileExt == "PNG" ||
  312. item.fileExt == "JPEG" ||
  313. item.fileExt == "jpeg"
  314. ) {
  315. this.pictureArray.splice(index, 1);
  316. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  317. this.videoArray.splice(index, 1);
  318. }
  319. });
  320. _self.changeSup(this.updateIdXiuGai);
  321. } else {
  322. this.failInfo();
  323. }
  324. });
  325. }
  326. },
  327. res => {
  328. console.log("返回");
  329. }
  330. )
  331. },
  332. // 操作成功反馈
  333. successInfo() {
  334. this.$message({
  335. type: "success",
  336. message: "操作成功!"
  337. });
  338. },
  339. // 操作失败反馈
  340. failInfo(val) {
  341. this.$message.error(val);
  342. },
  343. // 文件上传
  344. submitUpload() {
  345. this.$refs.upload.submit();
  346. },
  347. closeModal(){
  348. this.$emit('dialogClose')
  349. }
  350. },
  351. watch:{
  352. fileId(val){
  353. this.changeSup(val)
  354. }
  355. }
  356. }
  357. </script>
  358. <style lang="scss">
  359. .scroll_wrapper{
  360. overflow: hidden;
  361. }
  362. .scroll_wrapper .el-form{
  363. padding-top: 5px;
  364. padding-right: 5px;
  365. }
  366. .myForm .el-form-item__label{
  367. font-size:large;
  368. }
  369. .upload-container {
  370. width: 100%;
  371. position: relative;
  372. .image-uploader {
  373. width: 35%;
  374. float: left;
  375. }
  376. .image-preview {
  377. width: 200px;
  378. height: 200px;
  379. position: relative;
  380. border: 1px dashed #d9d9d9;
  381. float: left;
  382. // margin-left: 50px;
  383. .image-preview-wrapper {
  384. position: relative;
  385. width: 100%;
  386. height: 100%;
  387. img {
  388. width: 100%;
  389. height: 100%;
  390. }
  391. }
  392. .image-preview-action {
  393. position: absolute;
  394. width: 100%;
  395. height: 100%;
  396. left: 0;
  397. top: 0;
  398. color: #fff;
  399. opacity: 0;
  400. font-size: 20px;
  401. background-color: rgba(0, 0, 0, 0.5);
  402. transition: opacity 0.3s;
  403. cursor: pointer;
  404. text-align: center;
  405. line-height: 200px;
  406. .el-icon-delete {
  407. font-size: 36px;
  408. }
  409. }
  410. &:hover {
  411. .image-preview-action {
  412. opacity: 1;
  413. }
  414. }
  415. }
  416. .image-app-preview {
  417. margin-bottom: 10px;
  418. width: 40vh;
  419. height: 180px;
  420. position: relative;
  421. border: 1px dashed #d9d9d9;
  422. float: left;
  423. // margin-left: 50px;
  424. .app-fake-conver {
  425. height: 44px;
  426. position: absolute;
  427. width: 100%; // background: rgba(0, 0, 0, .1);
  428. text-align: center;
  429. line-height: 64px;
  430. color: #fff;
  431. }
  432. }
  433. }
  434. .file_modify_dialog{
  435. .el-icon-circle-plus,.el-icon-remove{
  436. margin-left: 10px;
  437. color: #009fff;
  438. cursor: pointer;
  439. }
  440. .el-form-item__label{
  441. font-size: large;
  442. }
  443. }
  444. </style>