|
@@ -119,8 +119,8 @@
|
|
|
<el-table-column label="数量" align="center">
|
|
|
<el-table-column prop="contractTotal" label="变更前" />
|
|
|
<el-table-column prop="currentChangeTotal" label="变更增减">
|
|
|
- <template #default="scope">
|
|
|
- <hc-table-input v-model="scope.row.currentChangeTotal" />
|
|
|
+ <template #default="{ row }">
|
|
|
+ <hc-table-input v-model="row.currentChangeTotal" @blur="currentChangeTotalBlur($event, row)" />
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
<el-table-column prop="changeTotal" label="变更后" />
|
|
@@ -138,13 +138,16 @@
|
|
|
</el-table>
|
|
|
</div>
|
|
|
</hc-card-item>
|
|
|
+ <!-- 附件列表 -->
|
|
|
<hc-card-item class="mt-3" title="附件列表">
|
|
|
- <hc-table is-new :column="tableColumn2" :datas="tableData2">
|
|
|
- <template #action="{ row }">
|
|
|
- <el-link type="primary">选择文件</el-link>
|
|
|
- <el-link type="danger">清除</el-link>
|
|
|
- </template>
|
|
|
- </hc-table>
|
|
|
+ <template #extra>
|
|
|
+ <span class="text-orange font-400">可上传 图片(png、jpg、jpeg)、Excel(xls、xlsx)、PDF、Word(doc、docx)文件</span>
|
|
|
+ </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" />
|
|
|
+ </el-form-item>
|
|
|
+ </el-form>
|
|
|
</hc-card-item>
|
|
|
</el-scrollbar>
|
|
|
</div>
|
|
@@ -152,6 +155,9 @@
|
|
|
|
|
|
<!-- 变更申请清单 -->
|
|
|
<ChangeRequest v-model="isChangeShow" :ids="changeIds" :tree-id="changeNodeItem.id" :contract-id="contractId" @finish="changeNodeFinish" />
|
|
|
+
|
|
|
+ <!-- 文件上传组件 -->
|
|
|
+ <hc-upload-file ref="uploadFileRef" :options="uploadFileOptions" @success="uploadFileSuccess" />
|
|
|
</hc-new-dialog>
|
|
|
</template>
|
|
|
|
|
@@ -159,10 +165,12 @@
|
|
|
import { nextTick, ref, watch } from 'vue'
|
|
|
import { useAppStore } from '~src/store'
|
|
|
import { getDictionaryData } from '~uti/tools'
|
|
|
-import { arrToKey, getArrValue, getObjValue, isArray, isNullES } from 'js-fast-way'
|
|
|
+import { arrToKey, deepClone, getArrValue, getObjValue, isArray, isNullES } from 'js-fast-way'
|
|
|
import ChangeRequest from './changeRequest.vue'
|
|
|
import unitApi from '~api/project/debit/contract/unit'
|
|
|
import mainApi from '~api/alter/admin/order'
|
|
|
+import { getHeader } from 'hc-vue3-ui'
|
|
|
+import BigNumber from 'bignumber.js'
|
|
|
|
|
|
const props = defineProps({
|
|
|
ids: {
|
|
@@ -327,6 +335,7 @@ const rowChangeNodeClick = ({ row, index }) => {
|
|
|
//删除变更申请清单
|
|
|
const tableFormListDel = (index) => {
|
|
|
tableData.value[tableIndex.value].formList.splice(index, 1)
|
|
|
+ getFormList()
|
|
|
}
|
|
|
|
|
|
//变更清单的添加弹窗
|
|
@@ -344,18 +353,70 @@ const changeShowClick = () => {
|
|
|
//确认选择完成
|
|
|
const changeNodeFinish = (data) => {
|
|
|
tableData.value[tableIndex.value].formList.push(...data)
|
|
|
+ getFormList()
|
|
|
}
|
|
|
|
|
|
-//附件列表
|
|
|
-const tableColumn2 = ref([
|
|
|
- { key: 'key1', name: '文件名称', width: 200 },
|
|
|
- { key: 'key2', name: '必须上传', width: 100 },
|
|
|
- { key: 'key3', name: '附件列表' },
|
|
|
- { key: 'action', name: '操作', width: 120 },
|
|
|
-])
|
|
|
-const tableData2 = ref([
|
|
|
- { key1: '工程设计变更申请单', key2: '是', key3: '文件名称' },
|
|
|
-])
|
|
|
+//变更清单增减
|
|
|
+const currentChangeTotalBlur = (event, row) => {
|
|
|
+ //计算数量
|
|
|
+ const changeNum = (BigNumber(row.contractTotal).plus(row.currentChangeTotal)).toNumber()
|
|
|
+ if (changeNum < 0) {
|
|
|
+ window.$message.warning('变更增减数量不能小于变更前数量')
|
|
|
+ row.currentChangeTotal = '-' + row.contractTotal
|
|
|
+ }
|
|
|
+ row.changeTotal = changeNum
|
|
|
+
|
|
|
+ //计算金额
|
|
|
+ row.currentChangeMoney = (BigNumber(row.currentChangeTotal).multipliedBy(row.currentPrice)).toNumber()
|
|
|
+ row.changeMoney = (BigNumber(changeNum).multipliedBy(row.currentPrice)).toNumber()
|
|
|
+ getFormList()
|
|
|
+}
|
|
|
+
|
|
|
+//获取变更清单总额
|
|
|
+const getFormList = () => {
|
|
|
+ let total = 0, table = deepClone(tableData.value)
|
|
|
+ for (let i = 0; i < table.length; i++) {
|
|
|
+ const item = table[i]
|
|
|
+ for (let j = 0; j < item.formList.length; j++) {
|
|
|
+ const form = item.formList[j]
|
|
|
+ total = (BigNumber(total).plus(form.currentChangeMoney)).toNumber()
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tableData.value = []
|
|
|
+ tableData.value = table
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+//附件上传
|
|
|
+const uploadFormProps = {
|
|
|
+ url: 'fileUrl',
|
|
|
+ name: 'fileName',
|
|
|
+}
|
|
|
+
|
|
|
+const attachmentUpload = () => {
|
|
|
+ uploadFileRef.value?.selectFile()
|
|
|
+}
|
|
|
+const attachmentUploadChange = (a, b, fileList) => {
|
|
|
+ baseForm.value.fileList = getArrValue(fileList)
|
|
|
+}
|
|
|
+
|
|
|
+//文件上传
|
|
|
+const uploadFileRef = ref(null)
|
|
|
+const uploadFileOptions = ref({
|
|
|
+ headers: getHeader(),
|
|
|
+ multiple: false,
|
|
|
+})
|
|
|
+
|
|
|
+// 文件上传成功的回调
|
|
|
+const uploadFileSuccess = ({ resData }) => {
|
|
|
+ baseForm.value.fileList.push({
|
|
|
+ contractId: contractId.value,
|
|
|
+ fileName: resData.originalName ?? '',
|
|
|
+ filePdfUrl: resData.pdfUrl ?? '',
|
|
|
+ fileUrl: resData.link ?? '',
|
|
|
+ })
|
|
|
+ uploadFileRef.value?.setModalShow(false)
|
|
|
+}
|
|
|
|
|
|
|
|
|
//保存
|