Browse Source

Merge branch 'stage' into dev0.3

cz 1 year ago
parent
commit
bc5b7d31ca

+ 2 - 2
src/components/byForm/index.vue

@@ -170,9 +170,9 @@
             :disabled="i.disabled ? i.disabled : false"
             :style="i.style">
           </el-cascader>
-          <div class="form-title" v-else-if="i.type == 'title'">
+          <!-- <div class="form-title" v-else-if="i.type == 'title'">
             {{ i.title }}
-          </div>
+          </div> -->
           <slot :name="i.slotName" v-else-if="i.type == 'slot'"> {{ i.slotName }}插槽占位符 </slot>
           <div class="upload" v-else-if="i.type == 'upload'">
             <el-upload

+ 6 - 3
src/components/byTable/index.vue

@@ -14,10 +14,11 @@
       </el-button>
     </div>
   </div>
+  <!-- statWarpHeight > 200 &&  -->
   <div
     class="stat-warp"
     v-if="statConfig.length != 0"
-    :class="statWarpHeight > 200 && isMore ? 'show-more' : ''"
+    :class="isMore ? 'show-more' : ''"
   >
     <div class="title">
       <select
@@ -31,7 +32,8 @@
       </select>
       <div v-if="statConfig.length === 1">{{ statConfig[0].label }}</div>
     </div>
-    <div class="more-btn"  @click="isMore = !isMore" v-if="statWarpHeight > 200">
+    <!-- v-if="statWarpHeight > 200" -->
+    <div class="more-btn"  @click="isMore = !isMore" >
       <span>
         <i v-if="!isMore" class="iconfont icon-btn_xiala22"></i>
         <i v-else class="iconfont icon-btn_shouqi22"></i>
@@ -358,6 +360,7 @@ export default defineComponent({
     const changeStatData = () => {
       statWarpHeight.value = document.getElementById("statWarp").offsetHeight;
     };
+    
     let statWarpHeight = ref(0);
     watch(
       proxy.statConfig,
@@ -367,7 +370,7 @@ export default defineComponent({
           statWarpHeight.value =
             document.getElementById("statWarp").offsetHeight;
         }, 500);
-      },
+      }, 
       { immediate: true }
     );
     let statSelectVal = ref(0);

+ 34 - 7
src/components/process/Contract.vue

