|
@@ -1,5 +1,5 @@
|
|
<template>
|
|
<template>
|
|
- <hc-new-dialog is-table widths="1200px" :show="isShow" title="材料计量单新增" @save="modalSave" @close="modalClose">
|
|
|
|
|
|
+ <hc-new-dialog is-table widths="1200px" :show="isShow" :title="modalTitle" @save="modalSave" @close="modalClose">
|
|
<div class="relative h-full flex">
|
|
<div class="relative h-full flex">
|
|
<div id="hc_modal_tree">
|
|
<div id="hc_modal_tree">
|
|
<hc-card-item scrollbar>
|
|
<hc-card-item scrollbar>
|
|
@@ -12,7 +12,7 @@
|
|
<el-form ref="baseFormRef" :model="baseForm" :rules="baseFormRules" label-position="top" label-width="auto">
|
|
<el-form ref="baseFormRef" :model="baseForm" :rules="baseFormRules" label-position="top" label-width="auto">
|
|
<el-row :gutter="20">
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
- <el-form-item label="材料到场编号:">
|
|
|
|
|
|
+ <el-form-item label="材料到场编号:" prop="materialArriveNumber">
|
|
<el-input v-model="baseForm.materialArriveNumber" />
|
|
<el-input v-model="baseForm.materialArriveNumber" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -30,21 +30,21 @@
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
<el-form-item label="单价:">
|
|
<el-form-item label="单价:">
|
|
- <el-input v-model="baseForm.price" :controls="false" :min="0" class="w-100" :precision="2" @change="calculate" />
|
|
|
|
|
|
+ <el-input-number v-model="baseForm.price" :controls="false" :min="0" class="w-100" :precision="2" @change="calculate" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
- <el-form-item label="数量:">
|
|
|
|
- <el-input-number v-model="baseForm.meterAmount" :controls="false" class="w-100" @change="calculate" />
|
|
|
|
|
|
+ <el-form-item label="数量:" prop="meterAmount">
|
|
|
|
+ <el-input-number v-model="baseForm.meterAmount" :controls="false" class="w-100" :precision="2" @change="calculate" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
<el-form-item label="计量金额:">
|
|
<el-form-item label="计量金额:">
|
|
- <el-input v-model="baseForm.meterMoney" disabled :controls="false" :min="0" class="w-100" :precision="2" />
|
|
|
|
|
|
+ <el-input-number v-model="baseForm.meterMoney" disabled :controls="false" :min="0" class="w-100" :precision="2" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-col :span="8">
|
|
- <el-form-item label="业务日期:">
|
|
|
|
|
|
+ <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" />
|
|
</el-form-item>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-col>
|
|
@@ -114,7 +114,7 @@ import { useAppStore } from '~src/store'
|
|
import contractApi from '~api/debit-pay/material/contract.js'
|
|
import contractApi from '~api/debit-pay/material/contract.js'
|
|
import periodApi from '~api/debit-pay/material/periods.js'
|
|
import periodApi from '~api/debit-pay/material/periods.js'
|
|
import orderApi from '~api/debit-pay/material/order.js'
|
|
import orderApi from '~api/debit-pay/material/order.js'
|
|
-import { arrToKey, getArrValue, getObjValue } from 'js-fast-way'
|
|
|
|
|
|
+import { arrToKey, formValidate, getArrValue } from 'js-fast-way'
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
ids: {
|
|
ids: {
|
|
type: [String, Number],
|
|
type: [String, Number],
|
|
@@ -124,6 +124,7 @@ const props = defineProps({
|
|
type: Object,
|
|
type: Object,
|
|
default: () => ({}),
|
|
default: () => ({}),
|
|
},
|
|
},
|
|
|
|
+
|
|
})
|
|
})
|
|
//事件
|
|
//事件
|
|
const emit = defineEmits(['close'])
|
|
const emit = defineEmits(['close'])
|
|
@@ -132,6 +133,7 @@ const contractId = ref(useAppState.getContractId)
|
|
const projectId = ref(useAppState.getProjectId)
|
|
const projectId = ref(useAppState.getProjectId)
|
|
const infoData = ref(props.infoData)
|
|
const infoData = ref(props.infoData)
|
|
const ids = ref(props.ids)
|
|
const ids = ref(props.ids)
|
|
|
|
+
|
|
//双向绑定
|
|
//双向绑定
|
|
// eslint-disable-next-line no-undef
|
|
// eslint-disable-next-line no-undef
|
|
const isShow = defineModel('modelValue', {
|
|
const isShow = defineModel('modelValue', {
|
|
@@ -139,20 +141,25 @@ const isShow = defineModel('modelValue', {
|
|
})
|
|
})
|
|
const baseForm = ref({})
|
|
const baseForm = ref({})
|
|
const fileName = ref('')
|
|
const fileName = ref('')
|
|
|
|
+const modalTitle = ref('材料计量单新增')
|
|
//监听
|
|
//监听
|
|
watch(() => [
|
|
watch(() => [
|
|
props.ids,
|
|
props.ids,
|
|
props.infoData,
|
|
props.infoData,
|
|
|
|
+
|
|
], ([Id, info]) => {
|
|
], ([Id, info]) => {
|
|
ids.value = Id
|
|
ids.value = Id
|
|
infoData.value = info
|
|
infoData.value = info
|
|
|
|
+
|
|
|
|
|
|
if (Id.length > 0) {
|
|
if (Id.length > 0) {
|
|
baseForm.value = info
|
|
baseForm.value = info
|
|
fileName.value = arrToKey(info?.fileList, 'fileName', ',')
|
|
fileName.value = arrToKey(info?.fileList, 'fileName', ',')
|
|
|
|
+ modalTitle.value = '材料计量单编辑'
|
|
} else {
|
|
} else {
|
|
baseForm.value = {}
|
|
baseForm.value = {}
|
|
fileName.value = ''
|
|
fileName.value = ''
|
|
|
|
+ modalTitle.value = '材料计量单新增'
|
|
}
|
|
}
|
|
}, { immediate: true })
|
|
}, { immediate: true })
|
|
|
|
|
|
@@ -226,45 +233,66 @@ const treeClick = ({ node, data, keys })=>{
|
|
//基础表单
|
|
//基础表单
|
|
const baseFormRef = ref(null)
|
|
const baseFormRef = ref(null)
|
|
// const baseForm = ref({})
|
|
// const baseForm = ref({})
|
|
-const baseFormRules = {}
|
|
|
|
|
|
+const baseFormRules = {
|
|
|
|
+ materialArriveNumber: {
|
|
|
|
+ required: true,
|
|
|
|
+ trigger: 'blur',
|
|
|
|
+ message: '请输入材料到场编号',
|
|
|
|
+ },
|
|
|
|
+ meterAmount: {
|
|
|
|
+ required: true,
|
|
|
|
+ trigger: 'blur',
|
|
|
|
+ message: '请输入数量',
|
|
|
|
+ },
|
|
|
|
+ businessDate: {
|
|
|
|
+ required: true,
|
|
|
|
+ trigger: 'blur',
|
|
|
|
+ message: '请输入业务日期',
|
|
|
|
+ },
|
|
|
|
+}
|
|
const modalSaving = ref(false)
|
|
const modalSaving = ref(false)
|
|
const modalSave = async () => {
|
|
const modalSave = async () => {
|
|
if (!treeItem.value?.id && ids.value.length < 1) {
|
|
if (!treeItem.value?.id && ids.value.length < 1) {
|
|
window.$message.warning('请先选择左侧节点')
|
|
window.$message.warning('请先选择左侧节点')
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- modalSaving.value = true
|
|
|
|
- if (ids.value.length < 1) {
|
|
|
|
- const { error, code, msg } = await orderApi.add({
|
|
|
|
- ...baseForm.value,
|
|
|
|
- contractId:contractId.value,
|
|
|
|
- contractMaterialId:treeItem.value?.id,
|
|
|
|
- projectId:projectId.value,
|
|
|
|
- })
|
|
|
|
- //判断状态
|
|
|
|
- modalSaving.value = false
|
|
|
|
- if (!error && code === 200) {
|
|
|
|
- window?.$message?.success(msg)
|
|
|
|
|
|
+ const res = await formValidate(baseFormRef.value)
|
|
|
|
+ if (res) {
|
|
|
|
+ modalSaving.value = true
|
|
|
|
+ if (ids.value.length < 1) {
|
|
|
|
+ const { error, code, msg } = await orderApi.add({
|
|
|
|
+ ...baseForm.value,
|
|
|
|
+ contractId:contractId.value,
|
|
|
|
+ contractMaterialId:treeItem.value?.id,
|
|
|
|
+ projectId:projectId.value,
|
|
|
|
+ })
|
|
|
|
+ //判断状态
|
|
|
|
+ modalSaving.value = false
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window?.$message?.success(msg)
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- } else if (ids.value.length > 0) {
|
|
|
|
- const { error, code, msg } = await orderApi.update({
|
|
|
|
- ...baseForm.value,
|
|
|
|
- contractId:contractId.value,
|
|
|
|
- contractMaterialId:treeItem.value?.id,
|
|
|
|
- projectId:projectId.value,
|
|
|
|
- })
|
|
|
|
- //判断状态
|
|
|
|
- modalSaving.value = false
|
|
|
|
- if (!error && code === 200) {
|
|
|
|
- window?.$message?.success(msg)
|
|
|
|
|
|
+ }
|
|
|
|
+ } else if (ids.value.length > 0) {
|
|
|
|
+ const { error, code, msg } = await orderApi.update({
|
|
|
|
+ ...baseForm.value,
|
|
|
|
+ contractId:contractId.value,
|
|
|
|
+ contractMaterialId:treeItem.value?.id,
|
|
|
|
+ projectId:projectId.value,
|
|
|
|
+ })
|
|
|
|
+ //判断状态
|
|
|
|
+ modalSaving.value = false
|
|
|
|
+ if (!error && code === 200) {
|
|
|
|
+ window?.$message?.success(msg)
|
|
|
|
+
|
|
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ modalClose()
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
- modalClose()
|
|
|
|
}
|
|
}
|
|
const HcUploadFileRef = ref(null)
|
|
const HcUploadFileRef = ref(null)
|
|
// const fileName = ref('')
|
|
// const fileName = ref('')
|