|
@@ -6,34 +6,53 @@
|
|
|
<el-row :gutter="20">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更令编号:" prop="changeNumber">
|
|
|
- <el-input v-model="baseForm.changeNumber" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.changeNumber" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeNumber')" @focus="currentInputFocus('changeNumber')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更令名称:" prop="changeName">
|
|
|
- <el-input v-model="baseForm.changeName" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.changeName" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeName')" @focus="currentInputFocus('changeName')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更发起单位:">
|
|
|
- <el-input v-model="baseForm.changeUnit" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.changeUnit" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeUnit')" @focus="currentInputFocus('changeUnit')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="业务日期:" prop="businessDate">
|
|
|
- <el-date-picker v-model="baseForm.businessDate" class="block" format="YYYY-MM-DD" type="date" value-format="YYYY-MM-DD" />
|
|
|
+ <el-date-picker
|
|
|
+ v-model="baseForm.businessDate" class="block" format="YYYY-MM-DD" type="date"
|
|
|
+ value-format="YYYY-MM-DD" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('businessDate')" @focus="currentInputFocus('businessDate')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更类型:">
|
|
|
- <el-select v-model="baseForm.changeType" filterable block>
|
|
|
+ <el-select
|
|
|
+ v-model="baseForm.changeType" filterable block :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeType')" @focus="currentInputFocus('changeType')"
|
|
|
+ >
|
|
|
<el-option v-for="item in typeData" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="延长工期:">
|
|
|
- <el-input v-model="baseForm.lengthenDays" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.lengthenDays" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('lengthenDays')" @focus="currentInputFocus('lengthenDays')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
@@ -43,41 +62,55 @@
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="设计完成时间:" prop="designDate">
|
|
|
- <el-date-picker v-model="baseForm.designDate" class="block" format="YYYY-MM-DD" type="date" value-format="YYYY-MM-DD" />
|
|
|
+ <el-date-picker
|
|
|
+ v-model="baseForm.designDate" class="block" format="YYYY-MM-DD" type="date"
|
|
|
+ value-format="YYYY-MM-DD" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('designDate')" @focus="currentInputFocus('designDate')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="实际变更桩号:">
|
|
|
- <el-input v-model="baseForm.realityChangeNumber" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.realityChangeNumber" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('realityChangeNumber')" @focus="currentInputFocus('realityChangeNumber')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更归类:">
|
|
|
- <el-select v-model="baseForm.changeClassify" filterable block>
|
|
|
+ <el-select
|
|
|
+ v-model="baseForm.changeClassify" filterable block :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeClassify')" @focus="currentInputFocus('changeClassify')"
|
|
|
+ >
|
|
|
<el-option v-for="item in classifyData" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更批复文号:">
|
|
|
- <el-input v-model="baseForm.changeApprovalNumber" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.changeApprovalNumber" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeApprovalNumber')" @focus="currentInputFocus('changeApprovalNumber')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="变更批复日期:" prop="changeApprovalDate">
|
|
|
- <el-date-picker v-model="baseForm.changeApprovalDate" class="block" format="YYYY-MM-DD" type="date" value-format="YYYY-MM-DD" />
|
|
|
+ <el-date-picker
|
|
|
+ v-model="baseForm.changeApprovalDate" class="block" format="YYYY-MM-DD" type="date"
|
|
|
+ value-format="YYYY-MM-DD" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @blur="currentInputBlur('changeApprovalDate')" @focus="currentInputFocus('changeApprovalDate')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <!-- el-col :span="24">
|
|
|
- <el-form-item class="input-link-item" label="引用预变更:">
|
|
|
- <el-input v-model="baseForm.key6" disabled />
|
|
|
- <el-link type="primary" @click="quoteClick">引用</el-link>
|
|
|
- <el-link type="danger">删除引用</el-link>
|
|
|
- </el-form-item>
|
|
|
- </el-col -->
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="变更原因:">
|
|
|
- <el-input v-model="baseForm.changeCause" :autosize="{ minRows: 4, maxRows: 8 }" type="textarea" />
|
|
|
+ <el-input
|
|
|
+ v-model="baseForm.changeCause" :autosize="{ minRows: 4, maxRows: 8 }" type="textarea"
|
|
|
+ :disabled="!isEdits || tableInfo.status === 2" @blur="currentInputBlur('changeCause')"
|
|
|
+ @focus="currentInputFocus('changeCause')"
|
|
|
+ />
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
@@ -85,12 +118,15 @@
|
|
|
</hc-card-item>
|
|
|
<!-- 变更申请部位 -->
|
|
|
<hc-card-item title="变更申请部位" class="mt-3">
|
|
|
- <hc-table :column="tableColumn" :datas="tableData" is-new is-current-row :index-style="{ width: 60 }" @row-click="rowChangeNodeClick">
|
|
|
+ <hc-table ref="tableRef1" :column="tableColumn" :datas="tableData" is-new is-current-row :index-style="{ width: 60 }" @row-click="rowChangeNodeClick">
|
|
|
<template #contractPicture="{ row }">
|
|
|
- <hc-table-input v-model="row.contractPicture" />
|
|
|
+ <hc-table-input
|
|
|
+ v-model="row.contractPicture" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @focus="meterInputFocus(row)" @blur="meterInputBlur(row)"
|
|
|
+ />
|
|
|
</template>
|
|
|
- <template #action="{ index }">
|
|
|
- <el-link type="danger" @click="delChangeNode(index)">删除</el-link>
|
|
|
+ <template #action="{ row, index }">
|
|
|
+ <el-link type="danger" @click="delChangeNode(row, index)">删除</el-link>
|
|
|
</template>
|
|
|
</hc-table>
|
|
|
</hc-card-item>
|
|
@@ -109,7 +145,10 @@
|
|
|
<el-table-column prop="contractTotal" label="变更前" />
|
|
|
<el-table-column prop="currentChangeTotal" label="变更增减">
|
|
|
<template #default="{ row }">
|
|
|
- <hc-table-input v-model="row.currentChangeTotal" @blur="currentChangeTotalBlur(row)" />
|
|
|
+ <hc-table-input
|
|
|
+ v-model="row.currentChangeTotal" :disabled="!isEdits || tableInfo.status === 2"
|
|
|
+ @focus="totalInputFocus(row)" @blur="totalInputBlur(row)"
|
|
|
+ />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="changeTotal" label="变更后" />
|
|
@@ -120,8 +159,8 @@
|
|
|
<el-table-column prop="changeMoney" label="变更后" />
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="action" label="操作" width="80" align="center">
|
|
|
- <template #default="scope">
|
|
|
- <el-link type="danger" @click="tableFormListDel(scope.$index)">删除</el-link>
|
|
|
+ <template #default="{ row, $index }">
|
|
|
+ <el-link type="danger" @click="tableFormListDel(row, $index)">删除</el-link>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -134,25 +173,24 @@
|
|
|
</template>
|
|
|
<el-form :model="baseForm" label-position="left" label-width="auto">
|
|
|
<el-form-item label="上传附件">
|
|
|
- <hc-form-upload type="list" :src="baseForm.fileList" :h-props="uploadFormProps" @upload="attachmentUpload" @change="attachmentUploadChange" />
|
|
|
+ <hc-form-upload type="list" :src="baseForm.fileList" :h-props="uploadFormProps" is-del @upload="attachmentUpload" @change="attachmentUploadChange" @del="attachmentUploadDel" />
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</hc-card-item>
|
|
|
<!-- 变更申请清单 -->
|
|
|
<ChangeRequest v-model="isChangeShow" :ids="changeIds" :tree-id="changeNodeItem.id" :contract-id="contractId" @finish="changeNodeFinish" />
|
|
|
<!-- 文件上传组件 -->
|
|
|
- <hc-upload-file ref="uploadFileRef" :echo-params="uploadFileParams" :options="uploadFileOptions" @success="uploadFileSuccess" />
|
|
|
+ <hc-upload-file ref="uploadFileRef" :options="uploadFileOptions" @success="uploadFileSuccess" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
import { onMounted, ref, watch } from 'vue'
|
|
|
+import { useAppStore } from '~src/store'
|
|
|
import ChangeRequest from '~src/views/alter/admin/components/order/changeRequest.vue'
|
|
|
-import { getDictionaryData, isNumberReg } from '~uti/tools'
|
|
|
-import { arrToKey, isArray, isNullES } from 'js-fast-way'
|
|
|
-import BigNumber from 'bignumber.js'
|
|
|
+import { delMessage, getDictionaryData, isNumberReg } from '~uti/tools'
|
|
|
+import { arrIndex, arrToKey, getArrValue, getObjVal, getObjValue, isArray, isNullES } from 'js-fast-way'
|
|
|
import { getHeader } from 'hc-vue3-ui'
|
|
|
-
|
|
|
import mainApi from '~api/tasks/hc-data'
|
|
|
|
|
|
const props = defineProps({
|
|
@@ -160,19 +198,19 @@ const props = defineProps({
|
|
|
type: Boolean,
|
|
|
default: true,
|
|
|
},
|
|
|
- type: {
|
|
|
- type: [String, Number],
|
|
|
- default: '',
|
|
|
+ info: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({}),
|
|
|
+ },
|
|
|
+ table: {
|
|
|
+ type: Object,
|
|
|
+ default: () => ({}),
|
|
|
},
|
|
|
})
|
|
|
|
|
|
-//双向绑定
|
|
|
-// eslint-disable-next-line no-undef
|
|
|
-const rowInfo = defineModel('modelValue', {
|
|
|
- default: () => ({}),
|
|
|
-})
|
|
|
-
|
|
|
-const contractId = ref('')
|
|
|
+const useAppState = useAppStore()
|
|
|
+const projectId = ref(useAppState.getProjectId || '')
|
|
|
+const contractId = ref(useAppState.getContractId || '')
|
|
|
|
|
|
//监听可否编辑
|
|
|
const isEdits = ref(props.isEdit)
|
|
@@ -180,28 +218,30 @@ watch(() => props.isEdit, (val) => {
|
|
|
isEdits.value = val
|
|
|
}, { immediate: true, deep: true })
|
|
|
|
|
|
-//监听类型
|
|
|
-const isType = ref(props.type)
|
|
|
-watch(() => props.type, (val) => {
|
|
|
- isType.value = val
|
|
|
-}, { immediate: true, deep: true })
|
|
|
-
|
|
|
//监听数据
|
|
|
-watch(() => rowInfo, (val) => {
|
|
|
- setTaskInfo(val.value)
|
|
|
+watch(() => [
|
|
|
+ props.table,
|
|
|
+ props.info,
|
|
|
+], ([table, row]) => {
|
|
|
+ setTaskInfo(table, row)
|
|
|
}, { deep: true })
|
|
|
|
|
|
//渲染完成
|
|
|
onMounted(() => {
|
|
|
- setTaskInfo(rowInfo.value)
|
|
|
+ setTaskInfo(props.table, props.info)
|
|
|
})
|
|
|
|
|
|
//设置任务信息
|
|
|
const taskInfo = ref({})
|
|
|
-const setTaskInfo = async (info) => {
|
|
|
- taskInfo.value = info
|
|
|
- getMeterChangeClassify().then()
|
|
|
- getMeterChangeType().then()
|
|
|
+const tableInfo = ref({})
|
|
|
+const setTaskInfo = (table, row) => {
|
|
|
+ tableInfo.value = table
|
|
|
+ taskInfo.value = row
|
|
|
+ if (getObjVal(table) && getObjVal(row)) {
|
|
|
+ getMeterChangeClassify()
|
|
|
+ getMeterChangeType()
|
|
|
+ getDataDetail()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//计量变更归类
|
|
@@ -216,12 +256,59 @@ const getMeterChangeType = async () => {
|
|
|
typeData.value = await getDictionaryData('meter_change_type')
|
|
|
}
|
|
|
|
|
|
+//获取任务数据信息详情
|
|
|
+const isLoading = ref(false)
|
|
|
+const getDataDetail = async () => {
|
|
|
+ const id = taskInfo.value.id
|
|
|
+ const dataId = tableInfo.value.id
|
|
|
+ const { data } = await mainApi.getDataDetail({ id, dataId })
|
|
|
+ //转换数据
|
|
|
+ const { changeTokenFormVO, attachmentFormTask } = getObjValue(data)
|
|
|
+ const res = getObjValue(changeTokenFormVO)
|
|
|
+ baseForm.value = res //表单信息
|
|
|
+ baseForm.value.fileList = getArrValue(attachmentFormTask) //附件列表
|
|
|
+ const nodeList = getArrValue(res.nodeList)
|
|
|
+ tableData.value = nodeList //部位列表
|
|
|
+ if (nodeList.length > 0) {
|
|
|
+ rowChangeNodeClick({ row: nodeList[0] })
|
|
|
+ tableRef1.value?.tableRef?.setCurrentRow(nodeList[0])
|
|
|
+ changeNodeItem.value = nodeList[0]
|
|
|
+ tableIndex.value = 0
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//基础表单
|
|
|
const baseFormRef = ref(null)
|
|
|
const baseForm = ref({ fileList: [], pictureUrl: '' })
|
|
|
const baseFormRules = {}
|
|
|
|
|
|
+//基础表单的输入框获得焦点
|
|
|
+const currentBaseForm = ref('')
|
|
|
+const currentInputFocus = (key) => {
|
|
|
+ currentBaseForm.value = baseForm.value[key]
|
|
|
+}
|
|
|
+
|
|
|
+//基础表单的输入框失去焦点
|
|
|
+const currentInputBlur = async (key) => {
|
|
|
+ if (currentBaseForm.value === baseForm.value[key]) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ //处理数据
|
|
|
+ let form = {
|
|
|
+ id: baseForm.value.id,
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ }
|
|
|
+ form[key] = baseForm.value[key]
|
|
|
+ const { error, msg, code } = await mainApi.changeTokenFromUpdate(form)
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('更新成功')
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '更新失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//清单表格
|
|
|
+const tableRef1 = ref(null)
|
|
|
const tableColumn = ref([
|
|
|
{ key: 'nodeName', name: '工程名称' },
|
|
|
{ key: 'nodeUrl', name: '节点路径' },
|
|
@@ -232,16 +319,55 @@ const tableColumn = ref([
|
|
|
])
|
|
|
const tableData = ref([])
|
|
|
|
|
|
+//合同图号的输入框获得焦点
|
|
|
+const currentPicture = ref('')
|
|
|
+const meterInputFocus = (row) => {
|
|
|
+ currentPicture.value = row.contractPicture
|
|
|
+}
|
|
|
+
|
|
|
+//合同图号的输入框失去焦点
|
|
|
+const meterInputBlur = async (row) => {
|
|
|
+ if (currentPicture.value === row.contractPicture) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ //处理数据
|
|
|
+ const { error, msg, code } = await mainApi.changeTokenMeterUpdate({
|
|
|
+ primaryKeyId: row.primaryKeyId,
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ contractPicture: row.contractPicture
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('更新成功')
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '更新失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
//删除变更申请部位
|
|
|
-const delChangeNode = (index) => {
|
|
|
- tableData.value.splice(index, 1)
|
|
|
- tableIndex.value = -1
|
|
|
+const delChangeNode = (row, index) => {
|
|
|
+ delMessage(async () => {
|
|
|
+ const { code, msg } = await mainApi.remove({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ dataId: tableInfo.value.id,
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ primaryKeyId: row.primaryKeyId,
|
|
|
+ type: 1
|
|
|
+ })
|
|
|
+ if (code === 200) {
|
|
|
+ window.$message.success('删除成功')
|
|
|
+ getDataDetail()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
//变更申请部位 行被点击
|
|
|
const changeNodeItem = ref({})
|
|
|
const tableIndex = ref(-1)
|
|
|
-const rowChangeNodeClick = ({ row, index }) => {
|
|
|
+const rowChangeNodeClick = ({ row }) => {
|
|
|
+ const index = arrIndex(tableData.value, 'id', row.id)
|
|
|
if (!isArray(row.formList)) {
|
|
|
tableData.value[index].formList = []
|
|
|
}
|
|
@@ -250,10 +376,25 @@ const rowChangeNodeClick = ({ row, index }) => {
|
|
|
}
|
|
|
|
|
|
//删除变更申请清单
|
|
|
-const tableFormListDel = (index) => {
|
|
|
- tableData.value[tableIndex.value].formList.splice(index, 1)
|
|
|
- getFormList()
|
|
|
+const tableFormListDel = (row, index) => {
|
|
|
+ delMessage(async () => {
|
|
|
+ const { code, msg } = await mainApi.remove({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ dataId: tableInfo.value.id,
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ primaryKeyId: row.primaryKeyId,
|
|
|
+ type: 1
|
|
|
+ })
|
|
|
+ if (code === 200) {
|
|
|
+ window.$message.success('删除成功')
|
|
|
+ getDataDetail()
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
+
|
|
|
//变更清单的添加弹窗
|
|
|
const isChangeShow = ref(false)
|
|
|
const changeIds = ref('')
|
|
@@ -269,54 +410,107 @@ const changeShowClick = () => {
|
|
|
//确认选择完成
|
|
|
const changeNodeFinish = (data) => {
|
|
|
tableData.value[tableIndex.value].formList.push(...data)
|
|
|
- getFormList()
|
|
|
}
|
|
|
|
|
|
-//变更清单增减
|
|
|
-const currentChangeTotalBlur = (row) => {
|
|
|
+//变更增减的输入框获得焦点
|
|
|
+const currentChangeTotal = ref('')
|
|
|
+const totalInputFocus = (row) => {
|
|
|
+ currentChangeTotal.value = row.currentChangeTotal
|
|
|
+}
|
|
|
+
|
|
|
+//变更增减的输入框失去焦点
|
|
|
+const totalInputBlur = async (row) => {
|
|
|
//如果为空
|
|
|
let val = row.currentChangeTotal
|
|
|
const isMeter = isNumberReg(val)
|
|
|
if (isNullES(val) || !isMeter) {
|
|
|
val = 0
|
|
|
}
|
|
|
+ if (currentChangeTotal.value === val) {
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ //处理数据
|
|
|
+ const { error, msg, code } = await mainApi.changeTokenInventoryUpdate({
|
|
|
+ contractId: contractId.value,
|
|
|
+ primaryKeyIdInventory: row.primaryKeyId ?? '',
|
|
|
+ primaryKeyIdMeter: changeNodeItem.value?.primaryKeyId ?? '',
|
|
|
+ taskId: taskInfo.value.id ?? '',
|
|
|
+ dataId: tableInfo.value.id ?? '',
|
|
|
+ changTotal: val
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('更新成功')
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '更新失败')
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
-//获取变更清单总额
|
|
|
-const getFormList = () => {
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-//附件上传
|
|
|
+//文件上传
|
|
|
+const uploadFileRef = ref(null)
|
|
|
+const uploadFileOptions = ref({
|
|
|
+ headers: getHeader(),
|
|
|
+ multiple: false,
|
|
|
+})
|
|
|
const uploadFormProps = {
|
|
|
url: 'fileUrl',
|
|
|
name: 'fileName',
|
|
|
}
|
|
|
|
|
|
const attachmentUpload = () => {
|
|
|
- //uploadFileRef.value?.selectFile()
|
|
|
+ if (isEdits.value || tableInfo.status !== 2) {
|
|
|
+ uploadFileRef.value?.selectFile()
|
|
|
+ } else {
|
|
|
+ window.$message.error('当前状态不可上传')
|
|
|
+ }
|
|
|
}
|
|
|
const attachmentUploadChange = (a, b, fileList) => {
|
|
|
- //baseForm.value.fileList = getArrValue(fileList)
|
|
|
+ baseForm.value.fileList = getArrValue(fileList)
|
|
|
}
|
|
|
|
|
|
-//文件上传
|
|
|
-const uploadFileRef = ref(null)
|
|
|
-const uploadFileParams = ref({})
|
|
|
-const uploadFileOptions = ref({
|
|
|
- headers: getHeader(),
|
|
|
- multiple: false,
|
|
|
-})
|
|
|
-
|
|
|
// 文件上传成功的回调
|
|
|
-const uploadFileSuccess = ({ resData }) => {
|
|
|
+const uploadFileSuccess = async ({ resData }) => {
|
|
|
baseForm.value.fileList.push({
|
|
|
- /*contractId: contractId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
fileName: resData.originalName ?? '',
|
|
|
filePdfUrl: resData.pdfUrl ?? '',
|
|
|
- fileUrl: resData.link ?? '',*/
|
|
|
+ fileUrl: resData.link ?? '',
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ })
|
|
|
+ uploadFileRef.value?.setModalShow(false)
|
|
|
+ //发起请求
|
|
|
+ const dataId = tableInfo.value.id
|
|
|
+ const { error, code, msg } = await mainApi.taskUploadFile({
|
|
|
+ projectId: projectId.value,
|
|
|
+ contractId: contractId.value,
|
|
|
+ fileList: baseForm.value.fileList,
|
|
|
+ taskId: taskInfo.value.id,
|
|
|
+ dataId,
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success('上传成功')
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '上传失败')
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//删除文件
|
|
|
+const attachmentUploadDel = ({ file }, resolve) => {
|
|
|
+ if (!isEdits.value) {
|
|
|
+ window.$message.error('当前状态不可删除')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ delMessage(async () => {
|
|
|
+ const { error, code, msg } = await mainApi.removeFile({
|
|
|
+ id: file.id,
|
|
|
+ taskId: taskInfo.value.id
|
|
|
+ })
|
|
|
+ if (!error && code === 200) {
|
|
|
+ resolve(true)
|
|
|
+ } else {
|
|
|
+ window.$message.error(msg ?? '删除失败')
|
|
|
+ resolve(false)
|
|
|
+ }
|
|
|
})
|
|
|
- //uploadFileRef.value?.setModalShow(false)
|
|
|
}
|
|
|
</script>
|
|
|
|