style:编辑企业
Showing
5 changed files
with
518 additions
and
55 deletions
| 1 | /* | 1 | /* |
| 2 | * @Description: 企业银行接口 | 2 | * @Description: 企业银行接口 |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-09-07 14:42:19 | 4 | * @LastEditTime: 2023-09-07 16:53:25 |
| 5 | */ | 5 | */ |
| 6 | import request from '@/utils/request' | 6 | import request from '@/utils/request' |
| 7 | let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl')) | 7 | let SERVER = window.config ? window.config : JSON.parse(localStorage.getItem('ApiUrl')) |
| ... | @@ -20,4 +20,44 @@ export function getCompanyMaterialList (bsmCompany) { | ... | @@ -20,4 +20,44 @@ export function getCompanyMaterialList (bsmCompany) { |
| 20 | bsmCompany: bsmCompany | 20 | bsmCompany: bsmCompany |
| 21 | } | 21 | } |
| 22 | }) | 22 | }) |
| 23 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 23 | } | ||
| 24 | /** | ||
| 25 | * @description: 添加材料目录 | ||
| 26 | * @param {*} bsmCompany | ||
| 27 | * @author: renchao | ||
| 28 | */ | ||
| 29 | export function addCompanyMaterial (data) { | ||
| 30 | return request({ | ||
| 31 | url: SERVER.SERVERAPI + '/rest/sys/company/addCompanyMaterial', | ||
| 32 | method: 'post', | ||
| 33 | data | ||
| 34 | }) | ||
| 35 | } | ||
| 36 | |||
| 37 | /** | ||
| 38 | * @description: 获取文件材料列表 | ||
| 39 | * @param {*} bsmCompany | ||
| 40 | * @author: renchao | ||
| 41 | */ | ||
| 42 | export function getFileListByBsmMaterial (bsmMaterial) { | ||
| 43 | return request({ | ||
| 44 | url: SERVER.SERVERAPI + '/rest/sys/company/getFileListByBsmMaterial', | ||
| 45 | method: 'get', | ||
| 46 | params: { | ||
| 47 | bsmMaterial: bsmMaterial | ||
| 48 | } | ||
| 49 | }) | ||
| 50 | } | ||
| 51 | |||
| 52 | /** | ||
| 53 | * @description: 批量上传材料目录 | ||
| 54 | * @param {*} bsmCompany | ||
| 55 | * @author: renchao | ||
| 56 | */ | ||
| 57 | export function uploadBatch (data) { | ||
| 58 | return request({ | ||
| 59 | url: SERVER.SERVERAPI + '/rest/sys/company/uploadBatch', | ||
| 60 | method: 'post', | ||
| 61 | data | ||
| 62 | }) | ||
| 63 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-08-03 14:50:08 | 4 | * @LastEditTime: 2023-09-07 16:28:14 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <transition name="msgbox-fade"> | 7 | <transition name="msgbox-fade"> |
| ... | @@ -167,6 +167,7 @@ | ... | @@ -167,6 +167,7 @@ |
| 167 | min-height: 30%; | 167 | min-height: 30%; |
| 168 | max-height: 90vh; | 168 | max-height: 90vh; |
| 169 | overflow-y: scroll; | 169 | overflow-y: scroll; |
| 170 | box-sizing: border-box; | ||
| 170 | } | 171 | } |
| 171 | 172 | ||
| 172 | .ls-mask-footer { | 173 | .ls-mask-footer { | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-08-15 09:43:46 | 4 | * @LastEditTime: 2023-09-07 16:13:07 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="clmlmx-box"> | 7 | <div class="clmlmx-box"> |
| ... | @@ -209,13 +209,6 @@ | ... | @@ -209,13 +209,6 @@ |
| 209 | this.unitData = this.$parent.unitData; | 209 | this.unitData = this.$parent.unitData; |
| 210 | var formdata = new FormData(); | 210 | var formdata = new FormData(); |
| 211 | formdata.append("bsmSlsq", Vue.prototype.$currentRoute.query.bsmSlsq); | 211 | formdata.append("bsmSlsq", Vue.prototype.$currentRoute.query.bsmSlsq); |
| 212 | if (Vue.prototype.$currentRoute.query.sqywbm == "DJBBL") { | ||
| 213 | formdata.append("bsmSldy", this.formData.bsmRepair); | ||
| 214 | formdata.append("clfl", 3); | ||
| 215 | } else { | ||
| 216 | formdata.append("bsmSldy", this.formData.unitData[0]?.bsmSldy); | ||
| 217 | formdata.append("clfl", 2); | ||
| 218 | } | ||
| 219 | InitClml(formdata).then((res) => { | 212 | InitClml(formdata).then((res) => { |
| 220 | if (res.code == 200) { | 213 | if (res.code == 200) { |
| 221 | resolve(res.code) | 214 | resolve(res.code) | ... | ... |
| 1 | <!-- | ||
| 2 | * @Description: | ||
| 3 | * @Autor: renchao | ||
| 4 | * @LastEditTime: 2023-09-07 16:54:37 | ||
| 5 | --> | ||
| 6 | <template> | ||
| 7 | <div class="rlPopup"> | ||
| 8 | <div class="prev handle-btn" v-if="!isScan" @click="prev()"> | ||
| 9 | <i class="el-icon-arrow-left"></i> | ||
| 10 | </div> | ||
| 11 | <div class="next handle-btn" v-if="!isScan" @click="next()"> | ||
| 12 | <i class="el-icon-arrow-right"></i> | ||
| 13 | </div> | ||
| 14 | <div class="img-list-wrap"> | ||
| 15 | <img src="http://127.0.0.1:38088/video=stream&camidx=0" v-if="isScan" alt="高拍仪"> | ||
| 16 | <div v-for="(img, i) in previewImg.imgList" :key="i" v-else> | ||
| 17 | <photo-zoom :url="img.fjurl" :bigWidth="165" v-if="i === previewImg.index" :scale="2" | ||
| 18 | overlayStyle="width: 100%;height:100%"> | ||
| 19 | </photo-zoom> | ||
| 20 | </div> | ||
| 21 | </div> | ||
| 22 | <!--缩略图--> | ||
| 23 | <div class="thumb-wrap"> | ||
| 24 | <div class="thumb-wrap-button"> | ||
| 25 | <el-button type="primary" @click="clickImage" v-if="previewImg.imgList.length>0">(放大) 显示(缩小)</el-button> | ||
| 26 | <el-upload class="fileUpdate" ref="upload" :key="key" action="" :show-file-list="false" :multiple="true" :auto-upload="false" | ||
| 27 | :on-change="handleChange" | ||
| 28 | accept=".JPG, .PNG, .JPEG,.jpg, .png, .jpeg"> | ||
| 29 | <el-button icon="el-icon-upload" type="primary" v-if="ableOperation">上传</el-button> | ||
| 30 | </el-upload> | ||
| 31 | <!-- 左移右移 --> | ||
| 32 | <el-button type="primary" @click="handleMove('left')" v-if="ableOperation">左移</el-button> | ||
| 33 | <el-button type="primary" @click="handleMove('right')" v-if="ableOperation">右移</el-button> | ||
| 34 | <el-button type="primary" icon="el-icon-delete-solid" @click="handleDelete" | ||
| 35 | v-if="thumbnailImages.length>0 && ableOperation">删除</el-button> | ||
| 36 | <div v-if="ableOperation" class="pl-5"> | ||
| 37 | <el-button type="primary" @click="handleOpenScan" v-if="ableOperation">{{scanTitle}}</el-button> | ||
| 38 | <el-button type="primary" @click="handleViewScan" v-if="isScan && ableOperation">拍照</el-button> | ||
| 39 | </div> | ||
| 40 | </div> | ||
| 41 | <ul> | ||
| 42 | <li v-for="(img, index) in thumbnailImages" :key="index" :class="{ active: previewImg.index === index }" | ||
| 43 | @click="showCurrent(index)"> | ||
| 44 | <img :src="img.fjurl"> | ||
| 45 | </li> | ||
| 46 | </ul> | ||
| 47 | </div> | ||
| 48 | <!-- 点开后的视图 --> | ||
| 49 | <publicPicture v-if="showViewer" :url-list="allLi" :initialIndex="initialIndex" @close-viewer="closeViewer"> | ||
| 50 | </publicPicture> | ||
| 51 | </div> | ||
| 52 | </template> | ||
| 53 | <script> | ||
| 54 | import PhotoZoom from '@/components/PhotoZoom' | ||
| 55 | import { getAltimeterInfo, getUuid } from '@/utils/operation.js' | ||
| 56 | import { uploadBatch, deleteClmx } from "@/api/company.js" | ||
| 57 | import publicPicture from '@/components/publicPicture/index.vue' | ||
| 58 | export default { | ||
| 59 | name: 'PreviewImage', | ||
| 60 | props: { | ||
| 61 | previewImg: { | ||
| 62 | type: Object, | ||
| 63 | default: () => { } | ||
| 64 | }, | ||
| 65 | ableOperation: { | ||
| 66 | type: Boolean, | ||
| 67 | default: true | ||
| 68 | } | ||
| 69 | }, | ||
| 70 | components: { | ||
| 71 | PhotoZoom, | ||
| 72 | publicPicture | ||
| 73 | }, | ||
| 74 | data () { | ||
| 75 | return { | ||
| 76 | key: 0, | ||
| 77 | isScan: false, | ||
| 78 | // 打开高拍仪 | ||
| 79 | scanTitle: '打开高拍仪', | ||
| 80 | transform: { | ||
| 81 | scale: 1, | ||
| 82 | degree: 0 | ||
| 83 | }, | ||
| 84 | maxFileLength: 0, | ||
| 85 | // 缩略图 | ||
| 86 | thumbnailImages: [], | ||
| 87 | showViewer: false, | ||
| 88 | initialIndex: undefined, | ||
| 89 | allLi: [], | ||
| 90 | } | ||
| 91 | }, | ||
| 92 | watch: { | ||
| 93 | previewImg: { | ||
| 94 | handler (newValue, oldValue) { | ||
| 95 | if (newValue.imgList && newValue.imgList.length > 0) { | ||
| 96 | this.allLi = _.cloneDeep(newValue.imgList).map(item => item.fjurl) | ||
| 97 | this.thumbnailImages = newValue.imgList | ||
| 98 | } else { | ||
| 99 | this.allLi = [] | ||
| 100 | this.thumbnailImages = [] | ||
| 101 | } | ||
| 102 | }, | ||
| 103 | deep: true, | ||
| 104 | immediate: true | ||
| 105 | } | ||
| 106 | }, | ||
| 107 | created () { | ||
| 108 | this.maxLength = 0; | ||
| 109 | this.allLi = _.cloneDeep(this.previewImg.imgList).map(item => item.fjurl) | ||
| 110 | this.thumbnailImages = this.previewImg.imgList | ||
| 111 | }, | ||
| 112 | computed: { | ||
| 113 | isFirst () { | ||
| 114 | return this.previewImg.index === 0 | ||
| 115 | }, | ||
| 116 | isLast () { | ||
| 117 | return this.previewImg.index === this.previewImg.imgList.length - 1 | ||
| 118 | } | ||
| 119 | }, | ||
| 120 | methods: { | ||
| 121 | /** | ||
| 122 | * @description: 打开高拍仪 | ||
| 123 | * @author: renchao | ||
| 124 | */ | ||
| 125 | handleOpenScan () { | ||
| 126 | this.isScan = !this.isScan | ||
| 127 | if (this.isScan) { | ||
| 128 | this.$message({ | ||
| 129 | message: '正在启动程序请稍等', | ||
| 130 | type: 'success' | ||
| 131 | }) | ||
| 132 | setTimeout(() => { | ||
| 133 | this.scanTitle = '关闭高拍仪' | ||
| 134 | }, 4000) | ||
| 135 | } else { | ||
| 136 | this.scanTitle = '打开高拍仪' | ||
| 137 | } | ||
| 138 | }, | ||
| 139 | // 左右移动 | ||
| 140 | handleMove (direction) { | ||
| 141 | |||
| 142 | }, | ||
| 143 | /** | ||
| 144 | * @description: 拍照 | ||
| 145 | * @author: renchao | ||
| 146 | */ | ||
| 147 | handleViewScan () { | ||
| 148 | function dataURLtoBlob (base64String) { | ||
| 149 | const arr = base64String.split(','); | ||
| 150 | if (arr.length !== 2) { | ||
| 151 | throw new Error('Invalid Base64 format'); | ||
| 152 | } | ||
| 153 | const mime = arr[0].match(/:(.*?);/)[1]; | ||
| 154 | if (!mime) { | ||
| 155 | throw new Error('Cannot retrieve MIME type'); | ||
| 156 | } | ||
| 157 | const bstr = atob(arr[1]); | ||
| 158 | const n = bstr.length; | ||
| 159 | const u8arr = new Uint8Array(n); | ||
| 160 | for (let i = 0; i < n; i++) { | ||
| 161 | u8arr[i] = bstr.charCodeAt(i); | ||
| 162 | } | ||
| 163 | return new Blob([u8arr], { type: mime }); | ||
| 164 | } | ||
| 165 | function blobToFile (blob) { | ||
| 166 | let name = getUuid(8) + '.jpg' | ||
| 167 | const file = new File([blob], name); | ||
| 168 | return file; | ||
| 169 | } | ||
| 170 | getAltimeterInfo().then(res => { | ||
| 171 | let blob = dataURLtoBlob('data:image/png;base64,' + res.data.photoBase64); | ||
| 172 | let file = blobToFile(blob); | ||
| 173 | var formData = new FormData(); | ||
| 174 | formData.append('file', file) | ||
| 175 | formData.append("bsmMaterial ", this.previewImg.bsmMaterial); | ||
| 176 | formData.append("bsmSlsq", this.previewImg.bsmSlsq); | ||
| 177 | uploadSjClmx(formData).then((res) => { | ||
| 178 | if (res.code == 200) { | ||
| 179 | this.$emit('updateList', res.result) | ||
| 180 | this.$message({ | ||
| 181 | message: '上传成功!', | ||
| 182 | type: 'success' | ||
| 183 | }) | ||
| 184 | } | ||
| 185 | }) | ||
| 186 | }) | ||
| 187 | }, | ||
| 188 | /** | ||
| 189 | * @description: prev | ||
| 190 | * @author: renchao | ||
| 191 | */ | ||
| 192 | prev () { | ||
| 193 | let len = this.previewImg.imgList.length | ||
| 194 | if (this.isFirst || len == 0) { | ||
| 195 | this.$emit('prevPriview') | ||
| 196 | } else { | ||
| 197 | this.$parent.previewImg.index = (this.$parent.previewImg.index - 1 + len) % len | ||
| 198 | } | ||
| 199 | }, | ||
| 200 | /** | ||
| 201 | * @description: next | ||
| 202 | * @author: renchao | ||
| 203 | */ | ||
| 204 | next () { | ||
| 205 | let len = this.previewImg.imgList.length | ||
| 206 | if (this.isLast || len == 0) { | ||
| 207 | this.$emit('nextPriview') | ||
| 208 | } else { | ||
| 209 | this.$parent.previewImg.index = (this.$parent.previewImg.index + 1) % len | ||
| 210 | } | ||
| 211 | }, | ||
| 212 | /** | ||
| 213 | * @description: showCurrent | ||
| 214 | * @param {*} index | ||
| 215 | * @author: renchao | ||
| 216 | */ | ||
| 217 | showCurrent (index) { | ||
| 218 | this.previewImg.index = index | ||
| 219 | }, | ||
| 220 | /** | ||
| 221 | * @description: closeViewer | ||
| 222 | * @author: renchao | ||
| 223 | */ | ||
| 224 | closeViewer () { | ||
| 225 | this.showViewer = false | ||
| 226 | }, | ||
| 227 | /** | ||
| 228 | * @description: clickImage | ||
| 229 | * @author: renchao | ||
| 230 | */ | ||
| 231 | clickImage () { | ||
| 232 | this.showViewer = true | ||
| 233 | }, | ||
| 234 | /** | ||
| 235 | * @description: handleChange | ||
| 236 | * @param {*} file | ||
| 237 | * @param {*} files | ||
| 238 | * @author: renchao | ||
| 239 | */ | ||
| 240 | async handleChange (file, fileList) { | ||
| 241 | let length = fileList.length; | ||
| 242 | this.maxFileLength = Math.max(length, this.maxFileLength) | ||
| 243 | var formData = new FormData(); | ||
| 244 | setTimeout(() => { | ||
| 245 | if (this.maxFileLength !== length) { | ||
| 246 | return | ||
| 247 | } | ||
| 248 | let num = 0, max = 0; | ||
| 249 | const isLt5M = file.size / 1024 / 1024 < 5; | ||
| 250 | fileList.forEach(item => { | ||
| 251 | if (!isLt5M) { | ||
| 252 | max++ | ||
| 253 | } | ||
| 254 | if (!['image/jpeg', 'image/png', 'image/jpg', 'image/gif'].includes(item.raw.type)) { | ||
| 255 | num++ | ||
| 256 | } else { | ||
| 257 | formData.append('file', item.raw) | ||
| 258 | } | ||
| 259 | }) | ||
| 260 | if (num >= 1) { | ||
| 261 | this.$message.error("请选择jpeg/png/jpg/bmp/gif格式的图片后重试") | ||
| 262 | // 移除不支持的文件类型 | ||
| 263 | this.key++ | ||
| 264 | return; | ||
| 265 | } | ||
| 266 | if (max >= 1) { | ||
| 267 | this.$message.error('上传图片大小不能超过 5MB!'); | ||
| 268 | this.key++ | ||
| 269 | return; | ||
| 270 | } | ||
| 271 | formData.append("bsmMaterial ", this.previewImg.bsmMaterial); | ||
| 272 | uploadBatch(formData).then((res) => { | ||
| 273 | if (res.code == 200) { | ||
| 274 | this.$emit('updateList', res.result) | ||
| 275 | this.$message({ | ||
| 276 | message: '上传成功!', | ||
| 277 | type: 'success' | ||
| 278 | }) | ||
| 279 | this.$refs.upload.clearFiles(); | ||
| 280 | this.maxFileLength = 0 | ||
| 281 | } | ||
| 282 | }) | ||
| 283 | }, 0) | ||
| 284 | }, | ||
| 285 | /** | ||
| 286 | * @description: handleDelete | ||
| 287 | * @author: renchao | ||
| 288 | */ | ||
| 289 | handleDelete () { | ||
| 290 | let that = this | ||
| 291 | this.$confirm('此操作将永久删除, 是否继续?', '提示', { | ||
| 292 | confirmButtonText: '确定', | ||
| 293 | cancelButtonText: '取消', | ||
| 294 | type: 'warning' | ||
| 295 | }).then(async () => { | ||
| 296 | let bsmClmx = this.previewImg.imgList[this.previewImg.index].bsmClmx | ||
| 297 | let bsmMaterial = this.previewImg.imgList[this.previewImg.index].bsmMaterial | ||
| 298 | this.previewImg.imgList = this.previewImg.imgList.filter(item => item.bsmClmx != bsmClmx) | ||
| 299 | deleteClmx(bsmClmx).then(res => { | ||
| 300 | if (res.code == 200) { | ||
| 301 | that.$emit('updateList', { children: this.previewImg.imgList, bsmMaterial: bsmMaterial }) | ||
| 302 | that.$message({ | ||
| 303 | message: '删除成功!', | ||
| 304 | type: 'success' | ||
| 305 | }) | ||
| 306 | } | ||
| 307 | }) | ||
| 308 | }).catch(() => { | ||
| 309 | this.$message({ | ||
| 310 | type: 'info', | ||
| 311 | message: '已取消删除' | ||
| 312 | }) | ||
| 313 | }) | ||
| 314 | } | ||
| 315 | } | ||
| 316 | } | ||
| 317 | </script> | ||
| 318 | <style lang="scss" scoped> | ||
| 319 | // 查看大图 | ||
| 320 | .rlPopup { | ||
| 321 | position: relative; | ||
| 322 | width: 100%; | ||
| 323 | text-align: center; | ||
| 324 | height: 100%; | ||
| 325 | |||
| 326 | .handle-btn { | ||
| 327 | position: absolute; | ||
| 328 | top: 50%; | ||
| 329 | transform: translateY(-100%); | ||
| 330 | width: 66px; | ||
| 331 | height: 66px; | ||
| 332 | line-height: 75px; | ||
| 333 | color: #fff; | ||
| 334 | background-color: rgb(239, 239, 239); | ||
| 335 | border-radius: 50%; | ||
| 336 | cursor: pointer; | ||
| 337 | text-align: center; | ||
| 338 | transition: all 0.3s; | ||
| 339 | |||
| 340 | i { | ||
| 341 | font-size: 24px; | ||
| 342 | } | ||
| 343 | } | ||
| 344 | |||
| 345 | .handle-btn:hover { | ||
| 346 | background-color: rgb(185, 183, 183); | ||
| 347 | } | ||
| 348 | |||
| 349 | .prev { | ||
| 350 | left: 1%; | ||
| 351 | } | ||
| 352 | |||
| 353 | .next { | ||
| 354 | right: 1%; | ||
| 355 | } | ||
| 356 | |||
| 357 | .img-list-wrap { | ||
| 358 | width: 100%; | ||
| 359 | display: flex; | ||
| 360 | justify-content: center; | ||
| 361 | height: calc(100% - 80px); | ||
| 362 | align-items: center; | ||
| 363 | background: rgba(194, 190, 190, 0.1); | ||
| 364 | overflow: scroll; | ||
| 365 | |||
| 366 | img { | ||
| 367 | display: block; | ||
| 368 | object-fit: scale-down; | ||
| 369 | transition: all 0.3s; | ||
| 370 | max-width: 100%; | ||
| 371 | } | ||
| 372 | } | ||
| 373 | |||
| 374 | .thumb-wrap { | ||
| 375 | &-button { | ||
| 376 | display: flex; | ||
| 377 | justify-content: center; | ||
| 378 | |||
| 379 | .fileUpdate { | ||
| 380 | margin: 0 10px; | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | li { | ||
| 385 | float: left; | ||
| 386 | width: 60px; | ||
| 387 | height: 45px; | ||
| 388 | border: solid 1px #ececec; | ||
| 389 | position: relative; | ||
| 390 | margin-right: 5px; | ||
| 391 | cursor: pointer; | ||
| 392 | |||
| 393 | &:last-child { | ||
| 394 | margin-right: 0; | ||
| 395 | } | ||
| 396 | |||
| 397 | img { | ||
| 398 | max-width: 57px; | ||
| 399 | max-height: 42px; | ||
| 400 | display: block; | ||
| 401 | object-fit: scale-down; | ||
| 402 | position: absolute; | ||
| 403 | top: 50%; | ||
| 404 | left: 50%; | ||
| 405 | transform: translate(-50%, -50%); | ||
| 406 | } | ||
| 407 | } | ||
| 408 | |||
| 409 | .active { | ||
| 410 | border-color: #409eff; | ||
| 411 | } | ||
| 412 | } | ||
| 413 | } | ||
| 414 | </style> | ||
| 415 | <style> | ||
| 416 | .zoom-on-hover { | ||
| 417 | position: relative; | ||
| 418 | overflow: hidden; | ||
| 419 | } | ||
| 420 | |||
| 421 | .zoom-on-hover .normal { | ||
| 422 | width: 100%; | ||
| 423 | } | ||
| 424 | |||
| 425 | .zoom-on-hover .zoom { | ||
| 426 | position: absolute; | ||
| 427 | opacity: 0; | ||
| 428 | transform-origin: top left; | ||
| 429 | } | ||
| 430 | |||
| 431 | .zoom-on-hover.zoomed .zoom { | ||
| 432 | opacity: 1; | ||
| 433 | } | ||
| 434 | |||
| 435 | .zoom-on-hover.zoomed .normal { | ||
| 436 | opacity: 0; | ||
| 437 | } | ||
| 438 | </style> |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Description: | 2 | * @Description: |
| 3 | * @Autor: renchao | 3 | * @Autor: renchao |
| 4 | * @LastEditTime: 2023-09-07 15:06:42 | 4 | * @LastEditTime: 2023-09-07 16:54:32 |
| 5 | --> | 5 | --> |
| 6 | <template> | 6 | <template> |
| 7 | <div class="clxx"> | 7 | <div class="clxx"> |
| ... | @@ -29,12 +29,11 @@ | ... | @@ -29,12 +29,11 @@ |
| 29 | </div> | 29 | </div> |
| 30 | <div | 30 | <div |
| 31 | v-for="(item, index) in tableData" | 31 | v-for="(item, index) in tableData" |
| 32 | :key="item.bsmSj" | 32 | :key="item.bsmMaterial" |
| 33 | :class="['child', treeCheckId == item.bsmSj ? 'checked' : '']" | 33 | :class="['child', treeCheckId == item.bsmMaterial ? 'checked' : '']" |
| 34 | @click="treeClick(item, index)"> | 34 | @click="treeClick(item, index)"> |
| 35 | <span v-if="item.isrequired == 1" class="required">必选</span> | 35 | {{ item.clmc }} |
| 36 | {{ item.sjmc }} | 36 | <span class="cl_number" :key="key">({{ item.sxh }})</span> |
| 37 | <span class="cl_number" :key="key">({{ item.children ? item.children.length : 0 }})</span> | ||
| 38 | </div> | 37 | </div> |
| 39 | </div> | 38 | </div> |
| 40 | </div> | 39 | </div> |
| ... | @@ -60,8 +59,8 @@ | ... | @@ -60,8 +59,8 @@ |
| 60 | import store from '@/store/index.js' | 59 | import store from '@/store/index.js' |
| 61 | import clxxAddDialog from "./dialog/clxxAddDialog.vue"; | 60 | import clxxAddDialog from "./dialog/clxxAddDialog.vue"; |
| 62 | import clxxDetailDialog from "./dialog/clxxDetailDialog.vue"; | 61 | import clxxDetailDialog from "./dialog/clxxDetailDialog.vue"; |
| 63 | import imagePreview from "@/views/components/imagePreview.vue"; | 62 | import imagePreview from "./dialog/imagePreview.vue"; |
| 64 | import { getCompanyMaterialList } from "@/api/company.js"; | 63 | import { getCompanyMaterialList, addCompanyMaterial, getFileListByBsmMaterial } from "@/api/company.js"; |
| 65 | export default { | 64 | export default { |
| 66 | components: { clxxAddDialog, imagePreview, clxxDetailDialog }, | 65 | components: { clxxAddDialog, imagePreview, clxxDetailDialog }, |
| 67 | props: { | 66 | props: { |
| ... | @@ -82,9 +81,7 @@ | ... | @@ -82,9 +81,7 @@ |
| 82 | key: 0, | 81 | key: 0, |
| 83 | tableData: [], | 82 | tableData: [], |
| 84 | previewImg: { | 83 | previewImg: { |
| 85 | // 收件标识码 | 84 | bsmMaterial: "", |
| 86 | bsmSj: "", | ||
| 87 | bsmSlsq: this.$parent.bsmSlsq, | ||
| 88 | index: 0, | 85 | index: 0, |
| 89 | selectedIndex: 0, | 86 | selectedIndex: 0, |
| 90 | imgList: [], | 87 | imgList: [], |
| ... | @@ -102,10 +99,10 @@ | ... | @@ -102,10 +99,10 @@ |
| 102 | nextPriview () { | 99 | nextPriview () { |
| 103 | if (this.treeCheckIndex < this.tableData.length) { | 100 | if (this.treeCheckIndex < this.tableData.length) { |
| 104 | this.treeCheckIndex++; | 101 | this.treeCheckIndex++; |
| 105 | this.treeCheckId = this.tableData[this.treeCheckIndex].bsmSj; | 102 | this.treeCheckId = this.tableData[this.treeCheckIndex].bsmMaterial; |
| 106 | this.previewImg.index = 0; | 103 | this.previewImg.index = 0; |
| 107 | this.previewImg.imgList = this.tableData[this.treeCheckIndex].children; | 104 | this.previewImg.imgList = this.tableData[this.treeCheckIndex].children; |
| 108 | this.previewImg.bsmSj = this.tableData[this.treeCheckIndex].bsmSj; | 105 | this.previewImg.bsmMaterial = this.tableData[this.treeCheckIndex].bsmMaterial; |
| 109 | } | 106 | } |
| 110 | }, | 107 | }, |
| 111 | /** | 108 | /** |
| ... | @@ -115,10 +112,10 @@ | ... | @@ -115,10 +112,10 @@ |
| 115 | prevPriview () { | 112 | prevPriview () { |
| 116 | if (this.treeCheckIndex >= 1) { | 113 | if (this.treeCheckIndex >= 1) { |
| 117 | this.treeCheckIndex--; | 114 | this.treeCheckIndex--; |
| 118 | this.treeCheckId = this.tableData[this.treeCheckIndex].bsmSj; | 115 | this.treeCheckId = this.tableData[this.treeCheckIndex].bsmMaterial; |
| 119 | this.previewImg.index = this.previewImg.imgList.length; | 116 | this.previewImg.index = this.previewImg.imgList.length; |
| 120 | this.previewImg.imgList = this.tableData[this.treeCheckIndex].children; | 117 | this.previewImg.imgList = this.tableData[this.treeCheckIndex].children; |
| 121 | this.previewImg.bsmSj = this.tableData[this.treeCheckIndex].bsmSj; | 118 | this.previewImg.bsmMaterial = this.tableData[this.treeCheckIndex].bsmMaterial; |
| 122 | } | 119 | } |
| 123 | }, | 120 | }, |
| 124 | /** | 121 | /** |
| ... | @@ -156,12 +153,12 @@ | ... | @@ -156,12 +153,12 @@ |
| 156 | * @author: renchao | 153 | * @author: renchao |
| 157 | */ | 154 | */ |
| 158 | setChecked (item) { | 155 | setChecked (item) { |
| 159 | this.treeCheckId = item.bsmSj; | 156 | this.treeCheckId = item.bsmMaterial; |
| 160 | this.title = item.sjmc; | 157 | this.title = item.sjmc; |
| 161 | this.titleYs = 1; | 158 | this.titleYs = 1; |
| 162 | this.titleNum = item.children.length; | 159 | this.titleNum = item.children.length; |
| 163 | this.previewImg.imgList = item.children; | 160 | // this.previewImg.imgList = item.children; |
| 164 | this.previewImg.bsmSj = item.bsmSj; | 161 | this.previewImg.bsmMaterial = item.bsmMaterial; |
| 165 | }, | 162 | }, |
| 166 | /** | 163 | /** |
| 167 | * @description: updateList | 164 | * @description: updateList |
| ... | @@ -173,7 +170,7 @@ | ... | @@ -173,7 +170,7 @@ |
| 173 | if (val.children.length != 0) { | 170 | if (val.children.length != 0) { |
| 174 | //删除最后一张图片时 val=null | 171 | //删除最后一张图片时 val=null |
| 175 | this.tableData.forEach((item) => { | 172 | this.tableData.forEach((item) => { |
| 176 | if (item.bsmSj === val.bsmSj) { | 173 | if (item.bsmMaterial === val.bsmMaterial) { |
| 177 | item.children = val.children; | 174 | item.children = val.children; |
| 178 | } | 175 | } |
| 179 | }); | 176 | }); |
| ... | @@ -185,11 +182,11 @@ | ... | @@ -185,11 +182,11 @@ |
| 185 | } else { | 182 | } else { |
| 186 | this.previewImg.imgList = []; | 183 | this.previewImg.imgList = []; |
| 187 | this.tableData.forEach((item, index) => { | 184 | this.tableData.forEach((item, index) => { |
| 188 | if (this.treeCheckId == item.bsmSj) { | 185 | if (this.treeCheckId == item.bsmMaterial) { |
| 189 | item.children = []; | 186 | item.children = []; |
| 190 | that.treeCheckIndex = index; | 187 | that.treeCheckIndex = index; |
| 191 | } | 188 | } |
| 192 | }); | 189 | }) |
| 193 | } | 190 | } |
| 194 | }, | 191 | }, |
| 195 | /** | 192 | /** |
| ... | @@ -206,28 +203,20 @@ | ... | @@ -206,28 +203,20 @@ |
| 206 | */ | 203 | */ |
| 207 | addSave (data) { | 204 | addSave (data) { |
| 208 | let obj = { | 205 | let obj = { |
| 209 | bsmSlsq: this.$parent.bsmSlsq, | 206 | bsmCompany: this.formData.bsmCompany, |
| 210 | isrequired: "1", | 207 | clmc: data.clmc, |
| 211 | sjmc: data.clmc, | 208 | cllx: data.cllx |
| 212 | sjsl: 0, | ||
| 213 | smzt: "", | ||
| 214 | ys: 0, | ||
| 215 | sjlx: data.cllx, | ||
| 216 | sfxjcl: "1", // 是否必选 | ||
| 217 | }; | 209 | }; |
| 218 | if (this.$route.query.sqywbm == "DJBBL") { | 210 | addCompanyMaterial(obj).then(async (res) => { |
| 219 | obj.bsmSldy = this.$parent.bsmRepair | ||
| 220 | } | ||
| 221 | saveClml(obj).then(async (res) => { | ||
| 222 | if (res.code == 200) { | 211 | if (res.code == 200) { |
| 223 | let res = await this.clmlInitList(2); | 212 | let res = await this.clmlInitList(2); |
| 224 | if (res == 200) | 213 | if (res == 200) |
| 225 | this.$message({ | 214 | this.$message({ |
| 226 | message: "新增成功", | 215 | message: "新增成功", |
| 227 | type: "success", | 216 | type: "success" |
| 228 | }); | 217 | }) |
| 229 | } | 218 | } |
| 230 | }); | 219 | }) |
| 231 | }, | 220 | }, |
| 232 | /** | 221 | /** |
| 233 | * @description: 材料目录点击选中 | 222 | * @description: 材料目录点击选中 |
| ... | @@ -237,10 +226,12 @@ | ... | @@ -237,10 +226,12 @@ |
| 237 | */ | 226 | */ |
| 238 | treeClick (item, index) { | 227 | treeClick (item, index) { |
| 239 | this.previewImg.index = 0; | 228 | this.previewImg.index = 0; |
| 240 | this.treeCheckId = item?.bsmSj; | 229 | this.treeCheckId = item?.bsmMaterial; |
| 241 | this.treeCheckIndex = index; | 230 | this.treeCheckIndex = index; |
| 242 | this.previewImg.imgList = item.children ? item.children : []; | 231 | getFileListByBsmMaterial(item.bsmMaterial).then(res => { |
| 243 | this.previewImg.bsmSj = item?.bsmSj; | 232 | this.previewImg.imgList = res.result ? res.result : [] |
| 233 | }) | ||
| 234 | this.previewImg.bsmMaterial = item?.bsmMaterial; | ||
| 244 | }, | 235 | }, |
| 245 | /** | 236 | /** |
| 246 | * @description: 小图片点击 | 237 | * @description: 小图片点击 |
| ... | @@ -269,14 +260,13 @@ | ... | @@ -269,14 +260,13 @@ |
| 269 | setTableData (tableData) { | 260 | setTableData (tableData) { |
| 270 | this.$nextTick((res) => { | 261 | this.$nextTick((res) => { |
| 271 | this.tableData = tableData; | 262 | this.tableData = tableData; |
| 272 | }); | 263 | }) |
| 273 | }, | 264 | } |
| 274 | }, | 265 | } |
| 275 | }; | 266 | } |
| 276 | </script> | 267 | </script> |
| 277 | <style scoped lang="scss"> | 268 | <style scoped lang="scss"> |
| 278 | @import "~@/styles/mixin.scss"; | 269 | @import "~@/styles/mixin.scss"; |
| 279 | |||
| 280 | .active { | 270 | .active { |
| 281 | background: $light-blue !important; | 271 | background: $light-blue !important; |
| 282 | color: #fff; | 272 | color: #fff; |
| ... | @@ -294,6 +284,7 @@ | ... | @@ -294,6 +284,7 @@ |
| 294 | 284 | ||
| 295 | .clxx { | 285 | .clxx { |
| 296 | width: 100%; | 286 | width: 100%; |
| 287 | height: 94%; | ||
| 297 | display: flex; | 288 | display: flex; |
| 298 | padding-left: 5px; | 289 | padding-left: 5px; |
| 299 | .left { | 290 | .left { | ... | ... |
-
Please register or sign in to post a comment