|
|
@@ -176,6 +176,60 @@
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</hc-new-dialog>
|
|
|
+
|
|
|
+ <!-- 新增编辑文件 -->
|
|
|
+ <hc-new-dialog v-model="uploadModal" is-table title="上传工程文件" widths="90vw" @close="uploadModalClose">
|
|
|
+ <HcTable
|
|
|
+ :column="tableUploadColumn" :datas="tableUploadData" :index-style="{ width: 80 }"
|
|
|
+ :loading="uploadSaveLoading"
|
|
|
+ is-new is-sort ui="hc-form-table" @row-sort="tableUploadRowSort"
|
|
|
+ >
|
|
|
+ <template #fileNumber="{ row }">
|
|
|
+ <!-- <el-input v-model="row.fileNumber" :class="row['isFileNumber'] ? 'is-error' : ''" @input="tableIsInput($event, row, 'isFileNumber')"/> -->
|
|
|
+ <el-input v-model="row.fileNumber" />
|
|
|
+ </template>
|
|
|
+ <template #fileName="{ row }">
|
|
|
+ <el-input v-model="row.fileName" :class="row.isFileName ? 'is-error' : ''" @input="tableIsInput($event, row, 'isFileName')" />
|
|
|
+ </template>
|
|
|
+ <template #fileTime="{ row }">
|
|
|
+ <div class="relative w-full">
|
|
|
+ <el-date-picker v-model="row.fileTime" class="w-full!" :clearable="false" format="YYYYMMDD" type="date" value-format="YYYYMMDD" />
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <template #dutyUser="{ row }">
|
|
|
+ <el-input v-model="row.dutyUser" />
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template #action="{ row, index }">
|
|
|
+ <el-button :loading="row.delBtnLoading" plain size="small" type="danger" @click="delUploadData(row, index)">删除</el-button>
|
|
|
+ </template>
|
|
|
+ </HcTable>
|
|
|
+ <template #footer>
|
|
|
+ <div class="lr-dialog-footer">
|
|
|
+ <div class="left flex items-center">
|
|
|
+ <el-button hc-btn type="primary" @click="uploadFileClick">
|
|
|
+ <HcIcon name="add-circle" />
|
|
|
+ <span>新增上传</span>
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ <div class="right">
|
|
|
+ <el-button size="large" :loading="uploadSaveLoading" @click="batchUploadCancel">
|
|
|
+ <HcIcon name="close" />
|
|
|
+ <span>取消</span>
|
|
|
+ </el-button>
|
|
|
+ <el-button :loading="uploadSaveLoading" hc-btn type="primary" @click="batchUploadSave">
|
|
|
+ <HcIcon name="save" />
|
|
|
+ <span>提交保存</span>
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </hc-new-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
@@ -184,12 +238,12 @@ import { onMounted, ref } from 'vue'
|
|
|
import scanApi from '~api/archiveFile/scanning'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import HcTree from '~src/components/tree/hc-tree.vue'
|
|
|
-import { arrToId, deepClone, formValidate, getArrValue, getObjValue } from 'js-fast-way'
|
|
|
+import { arrToId, deepClone, formValidate, getArrValue, getObjVal, getObjValue } from 'js-fast-way'
|
|
|
import MenuItem from './MenuItem.vue' // 导入递归组件
|
|
|
import { toPdfPage } from '~uti/btn-auth'
|
|
|
|
|
|
import tasksApi from '~api/tasks/data'
|
|
|
-import { HcDelMsg, HcFirmMsg } from 'hc-vue3-ui'
|
|
|
+import { HcDelMsg, HcFirmMsg, HcUploadFileApi } from 'hc-vue3-ui'
|
|
|
|
|
|
const useAppState = useAppStore()
|
|
|
const contractId = ref(useAppState.getContractId)
|
|
|
@@ -596,7 +650,7 @@ const addClick = ()=>{
|
|
|
}
|
|
|
const curItem = ref(null)
|
|
|
const menuClick = (item, cur)=>{
|
|
|
- console.log(item, cur, 'item2222222')
|
|
|
+
|
|
|
curItem.value = cur
|
|
|
const { key } = item
|
|
|
if (key === 'add-node') {
|
|
|
@@ -670,6 +724,85 @@ const uploadModalClick = () => {
|
|
|
uploadModal.value = true
|
|
|
}
|
|
|
const uploadModal = ref(false)
|
|
|
+const uploadModalClose = ()=>{
|
|
|
+ uploadModal.value = false
|
|
|
+}
|
|
|
+//设置文件表头
|
|
|
+const tableUploadColumn = ref([
|
|
|
+ { key: 'fileNumber', name: '文件编号' },
|
|
|
+ { key: 'fileName', name: '文件名称' },
|
|
|
+ { key: 'fileTime', name: '文件日期' },
|
|
|
+ { key: 'dutyUser', name: '责任者' },
|
|
|
+ { key: 'action', name: '操作', width: 220 },
|
|
|
+])
|
|
|
+const tableUploadData = ref([])
|
|
|
+const uploadSaveLoading = ref(false)
|
|
|
+//表格数据排序
|
|
|
+const tableUploadRowSort = (arr) => {
|
|
|
+ tableUploadData.value = arr
|
|
|
+}
|
|
|
+const uploadsLoading = ref(false)
|
|
|
+//打开文件选择框
|
|
|
+const uploadFileClick = () => {
|
|
|
+ HcUploadFileApi({
|
|
|
+ multiple: true,
|
|
|
+ progress: () => {
|
|
|
+ uploadsLoading.value = true
|
|
|
+ },
|
|
|
+ success: (file, res) => {
|
|
|
+ uploadsChange(file.id, res.data)
|
|
|
+ },
|
|
|
+ error: (file) => {
|
|
|
+ uploadsLoading.value = false
|
|
|
+ window.$message.error(`${file.name} 上传失败`)
|
|
|
+ },
|
|
|
+ finish: () => {
|
|
|
+ uploadsLoading.value = false
|
|
|
+ window.$message.success('全部上传完成')
|
|
|
+ },
|
|
|
+ })
|
|
|
+}
|
|
|
+const uploadsChange = (fileId, item)=>{
|
|
|
+ if (getObjVal(item)) {
|
|
|
+ let newArr = tableUploadData.value
|
|
|
+ const sheet = sheetType.value, source = sheetSourceType.value
|
|
|
+ let name = item['originalName'] || ''
|
|
|
+ let fileName = name.substring(0, name.lastIndexOf('.'))
|
|
|
+ newArr.push({
|
|
|
+ fileUploadId: fileId,
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ nodeId: nodeIds.value,
|
|
|
+ fileNumber: '',
|
|
|
+ fileName: fileName,
|
|
|
+ ossFileName: item?.name || '',
|
|
|
+ fileTime: null,
|
|
|
+ fileUrl: item?.link || '',
|
|
|
+ sheetType: sheet.length > 0 ? sheet[0]['dictKey'] || '' : '',
|
|
|
+ sheetSource: source.length > 0 ? source[0]['dictKey'] || '' : '',
|
|
|
+ drawingNo: '',
|
|
|
+ citeChangeNumber: '',
|
|
|
+ isApproval: 1,
|
|
|
+ isNeedCertification: 1,
|
|
|
+ dutyUser: dutyUser.value,
|
|
|
+ pdfFileUrl: item?.pdfUrl || '',
|
|
|
+ filePage: item?.page || '',
|
|
|
+ isElement: 0,
|
|
|
+ isUpdateUrl: 0,
|
|
|
+ fileSize: item?.fileSize,
|
|
|
+ })
|
|
|
+ //tableUploadData.value = newArr
|
|
|
+ tableUploadData.value = arrKeySort(newArr, 'fileUploadId')
|
|
|
+ } else {
|
|
|
+ console.log(item)
|
|
|
+ }
|
|
|
+}
|
|
|
+const batchUploadCancel = ()=>{
|
|
|
+
|
|
|
+}
|
|
|
+const batchUploadSave = ()=>{
|
|
|
+
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="scss">
|