d85a489d by 任超

style:材料预览

1 parent c9f6c360
...@@ -87,33 +87,19 @@ export default { ...@@ -87,33 +87,19 @@ export default {
87 }, 87 },
88 methods: { 88 methods: {
89 prev () { 89 prev () {
90 if (this.isFirst) {
91 if (this.previewImg.selectedIndex - 1 >= 0) {
92 this.$parent.previewImg.index = 1
93 }
94 return
95 }
96 let len = this.previewImg.imgList.length 90 let len = this.previewImg.imgList.length
97 this.$parent.previewImg.index = (this.$parent.previewImg.index - 1 + len) % len 91 if (this.isFirst || len == 0) {
98 this.reset() 92 this.$emit('prevPriview')
99 },
100 next () {
101 if (this.isLast) {
102 if (this.previewImg.selectedIndex + 1 < this.previewImg.attachmentList.length) {
103 this.$parent.previewImg.index = 0
104 }
105 return
106 } else { 93 } else {
107 console.log(this.$parent.previewImg.selectedIndex); 94 this.$parent.previewImg.index = (this.$parent.previewImg.index - 1 + len) % len
108 } 95 }
109 let len = this.previewImg.imgList.length
110 this.$parent.previewImg.index = (this.$parent.previewImg.index + 1) % len
111 this.reset()
112 }, 96 },
113 reset () { 97 next () {
114 this.transform = { 98 let len = this.previewImg.imgList.length
115 scale: 1, 99 if (this.isLast || len == 0) {
116 degree: 0 100 this.$emit('nextPriview')
101 } else {
102 this.$parent.previewImg.index = (this.$parent.previewImg.index + 1) % len
117 } 103 }
118 }, 104 },
119 showCurrent (index) { 105 showCurrent (index) {
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
19 <div class="item"> 19 <div class="item">
20 材料目录({{tableData.length}}) 20 材料目录({{tableData.length}})
21 <div> 21 <div>
22 <div v-for="item in tableData" :key="item.bsmSj" 22 <div v-for="(item,index) in tableData" :key="item.bsmSj"
23 :class="['child', treeCheckId == item.bsmSj ? 'checked' : '']" @click="treeClick(item)"> 23 :class="['child', treeCheckId == item.bsmSj ? 'checked' : '']" @click="treeClick(item,index)">
24 <span v-if="item.isrequired==1" class="required">必选</span> 24 <span v-if="item.isrequired==1" class="required">必选</span>
25 {{ item.sjmc }} 25 {{ item.sjmc }}
26 <span class="cl_number">({{item.children.length}})</span> 26 <span class="cl_number">({{item.children.length}})</span>
...@@ -28,7 +28,8 @@ ...@@ -28,7 +28,8 @@
28 </div> 28 </div>
29 </div> 29 </div>
30 </div> 30 </div>
31 <image-preview ref='imageRef' :previewImg="previewImg" @updateList="updateList" /> 31 <image-preview ref='imageRef' :previewImg="previewImg" @updateList="updateList" @nextPriview="nextPriview"
32 @prevPriview="prevPriview" />
32 </div> 33 </div>
33 </div> 34 </div>
34 <clxxAddDialog v-model="isDialog" /> 35 <clxxAddDialog v-model="isDialog" />
...@@ -56,6 +57,7 @@ export default { ...@@ -56,6 +57,7 @@ export default {
56 ], 57 ],
57 iclass: "", 58 iclass: "",
58 // 材料目录选中 59 // 材料目录选中
60 treeCheckIndex: 0,
59 treeCheckId: "", 61 treeCheckId: "",
60 checkedId: "1", 62 checkedId: "1",
61 column: [ 63 column: [
...@@ -205,6 +207,25 @@ export default { ...@@ -205,6 +207,25 @@ export default {
205 this.clmlInitList() 207 this.clmlInitList()
206 }, 208 },
207 methods: { 209 methods: {
210 // 自动预览
211 nextPriview () {
212 if (this.treeCheckIndex < this.tableData.length) {
213 this.treeCheckIndex++
214 this.treeCheckId = this.tableData[this.treeCheckIndex].bsmSj
215 this.previewImg.index = 0
216 this.previewImg.imgList = this.tableData[this.treeCheckIndex].children
217 this.previewImg.bsmSj = this.tableData[this.treeCheckIndex].bsmSj
218 }
219 },
220 prevPriview () {
221 if (this.treeCheckIndex >= 1) {
222 this.treeCheckIndex--
223 this.treeCheckId = this.tableData[this.treeCheckIndex].bsmSj
224 this.previewImg.index = this.previewImg.imgList.length
225 this.previewImg.imgList = this.tableData[this.treeCheckIndex].children
226 this.previewImg.bsmSj = this.tableData[this.treeCheckIndex].bsmSj
227 }
228 },
208 // 材料目录明细初始化 229 // 材料目录明细初始化
209 clmlInitList () { 230 clmlInitList () {
210 return new Promise(resolve => { 231 return new Promise(resolve => {
...@@ -228,6 +249,7 @@ export default { ...@@ -228,6 +249,7 @@ export default {
228 }) 249 })
229 }, 250 },
230 updateList (val) { 251 updateList (val) {
252 let that = this
231 if (val != null) { //删除最后一张图片时 val=null 253 if (val != null) { //删除最后一张图片时 val=null
232 this.tableData.forEach(item => { 254 this.tableData.forEach(item => {
233 if (item.bsmSj === val.bsmSj) { 255 if (item.bsmSj === val.bsmSj) {
...@@ -240,9 +262,10 @@ export default { ...@@ -240,9 +262,10 @@ export default {
240 } 262 }
241 } else { 263 } else {
242 this.previewImg.imgList = [] 264 this.previewImg.imgList = []
243 this.tableData.forEach(item => { 265 this.tableData.forEach((item, index) => {
244 if (this.treeCheckId == item.bsmSj) { 266 if (this.treeCheckId == item.bsmSj) {
245 item.children = [] 267 item.children = []
268 that.treeCheckIndex = index
246 } 269 }
247 }) 270 })
248 } 271 }
...@@ -343,9 +366,10 @@ export default { ...@@ -343,9 +366,10 @@ export default {
343 }) 366 })
344 }, 367 },
345 // 材料目录点击选中 368 // 材料目录点击选中
346 treeClick (item) { 369 treeClick (item, index) {
347 this.previewImg.index = 0 370 this.previewImg.index = 0
348 this.treeCheckId = item.bsmSj 371 this.treeCheckId = item?.bsmSj
372 this.treeCheckIndex = index
349 this.previewImg.imgList = item?.children 373 this.previewImg.imgList = item?.children
350 this.previewImg.bsmSj = item?.bsmSj 374 this.previewImg.bsmSj = item?.bsmSj
351 }, 375 },
...@@ -469,8 +493,9 @@ export default { ...@@ -469,8 +493,9 @@ export default {
469 cursor: pointer; 493 cursor: pointer;
470 box-sizing: border-box; 494 box-sizing: border-box;
471 border-radius: 6px; 495 border-radius: 6px;
472 line-height: 24px; 496 line-height: 20px;
473 transition: all 0.3s; 497 transition: all 0.3s;
498 padding: 8px 0;
474 } 499 }
475 500
476 .child:hover { 501 .child:hover {
......