Browse Source

报销发票拖拽

huangguoce 1 month ago
parent
commit
1b14d3af27
1 changed files with 19 additions and 6 deletions
  1. 19 6
      src/views/common/NewDigitalInvoiceUploadComponent.vue

+ 19 - 6
src/views/common/NewDigitalInvoiceUploadComponent.vue

@@ -405,13 +405,9 @@ export default {
 					this.showDivider = true
 					this.showDivider = true
 				}
 				}
 			}
 			}
-			console.log(this.isConfirm);
-			console.log(this.isConfirm);
-			console.log(this.isConfirm);
-			console.log(this.isConfirm);
-			console.log(this.isConfirm);
 
 
-			// 如果是综合管理部主任,可以拖拽发票顺序
+			// 如果是综合管理部主任或者发票上传本人,可以拖拽发票顺序
+
 			if (this.isConfirm == 1 || this.isConfirm == 4) {
 			if (this.isConfirm == 1 || this.isConfirm == 4) {
 				const tbody = this.$refs.uploadTable.$el.querySelector('.el-table__body-wrapper tbody');
 				const tbody = this.$refs.uploadTable.$el.querySelector('.el-table__body-wrapper tbody');
 				Sortable.create(tbody, {
 				Sortable.create(tbody, {
@@ -733,6 +729,23 @@ export default {
 				if (fileList && fileList.length > 0) {
 				if (fileList && fileList.length > 0) {
 					this.fileList = [];
 					this.fileList = [];
 				}
 				}
+				// 综合管理部主任或者发票上传本人,可以拖拽发票顺序
+				if (this.isConfirm == 1 || this.isConfirm == 4) {
+					const tbody = this.$refs.uploadTable.$el.querySelector('.el-table__body-wrapper tbody');
+					Sortable.create(tbody, {
+						group: 'shared',
+						animation: 150,
+						ghostClass: 'sortable-ghost', //拖拽样式
+						easing: 'cubic-bezier(1, 0, 0, 1)',
+						onStart: (item) => {
+							console.log(item);
+						},
+						// 结束拖动事件
+						onEnd: (item) => {
+							this.setNodeSort(item.oldIndex, item.newIndex)
+						},
+					})
+				}
 				// 在 changes 完成后,手动调用 handleUploadSuccess
 				// 在 changes 完成后,手动调用 handleUploadSuccess
 				await this.handleUploadSuccess(null, null, this.fileList);  // 传入空参数或实际参数
 				await this.handleUploadSuccess(null, null, this.fileList);  // 传入空参数或实际参数
 			} catch (error) {
 			} catch (error) {