瀏覽代碼

附件修改

sangwenwei 1 年之前
父節點
當前提交
46953f4cf4

+ 2 - 2
src/api/jy/ProjectInfoService.js

@@ -153,11 +153,11 @@ export default class ProjectInfoService {
 	/*
 	根据id查找外审信息
 	 */
-	getAttachmentList(projectId){
+	getAttachmentList(projectId,id){
 		return request({
 			url: prefix + '/jyProject/getAttachmentList',
 			method: 'get',
-			params: {projectId:projectId}
+			params: {projectId:projectId, id: id}
 		})
 	}
 

+ 3 - 1
src/views/jy/project/FileForm.vue

@@ -70,6 +70,7 @@
         this.dataList = []
         this.dataListNew = []
         await this.ossService.getFileListByAttachmentIdAndModuleType(id,projectId).then((data) => {
+        	console.log('data',data)
 			if(data){
 				data.forEach((item) => {
 					item.name = item.attachmentName
@@ -89,7 +90,7 @@
 		  this.$nextTick(() => {
           // this.$refs.upload.clearFiles()
           this.$refs.inputForm.resetFields()
-            this.$refs.uploadComponent.newUpload(method, [], 'workClient', 300)
+            this.$refs.uploadComponent.newUpload(method, this.dataList, 'workClient', 300)
           this.loading = false
         })
       },
@@ -116,6 +117,7 @@
 				item.moduleType = this.moduleType
               this.inputForm.workAttachments.push(item)
             })
+			  this.$emit('getFiles',this.dataListNew)
 			console.log(this.inputForm)
             this.ossService.save(this.inputForm.workAttachments).then((data) => {
               this.close()

+ 61 - 77
src/views/jy/project/OutInstanceForm.vue

@@ -152,8 +152,12 @@
 						</template>
 					</vxe-column>
 					<vxe-column field="workAttachmentType" width="100px" title="文件类型"></vxe-column>
-					<vxe-column field="date" title="上传时间" width="100px"></vxe-column>
-					<vxe-column field="WorkAttachmentType" width="100px" title="文件大小(M)"></vxe-column>
+					<vxe-column field="createDate" title="上传时间" width="100px"></vxe-column>
+					<vxe-column field="fileSize" width="100px" title="文件大小(M)">
+						<template #default="scope">
+							{{getSize(scope.row.fileSize)}}
+						</template>
+					</vxe-column>
 
 					<vxe-column
 						title="操作"
@@ -166,7 +170,8 @@
 								v-if="scope.row.levelFlag === 2"
 								type="primary"
 								size="small"
-								@click="openFileForm(scope.row.id,this.inputForm.projectId)"
+								:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
+								@click="openFileForm(scope.row.id,this.inputForm.id)"
 							>编辑</el-button>
 							<el-button
 								v-if="scope.row.levelFlag === 3"
@@ -181,8 +186,8 @@
 		</el-row>
 
 		<!--        附件-->
-		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
-		<FileForm ref="fileForm"></FileForm>
+<!--		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>-->
+		<FileForm ref="fileForm" @getFiles="getFiles"></FileForm>
 
 
 	</div>
@@ -252,7 +257,7 @@
 		computed: {
 			bus: {
 				get () {
-					this.$refs.uploadComponent.setDividerName('附件')
+					// this.$refs.uploadComponent.setDividerName('附件')
 					return this.businessId
 
 				},
@@ -280,7 +285,7 @@
 			'loading': {
 				handler (newVal) {
 					this.$emit('changeLoading', newVal)
-					this.$refs.uploadComponent.changeLoading(newVal)
+					// this.$refs.uploadComponent.changeLoading(newVal)
 				}
 			}
 		},
@@ -330,7 +335,7 @@
 				this.$nextTick(() => {
 					this.$refs.inputForm.resetFields()
 					this.loading = true
-					this.$refs.uploadComponent.clearUpload()
+					// this.$refs.uploadComponent.clearUpload()
 					// this.$refs.archiveFile.clearUpload()
 					console.log('id',this.inputForm.id)
 					this.projectInfoService.findByIdOut(this.inputForm.id).then((data) => {
@@ -354,19 +359,19 @@
 						}
 						console.log('method2',method)
 
-						this.projectInfoService.getAttachmentList(this.inputForm.projectId).then((data) => {
+						this.projectInfoService.getAttachmentList(this.inputForm.projectId,this.inputForm.id).then((data) => {
 							console.log("getAttachmentList",data)
 							this.tableData = data
 						})
 
-						this.$refs.uploadComponent.newUpload(method, this.inputForm.fileList, 'jyProjectOut', null, '附件', null, null, null)
+						// this.$refs.uploadComponent.newUpload(method, this.inputForm.fileList, 'jyProjectOut', null, '附件', null, null, null)
 						// this.$refs.archiveFile.newUpload('view', [], 'cwWorkContract', null, null, null, null, false)
 						this.loading = false
 					})
 				})
 			},
 			close () {
-				this.$refs.uploadComponent.clearUpload()
+				// this.$refs.uploadComponent.clearUpload()
 				this.inputForm = {
 					id: '',
 					contractName:'',
@@ -389,8 +394,8 @@
 			},
 
 			//测试按钮
-			openFileForm(id,projectId){
-				this.$refs.fileForm.init("add", id,projectId)
+			openFileForm(id,typeId){
+				this.$refs.fileForm.init("add", id,typeId)
 			},
 			showFile (row) {
 				console.log("showFile",row)
@@ -401,7 +406,26 @@
 				console.log("toHref",row)
 				toHref(row)
 			},
+			getFiles(){
+				this.projectInfoService.getAttachmentList(this.inputForm.projectId,this.inputForm.id).then((data) => {
+					this.tableData = data
+					console.log('data',data)
+				})
 
+			},
+			getSize (value) {
+				if (this.commonJS.isEmpty(value)) {
+					return ''
+				} else {
+					let val = parseInt(value)
+					let k = 1024
+					let sizes = ['B', 'KB', 'MB', 'GB', 'PB', 'TB', 'EB', 'ZB', 'YB']
+					let i = Math.floor(Math.log(val) / Math.log(k))
+					let result = val / Math.pow(k, i);
+					let kb = parseFloat(result.toPrecision(3));
+					return kb + '' + sizes[i]
+				}
+			},
 			reapplyForm (callback) {
 				this.loading = true
 				this.projectInfoService.findByIdOut(this.inputForm.id).then((data) => {
@@ -451,48 +475,18 @@
 			// 表单提交
 			async doSubmit (status, callback) {
 				this.loading = true
-				if (await this.$refs.uploadComponent.checkProgress()) {
-					this.loading = false
-					throw new Error()
-				}
 				if (status === 'save') {
 					// 暂存
 					this.loading = true
 					this.inputForm.status = '1'
-					if (this.$refs.uploadComponent.checkProgress()) {
+					this.projectInfoService.saveFormOut(this.inputForm).then((data) => {
+						this.inputForm.assignee = this.inputForm.auditPeople
+						this.inputForm.id = data.businessId
+						callback(data.businessTable, data.businessId, this.inputForm)
 						this.loading = false
-						throw new Error()
-					}else {
-						this.$refs.uploadComponent.getDataList().then((list)=>{
-							if (this.commonJS.isNotEmpty(list)){
-								list.forEach((item, index) => {
-									if (this.commonJS.isEmpty(item.jyFileType)) {
-										this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-										this.loading = false
-										throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-									}
-									if (list.length <2){
-										this.$message.error('报批稿或专家评审意见表未上传')
-										this.loading = false
-										throw new Error('报批稿或专家评审意见表未上传')
-									}
-								})
-							}else {
-								this.$message.error('请上传文件')
-								this.loading = false
-								throw new Error('请上传文件')
-							}
-							this.inputForm.fileList = list
-							this.projectInfoService.saveFormOut(this.inputForm).then((data) => {
-								this.inputForm.assignee = this.inputForm.auditPeople
-								this.inputForm.id = data.businessId
-								callback(data.businessTable, data.businessId, this.inputForm)
-								this.loading = false
-							}).catch(() => {
-								this.loading = false
-							})
-						})
-					}
+					}).catch(() => {
+						this.loading = false
+					})
 
 					return
 				} else if (status === 'start') {
@@ -506,34 +500,24 @@
 				this.$refs['inputForm'].validate((valid) => {
 					if (valid) {
 						this.loading = true
-						if (this.$refs.uploadComponent.checkProgress()) {
-							this.loading = false
-							throw new Error()
-						}else {
-							this.$refs.uploadComponent.getDataList().then((list)=>{
-								if (this.commonJS.isNotEmpty(list)){
-									list.forEach((item, index) => {
-										if (this.commonJS.isEmpty(item.jyFileType)) {
-											this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-											this.loading = false
-											throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-										}
-									})
-								}else {
-									this.$message.error('请上传文件')
+						this.tableData.forEach(item=>{
+							console.log('item',item)
+							if (item.levelFlag === 2 && item.mustFlag === 1){
+								console.log('len',item.children.length)
+								if (item.children.length === 0){
 									this.loading = false
-									throw new Error('请上传文件')
+									this.$message.error('文件未上传')
+									throw new Error('文件未上传')
 								}
-								this.inputForm.fileList = list
-								this.projectInfoService.saveFormOut(this.inputForm).then((data) => {
-									this.inputForm.id = data.businessId
-									callback(data.businessTable, data.businessId, this.inputForm)
-									this.loading = false
-								}).catch(() => {
-									this.loading = false
-								})
-							})
-						}
+							}
+						})
+						this.projectInfoService.saveFormOut(this.inputForm).then((data) => {
+							this.inputForm.id = data.businessId
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.loading = false
+						}).catch(() => {
+							this.loading = false
+						})
 					} else {
 						this.loading = false
 					}
@@ -560,7 +544,7 @@
 									// 驳回
 									this.inputForm.status = '4'
 									this.loading = true
-									this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+									// this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
 									this.projectInfoService.saveFormOut(this.inputForm).then((data) => {
 										this.loading = false
 									}).catch(() => {

+ 154 - 75
src/views/jy/project/ProjectArchiveForm.vue

@@ -107,9 +107,87 @@
 			</el-row>
 
 		</el-form>
-		<!--        附件-->
-		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+		<el-divider content-position="left"><i class="el-icon-document"></i>
+			<span>附件信息</span>
+		</el-divider>
+		<el-row  :gutter="15" >
+			<el-col :span="24">
+				<vxe-table
+					border
+					show-overflow
+					ref="clientTable"
+					class="vxe-table-element"
+					style="margin-left: 5em"
+					:row-config="{keyField: 'id'}"
+					:column-config="{resizable: true}"
+					:tree-config="{transform: true, expandAll: true}"
+					:key="tableKey"
+					:data="tableData">
+					<vxe-column field="name" title="文件要求" width="260px" tree-node>
+						<template #default="scope">
+							<span style="font-weight: bold"
+								  v-if="scope.row.parentId === '0'"
+							>{{ scope.row.name }}
+							</span>
+							<span
+								v-if="scope.row.parentId !== '0' && scope.row.mustFlag === 1"
+							><span style="color: red;font-weight: bold">* </span>{{ scope.row.name }}
+							</span>
+							<span
+								v-if="scope.row.parentId !== '0' && scope.row.mustFlag === 0"
+							>{{ scope.row.name }}
+							</span>
+						</template>
+					</vxe-column>
+					<vxe-column field="attachmentName" title="文件描述/文件名称" show-overflow="false">
+						<template #default="scope">
+							<span
+								v-if="scope.row.levelFlag === 2"
+							>
+								<span style="font-weight: bold">文件格式及大小:{{ scope.row.size }}</span>
+								<br>
+								<span>{{ scope.row.type }}</span>
+							</span>
+							<el-link v-if="scope.row.levelFlag === 3"  type="primary" :underline="false" @click="showFile(scope.row)">{{scope.row.attachmentName}}</el-link>
+						</template>
+					</vxe-column>
+					<vxe-column field="workAttachmentType" width="100px" title="文件类型"></vxe-column>
+					<vxe-column field="createDate" title="上传时间" width="100px"></vxe-column>
+					<vxe-column field="fileSize" width="100px" title="文件大小(M)">
+						<template #default="scope">
+							{{getSize(scope.row.fileSize)}}
+						</template>
+					</vxe-column>
+
+					<vxe-column
+						title="操作"
+						width="100px"
+						fixed="right"
+						align="center"
+					>
+						<template #default="scope">
+							<el-button
+								v-if="scope.row.levelFlag === 2"
+								type="primary"
+								size="small"
+								:disabled="status === 'audit' ||status === 'taskFormDetail'|| method ==='view'"
+								@click="openFileForm(scope.row.id,this.inputForm.id)"
+							>编辑</el-button>
+							<el-button
+								v-if="scope.row.levelFlag === 3"
+								type="info"
+								size="small"
+								@click="toHref(scope.row)" >下载</el-button>
+
+						</template>
+					</vxe-column>
+				</vxe-table>
+			</el-col>
+		</el-row>
 
+		<!--        附件-->
+<!--		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>-->
+		<FileForm ref="fileForm" @getFiles="getFiles"></FileForm>
 
 	</div>
 </template>
@@ -159,20 +237,21 @@
 					remarks:''
 				},
 				keyWatch: '',
-				tabName:''
+				tabName:'',
+				tableData: [],
 
 			}
 		},
 		ProjectInfoService:null,
-		FileForm:null,
+
 		created () {
 			this.projectInfoService=new ProjectInfoService()
-			this.fileForm=new FileForm()
+
 		},
 		computed: {
 			bus: {
 				get () {
-					this.$refs.uploadComponent.setDividerName('附件')
+					// this.$refs.uploadComponent.setDividerName('附件')
 					return this.businessId
 
 				},
@@ -200,13 +279,14 @@
 			'loading': {
 				handler (newVal) {
 					this.$emit('changeLoading', newVal)
-					this.$refs.uploadComponent.changeLoading(newVal)
+					// this.$refs.uploadComponent.changeLoading(newVal)
 				}
 			}
 		},
 		components: {
 			UserSelectSignatory,
 			UpLoadComponent,
+			FileForm,
 		},
 		methods: {
 			getKeyWatch (keyWatch) {
@@ -248,9 +328,9 @@
 				this.$nextTick(() => {
 					this.$refs.inputForm.resetFields()
 					this.loading = true
-					this.$refs.uploadComponent.clearUpload()
+					// this.$refs.uploadComponent.clearUpload()
 					// this.$refs.archiveFile.clearUpload()
-					console.log('id',this.inputForm.id)
+					console.log('id',this.$store.state.user)
 					this.projectInfoService.findByIdArchive(this.inputForm.id).then((data) => {
 						this.inputForm = this.recover(this.inputForm, data)
 						this.inputForm.contractName=data.jyProjectList.contractName
@@ -271,14 +351,20 @@
 							method = 'view'
 						}
 						console.log('method2',method)
-						this.$refs.uploadComponent.newUpload(method, this.inputForm.fileList, 'jyProjectArchive', null, '附件', null, null, null)
+
+						this.projectInfoService.getAttachmentList(data.projectId,this.inputForm.id).then((data) => {
+							this.tableData = data
+							console.log("getAttachmentList",this.tableData)
+						})
+
+						// this.$refs.uploadComponent.newUpload(method, this.inputForm.fileList, 'jyProjectArchive', null, '附件', null, null, null)
 						// this.$refs.archiveFile.newUpload('view', [], 'cwWorkContract', null, null, null, null, false)
 						this.loading = false
 					})
 				})
 			},
 			close () {
-				this.$refs.uploadComponent.clearUpload()
+				// this.$refs.uploadComponent.clearUpload()
 				this.inputForm = {
 					id: '',
 					contractName:'',
@@ -348,48 +434,18 @@
 			// 表单提交
 			async doSubmit (status, callback) {
 				this.loading = true
-				if (await this.$refs.uploadComponent.checkProgress()) {
-					this.loading = false
-					throw new Error()
-				}
 				if (status === 'save') {
 					// 暂存
 					this.loading = true
 					this.inputForm.status = '1'
-					if (this.$refs.uploadComponent.checkProgress()) {
+					this.projectInfoService.saveFormArchive(this.inputForm).then((data) => {
+						this.inputForm.assignee = this.inputForm.auditPeople
+						this.inputForm.id = data.businessId
+						callback(data.businessTable, data.businessId, this.inputForm)
 						this.loading = false
-						throw new Error()
-					}else {
-						this.$refs.uploadComponent.getDataList().then((list)=>{
-							if (this.commonJS.isNotEmpty(list)){
-								list.forEach((item, index) => {
-									if (this.commonJS.isEmpty(item.jyFileType)) {
-										this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-										this.loading = false
-										throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-									}
-									if (list.length < 5){
-										this.$message.error('批复,报告的关键页或报告文本未上传')
-										this.loading = false
-										throw new Error('批复,报告的关键页或报告文本未上传')
-									}
-								})
-							}else {
-								this.$message.error('请上传文件')
-								this.loading = false
-								throw new Error('请上传文件')
-							}
-							this.inputForm.fileList = list
-							this.projectInfoService.saveFormArchive(this.inputForm).then((data) => {
-								this.inputForm.assignee = this.inputForm.auditPeople
-								this.inputForm.id = data.businessId
-								callback(data.businessTable, data.businessId, this.inputForm)
-								this.loading = false
-							}).catch(() => {
-								this.loading = false
-							})
-						})
-					}
+					}).catch(() => {
+						this.loading = false
+					})
 					return
 				} else if (status === 'start') {
 					// 送审  待审核
@@ -405,34 +461,24 @@
 				this.$refs['inputForm'].validate((valid) => {
 					if (valid) {
 						this.loading = true
-						if (this.$refs.uploadComponent.checkProgress()) {
-							this.loading = false
-							throw new Error()
-						}else {
-							this.$refs.uploadComponent.getDataList().then((list)=>{
-								if (this.commonJS.isNotEmpty(list)){
-									list.forEach((item, index) => {
-										if (this.commonJS.isEmpty(item.jyFileType)) {
-											this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-											this.loading = false
-											throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-										}
-									})
-								}else {
-									this.$message.error('请上传文件')
+						this.tableData.forEach(item=>{
+							console.log('item',item)
+							if (item.levelFlag === 2 && item.mustFlag === 1){
+								console.log('len',item.children.length)
+								if (item.children.length === 0){
 									this.loading = false
-									throw new Error('请上传文件')
+									this.$message.error('文件未上传')
+									throw new Error('文件未上传')
 								}
-								this.inputForm.fileList = list
-								this.projectInfoService.saveFormArchive(this.inputForm).then((data) => {
-									this.inputForm.id = data.businessId
-									callback(data.businessTable, data.businessId, this.inputForm)
-									this.loading = false
-								}).catch(() => {
-									this.loading = false
-								})
-							})
-						}
+							}
+						})
+						this.projectInfoService.saveFormArchive(this.inputForm).then((data) => {
+							this.inputForm.id = data.businessId
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.loading = false
+						}).catch(() => {
+							this.loading = false
+						})
 					} else {
 						this.loading = false
 					}
@@ -459,7 +505,7 @@
 									// 驳回
 									this.inputForm.status = '4'
 									this.loading = true
-									this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+									// this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
 									this.projectInfoService.saveFormOut(this.inputForm).then((data) => {
 										this.loading = false
 									}).catch(() => {
@@ -541,6 +587,39 @@
 					})
 				}
 			},
+			//测试按钮
+			openFileForm(id,typeId){
+				this.$refs.fileForm.init("add", id,typeId)
+			},
+			showFile (row) {
+				console.log("showFile",row)
+				row.name = row.attachmentName
+				openWindowOnUrl(row)
+			},
+			toHref (row) {
+				console.log("toHref",row)
+				toHref(row)
+			},
+			getFiles(){
+				this.projectInfoService.getAttachmentList(this.inputForm.projectId,this.inputForm.id).then((data) => {
+					this.tableData = data
+					console.log('data',data)
+				})
+
+			},
+			getSize (value) {
+				if (this.commonJS.isEmpty(value)) {
+					return ''
+				} else {
+					let val = parseInt(value)
+					let k = 1024
+					let sizes = ['B', 'KB', 'MB', 'GB', 'PB', 'TB', 'EB', 'ZB', 'YB']
+					let i = Math.floor(Math.log(val) / Math.log(k))
+					let result = val / Math.pow(k, i);
+					let kb = parseFloat(result.toPrecision(3));
+					return kb + '' + sizes[i]
+				}
+			},
 
 		}
 	}

+ 156 - 106
src/views/jy/project/ProjectEiaForm.vue

@@ -106,10 +106,86 @@
 			</el-row>
 
 		</el-form>
-		<!--        附件-->
-		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>
+		<el-divider content-position="left"><i class="el-icon-document"></i>
+			<span>附件信息</span>
+		</el-divider>
+		<el-row  :gutter="15" >
+			<el-col :span="24">
+				<vxe-table
+					border
+					show-overflow
+					ref="clientTable"
+					class="vxe-table-element"
+					style="margin-left: 5em"
+					:row-config="{keyField: 'id'}"
+					:column-config="{resizable: true}"
+					:tree-config="{transform: true, expandAll: true}"
+					:key="tableKey"
+					:data="tableData">
+					<vxe-column field="name" title="文件要求" width="260px" tree-node>
+						<template #default="scope">
+							<span style="font-weight: bold"
+								  v-if="scope.row.parentId === '0'"
+							>{{ scope.row.name }}
+							</span>
+							<span
+								v-if="scope.row.parentId !== '0' && scope.row.mustFlag === 1"
+							><span style="color: red;font-weight: bold">* </span>{{ scope.row.name }}
+							</span>
+							<span
+								v-if="scope.row.parentId !== '0' && scope.row.mustFlag === 0"
+							>{{ scope.row.name }}
+							</span>
+						</template>
+					</vxe-column>
+					<vxe-column field="attachmentName" title="文件描述/文件名称" show-overflow="false">
+						<template #default="scope">
+							<span
+								v-if="scope.row.levelFlag === 2"
+							>
+								<span style="font-weight: bold">文件格式及大小:{{ scope.row.size }}</span>
+								<br>
+								<span>{{ scope.row.type }}</span>
+							</span>
+							<el-link v-if="scope.row.levelFlag === 3"  type="primary" :underline="false" @click="showFile(scope.row)">{{scope.row.attachmentName}}</el-link>
+						</template>
+					</vxe-column>
+					<vxe-column field="workAttachmentType" width="100px" title="文件类型"></vxe-column>
+					<vxe-column field="createDate" title="上传时间" width="100px"></vxe-column>
+					<vxe-column field="fileSize" width="100px" title="文件大小(M)">
+						<template #default="scope">
+							{{getSize(scope.row.fileSize)}}
+						</template>
+					</vxe-column>
 
+					<vxe-column
+						title="操作"
+						width="100px"
+						fixed="right"
+						align="center"
+					>
+						<template #default="scope">
+							<el-button
+								v-if="scope.row.levelFlag === 2"
+								type="primary"
+								size="small"
+								:disabled="status === 'taskFormDetail'|| method ==='view'"
+								@click="openFileForm(scope.row.id,this.inputForm.id)"
+							>编辑</el-button>
+							<el-button
+								v-if="scope.row.levelFlag === 3"
+								type="info"
+								size="small"
+								@click="toHref(scope.row)" >下载</el-button>
 
+						</template>
+					</vxe-column>
+				</vxe-table>
+			</el-col>
+		</el-row>
+
+<!--		<UpLoadComponent ref="uploadComponent"></UpLoadComponent>-->
+		<FileForm ref="fileForm" @getFiles="getFiles"></FileForm>
 	</div>
 </template>
 
@@ -117,6 +193,7 @@
 	import ProjectInfoService from "@/api/jy/ProjectInfoService";
 	import UserSelectSignatory from '../workClientInfo/clientUserSelect'
 	import UpLoadComponent from '@/views/common/JyEiaUpLoadComponent'
+	import FileForm from './fileForm'
 	export default {
 		props: {
 			businessId: {
@@ -157,7 +234,9 @@
 					remarks:''
 				},
 				keyWatch: '',
-				tabName:''
+				tabName:'',
+				tableData: [],
+				tableKey :'1'
 
 			}
 		},
@@ -168,7 +247,7 @@
 		computed: {
 			bus: {
 				get () {
-					this.$refs.uploadComponent.setDividerName('附件')
+					// this.$refs.uploadComponent.setDividerName('附件')
 					return this.businessId
 
 				},
@@ -196,13 +275,14 @@
 			'loading': {
 				handler (newVal) {
 					this.$emit('changeLoading', newVal)
-					this.$refs.uploadComponent.changeLoading(newVal)
+					// this.$refs.uploadComponent.changeLoading(newVal)
 				}
-			}
+			},
 		},
 		components: {
 			UserSelectSignatory,
 			UpLoadComponent,
+			FileForm,
 		},
 		methods: {
 			getKeyWatch (keyWatch) {
@@ -244,10 +324,14 @@
 				this.$nextTick(() => {
 					this.$refs.inputForm.resetFields()
 					this.loading = true
-					this.$refs.uploadComponent.clearUpload()
+					// this.$refs.uploadComponent.clearUpload()
 					// this.$refs.archiveFile.clearUpload()
 					console.log('id',this.inputForm.id)
 					this.projectInfoService.findByIdEia(this.inputForm.id).then((data) => {
+						this.projectInfoService.getAttachmentList(data.projectId,this.inputForm.id).then((data) => {
+							this.tableData = data
+							console.log("getAttachmentList",this.tableData)
+						})
 						this.inputForm = this.recover(this.inputForm, data)
 						this.inputForm.contractName=data.jyProjectList.contractName
 						this.inputForm.contractAmount=data.jyProjectList.contractAmount
@@ -262,19 +346,20 @@
 						this.inputForm.projectLeader=data.jyProjectList.leader
 						this.inputForm.projectId=data.projectId
 						this.inputForm.remarks=data.remarks
-						console.log('data', data)
+						console.log('data', this.inputForm)
 						if (this.status === 'taskFormDetail') {
 							method = 'view'
 						}
 						console.log('method2',method)
-						this.$refs.uploadComponent.newUpload(method, this.inputForm.fileList, 'jyProjectEia', null, '附件', null, null, null)
+
+						// this.$refs.uploadComponent.newUpload(method, this.inputForm.fileList, 'jyProjectEia', null, '附件', null, null, null)
 						// this.$refs.archiveFile.newUpload('view', [], 'cwWorkContract', null, null, null, null, false)
 						this.loading = false
 					})
 				})
 			},
 			close () {
-				this.$refs.uploadComponent.clearUpload()
+				// this.$refs.uploadComponent.clearUpload()
 				this.inputForm = {
 					id: '',
 					contractName:'',
@@ -344,116 +429,46 @@
 			// 表单提交
 			async doSubmit (status, callback) {
 				this.loading = true
-				if (await this.$refs.uploadComponent.checkProgress()) {
-					this.loading = false
-					throw new Error()
-				}
 				if (status === 'save') {
 					// 暂存
-					this.loading = true
 					this.inputForm.status = '1'
-					if (this.$refs.uploadComponent.checkProgress()) {
+					this.projectInfoService.saveFormEia(this.inputForm).then((data) => {
+						this.inputForm.assignee = this.inputForm.auditPeople
+						this.inputForm.id = data.businessId
+						callback(data.businessTable, data.businessId, this.inputForm)
 						this.loading = false
-						throw new Error()
-					}else {
-						this.$refs.uploadComponent.getDataList().then((list)=>{
-							if (this.commonJS.isNotEmpty(list)){
-								list.forEach((item, index) => {
-									if (this.commonJS.isEmpty(item.jyFileType)) {
-										this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-										this.loading = false
-										throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-									}
-								})
-							}else {
-								this.$message.error('请上传文件')
-								this.loading = false
-								throw new Error('请上传文件')
-							}
-							this.inputForm.fileList = list
-							this.projectInfoService.saveFormEia(this.inputForm).then((data) => {
-								this.inputForm.assignee = this.inputForm.auditPeople
-								this.inputForm.id = data.businessId
-								callback(data.businessTable, data.businessId, this.inputForm)
-								this.loading = false
-							}).catch(() => {
-								this.loading = false
-							})
-						})
-					}
+					}).catch(() => {
+						this.loading = false
+					})
 					return
 				} else if (status === 'start') {
 					// 送审  待审核
 					this.inputForm.status = '2'
 				} else if (status === 'agree') {
 					// 审核同意
-					if (this.$store.state.user.office.name ==='办公室'){
-						this.inputForm.status = '5'
-					}else {
-						this.inputForm.status = '2'
-					}
+					this.inputForm.status = '5'
 				}
 				this.$refs['inputForm'].validate((valid) => {
 					if (valid) {
 						this.loading = true
-						if (this.$refs.uploadComponent.checkProgress()) {
-							this.loading = false
-							throw new Error()
-						}else {
-							var count=0
-							var count1=0
-							var count2=0
-							this.$refs.uploadComponent.getDataList().then((list)=>{
-								if (this.commonJS.isNotEmpty(list)){
-									list.forEach((item, index) => {
-										if (this.commonJS.isEmpty(item.jyFileType)) {
-											this.$message.error('第' + (index + 1) + '条附件信息没有填写文件类型')
-											this.loading = false
-											throw new Error('第' + (index + 1) + '条附件信息没有填写文件类型')
-										} else if (this.$store.state.user.office.name === '办公室'){
-											if (item.jyFileType === '3'){
-												count2++
-											}
-											/*if (count2 === 0){
-												this.$message.error('请上传文件资质')
-												this.loading = false
-												throw new Error('请上传文件资质')
-											}*/
-										}
-										// if (list.length < 2){
-										// 	this.$message.error('承诺书或信息表未上传')
-										// 	this.loading = false
-										// 	throw new Error('承诺书或信息表未上传')
-										// }
-
-										if (item.jyFileType === '1'){
-											count++
-										}
-										if (item.jyFileType === '2'){
-											count1++
-										}
-										/*if (count === 0 || count1 === 0){
-											this.$message.error('承诺书或信息表未上传')
-											this.loading = false
-											throw new Error('承诺书或信息表未上传')
-										}*/
-									})
-								}else {
-									this.$message.error('请上传文件')
-									this.loading = false
-									throw new Error('请上传文件')
-								}
-
-								this.inputForm.fileList = list
-								this.projectInfoService.saveFormEia(this.inputForm).then((data) => {
-									this.inputForm.id = data.businessId
-									callback(data.businessTable, data.businessId, this.inputForm)
-									this.loading = false
-								}).catch(() => {
-									this.loading = false
-								})
-							})
+						this.tableData.forEach(item=>{
+							console.log('item',item)
+						if (item.levelFlag === 2 && item.mustFlag === 1){
+							console.log('len',item.children.length)
+							if (item.children.length === 0){
+								this.loading = false
+								this.$message.error('文件未上传')
+								throw new Error('文件未上传')
+							}
 						}
+						})
+						this.projectInfoService.saveFormEia(this.inputForm).then((data) => {
+							this.inputForm.id = data.businessId
+							callback(data.businessTable, data.businessId, this.inputForm)
+							this.loading = false
+						}).catch(() => {
+							this.loading = false
+						})
 					} else {
 						this.loading = false
 					}
@@ -480,7 +495,7 @@
 									// 驳回
 									this.inputForm.status = '4'
 									this.loading = true
-									this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
+									// this.inputForm.workAttachmentDtoList = this.$refs.uploadComponent.getDataList()
 									this.projectInfoService.saveFormEia(this.inputForm).then((data) => {
 										this.loading = false
 									}).catch(() => {
@@ -561,8 +576,43 @@
 						}
 					})
 				}
+
+			},
+			//测试按钮
+			openFileForm(id,typeId){
+				this.$refs.fileForm.init("add", id,typeId)
+			},
+			showFile (row) {
+				console.log("showFile",row)
+				row.name = row.attachmentName
+				openWindowOnUrl(row)
+			},
+			toHref (row) {
+				console.log("toHref",row)
+				toHref(row)
+			},
+			getFiles(){
+				this.projectInfoService.getAttachmentList(this.inputForm.projectId,this.inputForm.id).then((data) => {
+					this.tableData = data
+					console.log('data',data)
+				})
+
+			},
+			getSize (value) {
+				if (this.commonJS.isEmpty(value)) {
+					return ''
+				} else {
+					let val = parseInt(value)
+					let k = 1024
+					let sizes = ['B', 'KB', 'MB', 'GB', 'PB', 'TB', 'EB', 'ZB', 'YB']
+					let i = Math.floor(Math.log(val) / Math.log(k))
+					let result = val / Math.pow(k, i);
+					let kb = parseFloat(result.toPrecision(3));
+					return kb + '' + sizes[i]
+				}
 			},
 
+
 		}
 	}
 </script>

+ 1 - 1
src/views/jy/workContractInfo/WorkContractForm.vue

@@ -58,7 +58,7 @@
 						<el-form-item label="合同类型" prop="contractTypes"
 									  :rules="[{required: true, message: '合同类型不能为空', trigger: 'blur'}
                  ]" >
-							<el-cascader style="width: 100%" v-model="inputForm.contractTypes" :options="typeData" @change="handleChange"  clearable  :props="{
+							<el-cascader :disabled="status === 'audit' || status === 'taskFormDetail'|| method==='view'" style="width: 100%" v-model="inputForm.contractTypes" :options="typeData" @change="handleChange"  clearable  :props="{
 			value: 'value',
 			label: 'label', // 显示名称
 			children: 'children', // 子级字段名