@@ -1685,18 +1685,19 @@ const changeShroffAccount = (val) => {
     let data = accountList.value.filter((item) => item.value === val);
     console.log(formData.data.contractType);
     if (data && data.length > 0) {
-      if(formData.data.contractType == 2){
+      if (formData.data.contractType == 2) {
         formData.data.beneficiaryName = data[0].name;
         formData.data.beneficiaryBank = data[0].openingBank;
         formData.data.beneficiaryAccountNumber = data[0].accountOpening;
-        formData.data.beneficiaryBankAddress = '';
-        formData.data.swiftCode = '';
-        formData.data.beneficiaryAddress = '';
-      }else{
+        formData.data.beneficiaryBankAddress = "";
+        formData.data.swiftCode = "";
+        formData.data.beneficiaryAddress = "";
+      } else {
         formData.data.beneficiaryName = data[0].beneficiaryName;
         formData.data.beneficiaryBank = data[0].beneficiaryBank;
         formData.data.beneficiaryBankAddress = data[0].beneficiaryBankAddress;
-        formData.data.beneficiaryAccountNumber = data[0].beneficiaryAccountNumber;
+        formData.data.beneficiaryAccountNumber =
+          data[0].beneficiaryAccountNumber;
         formData.data.swiftCode = data[0].swiftCode;
         formData.data.beneficiaryAddress = data[0].beneficiaryAddress;
       }
@@ -1711,9 +1712,35 @@ watch(
       props.queryData &&
       ["10", "20", "30"].includes(route.query.processType)
     ) {
-      for (var text in props.queryData) {
+      for (let text in props.queryData) {
         formData.data[text] = props.queryData[text];
       }
+      console.log(formData.data, "asda");
+      for (let i = 0; i < formData.data.contractProductList.length; i++) {
+        if (!formData.data.contractProductList[i].name) {
+          formData.data.contractProductList[i].name =
+            formData.data.contractProductList[i].productCnName;
+        }
+        if (!formData.data.contractProductList[i].code) {
+          formData.data.contractProductList[i].code =
+            formData.data.contractProductList[i].productCode;
+        }
+      }
+      if (
+        formData.data.contractShipmentList &&
+        formData.data.contractShipmentList.length > 0
+      ) {
+        for (let i = 0; i < formData.data.contractShipmentList.length; i++) {
+          if (!formData.data.contractShipmentList[i].code) {
+            formData.data.contractShipmentList[i].code =
+              formData.data.contractProductList[i].productCode;
+          }
+          if (!formData.data.contractShipmentList[i].productName) {
+            formData.data.contractShipmentList[i].productName =
+              formData.data.contractProductList[i].productCnName;
+          }
+        }
+      }
       if (formData.data.countryId) {
         getCityData(formData.data.countryId, "20");
       }

+ 3 - 3
src/components/process/ContractAlteration.vue

@@ -1459,9 +1459,9 @@ const querySearch = (queryString, callback) => {
 };
 const clickSplit = (item) => {
   formData.data.contractShipmentList.push({
-    code: item.code,
+    productCode: item.productCode,
     productId: item.productId,
-    productName: item.productName,
+    productCnName: item.productCnName,
     shipmentTime: "",
     quantity: undefined,
   });
@@ -1527,7 +1527,7 @@ watch(
   () => {
     formOption.disabled = judgeStatus();
     if (props.queryData && ["10", "20", "30"].includes(route.query.processType)) {
-      for (var text in props.queryData) {
+      for (let text in props.queryData) {
         formData.data[text] = props.queryData[text];
       }
       if (formData.data.countryId) {

+ 24 - 27
src/views/finance/fundManage/accountStatement/index.vue

@@ -471,6 +471,9 @@ const config = computed(() => {
 });
 let transferMoneyModal = ref(false);
 const openTransferMoney = () => {
+  formData2.data = {
+    transactionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
+  };
   transferMoneyModal.value = true;
 };
 const formData2 = reactive({
@@ -497,14 +500,21 @@ const transferMoneyConfig = computed(() => {
 			selectPlaceholder: '币种',
 			selectProp: 'currency',
       fn: (value) => {
-        if (value != '') {
-          if (value.indexOf('.') > -1) {
-              formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
-          } else { 
-            formData2.data.amount = value
+        //判断value的类型
+        if(isNaN(value)){
+          
+          formData2.data.inCurrency = formData2.data.currency
+          formData2.data.commissionCurrency = formData2.data.currency
+        }else{
+          if (value != '') {
+            if (value.indexOf('.') > -1) {
+                formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
+            } else { 
+              formData2.data.amount = value
+            }
           }
-      }
-        formData2.data.inAmount = formData2.data.amount
+          formData2.data.inAmount = formData2.data.amount
+        }
       },
 		},
     
@@ -693,18 +703,18 @@ const formConfig = computed(() => {
           label: "合同到账",
         }
       : {},
-      {
+    {
       type: "radio",
       prop: "isTransaction",
       label: "是否往来",
       data: [
         {
           label: "是",
-          value: "1",
+          value: 1,
         },
         {
           label: "否",
-          value: "0",
+          value: 0,
         },
       ],
       fn: (val) => {
@@ -717,23 +727,7 @@ const formConfig = computed(() => {
       prop: "transactionDeptId",
       label: "往来单位",
       data: [],
-      isShow: formData.data.isTransaction == "1",
-      isLoad: {
-        //链接
-        url: "transactionDepartment/list?pageNum=1&pageSize=999",
-        method: "get",
-        //返回数据的路径默认返回data
-        resUrl: "data",
-        //参数
-        req: {},
-        //返回数据的key
-        labelKey: "name",
-        //返回数据的value
-        labelVal: "id",
-      },
-      fn: (val) => {
-        console.log(formConfig.value)
-      },
+      isShow: formData.data.isTransaction == 1,
     },
     {
       type: "title",
@@ -780,6 +774,8 @@ const getTransactionDepartment = () => {
           value: item.id,
         };
       });
+      formConfig.value[7].data = transactionDepartmentData.value
+      console.log(formConfig.value[7])
     });
 };
 getTransactionDepartment()
@@ -1036,6 +1032,7 @@ const update = (row) => {
   proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
     formData.data = res;
     loadingDialog.value = false;
+    getTransactionDepartment()
   });
   dialogVisible.value = true;
 };

+ 18 - 7
src/views/finance/fundManage/flow/index.vue

@@ -451,14 +451,21 @@ const transferMoneyConfig = computed(() => {
 			selectPlaceholder: '币种',
 			selectProp: 'currency',
       fn: (value) => {
-        if (value != '') {
-          if (value.indexOf('.') > -1) {
-              formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
-          } else { 
-            formData2.data.amount = value
+        //判断value的类型
+        if(isNaN(value)){
+          
+          formData2.data.inCurrency = formData2.data.currency
+          formData2.data.commissionCurrency = formData2.data.currency
+        }else{
+          if (value != '') {
+            if (value.indexOf('.') > -1) {
+                formData2.data.amount = value.slice(0, value.indexOf('.') + 3)
+            } else { 
+              formData2.data.amount = value
+            }
           }
-      }
-        formData2.data.inAmount = formData2.data.amount
+          formData2.data.inAmount = formData2.data.amount
+        }
       },
 		},
     
@@ -703,6 +710,8 @@ const getTransactionDepartment = () => {
           value: item.id,
         };
       });
+      formConfig.value[7].data = transactionDepartmentData.value
+      formConfig.value = {...formConfig.value}
     });
 };
 getTransactionDepartment()
@@ -758,7 +767,9 @@ const update = (row) => {
   proxy.post("/accountRunningWater/detail", { id: row.id }).then((res) => {
     formData.data = res;
     loadingDialog.value = false;
+    getTransactionDepartment()
   });
+  
   dialogVisible.value = true;
 };
 const deriveExcel = () => {

+ 2 - 2
src/views/salesMange/saleContract/claim/index.vue

@@ -74,7 +74,7 @@
       </byForm>
       <template #footer>
         <el-button @click="dialogVisible = false" size="large">取 消</el-button>
-        <el-button type="primary" v-no-double-click="submitForm" size="large" :loading="submitLoading"> 确 定 </el-button>
+        <el-button type="primary" @click="submitForm('byform')" size="large" :loading="submitLoading"> 确 定 </el-button>
       </template>
     </el-dialog>
 
@@ -415,7 +415,7 @@ const getDtl = (row) => {
       rate: row.rate,
       status: row.status + "",
       currency: row.currency,
-      waitAmount: Number(row.amount) - Number(res.data),
+      waitAmount: Math.round((Number(row.amount) - Number(res.data))* 100) / 100,
       accountManagementId: row.accountManagementId,
       accountManagementName: row.accountManagementName,
       claimTime: row.transactionTime,

+ 12 - 7
src/views/salesMange/saleContract/contract/index.vue

@@ -584,14 +584,12 @@ const getList = async (req) => {
     }, 200);
   });
 };
-const statConfig = computed(() => {
-  return [
-    {
+const statConfig = ref(
+  [{
       label: "合计",
       data: [],
-    },
-  ];
-});
+    }]
+)
 getDict();
 if (route.query.code) {
   sourceList.value.pagination.keyword = route.query.code;
@@ -601,7 +599,12 @@ onMounted(() => {
 })
 const getTotal = () => {
   proxy.post("/contract/getHeadCustomerStatistics",sourceList.value.pagination).then((res) => {
-    
+    statConfig.value = [
+      {
+        label: "合计",
+        data: [],
+      },
+    ];
     statConfig.value[0].data.push({
       label: "合计",
       data: [
@@ -643,7 +646,9 @@ const getTotal = () => {
           },
         ],
       });
+      
     }
+    console.log(statConfig.value)
     console.log(res);
   });
 };

+ 204 - 46
src/views/salesMange/saleContract/middle/index.vue

@@ -1,13 +1,33 @@
 <template>
   <div class="tenant">
+    <div class="isSet-box">
+      <el-radio-group v-model="sourceList.pagination.isSet" size="large" @change="getList">
+        <el-radio-button label="1">未创建</el-radio-button>
+        <el-radio-button label="2">已创建</el-radio-button>
+      </el-radio-group>
+    </div>
     <div class="content">
       <byTable
         :source="sourceList.data"
         :pagination="sourceList.pagination"
-        :config="config"
+        :config="sourceList.pagination.isSet == '1' ? config : config2"
         :loading="loading"
         :selectConfig="selectConfig"
         highlight-current-row
+        :action-list="[
+					{
+						text: '生成中间合同',
+						plain: true,
+						type: 'warning',
+            disabled: selection.data.length === 0,
+						action: () => openModal('add'),
+					},
+				]"
+        :table-events="{
+          //element talbe事件都能传
+          select: select,
+          selectAll: select,
+        }"
         @get-list="getList">
         <template #code="{ item }">
           <div style="width: 100%">
@@ -22,14 +42,14 @@
         </template>
         <template #sellCorporationName="{ item }">
           <div>
-            <span v-if="item.sellCorporationName">{{ item.sellCorporationName }}</span>
-            <span v-else>{{ item.oldSellCorporationName }}</span>
+            <span v-if="item.sellCorporationName">{{ item.buyCorporationName}}</span>
+            <span v-else>{{ item.buyCorporationName }}</span>
           </div>
         </template>
         <template #buyCorporationName="{ item }">
           <div>
-            <span v-if="item.buyCorporationName">{{ item.buyCorporationName }}</span>
-            <span v-else>{{ item.oldBuyCorporationName }}</span>
+            <span v-if="item.buyCorporationName">{{ item.sellCorporationName }}</span>
+            <span v-else>{{ item.sellCorporationName }}</span>
           </div>
         </template>
       </byTable>
@@ -42,11 +62,12 @@
             {{ printDetails.sellCorporationNameEn }}
           </div>
           <div style="text-align: center">
-            {{ printDetails.sellDetailedAddress }},{{ printDetails.sellCityName }},{{ printDetails.sellProvinceName }},{{ printDetails.sellCountryName }}
+            {{ printDetails.buyDetailedAddress }}
+            <!-- {{ printDetails.sellDetailedAddress }},{{ printDetails.sellCityName }},{{ printDetails.sellProvinceName }},{{ printDetails.sellCountryName }} -->
           </div>
           <div style="font-size: 14px; color: #409eff; text-align: center; padding-top: 16px">PROFORMA INVOICE</div>
           <div style="padding-top: 8px">
-            <div>PI NO. : {{ printDetails.contractCode }}</div>
+            <div>PI NO. : {{ printDetails.code }}</div>
             <div>PI DATE: {{ printDetails.createTimeEn }}</div>
           </div>
           <div style="border: 1px solid black; display: flex">
@@ -125,8 +146,9 @@
             <div class="contentRow" style="width: 100px; text-align: center">UNIT PRICE</div>
             <div class="contentRow" style="width: 100px; text-align: center">TOTAL PRICE</div>
           </div>
-          <div v-if="printDetails.productInfoList && printDetails.productInfoList.length > 0">
-            <div class="baseRow" style="display: flex" v-for="(item, index) in printDetails.productInfoList" :key="item.productId">
+          
+          <div v-if="printDetails.contractMap.contractProductList && printDetails.contractMap.contractProductList.length > 0">
+            <div class="baseRow" style="display: flex" v-for="(item, index) in printDetails.contractMap.contractProductList" :key="item.productId">
               <div class="contentRow" style="width: 50px; text-align: center">
                 {{ index + 1 }}
               </div>
@@ -137,10 +159,10 @@
                 {{ dictValueLabel(item.productUnit, productUnit) }}
               </div>
               <div class="contentRow" style="width: 100px; text-align: center">
-                {{ item.productQuantity }}
+                {{ item.quantity }}
               </div>
               <div class="contentRow" style="width: 100px; text-align: center">
-                {{ item.productPrice }}
+                {{ item.price }}
               </div>
               <div class="contentRow" style="width: 100px; text-align: center">
                 {{ item.amount }}
@@ -151,7 +173,7 @@
             <div class="contentRow" style="width: calc(100% - 400px); text-align: center">SUBTOTAL:</div>
             <div class="contentRow" style="width: 100px; text-align: center"></div>
             <div class="contentRow" style="width: 100px; text-align: center">
-              {{ statistics("productQuantity", 0) }}
+              {{ statistics("quantity", 0) }}
             </div>
             <div class="contentRow" style="width: 100px; text-align: center"></div>
             <div class="contentRow" style="width: 100px; text-align: center">
@@ -161,13 +183,13 @@
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">FREIGHT COST:</div>
             <div class="contentRow" style="width: 100px; text-align: center">
-              {{ statisticsTwo("amount", 2) }}
+              {{statisticsTwo("amount", 2) }}
             </div>
           </div>
           <div class="baseRow" style="display: flex">
             <div class="contentRow" style="width: calc(100% - 100px); text-align: right; color: #409eff">TOTAL PRICE:</div>
             <div class="contentRow" style="width: 100px; text-align: center">
-              {{ printDetails.totalAmount }}
+              {{ printDetails.amount }}
             </div>
           </div>
           <div class="baseRow" style="display: flex; border-bottom: 1px solid black">
@@ -257,7 +279,7 @@
 <script setup>
 import { computed, ref } from "vue";
 import byTable from "@/components/byTable/index";
-import { ElMessage } from "element-plus";
+import { ElMessage,ElMessageBox } from "element-plus";
 import byForm from "@/components/byForm/index";
 
 const { proxy } = getCurrentInstance();
@@ -274,6 +296,7 @@ const sourceList = ref({
     pageNum: 1,
     pageSize: 10,
     keyword: "",
+    isSet: "1",
   },
 });
 const loading = ref(false);
@@ -284,14 +307,24 @@ const selectConfig = computed(() => {
       prop: "sellCorporationId",
       data: corporationList.value,
     },
-    {
-      label: "采购方",
-      prop: "buyCorporationId",
-      data: corporationList.value,
-    },
+    // {
+    //   label: "采购方",
+    //   prop: "buyCorporationId",
+    //   data: corporationList.value,
+    // },
   ];
 });
-const config = computed(() => {
+
+const selection = ref({
+  data: [],
+});
+
+const select = (_selection, row) => {
+  selection.value.data = _selection;
+  console.log(_selection);
+};
+
+const config2 = computed(() => {
   return [
     {
       attrs: {
@@ -310,7 +343,7 @@ const config = computed(() => {
     {
       attrs: {
         label: "销售方",
-        slot: "sellCorporationName",
+        prop: "sellCorporationName",
         "min-width": 200,
       },
     },
@@ -323,14 +356,14 @@ const config = computed(() => {
     },
     {
       attrs: {
-        label: "最近操作人",
-        prop: "opUserName",
+        label: "创建人",
+        prop: "userName",
         width: 180,
       },
     },
     {
       attrs: {
-        label: "最近操作时间",
+        label: "创建时间",
         prop: "updateTime",
         width: 180,
       },
@@ -343,30 +376,131 @@ const config = computed(() => {
         fixed: "right",
       },
       renderHTML(row) {
-        return [
-          {
-            attrs: {
-              label: "编辑",
-              type: "primary",
-              text: true,
+        if(sourceList.value.pagination.isSet == '2') {
+          return [
+            {
+              attrs: {
+                label: "删除",
+                type: "primary",
+                text: true,
+              },
+              el: "button",
+              click() {
+                ElMessageBox.confirm(
+                "此操作将永久删除该数据, 是否继续?",
+                "提示",
+                {
+                  confirmButtonText: "确定",
+                  cancelButtonText: "取消",
+                  type: "warning",
+                }
+              ).then(() => {
+                proxy
+                  .post("/intermediateContract/del", {
+                    id: row.id,
+                  })
+                  .then(() => {
+                    ElMessage({
+                      message: "删除成功",
+                      type: "success",
+                    });
+                    getList();
+                  });
+              });
+              },
             },
-            el: "button",
-            click() {
-              clickUpdate(row);
+            {
+              attrs: {
+                label: "打印",
+                type: "primary",
+                text: true,
+              },
+              el: "button",
+              click() {
+                clickPrint(row);
+              },
             },
-          },
+          ];
+        } else{
+          return [
+            {
+              attrs: {
+                label: "生成中间合同",
+                type: "primary",
+                text: true,
+              },
+              el: "button",
+              click() {
+                clickUpdate(row);
+              },
+            },
+          ];
+        }
+        
+      },
+    },
+  ];
+});
+
+const config = computed(() => {
+  return [
+    {
+      type: "selection",
+      attrs: {
+        label: "多选",
+        prop: "remark",
+      },
+    },
+    {
+      attrs: {
+        label: "合同编码",
+        slot: "code",
+        width: 220,
+      },
+    },
+    {
+      attrs: {
+        label: "合同金额",
+        slot: "amount",
+        width: 140,
+      },
+    },
+    {
+      attrs: {
+        label: "归属公司",
+        slot: "buyCorporationName",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "客户名称",
+        slot: "sellCorporationName",
+        "min-width": 200,
+      },
+    },
+    {
+      attrs: {
+        label: "操作",
+        width: "120",
+        align: "center",
+        fixed: "right",
+      },
+      renderHTML(row) {
+        return [
           {
             attrs: {
-              label: "打印",
+              label: "生成中间合同",
               type: "primary",
               text: true,
             },
             el: "button",
             click() {
-              clickPrint(row);
+              clickUpdate(row);
             },
           },
         ];
+        
       },
     },
   ];
@@ -432,12 +566,23 @@ const getList = async (req) => {
 getDict();
 getList();
 const openPrint = ref(false);
-const printDetails = ref({});
+const printDetails = ref({
+  contractMap:{
+    contractProductList:[],
+    contract:{},
+  },
+});
 const clickPrint = (row) => {
-  printDetails.value = {};
+  printDetails.value = {
+    contractMap:{
+      contractProductList:[],
+      contract:{},
+    },
+  };
   openPrint.value = true;
-  proxy.post("/intermediateContract/getPrintInfo", { documentsId: row.documentsId }).then((res) => {
-    printDetails.value = res;
+  proxy.post("/intermediateContract/getPrintInfo", { id: row.id }).then((res) => {
+    printDetails.value = {...res,...res.contractMap.contract};
+    console.log(printDetails.value.contractMap.contractProductList);
   });
 };
 const clickDownload = () => {
@@ -445,8 +590,8 @@ const clickDownload = () => {
 };
 const statistics = (label, index) => {
   let num = 0;
-  if (printDetails.value.productInfoList && printDetails.value.productInfoList.length > 0) {
-    printDetails.value.productInfoList.map((item) => {
+  if (printDetails.value.contractMap.contractProductList && printDetails.value.contractMap.contractProductList.length > 0) {
+    printDetails.value.contractMap.contractProductList.map((item) => {
       if (item[label]) {
         num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
       }
@@ -456,8 +601,8 @@ const statistics = (label, index) => {
 };
 const statisticsTwo = (label, index) => {
   let num = 0;
-  if (printDetails.value.contractProjectList && printDetails.value.contractProjectList.length > 0) {
-    printDetails.value.contractProjectList.map((item) => {
+  if (printDetails.value.contractMap.contractProjectList && printDetails.value.contractMap.contractProjectList.length > 0) {
+    printDetails.value.contractMap.contractProjectList.map((item) => {
       if (item[label]) {
         num = parseFloat(Number(num) + Number(item[label])).toFixed(index);
       }
@@ -547,10 +692,23 @@ const rules = ref({
   buyContactName: [{ required: true, message: "请输入采购联系人", trigger: "blur" }],
   buyContactNumber: [{ required: true, message: "请输入采购联系电话", trigger: "blur" }],
 });
+const openModal = (type) => {
+  getPerson();
+  formData.data = {
+    documentsIds: selection.value.data.map((item) => item.id).join(","),
+    sellCorporationId: "",
+    sellContactName: "",
+    sellContactNumber: "",
+    buyCorporationId: "",
+    buyContactName: "",
+    buyContactNumber: "",
+  };
+  openUpdate.value = true;
+};
 const clickUpdate = (row) => {
   getPerson();
   formData.data = {
-    documentsId: row.documentsId,
+    documentsIds: row.id,
     sellCorporationId: "",
     sellContactName: "",
     sellContactNumber: "",

+ 15 - 2
src/views/system/addressConfig/index.vue

@@ -1,5 +1,6 @@
 <template>
   <div class="addressConfig"  v-loading="loading">
+    <el-button type="primary" style="margin-bottom:20px;"  @click="addAddress({},'null')">新增国家</el-button>
     <el-table
       :data="tableData"
       style="width: 100%"
@@ -14,7 +15,7 @@
         <template #default="scope">
             <el-button size="small" @click="addAddress(scope.row,'add')">
               新增
-            </el-button>
+            </el-button> 
             <el-button size="small" @click="addAddress(scope.row,'edit')"
             >修改</el-button>
             <el-button
@@ -204,9 +205,20 @@ const modalType = ref('add');
 const loadingDialog = ref(false);
 
 const addAddress = (row,type) => {
-  console.log(row)
   
   modalType.value = type;
+  if(type == 'null') {
+    formData.data = {
+      parentName:'无',
+      parentId:0,
+      name:undefined,
+      chineseName:undefined,
+      address:undefined,
+      levelCode:1,
+    }
+    dialogVisible.value = true;
+    return
+  }
   if(type == 'edit') {
     formData.data = {
       ...row,
@@ -277,6 +289,7 @@ const submit = ref(null);
 const submitForm = () => {
   submit.value.handleSubmit(() => {
     loadingDialog.value = true;
+    if(modalType.value == 'null') modalType.value = 'add'
     proxy.post("/customizeArea/" + modalType.value, formData.data).then(
       () => {
         ElMessage({