gaoluyang
21 小时以前 c7aebff7f6184b2d8da2669d2db5656e2bc09ec4
src/views/salesManagement/invoiceLedger/index.vue
@@ -18,6 +18,9 @@
        <el-form-item label="不显示有发票行">
          <el-checkbox v-model="searchForm.status" @change="handleQuery" />
        </el-form-item>
        <el-form-item label="发票金额">
          <el-input-number v-model="searchForm.invoiceTotal" :min="0" :precision="2" placeholder="请输入" style="width: 180px" @change="handleQuery" />
        </el-form-item>
        <el-form-item>
          <el-button type="primary" @click="handleQuery"> 搜索 </el-button>
          <el-button @click="resetForm"> 重置 </el-button>
@@ -32,7 +35,6 @@
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column label="销售合同号" prop="salesContractNo" show-overflow-tooltip width="180" />
        <el-table-column label="客户名称" prop="customerName" show-overflow-tooltip width="240" />
<!--        <el-table-column label="项目" prop="projectName" width="320" />-->
        <el-table-column label="产品大类" prop="productCategory" width="200" />
        <el-table-column label="规格型号" prop="specificationModel" width="160" show-overflow-tooltip />
        <el-table-column label="发票号" prop="invoiceNo" width="200" show-overflow-tooltip />
@@ -42,22 +44,11 @@
        <el-table-column label="录入人" prop="invoicePerson" show-overflow-tooltip />
        <el-table-column label="录入日期" prop="createTime" show-overflow-tooltip :formatter="formatDate" width="180" />
        <el-table-column label="开票日期" prop="invoiceDate" show-overflow-tooltip width="120" />
        <!-- <el-table-column label="发票" prop="invoiceFileName" width="120" align="center" show-overflow-tooltip fixed="right">
          <template #default="scope">
            <el-button v-if="scope.row.invoiceFileName" text bg type="primary"
              @click="handleFile(scope.row.commonFiles)">
              查看附件
            </el-button>
            <el-button v-else link type="primary" @click="handleDownload(scope.row)">
              上传
            </el-button>
          </template>
        </el-table-column> -->
        <el-table-column fixed="right" label="操作" width="150" align="center">
          <template #default="scope">
            <el-button link type="primary" size="small" @click="openForm(scope.row)">编辑</el-button>
            <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">附件</el-button>
            <el-button link type="primary" size="small" @click="delInvoiceLedger(scope.row)">删除</el-button>
            <el-button link type="primary" @click="openForm(scope.row)">编辑</el-button>
            <el-button link type="primary" @click="downLoadFile(scope.row)">附件</el-button>
            <el-button link type="primary" @click="delInvoiceLedger(scope.row)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
@@ -85,8 +76,11 @@
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item :label="`发票金额(元): 合同总额(${form.taxInclusiveTotalPrice}元)`" prop="invoiceTotal">
              <el-input-number :step="0.01" :min="0" :max="form.taxInclusiveTotalPrice" style="width: 100%" v-model="form.invoiceTotal" placeholder="请输入" clearable :precision="2"/>
            <el-form-item :label="`发票金额(元): `" prop="invoiceTotal">
              <el-input-number :step="0.01" :min="0" :max="maxInvoiceAmount || form.taxInclusiveTotalPrice" style="width: 100%" v-model="form.invoiceTotal" placeholder="请输入" clearable :precision="2"/>
              <div v-if="maxInvoiceAmount > 0" style="color: #909399; font-size: 12px; margin-top: 5px;">
                可填最大金额为:¥{{ maxInvoiceAmount.toFixed(2) }}元
              </div>
            </el-form-item>
          </el-col>
        </el-row>
@@ -187,6 +181,7 @@
    invoiceDateStart: undefined,
    invoiceDateEnd: undefined,
    createTimeStart: "", // 录入日期
    invoiceTotal: undefined, // 发票金额
  },
  form: {
    salesLedgerId: "",
@@ -212,9 +207,22 @@
  },
});
const { form, rules } = toRefs(data);
const { form: searchForm, resetForm } = useFormData(data.searchForm);
const { form: searchForm } = useFormData(data.searchForm);
// 自定义重置函数
const resetForm = () => {
  searchForm.searchText = "";
  searchForm.status = false;
  searchForm.invoiceDate = null;
  searchForm.invoiceDateStart = undefined;
  searchForm.invoiceDateEnd = undefined;
  searchForm.createTimeStart = "";
  searchForm.invoiceTotal = undefined;
  handleQuery();
};
const currentId = ref("");
const userStore = useUserStore();
const maxInvoiceAmount = ref(0); // 发票金额最大值
const upload = reactive({
  // 上传的地址
  url: import.meta.env.VITE_APP_BASE_API + "/invoiceLedger/uploadFile",
@@ -281,6 +289,11 @@
    if (!form.value.invoicePerson) {
      form.value.invoicePerson = userStore.nickName;
    }
    // 计算发票金额最大值:noInvoiceAmount + invoiceAmount
    const noInvoiceAmount = parseFloat(res.data.noInvoiceAmount || 0);
    const invoiceAmount = parseFloat(res.data.invoiceAmount || 0);
    maxInvoiceAmount.value = noInvoiceAmount + invoiceAmount;
  });
  dialogFormVisible.value = true;
};
@@ -439,12 +452,6 @@
}
onMounted(() => {
  // 设置开票日期范围默认值为当天
  const today = dayjs().format('YYYY-MM-DD');
  searchForm.invoiceDate = [today, today];
  // 设置范围日期字段的起始和结束时间
  searchForm.invoiceDateStart = today;
  searchForm.invoiceDateEnd = today;
  getList();
});
</script>