|
@@ -108,7 +108,7 @@
|
|
<div v-if="tab_key === '材料明细'" class="table-body">
|
|
<div v-if="tab_key === '材料明细'" class="table-body">
|
|
<hc-table :column="tableColumn1" :datas="tableData1" :index-style="{ width: 60 }" :loading="tableLoading1">
|
|
<hc-table :column="tableColumn1" :datas="tableData1" :index-style="{ width: 60 }" :loading="tableLoading1">
|
|
<template #changeTotal="{ row }">
|
|
<template #changeTotal="{ row }">
|
|
- <el-input v-model="row.changeTotal" />
|
|
|
|
|
|
+ <el-input v-model="row.changeTotal" @blur="changeTotalBlur(row)" />
|
|
</template>
|
|
</template>
|
|
</hc-table>
|
|
</hc-table>
|
|
</div>
|
|
</div>
|
|
@@ -118,9 +118,9 @@
|
|
</div>
|
|
</div>
|
|
<div class="table-upload">
|
|
<div class="table-upload">
|
|
<hc-table :column="tableColumn2" :datas="tableData2" :index-style="{ width: 60 }" :loading="tableLoading2">
|
|
<hc-table :column="tableColumn2" :datas="tableData2" :index-style="{ width: 60 }" :loading="tableLoading2">
|
|
- <template #action="{ row }">
|
|
|
|
- <el-link type="primary">预览</el-link>
|
|
|
|
- <el-link type="danger">删除</el-link>
|
|
|
|
|
|
+ <template #action="{ row, index }">
|
|
|
|
+ <el-link type="primary" @click="previewFile(row)">预览</el-link>
|
|
|
|
+ <el-link type="danger" @click="delFile(index)">删除</el-link>
|
|
</template>
|
|
</template>
|
|
</hc-table>
|
|
</hc-table>
|
|
</div>
|
|
</div>
|
|
@@ -164,7 +164,7 @@ import { ref, watch } from 'vue'
|
|
import { useAppStore } from '~src/store'
|
|
import { useAppStore } from '~src/store'
|
|
import { isNumberReg } from '~uti/tools'
|
|
import { isNumberReg } from '~uti/tools'
|
|
import mainApi from '~api/debit-pay/material/material'
|
|
import mainApi from '~api/debit-pay/material/material'
|
|
-import { formValidate, getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
|
|
|
+import { formValidate, getArrValue, getObjValue, isNullES, newWindow } from 'js-fast-way'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
ids: {
|
|
ids: {
|
|
@@ -386,6 +386,18 @@ const getMaterialDetail = async () => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//可调量失去焦点
|
|
|
|
+const changeTotalBlur = (row) => {
|
|
|
|
+ const { meterTotal, changeTotal } = row
|
|
|
|
+ if (!isNumberReg(changeTotal)) {
|
|
|
|
+ row.changeTotal = meterTotal
|
|
|
|
+ window.$message.warning('请输入正确的可调量')
|
|
|
|
+ } else if (changeTotal > meterTotal) {
|
|
|
|
+ row.changeTotal = meterTotal
|
|
|
|
+ window.$message.warning('只能小于等于计量数量')
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
//上传附件
|
|
//上传附件
|
|
const tableColumn2 = [
|
|
const tableColumn2 = [
|
|
{ key: 'fileName', name: '文件名称' },
|
|
{ key: 'fileName', name: '文件名称' },
|
|
@@ -438,14 +450,49 @@ const attachmentClose = () => {
|
|
formUploadFile.value = []
|
|
formUploadFile.value = []
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//预览附件
|
|
|
|
+const previewFile = ({ fileUrl }) => {
|
|
|
|
+ if (isNullES(fileUrl)) {
|
|
|
|
+ window.$message.warning('此文件已不存在,请删除后,重新上传')
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ newWindow(fileUrl)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//预览附件
|
|
|
|
+const delFile = (index) => {
|
|
|
|
+ tableData2.value.splice(index, 1)
|
|
|
|
+}
|
|
|
|
|
|
//保存
|
|
//保存
|
|
const saveLoaing = ref(false)
|
|
const saveLoaing = ref(false)
|
|
const modalSave = async () => {
|
|
const modalSave = async () => {
|
|
const isForm = await formValidate(formRef.value)
|
|
const isForm = await formValidate(formRef.value)
|
|
if (!isForm) return
|
|
if (!isForm) return
|
|
- modalClose()
|
|
|
|
- emit('finish')
|
|
|
|
|
|
+ const form = formModel.value
|
|
|
|
+ form.details = tableData1.value
|
|
|
|
+ form.files = tableData2.value
|
|
|
|
+ form.projectId = projectId.value
|
|
|
|
+ form.contractId = contractId.value
|
|
|
|
+ if (isNullES(form.id)) {//新增
|
|
|
|
+ const { code, msg } = mainApi.add(form)
|
|
|
|
+ if (code === 200) {
|
|
|
|
+ window.$message.success('保存成功')
|
|
|
|
+ modalClose()
|
|
|
|
+ emit('finish')
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '保存失败')
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ const { code, msg } = mainApi.update(form)
|
|
|
|
+ if (code === 200) {
|
|
|
|
+ window.$message.success('保存成功')
|
|
|
|
+ modalClose()
|
|
|
|
+ emit('finish')
|
|
|
|
+ } else {
|
|
|
|
+ window.$message.error(msg ?? '保存失败')
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
//关闭弹窗
|
|
//关闭弹窗
|