a230d2a2a043a967bac74b2c9915a0ea8c3a5dda.svn-base 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681
  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.nm" 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-tab-pane :label="filetabName">
  135. <el-table border :data="fileArray" style="width: 100%;margin: 0 auto;">
  136. <el-table-column header-align="center" align="center" label="文档">
  137. <template slot-scope="scope">
  138. <p>
  139. <a :href="`${hostUrl}/${scope.row.filePath}`" target="_blank" rel="noopener noreferrer">
  140. {{scope.row.fileName}}
  141. </a>
  142. </p>
  143. </template>
  144. </el-table-column>
  145. <el-table-column header-align="center" align="center" label="操作">
  146. <template slot-scope="scope">
  147. <el-button
  148. size="mini"
  149. @click="removeFile(scope.row.id,scope.$index)"
  150. type="danger"
  151. >删除</el-button>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. </el-tab-pane>
  156. </el-tabs>
  157. </div>
  158. </div>
  159. <span slot="footer">
  160. <el-button type="primary" @click="changeSupervisionInfo" :loding="changeSupervisionLoading">保存</el-button>
  161. <el-button @click="changeSupervisionVisiblefalse">取消</el-button>
  162. </span>
  163. </el-dialog>
  164. </template>
  165. <script>
  166. import {showDetailsXq,updatelist,deleteFileById} from "@api/duChaAPI.js";
  167. import request from "@util/gw_ajax_request.js";
  168. import {hostUrl} from '@util/global_variable'
  169. import Viewer from 'viewerjs';
  170. import 'viewerjs/dist/viewer.css';
  171. export default {
  172. props: ['editId'],
  173. data(){
  174. return{
  175. changeSupervisionVisible: true,
  176. changeSupervisionLoading: false,
  177. changeSupervision: {},
  178. rules1: {
  179. inspPblmName: [
  180. {
  181. required: true,
  182. message: "请输入问题名称",
  183. trigger: "blur"
  184. },
  185. {
  186. min: 1,
  187. max: 999,
  188. message: "不超过100字符",
  189. trigger: "blur"
  190. }
  191. ],
  192. inspPblmDesc: [
  193. {
  194. required: true,
  195. message: "请输入问题描述",
  196. trigger: "blur"
  197. }
  198. ],
  199. recPers: [
  200. {
  201. required: true,
  202. message: "请输入记录人",
  203. trigger: "blur"
  204. },
  205. {
  206. min: 1,
  207. max: 999,
  208. message: "不超过100字符",
  209. trigger: "blur"
  210. }
  211. ],
  212. objType: [
  213. {
  214. required: true,
  215. message: "请选择督查对象类型",
  216. trigger: "change"
  217. }
  218. ],
  219. objId: [
  220. {
  221. required: true,
  222. message: "请选择督查对象类型",
  223. trigger: "change"
  224. }
  225. ],
  226. inspPblmType: [
  227. {
  228. required: true,
  229. message: "请选择督查问题类型",
  230. trigger: "change"
  231. }
  232. ],
  233. dataStat: [
  234. {
  235. required: true,
  236. message: "请选择数据状态",
  237. trigger: "change"
  238. }
  239. ],
  240. collTime: [
  241. {
  242. required: true,
  243. message: "请选择采集时间",
  244. trigger: "change"
  245. }
  246. ],
  247. ifCasePblm: [
  248. {
  249. required: true,
  250. message: "请选择是否典型",
  251. trigger: "change"
  252. }
  253. ],
  254. pblmStat: [
  255. {
  256. required: true,
  257. message: "请选择问题类型",
  258. trigger: "change"
  259. }
  260. ],
  261. inspPblmCate: [
  262. {
  263. required: true,
  264. message: "请选择问题程度",
  265. trigger: "change"
  266. },
  267. {
  268. trigger: "change"
  269. }
  270. ]
  271. },
  272. supervisionState: [
  273. {
  274. value: "0",
  275. label: "一般"
  276. },
  277. {
  278. value: "1",
  279. label: "较重"
  280. },
  281. {
  282. value: "2",
  283. label: "严重"
  284. },
  285. {
  286. value: "3",
  287. label: "特别严重"
  288. }
  289. ],
  290. supervision: [
  291. {
  292. value: "1",
  293. label: "是"
  294. },
  295. {
  296. value: "0",
  297. label: "否"
  298. }
  299. ],
  300. addPicPanel: false,
  301. gwComFiles: [],
  302. picturetabName: "",
  303. audiotabName: "",
  304. videotabName: "",
  305. filetabName: "",
  306. pictureArray: [],
  307. audioArray: [],
  308. videoArray: [],
  309. fileArray:[],
  310. updateIdXiuGai: "",
  311. pblmId: "",
  312. t1: {},
  313. t2: {},
  314. t3: {},
  315. problemList: [],
  316. currentCheckPointList: [],
  317. currentProblemDescList: [],
  318. xiangqingmiaoshu: '',
  319. wenTiLeiBie:"",
  320. jianChaXiangMu:"",
  321. }
  322. },
  323. components:{
  324. upload: resolve => {
  325. require(["@widget/uploadFile.vue"], resolve);
  326. },
  327. },
  328. computed:{
  329. hostUrl(){
  330. return hostUrl
  331. },
  332. persId() {
  333. return localStorage.getItem("userid") ? localStorage.getItem("userid") : "1098101939614724096";
  334. }
  335. },
  336. mounted(){
  337. this.getproblemSmallType();
  338. },
  339. methods:{
  340. // 修改弹窗显示
  341. changeSup(id) {
  342. this.pictureArray = [];
  343. this.audioArray = [];
  344. this.videoArray = [];
  345. this.fileArray = [];
  346. this.updateIdXiuGai = id;
  347. let _this = this
  348. showDetailsXq(this.updateIdXiuGai).then(res => {
  349. // if(this.usersId==)
  350. this.changeSupervision = res.data;
  351. this.t1['inspPblmsName'] = this.changeSupervision.inspPblmsName
  352. this.problemList.forEach(ele=>{
  353. if(ele.inspPblmsName == _this.t1.inspPblmsName){
  354. _this.problemListChange(ele)
  355. }
  356. })
  357. this.t2['checkPointName'] = this.changeSupervision.checkPoint
  358. this.currentCheckPointList.forEach(ele=>{
  359. if(ele.checkPointName == _this.t2.checkPointName){
  360. _this.currentCheckPointListChange(ele)
  361. }
  362. })
  363. this.t3['pblmDesc'] = this.changeSupervision.pblmDesc
  364. res.data.gwComFiles.forEach(item => {
  365. if (
  366. item.fileExt == "mp3" ||
  367. item.fileExt == "MP3" ||
  368. item.fileExt == "m4a"
  369. ) {
  370. this.audioArray.push(item);
  371. } else if (
  372. item.fileExt == "jpg" ||
  373. item.fileExt == "JPG" ||
  374. item.fileExt == "png" ||
  375. item.fileExt == "PNG" ||
  376. item.fileExt == "JPEG" ||
  377. item.fileExt == "jpeg"
  378. ) {
  379. this.pictureArray.push(item);
  380. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  381. this.videoArray.push({
  382. id: item.id,
  383. bizId: item.bizId,
  384. width: "130",
  385. height: "130",
  386. autoplay: false,
  387. muted: true,
  388. language: "en",
  389. playbackRates: [0.7, 1.0, 1.5, 2.0],
  390. sources: [
  391. {
  392. type: "video/mp4",
  393. src: this.hostUrl + item.filePath
  394. }
  395. ]
  396. });
  397. }else{
  398. this.fileArray.push(item);
  399. }
  400. });
  401. _this.$nextTick(function(){
  402. var ViewerDom = document.getElementById('imgView');
  403. var viewer = new Viewer(ViewerDom, {})
  404. });
  405. this.picturetabName = "图片资料(" + this.pictureArray.length + ")";
  406. this.audiotabName = "音频资料(" + this.audioArray.length + ")";
  407. this.videotabName = "视频资料(" + this.videoArray.length + ")";
  408. this.filetabName = "其它资料(" + this.fileArray.length + ")";
  409. });
  410. },
  411. // 提交修改信息
  412. changeSupervisionInfo() {
  413. console.log(this)
  414. var _self = this;
  415. this.$refs.changeSupFrom.validate(valid => {
  416. if (valid) {
  417. this.$nextTick(()=>{
  418. if (_self.$refs.uploadFile.submitUpload(_self.changeSupervision.pblmId)) {
  419. _self.removeNewSupervision();
  420. }
  421. setTimeout(()=>{
  422. _self.changeSupervisionLoading = true;
  423. _self.changeSupervision.checkPoint = _self.jianChaXiangMu
  424. _self.changeSupervision.inspPblmName = _self.wenTiLeiBie
  425. _self.changeSupervision.inspPlbmType = _self.t2.sort2;
  426. _self.changeSupervision.pblmsTypeId = _self.t2.guid;
  427. _self.changeSupervision.gwComFiles = _self.gwComFiles;
  428. let data = _self.changeSupervision;
  429. updatelist(data).then(res => {
  430. _self.pblmId = res.data.pblmId;
  431. _self.gwComFiles = res.data.gwComFiles;
  432. if (res.success) {
  433. _self.changeSupervisionLoading = false;
  434. _self.successInfo();
  435. _self.addPicPanel = false;
  436. } else {
  437. _self.failInfo();
  438. _self.$emit('closeEditDialog')
  439. }
  440. });
  441. },500)
  442. })
  443. }
  444. });
  445. },
  446. removeNewSupervision(arg) {
  447. this.gwComFiles = [];
  448. if (arg) {
  449. this.gwComFiles = arg;
  450. this.$refs.uploadFile.init();
  451. }
  452. // this.changeSup(this.editId)
  453. // this.$emit('closeEditDialog','success')
  454. },
  455. changeSupervisionVisiblefalse() {
  456. this.$emit('closeEditDialog')
  457. this.$refs.uploadFile.init();
  458. this.addPicPanel = false;
  459. },
  460. addPic() {
  461. this.addPicPanel = !this.addPicPanel;
  462. },
  463. // 删除图片文件
  464. removeFile(id, index) {
  465. // this.updateIdXiuGai = this.updateIdXiuGai;
  466. var _self = this;
  467. this.$confirm("此操作将永久删除该文件, 是否继续?", "提示", {
  468. confirmButtonText: "确定",
  469. cancelButtonText: "返回",
  470. type: "warning"
  471. }).then(
  472. res => {
  473. if (res === "confirm") {
  474. deleteFileById(id, this.persId).then(res => {
  475. if (res.success) {
  476. this.changeSupervision.gwComFiles.forEach(item => {
  477. if (
  478. item.fileExt == "mp3" ||
  479. item.fileExt == "MP3" ||
  480. item.fileExt == "m4a"
  481. ) {
  482. this.audiotabName.splice(index, 1);
  483. } else if (
  484. item.fileExt == "jpg" ||
  485. item.fileExt == "JPG" ||
  486. item.fileExt == "png" ||
  487. item.fileExt == "PNG" ||
  488. item.fileExt == "JPEG" ||
  489. item.fileExt == "jpeg"
  490. ) {
  491. this.pictureArray.splice(index, 1);
  492. } else if (item.fileExt == "mp4" || item.fileExt == "MP4") {
  493. this.videoArray.splice(index, 1);
  494. }
  495. });
  496. _self.changeSup(this.updateIdXiuGai);
  497. } else {
  498. this.failInfo();
  499. }
  500. });
  501. }
  502. },
  503. res => {
  504. console.log("返回");
  505. }
  506. )
  507. },
  508. // 操作成功反馈
  509. successInfo() {
  510. this.$message({
  511. type: "success",
  512. message: "操作成功!"
  513. });
  514. this.$emit('closeEditDialog','success');
  515. },
  516. // 操作失败反馈
  517. failInfo(val) {
  518. this.$message.error(val);
  519. },
  520. // 文件上传
  521. submitUpload() {
  522. this.$refs.upload.submit();
  523. },
  524. closeModal(){
  525. this.$emit('closeEditDialog')
  526. },
  527. getproblemSmallType() {
  528. let result = [];
  529. request.get('/dc/insp/pblms/getPblmType', {
  530. params: {
  531. type: 42,
  532. pguid: `42000000000000000000000000000000`
  533. }
  534. }).then(res => {
  535. if (res.success) {
  536. res.data.forEach((ele) => {
  537. let haveinspPblmsName = false;
  538. result.forEach((inspPblm) => {
  539. if (inspPblm['inspPblmsName'] == ele.inspPblmsName) {
  540. //
  541. let havechekPoint = false;
  542. inspPblm['checkPoints'].forEach((chekPoint) => {
  543. if (chekPoint['checkPointName'] == ele.checkPoint) {
  544. havechekPoint = true;
  545. }
  546. });
  547. if (!havechekPoint) {
  548. let newCheckPoint = {};
  549. newCheckPoint['checkPointName'] = ele.checkPoint;
  550. newCheckPoint['sort2'] = ele.sort2;
  551. newCheckPoint['guid'] = ele.guid
  552. inspPblm['checkPoints'].push(newCheckPoint);
  553. }
  554. haveinspPblmsName = true;
  555. }
  556. });
  557. if (!haveinspPblmsName) {
  558. let haveinspPblmsObj = {};
  559. haveinspPblmsObj['inspPblmsName'] = ele.inspPblmsName;
  560. haveinspPblmsObj['sort1'] = ele.sort1;
  561. haveinspPblmsObj['checkPoints'] = [{
  562. checkPointName: ele.checkPoint,
  563. sort2: ele.sort2,
  564. guid: ele.guid
  565. }];
  566. result.push(haveinspPblmsObj);
  567. }
  568. })
  569. this.problemList = result;
  570. this.changeSup(this.editId)
  571. }
  572. })
  573. },
  574. problemListChange: function (item) {
  575. this.t1 = item
  576. this.wenTiLeiBie = item.inspPblmsName;
  577. this.currentCheckPointList = item.checkPoints;
  578. },
  579. currentCheckPointListChange: function (item) {
  580. this.jianChaXiangMu = item.checkPointName;
  581. this.currentProblemDescList = item.pblmDescs;
  582. },
  583. currentProblemDescListChange: function (item) {
  584. this.xiangqingmiaoshu = item.pblmDesc;
  585. console.log(item);
  586. },
  587. },
  588. watch:{
  589. editId(val){
  590. this.changeSup(val)
  591. },
  592. 't3': {
  593. handler: function (val, oldVal) {
  594. },
  595. deep: true
  596. },
  597. }
  598. }
  599. </script>
  600. <style scoped lang="scss">
  601. .scroll_wrapper{
  602. overflow: hidden;
  603. }
  604. .scroll_wrapper .el-form{
  605. padding-top: 5px;
  606. padding-right: 5px;
  607. }
  608. .upload-container {
  609. width: 100%;
  610. position: relative;
  611. .image-uploader {
  612. width: 35%;
  613. float: left;
  614. }
  615. .image-preview {
  616. width: 200px;
  617. height: 200px;
  618. position: relative;
  619. border: 1px dashed #d9d9d9;
  620. float: left;
  621. // margin-left: 50px;
  622. .image-preview-wrapper {
  623. position: relative;
  624. width: 100%;
  625. height: 100%;
  626. img {
  627. width: 100%;
  628. height: 100%;
  629. }
  630. }
  631. .image-preview-action {
  632. position: absolute;
  633. width: 100%;
  634. height: 30px;
  635. left: 0;
  636. bottom: 0;
  637. color: #fff;
  638. opacity: 0;
  639. font-size: 20px;
  640. background-color: rgba(0, 0, 0, 0.5);
  641. transition: opacity 0.3s;
  642. cursor: pointer;
  643. text-align: center;
  644. line-height: 30px;
  645. .el-icon-delete {
  646. font-size: 25px;
  647. }
  648. }
  649. &:hover {
  650. .image-preview-action {
  651. opacity: 1;
  652. }
  653. }
  654. }
  655. .image-app-preview {
  656. margin-bottom: 10px;
  657. width: 40vh;
  658. height: 180px;
  659. position: relative;
  660. border: 1px dashed #d9d9d9;
  661. float: left;
  662. // margin-left: 50px;
  663. .app-fake-conver {
  664. height: 44px;
  665. position: absolute;
  666. width: 100%; // background: rgba(0, 0, 0, .1);
  667. text-align: center;
  668. line-height: 64px;
  669. color: #fff;
  670. }
  671. }
  672. }
  673. </style>