|
@@ -1,7 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import { ElMessage, dayjs, ElForm } from "element-plus";
|
|
|
import { computed, reactive, ref, watchEffect } from "vue";
|
|
|
-import { upload_invoice_rules } from "../../../config/configs";
|
|
|
+import { upload_invoice_rules, jsRequiredKeys, noPassRequiredKeys } from "../../../config/configs";
|
|
|
import { input_type_list, open_type_list } from "../../../status";
|
|
|
|
|
|
const props = defineProps<{
|
|
@@ -14,7 +14,7 @@ const rules = reactive({ ...upload_invoice_rules });
|
|
|
|
|
|
const disabled = computed(() => formData.input_type === "1");
|
|
|
|
|
|
-const noPass = computed(() => formData.status === "4");
|
|
|
+const noPass = computed(() => formData.status === "5");
|
|
|
|
|
|
const scanInputValue = ref("");
|
|
|
|
|
@@ -31,8 +31,8 @@ const formData = reactive({
|
|
|
});
|
|
|
|
|
|
function handleSaveStatus() {
|
|
|
- formRef.value.validate(isVaild => {
|
|
|
- if (!isVaild) return
|
|
|
+ formRef.value.validate(isValid => {
|
|
|
+ if (!isValid) return
|
|
|
|
|
|
const {
|
|
|
input_type: _,
|
|
@@ -46,10 +46,14 @@ function handleSaveStatus() {
|
|
|
let params: Record<string, string> | null = null;
|
|
|
|
|
|
switch (status) {
|
|
|
- case "4":
|
|
|
- params = { status: "4", remark: formData.remark };
|
|
|
+ case "5":
|
|
|
+ params = { status: "5", remark: formData.remark };
|
|
|
break;
|
|
|
default:
|
|
|
+ if (Number(subtotal_fee) >= Number(total_fee) && formData.open_type !== '1') {
|
|
|
+ return ElMessage.error('税前金额不能大于或等于税后金额')
|
|
|
+ }
|
|
|
+
|
|
|
if (formData.open_type === "1") {
|
|
|
//金税开票 -> 财务审核
|
|
|
params = { status: "1", open_type: "1", remark };
|
|
@@ -99,9 +103,21 @@ function handleScanKeydown(evt: KeyboardEvent) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-watchEffect(() => {
|
|
|
- const { status } = formData;
|
|
|
- rules.remark[0].required = status === '4'
|
|
|
+watchEffect(() => {
|
|
|
+ const { status, open_type } = formData;
|
|
|
+ const keys = Object.keys(upload_invoice_rules);
|
|
|
+
|
|
|
+ keys.forEach(key => {
|
|
|
+ if (open_type === '1') {
|
|
|
+ rules[key][0].required = jsRequiredKeys.includes(key)
|
|
|
+ } else if (status === '5') {
|
|
|
+ rules[key][0].required = noPassRequiredKeys.includes(key)
|
|
|
+ } else {
|
|
|
+ rules[key][0].required = key !== 'remark'
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ console.log(rules)
|
|
|
})
|
|
|
</script>
|
|
|
|
|
@@ -113,7 +129,7 @@ watchEffect(() => {
|
|
|
<el-form-item label="审核状态" prop="status">
|
|
|
<el-select v-model="formData.status" placeholder="菜单名称">
|
|
|
<el-option label="通过" value="1" />
|
|
|
- <el-option label="不通过" value="4" />
|
|
|
+ <el-option label="不通过" value="5" />
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="开票类型" prop="open_type" v-if="!noPass">
|
|
@@ -139,12 +155,12 @@ watchEffect(() => {
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
- <el-col :span="16" style="padding: 0 0 0 16px" v-show="formData.input_type === '1'">
|
|
|
+ <el-col :span="16" style="padding: 0 0 0 16px" v-if="formData.input_type === '1'">
|
|
|
<el-input v-model="scanInputValue" :rows="1" type="textarea" maxlength="30" placeholder="扫码枪输入处"
|
|
|
@keydown="handleScanKeydown" />
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
- <el-row v-show="formData.open_type !== '1'" v-if="!noPass">
|
|
|
+ <el-row v-if="!noPass && formData.open_type !== '1'">
|
|
|
<el-col :span="8">
|
|
|
<el-form-item label="发票号码" prop="invCode">
|
|
|
<el-input v-model="formData.invCode" placeholder="发票号码" :disabled="disabled" />
|