|
@@ -0,0 +1,235 @@
|
|
|
+<template>
|
|
|
+ <div class="tenant">
|
|
|
+ <byTable
|
|
|
+ :source="sourceList.data"
|
|
|
+ :pagination="sourceList.pagination"
|
|
|
+ :config="config"
|
|
|
+ :loading="loading"
|
|
|
+ highlight-current-row
|
|
|
+ :selectConfig="selectConfig"
|
|
|
+ :table-events="{
|
|
|
+ select: select,
|
|
|
+ }"
|
|
|
+ :action-list="[
|
|
|
+ {
|
|
|
+ text: '添加发票',
|
|
|
+ action: () => openModal('add'),
|
|
|
+ },
|
|
|
+ ]"
|
|
|
+ @get-list="getList">
|
|
|
+ </byTable>
|
|
|
+
|
|
|
+ <el-dialog title="添加发票" v-if="dialogVisible" v-model="dialogVisible" width="600">
|
|
|
+ <byForm :formConfig="formConfig" :formOption="formOption" v-model="formData.data" :rules="rules" ref="submit"> </byForm>
|
|
|
+ <template #footer>
|
|
|
+ <el-button @click="dialogVisible = false" size="large">取 消</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm()" size="large" :loading="submitLoading"> 确 定 </el-button>
|
|
|
+ </template>
|
|
|
+ </el-dialog>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<script setup>
|
|
|
+import { ElMessage, ElMessageBox } from "element-plus";
|
|
|
+import byTable from "@/components/byTable/index";
|
|
|
+import byForm from "@/components/byForm/index";
|
|
|
+import { computed, ref } from "vue";
|
|
|
+import useUserStore from "@/store/modules/user";
|
|
|
+
|
|
|
+const { proxy } = getCurrentInstance();
|
|
|
+const customerList = ref([]);
|
|
|
+const invoiceType = ref([]);
|
|
|
+const loading = ref(false);
|
|
|
+const sourceList = ref({
|
|
|
+ data: [],
|
|
|
+ pagination: {
|
|
|
+ total: 0,
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ keyword: "",
|
|
|
+ customerId: "",
|
|
|
+ },
|
|
|
+});
|
|
|
+const selectConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ label: "归属公司",
|
|
|
+ prop: "customerId",
|
|
|
+ data: customerList.value,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const config = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "归属公司",
|
|
|
+ prop: "customerName",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "发票金额",
|
|
|
+ prop: "money",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "开票时间",
|
|
|
+ prop: "createTime",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "创建人",
|
|
|
+ prop: "userName",
|
|
|
+ width: 160,
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "关联合同",
|
|
|
+ prop: "contractCodes",
|
|
|
+ },
|
|
|
+ },
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "操作",
|
|
|
+ width: "80",
|
|
|
+ align: "center",
|
|
|
+ },
|
|
|
+ renderHTML(row) {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ attrs: {
|
|
|
+ label: "删除",
|
|
|
+ type: "danger",
|
|
|
+ text: true,
|
|
|
+ },
|
|
|
+ el: "button",
|
|
|
+ click() {
|
|
|
+ ElMessageBox.confirm("此操作将永久删除该数据, 是否继续?", "提示", {
|
|
|
+ confirmButtonText: "确定",
|
|
|
+ cancelButtonText: "取消",
|
|
|
+ type: "warning",
|
|
|
+ }).then(() => {
|
|
|
+ proxy
|
|
|
+ .post("/supplierInfo/delete", {
|
|
|
+ id: row.id,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ ElMessage({
|
|
|
+ message: "删除成功",
|
|
|
+ type: "success",
|
|
|
+ });
|
|
|
+ getList();
|
|
|
+ });
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+ },
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const getDict = () => {
|
|
|
+ proxy.post("/customer/page", { pageNum: 1, pageSize: 999 }).then((res) => {
|
|
|
+ customerList.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ ...item,
|
|
|
+ label: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
+ proxy
|
|
|
+ .post("/dictTenantData/page", {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 999,
|
|
|
+ dictCode: "invoice_type",
|
|
|
+ tenantId: useUserStore().user.tenantId,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.rows && res.rows.length > 0) {
|
|
|
+ invoiceType.value = res.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ label: item.dictValue,
|
|
|
+ value: item.dictKey,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+};
|
|
|
+getDict();
|
|
|
+const getList = async (req) => {
|
|
|
+ sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
|
|
|
+ loading.value = true;
|
|
|
+ proxy.post("/contractInvoice/page", sourceList.value.pagination).then((message) => {
|
|
|
+ sourceList.value.data = message.rows;
|
|
|
+ sourceList.value.pagination.total = message.total;
|
|
|
+ setTimeout(() => {
|
|
|
+ loading.value = false;
|
|
|
+ }, 200);
|
|
|
+ });
|
|
|
+};
|
|
|
+getList();
|
|
|
+const dialogVisible = ref(false);
|
|
|
+const submit = ref(null);
|
|
|
+const submitLoading = ref(false);
|
|
|
+const formData = reactive({
|
|
|
+ data: {},
|
|
|
+});
|
|
|
+const formOption = reactive({
|
|
|
+ inline: true,
|
|
|
+ labelWidth: 100,
|
|
|
+ itemWidth: 100,
|
|
|
+ rules: [],
|
|
|
+});
|
|
|
+const formConfig = computed(() => {
|
|
|
+ return [
|
|
|
+ {
|
|
|
+ type: "select",
|
|
|
+ label: "发票类型",
|
|
|
+ prop: "type",
|
|
|
+ data: invoiceType.value,
|
|
|
+ },
|
|
|
+ ];
|
|
|
+});
|
|
|
+const rules = ref({
|
|
|
+ type: [{ required: true, message: "请选择发票类型", trigger: "change" }],
|
|
|
+});
|
|
|
+const openModal = () => {
|
|
|
+ formData.data = {
|
|
|
+ invoiceDetailsList: [],
|
|
|
+ };
|
|
|
+ dialogVisible.value = true;
|
|
|
+};
|
|
|
+const submitForm = () => {
|
|
|
+ submit.value.handleSubmit(() => {
|
|
|
+ submitLoading.value = true;
|
|
|
+ proxy.post("/contractInvoice/add", formData.data).then(
|
|
|
+ () => {
|
|
|
+ ElMessage({ message: "添加成功", type: "success" });
|
|
|
+ dialogVisible.value = false;
|
|
|
+ submitLoading.value = false;
|
|
|
+ getList();
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ console.log(err);
|
|
|
+ submitLoading.value = false;
|
|
|
+ }
|
|
|
+ );
|
|
|
+ });
|
|
|
+};
|
|
|
+</script>
|
|
|
+
|
|
|
+<style lang="scss" scoped>
|
|
|
+.tenant {
|
|
|
+ padding: 20px;
|
|
|
+}
|
|
|
+::v-deep(.el-input-number .el-input__inner) {
|
|
|
+ text-align: left;
|
|
|
+}
|
|
|
+</style>
|