19a241e5cab3a09729ff5d6148f8f56f951f8fa4.svn-base 17 KB

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