fe4ea74cb92ff46e6c6a29690d580b480dfd6b3a.svn-base 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650
  1. <template>
  2. <!-- 修改弹框 -->
  3. <el-dialog
  4. width="60%"
  5. class="outerDialog custom_dialog"
  6. title="修改督查问题"
  7. :modal = true
  8. @close="closeModal"
  9. :append-to-body = true
  10. :visible.sync="changeSupervisionVisible">
  11. <div class="scroll_wrapper">
  12. <div
  13. style="width:49%;overflow-y:auto;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" :rules="rules1" :model="changeSupervision" label-width="120px">
  16. <el-form-item label="督查对象名称">
  17. <el-input v-model="changeSupervision.newVillName" clearable :readonly="true"></el-input>
  18. </el-form-item>
  19. <el-form-item label="问题类别" prop="inspPblmsName">
  20. <el-select v-model="t1" value-key="inspPblmsName" placeholder="请选择" @change="problemListChange">
  21. <el-option v-for="(item,index) in problemList" :key="index" :label="item.inspPblmsName" :value="item">
  22. </el-option>
  23. </el-select>
  24. </el-form-item>
  25. <el-form-item label="检查项目" prop="checkPoint" style="text-align:left">
  26. <el-select v-model="t2" placeholder="请选择" value-key="checkPointName" @change="currentCheckPointListChange">
  27. <el-option v-for="(item,index) in currentCheckPointList" :key="index" :label="item.checkPointName" :value="item">
  28. </el-option>
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item label="详细描述" prop="inspPblmDesc">
  32. <el-input type="textarea" :rows="2" v-model="changeSupervision.inspPblmDesc" clearable></el-input>
  33. </el-form-item>
  34. <el-form-item label="上报人" prop="persName">
  35. <el-input
  36. resize="none"
  37. type="input"
  38. :rows="3"
  39. readonly
  40. placeholder="请输入"
  41. v-model.trim="changeSupervision.persName"
  42. ></el-input>
  43. </el-form-item>
  44. <el-form-item label="上报时间" prop="collTime">
  45. <el-date-picker v-model="changeSupervision.collTime" readonly type="date"></el-date-picker>
  46. </el-form-item>
  47. </el-form>
  48. </div>
  49. <div
  50. style="width: 49%;float: left;border: 1px solid rgb(213, 213, 255);margin-right: 5px;overflow-y: auto;max-height: 58vh;">
  51. <p style="font-weight:bolder;background-color:#d5d5ff;padding:3px;">多媒体信息</p>
  52. <el-tabs style="margin:0px 5px">
  53. <el-tab-pane :label="picturetabName">
  54. <el-row style="text-align:right;">
  55. <el-button
  56. :v-if="!addPicPanel?addPicPanel:addPicPanel"
  57. size="mini"
  58. type="text"
  59. :icon="!addPicPanel?'el-icon-circle-plus-outline':'el-icon-circle-close-outline'"
  60. @click="addPic"
  61. >{{!addPicPanel?"添加":"取消"}}</el-button>
  62. </el-row>
  63. <!-- 该上传组件之前用v-if="addPicPanel 控制显示隐藏,发现在点击编辑问题时,如果不上传图片,之间点击确认时会报错 add by lch -->
  64. <el-row v-show="addPicPanel"> <!-- v-if="addPicPanel" -->
  65. <upload
  66. ref="uploadFile"
  67. :url="`/pdcApi/file/insert?bizId=`"
  68. @uploadOver="removeNewSupervision"
  69. ></upload>
  70. </el-row>
  71. <el-row>
  72. <div style="overflow-y:auto;overflow-x:hidden;max-height:30vh;padding:10px;">
  73. <div class="upload-container" id="imgView">
  74. <div
  75. v-for="(item, index) in pictureArray"
  76. :key="index"
  77. class="image-preview image-app-preview"
  78. >
  79. <div class="image-preview-wrapper">
  80. <img :src="`${hostUrl}/${item.filePath}`">
  81. <div class="image-preview-action">
  82. <i @click="removeFile(item.id)" class="el-icon-delete"></i>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </el-row>
  89. </el-tab-pane>
  90. <el-tab-pane :label="audiotabName">
  91. <el-table border :data="audioArray" style="width: 100%;margin: 0 auto;">
  92. <el-table-column header-align="center" align="center" label="音频">
  93. <template slot-scope="scope">
  94. <elaudio
  95. style="margin-left:15%;width:100px;height:30px;"
  96. :theUrl="`${hostUrl}/${scope.row.filePath}`"
  97. ></elaudio>
  98. </template>
  99. </el-table-column>
  100. <el-table-column header-align="center" align="center" label="操作">
  101. <template slot-scope="scope">
  102. <el-button
  103. size="mini"
  104. @click="removeFile(scope.row.id,scope.$index)"
  105. type="danger"
  106. >删除</el-button>
  107. </template>
  108. </el-table-column>
  109. </el-table>
  110. </el-tab-pane>
  111. <el-tab-pane :label="videotabName">
  112. <el-table border :data="videoArray" style="width: 100%;margin: 0 auto;">
  113. <el-table-column header-align="center" align="center" label="视频">
  114. <template slot-scope="scope">
  115. <video-player
  116. class="vjs-custom-skin"
  117. ref="videoPlayer"
  118. :options="scope.row"
  119. :playsinline="true"
  120. ></video-player>
  121. </template>
  122. </el-table-column>
  123. <el-table-column header-align="center" align="center" label="操作">
  124. <template slot-scope="scope">
  125. <el-button
  126. size="mini"
  127. @click="removeFile(scope.row.id,scope.$index)"
  128. type="danger"
  129. >删除</el-button>
  130. </template>
  131. </el-table-column>
  132. </el-table>
  133. </el-tab-pane>
  134. </el-tabs>
  135. </div>
  136. </div>
  137. <span slot="footer">
  138. <el-button type="primary" @click="changeSupervisionInfo" :loding="changeSupervisionLoading">保存</el-button>
  139. <el-button @click="changeSupervisionVisiblefalse">取消</el-button>
  140. </span>
  141. </el-dialog>
  142. </template>
  143. <script>
  144. import {showDetailsXq,updatelist,deleteFileById} from "@api/duChaAPI.js";
  145. import request from "@util/gw_ajax_request.js";
  146. import {hostUrl} from '@util/global_variable'
  147. import Viewer from 'viewerjs';
  148. import 'viewerjs/dist/viewer.css';
  149. export default {
  150. props: ['editId'],
  151. data(){
  152. return{
  153. changeSupervisionVisible: true,
  154. changeSupervisionLoading: false,
  155. changeSupervision: {},
  156. rules1: {
  157. inspPblmName: [
  158. {
  159. required: true,
  160. message: "请输入问题名称",
  161. trigger: "blur"
  162. },
  163. {
  164. min: 1,
  165. max: 999,
  166. message: "不超过100字符",
  167. trigger: "blur"
  168. }
  169. ],
  170. inspPblmDesc: [
  171. {
  172. required: true,
  173. message: "请输入问题描述",
  174. trigger: "blur"
  175. }
  176. ],
  177. recPers: [
  178. {
  179. required: true,
  180. message: "请输入记录人",
  181. trigger: "blur"
  182. },
  183. {
  184. min: 1,
  185. max: 999,
  186. message: "不超过100字符",
  187. trigger: "blur"
  188. }
  189. ],
  190. objType: [
  191. {
  192. required: true,
  193. message: "请选择督查对象类型",
  194. trigger: "change"
  195. }
  196. ],
  197. objId: [
  198. {
  199. required: true,
  200. message: "请选择督查对象类型",
  201. trigger: "change"
  202. }
  203. ],
  204. inspPblmType: [
  205. {
  206. required: true,
  207. message: "请选择督查问题类型",
  208. trigger: "change"
  209. }
  210. ],
  211. dataStat: [
  212. {
  213. required: true,
  214. message: "请选择数据状态",
  215. trigger: "change"
  216. }
  217. ],
  218. collTime: [
  219. {
  220. required: true,
  221. message: "请选择采集时间",
  222. trigger: "change"
  223. }
  224. ],
  225. ifCasePblm: [
  226. {
  227. required: true,
  228. message: "请选择是否典型",
  229. trigger: "change"
  230. }
  231. ],
  232. pblmStat: [
  233. {
  234. required: true,
  235. message: "请选择问题类型",
  236. trigger: "change"
  237. }
  238. ],
  239. inspPblmCate: [
  240. {
  241. required: true,
  242. message: "请选择问题程度",
  243. trigger: "change"
  244. },
  245. {
  246. trigger: "change"
  247. }
  248. ]
  249. },
  250. supervisionState: [
  251. {
  252. value: "0",
  253. label: "一般"
  254. },
  255. {
  256. value: "1",
  257. label: "较重"
  258. },
  259. {
  260. value: "2",
  261. label: "严重"
  262. },
  263. {
  264. value: "3",
  265. label: "特别严重"
  266. }
  267. ],
  268. supervision: [
  269. {
  270. value: "1",
  271. label: "是"
  272. },
  273. {
  274. value: "0",
  275. label: "否"
  276. }
  277. ],
  278. addPicPanel: false,
  279. gwComFiles: [],
  280. picturetabName: "",
  281. audiotabName: "",
  282. videotabName: "",
  283. pictureArray: [],
  284. audioArray: [],
  285. videoArray: [],
  286. updateIdXiuGai: "",
  287. pblmId: "",
  288. t1: {},
  289. t2: {},
  290. t3: {},
  291. problemList: [],
  292. currentCheckPointList: [],
  293. currentProblemDescList: [],
  294. xiangqingmiaoshu: '',
  295. wenTiLeiBie:"",
  296. jianChaXiangMu:"",
  297. }
  298. },
  299. components:{
  300. upload: resolve => {
  301. require(["@widget/uploadFile.vue"], resolve);
  302. },
  303. },
  304. computed:{
  305. hostUrl(){
  306. return hostUrl
  307. },
  308. persId() {
  309. return localStorage.getItem("userid") ? localStorage.getItem("userid") : "1098101939614724096";
  310. }
  311. },
  312. mounted(){
  313. this.getproblemSmallType();
  314. },
  315. methods:{
  316. // 修改弹窗显示
  317. changeSup(id) {
  318. this.pictureArray = [];
  319. this.audioArray = [];
  320. this.videoArray = [];
  321. this.updateIdXiuGai = id;
  322. let _this = this
  323. showDetailsXq(this.updateIdXiuGai).then(res => {
  324. // if(this.usersId==)
  325. this.changeSupervision = res.data;
  326. this.gwComFiles = this.changeSupervision.gwComFiles;
  327. this.t1['inspPblmsName'] = this.changeSupervision.inspPblmsName
  328. this.problemList.forEach(ele=>{
  329. if(ele.inspPblmsName == _this.t1.inspPblmsName){
  330. _this.problemListChange(ele)
  331. }
  332. })
  333. this.t2['checkPointName'] = this.changeSupervision.checkPoint
  334. this.currentCheckPointList.forEach(ele=>{
  335. if(ele.checkPointName == _this.t2.checkPointName){
  336. _this.currentCheckPointListChange(ele)
  337. }
  338. })
  339. this.t3['pblmDesc'] = this.changeSupervision.pblmDesc
  340. res.data.gwComFiles.forEach(item => {
  341. if (
  342. item.fileExt == "mp3" ||
  343. item.fileExt == "MP3" ||
  344. item.fileExt == "m4a"
  345. ) {
  346. this.audioArray.push(item);
  347. } else if (
  348. item.fileExt == "jpg" ||
  349. item.fileExt == "JPG" ||
  350. item.fileExt == "png" ||
  351. item.fileExt == "PNG" ||
  352. item.fileExt == "JPEG" ||
  353. item.fileExt == "jpeg"
  354. ) {
  355. this.pictureArray.push(item);
  356. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  357. this.videoArray.push({
  358. id: item.id,
  359. bizId: item.bizId,
  360. width: "130",
  361. height: "130",
  362. autoplay: false,
  363. muted: true,
  364. language: "en",
  365. playbackRates: [0.7, 1.0, 1.5, 2.0],
  366. sources: [
  367. {
  368. type: "video/mp4",
  369. src: this.hostUrl + item.filePath
  370. }
  371. ]
  372. });
  373. }
  374. });
  375. _this.$nextTick(function(){
  376. var ViewerDom = document.getElementById('imgView');
  377. var viewer = new Viewer(ViewerDom, {})
  378. });
  379. this.picturetabName = "图片资料(" + this.pictureArray.length + ")";
  380. this.audiotabName = "音频资料(" + this.audioArray.length + ")";
  381. this.videotabName = "视频资料(" + this.videoArray.length + ")";
  382. });
  383. },
  384. // 提交修改信息
  385. changeSupervisionInfo() {
  386. console.log(this)
  387. var _self = this;
  388. this.$refs.changeSupFrom.validate(valid => {
  389. if (valid) {
  390. this.$nextTick(()=>{
  391. if (_self.$refs.uploadFile.submitUpload(_self.changeSupervision.pblmId)) {
  392. _self.removeNewSupervision();
  393. }
  394. setTimeout(()=>{
  395. _self.changeSupervisionLoading = true;
  396. _self.changeSupervision.checkPoint = _self.jianChaXiangMu
  397. _self.changeSupervision.inspPblmName = _self.wenTiLeiBie
  398. _self.changeSupervision.inspPlbmType = _self.t2.sort2;
  399. _self.changeSupervision.pblmsTypeId = _self.t2.guid;
  400. _self.changeSupervision.gwComFiles = _self.gwComFiles;
  401. let data = _self.changeSupervision;
  402. updatelist(data).then(res => {
  403. _self.pblmId = res.data.pblmId;
  404. _self.gwComFiles = res.data.gwComFiles;
  405. if (res.success) {
  406. _self.changeSupervisionLoading = false;
  407. _self.successInfo();
  408. _self.addPicPanel = false;
  409. } else {
  410. _self.failInfo();
  411. _self.$emit('closeEditDialog')
  412. }
  413. });
  414. },500)
  415. })
  416. }
  417. });
  418. },
  419. removeNewSupervision(arg) {
  420. if (arg) {
  421. this.gwComFiles = this.gwComFiles.concat(arg);
  422. return;
  423. }
  424. },
  425. changeSupervisionVisiblefalse() {
  426. this.$emit('closeEditDialog')
  427. this.$refs.uploadFile.init();
  428. this.addPicPanel = false;
  429. },
  430. addPic() {
  431. this.addPicPanel = !this.addPicPanel;
  432. },
  433. // 删除图片文件
  434. removeFile(id, index) {
  435. // this.updateIdXiuGai = this.updateIdXiuGai;
  436. var _self = this;
  437. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  438. confirmButtonText: "确定",
  439. cancelButtonText: "返回",
  440. type: "warning"
  441. }).then(
  442. res => {
  443. if (res === "confirm") {
  444. deleteFileById(id, this.persId).then(res => {
  445. if (res.success) {
  446. this.changeSupervision.gwComFiles.forEach(item => {
  447. if (
  448. item.fileExt == "mp3" ||
  449. item.fileExt == "MP3" ||
  450. item.fileExt == "m4a"
  451. ) {
  452. this.audiotabName.splice(index, 1);
  453. } else if (
  454. item.fileExt == "jpg" ||
  455. item.fileExt == "JPG" ||
  456. item.fileExt == "png" ||
  457. item.fileExt == "PNG" ||
  458. item.fileExt == "JPEG" ||
  459. item.fileExt == "jpeg"
  460. ) {
  461. this.pictureArray.splice(index, 1);
  462. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  463. this.videoArray.splice(index, 1);
  464. }
  465. });
  466. _self.changeSup(this.updateIdXiuGai);
  467. } else {
  468. this.failInfo();
  469. }
  470. });
  471. }
  472. },
  473. res => {
  474. console.log("返回");
  475. }
  476. )
  477. },
  478. // 操作成功反馈
  479. successInfo() {
  480. this.$message({
  481. type: "success",
  482. message: "操作成功!"
  483. });
  484. this.$emit('closeEditDialog')
  485. },
  486. // 操作失败反馈
  487. failInfo(val) {
  488. this.$message.error(val);
  489. },
  490. // 文件上传
  491. submitUpload() {
  492. this.$refs.upload.submit();
  493. },
  494. closeModal(){
  495. this.$emit('closeEditDialog')
  496. },
  497. getproblemSmallType() {
  498. let result = [];
  499. request.get('/dc/insp/pblms/getPblmType', {
  500. params: {
  501. type: 37,
  502. pguid: `37000000000000000000000000000000`
  503. }
  504. }).then(res => {
  505. if (res.success) {
  506. res.data.forEach((ele) => {
  507. let haveinspPblmsName = false;
  508. result.forEach((inspPblm) => {
  509. if (inspPblm['inspPblmsName'] == ele.inspPblmsName) {
  510. //
  511. let havechekPoint = false;
  512. inspPblm['checkPoints'].forEach((chekPoint) => {
  513. if (chekPoint['checkPointName'] == ele.checkPoint) {
  514. havechekPoint = true;
  515. }
  516. });
  517. if (!havechekPoint) {
  518. let newCheckPoint = {};
  519. newCheckPoint['checkPointName'] = ele.checkPoint;
  520. newCheckPoint['sort2'] = ele.sort2;
  521. newCheckPoint['guid'] = ele.guid
  522. inspPblm['checkPoints'].push(newCheckPoint);
  523. }
  524. haveinspPblmsName = true;
  525. }
  526. });
  527. if (!haveinspPblmsName) {
  528. let haveinspPblmsObj = {};
  529. haveinspPblmsObj['inspPblmsName'] = ele.inspPblmsName;
  530. haveinspPblmsObj['sort1'] = ele.sort1;
  531. haveinspPblmsObj['checkPoints'] = [{
  532. checkPointName: ele.checkPoint,
  533. sort2: ele.sort2,
  534. guid: ele.guid
  535. }];
  536. result.push(haveinspPblmsObj);
  537. }
  538. })
  539. this.problemList = result;
  540. this.changeSup(this.editId)
  541. }
  542. })
  543. },
  544. problemListChange: function (item) {
  545. this.t1 = item
  546. this.wenTiLeiBie = item.inspPblmsName;
  547. this.currentCheckPointList = item.checkPoints;
  548. },
  549. currentCheckPointListChange: function (item) {
  550. this.jianChaXiangMu = item.checkPointName;
  551. this.currentProblemDescList = item.pblmDescs;
  552. },
  553. currentProblemDescListChange: function (item) {
  554. this.xiangqingmiaoshu = item.pblmDesc;
  555. console.log(item);
  556. },
  557. },
  558. watch:{
  559. editId(val){
  560. this.changeSup(val)
  561. },
  562. 't3': {
  563. handler: function (val, oldVal) {
  564. },
  565. deep: true
  566. },
  567. }
  568. }
  569. </script>
  570. <style scoped lang="scss">
  571. .scroll_wrapper{
  572. overflow: hidden;
  573. }
  574. .scroll_wrapper .el-form{
  575. padding-top: 5px;
  576. padding-right: 5px;
  577. }
  578. .upload-container {
  579. width: 100%;
  580. position: relative;
  581. .image-uploader {
  582. width: 35%;
  583. float: left;
  584. }
  585. .image-preview {
  586. width: 200px;
  587. height: 200px;
  588. position: relative;
  589. border: 1px dashed #d9d9d9;
  590. float: left;
  591. // margin-left: 50px;
  592. .image-preview-wrapper {
  593. position: relative;
  594. width: 100%;
  595. height: 100%;
  596. img {
  597. width: 100%;
  598. height: 100%;
  599. }
  600. }
  601. .image-preview-action {
  602. position: absolute;
  603. width: 100%;
  604. height: 30px;
  605. left: 0;
  606. bottom: 0;
  607. color: #fff;
  608. opacity: 0;
  609. font-size: 20px;
  610. background-color: rgba(0, 0, 0, 0.5);
  611. transition: opacity 0.3s;
  612. cursor: pointer;
  613. text-align: center;
  614. line-height: 30px;
  615. .el-icon-delete {
  616. font-size: 25px;
  617. }
  618. }
  619. &:hover {
  620. .image-preview-action {
  621. opacity: 1;
  622. }
  623. }
  624. }
  625. .image-app-preview {
  626. margin-bottom: 10px;
  627. width: 40vh;
  628. height: 180px;
  629. position: relative;
  630. border: 1px dashed #d9d9d9;
  631. float: left;
  632. // margin-left: 50px;
  633. .app-fake-conver {
  634. height: 44px;
  635. position: absolute;
  636. width: 100%; // background: rgba(0, 0, 0, .1);
  637. text-align: center;
  638. line-height: 64px;
  639. color: #fff;
  640. }
  641. }
  642. }
  643. </style>