Browse Source

基础资料新加编辑按钮

Qukatie 1 month ago
parent
commit
dc8dd99324

+ 228 - 212
src/views/tirePartsMall/basicData/accountManagement/detailsPage.vue

@@ -2,25 +2,21 @@
   <div>
     <div class="customer-head">
       <div class="customer-back">
-        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
-          @click="backToList(0)">返回列表
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
+          >返回列表
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <!--        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
-        <!--                   @click="confirmEditing">编辑-->
-        <!--        </el-button>-->
-        <el-button class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据
+        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="editButton" @click="inEdit"
+          >编辑
         </el-button>
-        <el-button class="el-button--small-yh" :type="form.enableOrNot == 0?'primary':''" size="small" @click="enableNot" v-if="form.id">
-          {{ form.enableOrNot == 0 ? '启用' : '禁用' }}
+        <el-button v-if="!editButton" class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据 </el-button>
+        <el-button class="el-button--small-yh" :type="form.enableOrNot == 0 ? 'primary' : ''" size="small" @click="enableNot" v-if="form.id">
+          {{ form.enableOrNot == 0 ? "启用" : "禁用" }}
         </el-button>
       </div>
     </div>
-     <div style="color:#F56C6C;position: relative;top: 12px;z-index: 1000;left: 40%;width: 160px;">
-        请先禁用再进行编辑!!!
-      </div>
-    <div style="margin-top: 30px">
+    <div style="margin-top: 50px">
       <trade-card title="基础信息">
         <avue-form class="trading-form" :option="optionForm" v-model="form" ref="form">
           <template slot="accountBalance">
@@ -30,23 +26,15 @@
       </trade-card>
     </div>
 
-    <el-dialog
-      title="提示"
-      :visible.sync="dialogVisible"
-      :modal-append-to-body="false"
-      width="80%">
-
+    <el-dialog title="提示" :visible.sync="dialogVisible" :modal-append-to-body="false" width="80%">
       <el-tabs v-model="activeName" @tab-click="handleClick">
         <el-tab-pane label="收款" name="collection">
-          <el-table
-            :data="collectionData"
-            stripe
-            style="width: 100%">
-            <el-table-column prop="sysNo" label="单号"/>
-            <el-table-column prop="corpId" label="客户"/>
-            <el-table-column prop="settlementDate" label="结算日期"/>
-            <el-table-column prop="amount" label="金额"/>
-            <el-table-column prop="financeStatus" label="类型"/>
+          <el-table :data="collectionData" stripe style="width: 100%">
+            <el-table-column prop="sysNo" label="单号" />
+            <el-table-column prop="corpId" label="客户" />
+            <el-table-column prop="settlementDate" label="结算日期" />
+            <el-table-column prop="amount" label="金额" />
+            <el-table-column prop="financeStatus" label="类型" />
           </el-table>
           <el-pagination
             @size-change="collectionSizeChange"
@@ -55,19 +43,17 @@
             :page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400]"
             :page-size="collectionPagination.size"
             layout="total, sizes, prev, pager, next, jumper"
-            :total="collectionPagination.total">
+            :total="collectionPagination.total"
+          >
           </el-pagination>
         </el-tab-pane>
         <el-tab-pane label="付款" name="payment">
-          <el-table
-            :data="paymentData"
-            stripe
-            style="width: 100%">
-            <el-table-column prop="sysNo" label="单号"/>
-            <el-table-column prop="corpId" label="供应商"/>
-            <el-table-column prop="settlementDate" label="结算日期"/>
-            <el-table-column prop="amount" label="金额"/>
-            <el-table-column prop="financeStatus" label="类型"/>
+          <el-table :data="paymentData" stripe style="width: 100%">
+            <el-table-column prop="sysNo" label="单号" />
+            <el-table-column prop="corpId" label="供应商" />
+            <el-table-column prop="settlementDate" label="结算日期" />
+            <el-table-column prop="amount" label="金额" />
+            <el-table-column prop="financeStatus" label="类型" />
           </el-table>
           <el-pagination
             @size-change="handleSizeChange"
@@ -76,7 +62,8 @@
             :page-sizes="[10, 20, 30, 40, 50, 100, 200, 300, 400]"
             :page-size="paymentPagination.size"
             layout="total, sizes, prev, pager, next, jumper"
-            :total="paymentPagination.total">
+            :total="paymentPagination.total"
+          >
           </el-pagination>
         </el-tab-pane>
       </el-tabs>
@@ -85,12 +72,10 @@
         <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
       </span>
     </el-dialog>
-
   </div>
 </template>
 
 <script>
-
 import { typeSave, detail, editenable } from "@/api/tirePartsMall/basicData/accountManagement";
 import { getList } from "@/api/collectionSettlement/index";
 import { getUser } from "@/api/system/user";
@@ -100,7 +85,9 @@ export default {
   name: "detailsPage",
   data() {
     return {
-      activeName: 'collection',
+      editButton: false,
+      editDisabled: false,
+      activeName: "collection",
       khCorpList: [],
       gysCorpList: [],
       collectionData: [],
@@ -120,70 +107,83 @@ export default {
       optionForm: {
         menuBtn: false,
         span: 8,
-        column: [{
-          label: '账户名称',
-          prop: "cname",
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '账户类型',
-          prop: "accountType",
-          type: 'select',
-          dicUrl: "/api/blade-system/dict-biz/dictionary?code=accountType",
-          props: {
-            label: "dictValue",
-            value: "dictValue"
-          }
-        }, {
-          label: '开户银行',
-          prop: "bankDeposit"
-        }, {
-          label: '银行账号',
-          prop: "bankAccount"
-        }, {
-          label: '开户人',
-          prop: "accountHolder"
-        }, {
-          label: '公司名称',
-          prop: "corporateName",
-          type: 'select',
+        disabled:false,
+        column: [
+          {
+            label: "账户名称",
+            prop: "cname",
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "账户类型",
+            prop: "accountType",
+            type: "select",
+            dicUrl: "/api/blade-system/dict-biz/dictionary?code=accountType",
+            props: {
+              label: "dictValue",
+              value: "dictValue"
+            }
+          },
+          {
+            label: "开户银行",
+            prop: "bankDeposit"
+          },
+          {
+            label: "银行账号",
+            prop: "bankAccount"
+          },
+          {
+            label: "开户人",
+            prop: "accountHolder"
+          },
+          {
+            label: "公司名称",
+            prop: "corporateName",
+            type: "select",
             disabled: true,
-          dicUrl: "/api/blade-system/dept/lazy-list?parentId=",
-          props: {
-            label: "deptName",
-            value: "id"
-          }
-        }, {
-          label: '币别',
-          prop: "currency",
-          span: 8,
-          type: 'select',
-          dicData: [
-            {
-              label: "CNY",
-              value: "CNY",
-            },
-            {
-              label: "USD",
-              value: "USD",
+            dicUrl: "/api/blade-system/dept/lazy-list?parentId=",
+            props: {
+              label: "deptName",
+              value: "id"
             }
-          ],
-        }, {
-          label: '账户余额',
-          prop: "accountBalance",
-          disabled: true
-        }, {
-          label: '备注',
-          prop: "remarks",
-          type: 'textarea',
-          span: 24,
-          minRows: 2
-        }]
+          },
+          {
+            label: "币别",
+            prop: "currency",
+            span: 8,
+            type: "select",
+            dicData: [
+              {
+                label: "CNY",
+                value: "CNY"
+              },
+              {
+                label: "USD",
+                value: "USD"
+              }
+            ]
+          },
+          {
+            label: "账户余额",
+            prop: "accountBalance",
+            disabled: true
+          },
+          {
+            label: "备注",
+            prop: "remarks",
+            type: "textarea",
+            span: 24,
+            minRows: 2
+          }
+        ]
       }
-    }
+    };
   },
   props: {
     onLoad: {
@@ -195,157 +195,171 @@ export default {
   },
   async created() {
     if (this.onLoad.id) {
-      this.queryData(this.onLoad.id)
-    }else {
-        getUser(JSON.parse(localStorage.getItem('saber-userInfo')).content.user_id).then(res=>{
-            this.form.corporateName = res.data.data.deptName
-            this.form.corporateId = res.data.data.deptId
-        })
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
+      this.queryData(this.onLoad.id);
+    } else {
+      getUser(JSON.parse(localStorage.getItem("saber-userInfo")).content.user_id).then(res => {
+        this.form.corporateName = res.data.data.deptName;
+        this.form.corporateId = res.data.data.deptId;
+      });
     }
   },
   methods: {
+    inEdit() {
+      if (this.form.enableOrNot == 1) {
+        return this.$message.error("请先禁用再进行编辑");
+      }
+      if (this.form.enableOrNot == 0) {
+        this.editButton = false;
+        this.editDisabled = false;
+        this.optionForm.disabled = false;
+      }
+    },
     handleCurrentChange(currentPage) {
-      if (this.activeName === 'collection') {
-        this.collectionPagination.current = currentPage
+      if (this.activeName === "collection") {
+        this.collectionPagination.current = currentPage;
         getList(this.collectionPagination).then(res => {
-          this.collectionData = res.data.data.records
-          this.collectionPagination.total = res.data.data.total
+          this.collectionData = res.data.data.records;
+          this.collectionPagination.total = res.data.data.total;
           this.collectionData.map(data => {
             for (let corp of this.khCorpList) {
               if (data.corpId == corp.id) {
-                data.corpId = corp.cname
-                break
+                data.corpId = corp.cname;
+                break;
               }
             }
-            return data
-          })
-        })
-      } else if (this.activeName === 'payment') {
-        this.paymentPagination.current = currentPage
+            return data;
+          });
+        });
+      } else if (this.activeName === "payment") {
+        this.paymentPagination.current = currentPage;
         getList(this.paymentPagination).then(res => {
-          this.paymentData = res.data.data.records
-          this.paymentPagination.total = res.data.data.total
+          this.paymentData = res.data.data.records;
+          this.paymentPagination.total = res.data.data.total;
           this.paymentData.map(data => {
             for (let corp of this.gysCorpList) {
               if (data.corpId == corp.id) {
-                data.corpId = corp.cname
-                break
+                data.corpId = corp.cname;
+                break;
               }
             }
-            return data
-          })
-
-        })
+            return data;
+          });
+        });
       }
     },
     accountBalanceClick() {
-      corpsDescListAll({corpType: 'KH', enableOrNot: 1}).then(res => {
-        this.khCorpList = res.data.data
+      corpsDescListAll({ corpType: "KH", enableOrNot: 1 }).then(res => {
+        this.khCorpList = res.data.data;
 
-        this.activeName = 'collection'
-        this.collectionPagination.billType = 'SK'
-        this.collectionPagination.dc = 'd'
-        this.collectionPagination.accountName = this.form.id
-        this.collectionPagination.accountId = this.form.id
-        this.collectionPagination.current = 1
+        this.activeName = "collection";
+        this.collectionPagination.billType = "SK";
+        this.collectionPagination.dc = "d";
+        this.collectionPagination.accountName = this.form.id;
+        this.collectionPagination.accountId = this.form.id;
+        this.collectionPagination.current = 1;
 
         getList(this.collectionPagination).then(res => {
-          this.collectionData = res.data.data.records
+          this.collectionData = res.data.data.records;
           this.collectionData.map(data => {
             for (let corp of this.khCorpList) {
               if (data.corpId == corp.id) {
-                data.corpId = corp.cname
-                break
+                data.corpId = corp.cname;
+                break;
               }
             }
-            return data
-          })
+            return data;
+          });
 
-          this.collectionPagination.total = res.data.data.total
-          this.dialogVisible = true
-        })
-      })
+          this.collectionPagination.total = res.data.data.total;
+          this.dialogVisible = true;
+        });
+      });
 
-      corpsDescListAll({corpType: 'GYS', enableOrNot: 1}).then(res => {
-        this.gysCorpList = res.data.data
-      })
+      corpsDescListAll({ corpType: "GYS", enableOrNot: 1 }).then(res => {
+        this.gysCorpList = res.data.data;
+      });
     },
     handleClick() {
-      if (this.activeName === 'collection') {
+      if (this.activeName === "collection") {
         // 收款
-        this.collectionPagination.billType = 'SK'
-        this.collectionPagination.dc = 'd'
-        this.collectionPagination.accountName = this.form.id
-        this.collectionPagination.accountId = this.form.id
-        this.collectionPagination.current = 1
+        this.collectionPagination.billType = "SK";
+        this.collectionPagination.dc = "d";
+        this.collectionPagination.accountName = this.form.id;
+        this.collectionPagination.accountId = this.form.id;
+        this.collectionPagination.current = 1;
 
         getList(this.collectionPagination).then(res => {
-          this.collectionData = res.data.data.records
-          this.collectionPagination.total = res.data.data.total
+          this.collectionData = res.data.data.records;
+          this.collectionPagination.total = res.data.data.total;
           this.collectionData.map(data => {
             for (let corp of this.khCorpList) {
               if (data.corpId == corp.id) {
-                data.corpId = corp.cname
-                break
+                data.corpId = corp.cname;
+                break;
               }
             }
-            return data
-          })
-        })
-      } else if (this.activeName === 'payment') {
+            return data;
+          });
+        });
+      } else if (this.activeName === "payment") {
         // 付款
-        this.paymentPagination.billType = 'FK'
-        this.paymentPagination.dc = 'c'
-        this.paymentPagination.accountName = this.form.id
-        this.paymentPagination.accountId = this.form.id
-        this.paymentPagination.current = 1
+        this.paymentPagination.billType = "FK";
+        this.paymentPagination.dc = "c";
+        this.paymentPagination.accountName = this.form.id;
+        this.paymentPagination.accountId = this.form.id;
+        this.paymentPagination.current = 1;
 
         getList(this.paymentPagination).then(res => {
-          this.paymentData = res.data.data.records
-          this.paymentPagination.total = res.data.data.total
+          this.paymentData = res.data.data.records;
+          this.paymentPagination.total = res.data.data.total;
           this.paymentData.map(data => {
             for (let corp of this.gysCorpList) {
               if (data.corpId == corp.id) {
-                data.corpId = corp.cname
-                break
+                data.corpId = corp.cname;
+                break;
               }
             }
-            return data
-          })
-        })
+            return data;
+          });
+        });
       }
     },
     //启用禁用
     enableNot() {
-      let data = this.form
+      let data = this.form;
       editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
         this.$message({
           type: "success",
           message: data.enableOrNot ? "禁用成功!" : "启用成功!"
         });
-        this.queryData(data.id)
+        this.queryData(data.id);
         // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
-      })
+      });
     },
     // 查询
     queryData(id) {
       const loading = this.$loading({
         lock: true,
-        text: '加载中',
-        spinner: 'el-icon-loading',
-        background: 'rgba(255,255,255,0.7)'
-      })
-      detail({ id }).then(res => {
-        this.form = res.data.data;
-        if (this.form.enableOrNot == 1) {
-            this.$set(this.optionForm,'disabled',true)
-        }else {
-            this.$set(this.optionForm,'disabled',false)
-        }
-        loading.close()
-      }).finally(() => {
-        loading.close()
+        text: "加载中",
+        spinner: "el-icon-loading",
+        background: "rgba(255,255,255,0.7)"
       });
+      detail({ id })
+        .then(res => {
+          this.form = res.data.data;
+          if (this.form.enableOrNot == 1) {
+            this.editButton = true;
+            this.editDisabled = true;
+            this.optionForm.disabled = true;
+          }
+          loading.close();
+        })
+        .finally(() => {
+          loading.close();
+        });
     },
     editCustomer() {
       this.$refs["form"].validate((valid, done) => {
@@ -353,38 +367,40 @@ export default {
         if (valid) {
           const loading = this.$loading({
             lock: true,
-            text: '加载中',
-            spinner: 'el-icon-loading',
-            background: 'rgba(255,255,255,0.7)'
-          })
+            text: "加载中",
+            spinner: "el-icon-loading",
+            background: "rgba(255,255,255,0.7)"
+          });
           if (!this.form.id && !this.form.enableOrNot) {
             this.form.enableOrNot = 1;
           }
-          typeSave(this.form).then(res => {
-            loading.close()
-            this.$message({
-              type: "success",
-              message: this.form.id ? "修改成功!" : "新增成功!"
+          typeSave(this.form)
+            .then(res => {
+              loading.close();
+              this.$message({
+                type: "success",
+                message: this.form.id ? "修改成功!" : "新增成功!"
+              });
+              this.queryData(res.data.data.id);
+              if (!this.form.id) {
+                //添加成功后默认启用
+                let data = this.form;
+                // editenable({ id: res.data.data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
+                //   this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
+                // })
+              }
+            })
+            .finally(() => {
+              loading.close();
             });
-            this.queryData(res.data.data.id);
-            if (!this.form.id) {
-              //添加成功后默认启用
-              let data = this.form
-              // editenable({ id: res.data.data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
-              //   this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
-              // })
-            }
-          }).finally(() => {
-            loading.close()
-          });
         }
-      })
+      });
     },
     backToList(type) {
       this.$emit("backToList", type);
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>

+ 28 - 12
src/views/tirePartsMall/basicData/brandPage/detailsPage.vue

@@ -7,19 +7,16 @@
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <!--        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
-        <!--                   @click="confirmEditing">编辑-->
-        <!--        </el-button>-->
-        <el-button class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据 </el-button>
+        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="editButton" @click="inEdit"
+          >编辑
+        </el-button>
+        <el-button v-if="!editButton" class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据 </el-button>
         <el-button class="el-button--small-yh" :type="form.enableOrNot == 0 ? 'primary' : ''" size="small" @click="enableNot" v-if="form.id">
           {{ form.enableOrNot == 0 ? "启用" : "禁用" }}
         </el-button>
       </div>
     </div>
-     <div style="color:#F56C6C;position: relative;top: 12px;z-index: 1000;left: 40%;width: 160px;">
-        请先禁用再进行编辑!!!
-      </div>
-    <div style="margin-top: 30px">
+    <div style="margin-top: 50px">
       <trade-card title="基础信息">
         <avue-form :option="optionForm" v-model="form" ref="form"></avue-form>
       </trade-card>
@@ -27,7 +24,7 @@
         <c-upload
           basic
           :data="form.brandFigureList"
-          :disabled="disabled"
+          :disabled="disabled||editDisabled"
           deleteUrl="/api/blade-sales-part/brandfigure/remove"
           :enumerationValue="338"
           display
@@ -42,7 +39,7 @@
         <c-upload
           basic
           :data="form.brandFilesList"
-          :disabled="disabled"
+          :disabled="disabled||editDisabled"
           deleteUrl="/api/blade-sales-part/brandfiles/remove"
           :enumerationValue="272.1"
           display
@@ -62,6 +59,8 @@ export default {
   name: "detailsPage",
   data() {
     return {
+      editButton: false,
+      editDisabled: false,
       disabled: false,
       form: {
         brandFilesList: [],
@@ -70,6 +69,7 @@ export default {
       optionForm: {
         menuBtn: false,
         span: 8,
+        disabled:false,
         column: [
           {
             label: "名称",
@@ -119,12 +119,28 @@ export default {
       this.titleType = res.data.data;
     });
     if (this.onLoad.id && this.detailData.id) {
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
       this.refresh(this.onLoad.id, true);
     } else if (this.onLoad.id) {
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
       this.refresh(this.onLoad.id, true);
     }
   },
   methods: {
+    inEdit() {
+      if (this.form.enableOrNot == 1) {
+        return this.$message.error("请先禁用再进行编辑");
+      }
+      if (this.form.enableOrNot == 0) {
+        this.editButton = false;
+        this.editDisabled = false;
+        this.optionForm.disabled = false;
+      }
+    },
     allClick(name) {
       if (name == "同步花纹") {
         this.$confirm("是否同步花纹?", "提示", {
@@ -150,9 +166,9 @@ export default {
         .then(res => {
           this.form = res.data.data;
           if (this.form.enableOrNot == 1) {
+            this.editButton = true;
+            this.editDisabled = true;
             this.$set(this.optionForm, "disabled", true);
-          } else {
-            this.$set(this.optionForm, "disabled", false);
           }
           loading.close();
         })

+ 34 - 29
src/views/tirePartsMall/basicData/commodityInformation/detailsPage.vue

@@ -8,26 +8,24 @@
           </el-button>
         </div>
         <div class="add-customer-btn">
+          <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="editButton" @click="inEdit"
+            >编辑
+          </el-button>
+          <el-button v-if="!editButton" class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据 </el-button>
           <el-button v-if="form.enableOrNot == 0" size="small" @click="disabled(1)">
             启用
           </el-button>
           <el-button v-if="form.enableOrNot == 1" size="small" @click="disabled(0)">
             禁用
           </el-button>
-          <el-button type="primary" size="small" @click="editCustomer">
-            保存数据
-          </el-button>
         </div>
       </div>
-      <div style="color:#F56C6C;position: relative;top: 12px;z-index: 1000;left: 40%;width: 160px;">
-        请先禁用再进行编辑!!!
-      </div>
-      <trade-card title="基础资料" style="margin-top: 30px">
+      <trade-card title="基础资料" style="margin-top: 50px">
         <avue-form ref="form" class="trading-form" v-model="form" :option="option" :key="key">
           <template slot="goodsTypeId" slot-scope="{ disabled }">
             <div style="display:flex;">
               <avue-cascader
-                :disabled="disabled"
+                :disabled="disabled||editDisabled"
                 :emit-path="false"
                 check-strictly
                 :show-all-levels="false"
@@ -41,7 +39,7 @@
           </template>
           <template slot="unit" slot-scope="{ disabled }">
             <div style="display:flex;">
-              <avue-select :disabled="disabled" v-model="form.unit" filterable placeholder="请选择单位" :dic="unitList" :props="props2"></avue-select>
+              <avue-select :disabled="disabled||editDisabled" v-model="form.unit" filterable placeholder="请选择单位" :dic="unitList" :props="props2"></avue-select>
               <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px" @click="$refs.dictbiz.open()"></i>
             </div>
           </template>
@@ -58,30 +56,30 @@
           </template>
           <template slot="whetherIntegral" slot-scope="{ disabled }">
             <!--<el-switch v-model="form.whetherIntegral" active-text="是" inactive-text="否" active-value="1" inactive-value="0" @change="whetherChange"/>-->
-            <el-switch v-model="form.whetherIntegral" :disabled="disabled" active-text="是" inactive-text="否" active-value="1" inactive-value="0" />
+            <el-switch v-model="form.whetherIntegral" :disabled="disabled||editDisabled" active-text="是" inactive-text="否" active-value="1" inactive-value="0" />
           </template>
 
           <template slot="explosionProof" slot-scope="{ disabled }">
-            <!--<el-switch v-model="form.explosionProof" :disabled="disabled" active-text="是" inactive-text="否"-->
+            <!--<el-switch v-model="form.explosionProof" :disabled="disabled||editDisabled" active-text="是" inactive-text="否"-->
             <!--    active-value="1" inactive-value="0" />-->
             <!--<el-radio v-model="form.explosionProof"></el-radio>-->
             <el-checkbox v-model="form.explosionProof" :checked="form.explosionProof == 1" :true-label="1" :false-label="0"></el-checkbox>
           </template>
 
           <template slot="originalFactory" slot-scope="{ disabled }">
-            <!--<el-switch v-model="form.originalFactory" :disabled="disabled" active-text="是" inactive-text="否"-->
+            <!--<el-switch v-model="form.originalFactory" :disabled="disabled||editDisabled" active-text="是" inactive-text="否"-->
             <!--           active-value="1" inactive-value="0" />-->
             <el-checkbox v-model="form.originalFactory" :checked="form.originalFactory == 1" :true-label="1" :false-label="0"></el-checkbox>
           </template>
           <template slot="selfRecovery" slot-scope="{ disabled }">
-            <!--<el-switch v-model="form.selfRecovery" :disabled="disabled" active-text="是" inactive-text="否"-->
+            <!--<el-switch v-model="form.selfRecovery" :disabled="disabled||editDisabled" active-text="是" inactive-text="否"-->
             <!--           active-value="1" inactive-value="0" />-->
             <el-checkbox v-model="form.selfRecovery" :checked="form.selfRecovery == 1" :true-label="1" :false-label="0"></el-checkbox>
           </template>
         </avue-form>
       </trade-card>
       <containerTitle title="附件信息"></containerTitle>
-      <c-upload :data="filesList" display deleteUrl="/api/blade-sales-part/goodsfiles/remove" :enumerationValue="160.1" />
+      <c-upload :data="filesList" display deleteUrl="/api/blade-sales-part/goodsfiles/remove" :enumerationValue="160.1" :disabled="editDisabled"/>
       <el-dialog
         title="设置产品分类"
         v-dialogDrag
@@ -137,6 +135,8 @@ export default {
   name: "index",
   data() {
     return {
+      editButton: false,
+      editDisabled: false,
       loadingBtn: false,
       goodsTypeVisible: false,
       storageVisible: false,
@@ -683,14 +683,29 @@ export default {
       this.form.goodsTypeId = this.detailData.goodsTypeId;
     }
     if (this.detailData.id) {
+      this.editButton = true;
+      this.editDisabled = true;
+      this.option.disabled = true;
       this.getDetail(this.detailData.id);
     }
     if (this.detailData.status == 1) {
+      this.editButton = true;
+      this.editDisabled = true;
       this.option.disabled = true;
     }
     this.getAllWorkDicts();
   },
   methods: {
+    inEdit() {
+      if (this.form.enableOrNot == 1) {
+        return this.$message.error("请先禁用再进行编辑");
+      }
+      if (this.form.enableOrNot == 0) {
+        this.editButton = false;
+        this.editDisabled = false;
+        this.option.disabled = false;
+      }
+    },
     getAllWorkDicts() {
       // getGoodstype().then(res => {
       //   this.goodsTypeList = res.data.data;
@@ -820,27 +835,17 @@ export default {
           }
           this.whetherChange(res.data.data.whether);
           //如果modifiable为0则不能修改
-          if (this.form.modifiable == 0) {
-            console.log(this.form.modifiable, "0");
-            for (let item of this.option.column) {
-              this.$set(item, "disabled", true);
-            }
-            this.isWhether = true;
-          } else if (this.form.modifiable == 1) {
+         if (this.form.modifiable == 1) {
             console.log(this.form.modifiable, "1");
             for (let item of this.option.column) {
               item.disabled = false;
             }
             this.isWhether = false;
           }
-          if (this.form.enableOrNot == 0) {
-            for (let item of this.option.column) {
-              this.$set(item, "disabled", false);
-            }
-          } else {
-            for (let item of this.option.column) {
-              this.$set(item, "disabled", true);
-            }
+          if (this.form.enableOrNot == 1) {
+            this.editButton = true;
+            this.editDisabled = true;
+            this.$set(this.option, "disabled", true);
           }
           this.key++;
         })

+ 32 - 32
src/views/tirePartsMall/basicData/customerInformation/detailsPage.vue

@@ -8,19 +8,16 @@
           </el-button>
         </div>
         <div class="add-customer-btn">
-          <el-button type="primary" size="small" @click="editCustomer">
-            保存数据
+          <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="editButton" @click="inEdit"
+            >编辑
           </el-button>
+          <el-button v-if="!editButton" class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据 </el-button>
           <el-button class="el-button--small-yh" :type="form.enableOrNot == 0 ? 'primary' : ''" size="small" v-if="form.id" @click="editEnable">
             {{ form.enableOrNot == 0 ? "启用" : "禁用" }}
           </el-button>
         </div>
       </div>
-
-      <div style="color:#F56C6C;position: relative;top: 12px;z-index: 1000;left: 40%;width: 160px;">
-        请先禁用再进行编辑!!!
-      </div>
-      <trade-card title="基础资料" style="margin-top: 30px" v-loading="loadingBtn">
+      <trade-card title="基础资料" style="margin-top: 50px" v-loading="loadingBtn">
         <avue-form ref="form" class="trading-form" v-model="form" :option="option">
           <template slot="corpsTypeId">
             <div style="display:flex;">
@@ -29,23 +26,8 @@
               <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px" @click="corpTypeVisible = true"></i>
             </div>
           </template>
-          <!--<template slot="brandDesc">-->
-          <!--    <div>-->
-          <!--        <avue-input-tree v-model="brandlist" :disabled="false" :dic="brandDescData"  :props="propsBrand" multiple placeholder="请选品牌">-->
-          <!--        </avue-input-tree>-->
-          <!--    </div>-->
-          <!--</template>-->
           <template slot="deliveryWarehouseId">
             <div style="display:flex;">
-              <!-- <avue-input-tree
-                v-model="form.deliveryWarehouseId"
-                :disabled="option.disabled"
-                placeholder="请选择发货仓库"
-                @change="warehouseChange"
-                :dic="corpTypeListCk"
-                :props="propsCk"
-              >
-              </avue-input-tree> -->
               <dic-select
                 v-model="form.deliveryWarehouseName"
                 placeholder="业务员"
@@ -102,14 +84,14 @@
           <template slot-scope="{ type, size, row, disabled, index }" slot="menu">
             <el-button
               :size="size"
-              :disabled="disabled"
+              :disabled="disabled||editDisabled"
               :type="type"
               :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
               @click="$refs.crudTwo.rowEdit(row, index)"
               >{{ row.$cellEdit ? "确认" : "修改" }}
             </el-button>
-            <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type" @click="rowDelTwo(row, index)">删除 </el-button>
-            <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)">创建用户</el-button>
+            <el-button icon="el-icon-delete" :size="size" :disabled="disabled||editDisabled" :type="type" @click="rowDelTwo(row, index)">删除 </el-button>
+            <el-button icon="el-icon-check" :size="size" :type="type" @click="creatingUsers(row)" >创建用户</el-button>
           </template>
         </avue-crud>
       </trade-card>
@@ -134,22 +116,22 @@
             <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRow">录入明细 </el-button>
           </template>
           <template v-if="!row.$cellEdit" slot-scope="{ type, size, row, index, disabled }" slot="menu">
-            <!--<el-button :size="size" :disabled="disabled" :type="type"-->
+            <!--<el-button :size="size" :disabled="disabled||editDisabled" :type="type"-->
             <!--  :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.crud.rowEdit(row, index)">{{-->
             <!--    row.$cellEdit ? '确认' : '修改' }}-->
             <!--</el-button>-->
             <el-button
               :size="size"
-              :disabled="disabled"
+              :disabled="disabled||editDisabled"
               :type="type"
               :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
               @click="$refs.crud.rowCell(row, index)"
               >{{ row.$cellEdit ? "确认" : "修改" }}
             </el-button>
-            <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type" @click="rowDel(row, index)">删除 </el-button>
+            <el-button icon="el-icon-delete" :size="size" :disabled="disabled||editDisabled" :type="type" @click="rowDel(row, index)">删除 </el-button>
           </template>
           <template slot="defaultAddres" slot-scope="{ row, index, disabled }">
-            <el-switch active-value="1" inactive-value="0" :disabled="disabled" v-model="row.defaultAddres" @change="addressUnique(row, index)">
+            <el-switch active-value="1" inactive-value="0" :disabled="disabled||editDisabled" v-model="row.defaultAddres" @change="addressUnique(row, index)">
             </el-switch>
           </template>
         </avue-crud>
@@ -239,6 +221,8 @@ export default {
   name: "index",
   data() {
     return {
+      editButton: false,
+      editDisabled: false,
       propsCk: {
         label: "c",
         value: "id"
@@ -250,6 +234,7 @@ export default {
       optionData: {
         span: 8,
         menuBtn: false,
+        disabled: false,
         column: [
           {
             label: "所属角色",
@@ -750,7 +735,7 @@ export default {
           {
             label: "登录用户id",
             prop: "userId",
-            display:false
+            display: false
           },
           {
             label: "备注",
@@ -779,9 +764,14 @@ export default {
     this.option2 = await this.getColumnData(this.getColumnName(263.2), option2);
     // this.option3 = await this.getColumnData(this.getColumnName(208.4), option3);
     if (this.detailData.id) {
+      this.editButton = true;
+      this.editDisabled = true;
+      this.option.disabled = true;
       this.getDetail(this.detailData.id, true);
     }
     if (this.detailData.status == 1) {
+      this.editButton = true;
+      this.editDisabled = true;
       this.option.disabled = true;
     }
     if (!website.tenantMode) {
@@ -803,6 +793,16 @@ export default {
     }, 100);
   },
   methods: {
+    inEdit() {
+      if (this.form.enableOrNot == 1) {
+        return this.$message.error("请先禁用再进行编辑");
+      }
+      if (this.form.enableOrNot == 0) {
+        this.editButton = false;
+        this.editDisabled = false;
+        this.option.disabled = false;
+      }
+    },
     dicChange(name, row) {
       if (name == "deliveryWarehouseName") {
         if (row) {
@@ -984,9 +984,9 @@ export default {
             //   });
             // }
 
+            this.editButton = true;
+            this.editDisabled = true;
             this.$set(this.option, "disabled", true);
-          } else {
-            this.$set(this.option, "disabled", false);
           }
           if (this.form.brandId == null || this.form.brandId === "") {
             this.form.brandId = "";

+ 258 - 188
src/views/tirePartsMall/basicData/supplier/detailsPage.vue

@@ -2,82 +2,115 @@
   <div>
     <div class="customer-head">
       <div class="customer-back">
-        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left"
-          @click="backToList(0)">返回列表
+        <el-button type="danger" style="border: none;background: none;color: red" icon="el-icon-arrow-left" @click="backToList(0)"
+          >返回列表
         </el-button>
       </div>
       <div class="add-customer-btn">
-        <!--        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="!editButton"-->
-        <!--                   @click="confirmEditing">编辑-->
-        <!--        </el-button>-->
-        <el-button class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据
+        <el-button class="el-button&#45;&#45;small-yh" style="margin-right: 10px" type="primary" size="small" v-if="editButton" @click="inEdit"
+          >编辑
         </el-button>
+        <el-button v-if="!editButton" class="el-button--small-yh" type="primary" size="small" @click="editCustomer">保存数据 </el-button>
 
-        <el-button class="el-button--small-yh" :type="form.enableOrNot == 0?'primary':''" size="small" v-if="form.id" @click="editEnable">
-          {{ form.enableOrNot == 0 ? '启用' : '禁用' }}
+        <el-button class="el-button--small-yh" :type="form.enableOrNot == 0 ? 'primary' : ''" size="small" v-if="form.id" @click="editEnable">
+          {{ form.enableOrNot == 0 ? "启用" : "禁用" }}
         </el-button>
       </div>
     </div>
-     <div style="color:#F56C6C;position: relative;top: 12px;z-index: 1000;left: 40%;width: 160px;">
-        请先禁用再进行编辑!!!
-      </div>
-    <div style="margin-top: 30px">
+    <div style="margin-top: 50px">
       <trade-card title="基础信息">
         <avue-form :option="optionForm" v-model="form" ref="form">
           <template slot="corpsTypeId" slot-scope="{ row }">
             <div style="display:flex;">
-              <avue-input-tree v-model="form.corpsTypeId" :disabled="optionForm.disabled" placeholder="请选择供货商分类" :dic="corpTypeList" :props="props">
+              <avue-input-tree
+                v-model="form.corpsTypeId"
+                :disabled="optionForm.disabled"
+                placeholder="请选择供货商分类"
+                :dic="corpTypeList"
+                :props="props"
+              >
               </avue-input-tree>
-              <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
-                @click="corpTypeVisible = true"></i>
+              <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px" @click="corpTypeVisible = true"></i>
             </div>
           </template>
         </avue-form>
       </trade-card>
       <trade-card title="联系人信息">
-        <avue-crud :option="optionContacts" v-model="formContacts" ref="formContacts" :data="form.corpsAttnList"
-          @row-save="rowSave" @row-update="rowUpdate"
+        <avue-crud
+          :option="optionContacts"
+          v-model="formContacts"
+          ref="formContacts"
+          :data="form.corpsAttnList"
+          @row-save="rowSave"
+          @row-update="rowUpdate"
           @resetColumn="resetColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 262.1)"
-          @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 262.1)">
-          <template slot-scope="{type,size,row,index,disabled}" slot="menu">
-            <el-button :size="size" :disabled="disabled" :type="type"
-              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.formContacts.rowCell(row, index)">{{
-                row.$cellEdit ? '确认' : '修改' }}
+          @saveColumn="saveColumnTwo('formContacts', 'optionContacts', 'optionContactsBack', 262.1)"
+        >
+          <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
+            <el-button
+              :size="size"
+              :disabled="disabled||editDisabled"
+              :type="type"
+              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
+              @click="$refs.formContacts.rowCell(row, index)"
+              >{{ row.$cellEdit ? "确认" : "修改" }}
             </el-button>
-            <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
-              @click="rowDelBox(row, index, 'rowDelBox1')">删除
+            <el-button icon="el-icon-delete" :size="size" :disabled="disabled||editDisabled" :type="type" @click="rowDelBox(row, index, 'rowDelBox1')"
+              >删除
             </el-button>
           </template>
         </avue-crud>
       </trade-card>
       <trade-card title="地址信息">
-        <avue-crud :option="optionAddress" v-model="formAddress" ref="formAddress" :data="form.corpsAddrList"
-          @row-save="rowSave" @row-update="rowUpdate"
+        <avue-crud
+          :option="optionAddress"
+          v-model="formAddress"
+          ref="formAddress"
+          :data="form.corpsAddrList"
+          @row-save="rowSave"
+          @row-update="rowUpdate"
           @resetColumn="resetColumnTwo('formContacts', 'optionAddress', 'optionAddressBack', 262.2)"
-          @saveColumn="saveColumnTwo('formContacts', 'optionAddress', 'optionAddressBack', 262.2)">>
-          <template slot-scope="{type,size,row,index,disabled}" slot="menu">
-            <el-button :size="size" :disabled="disabled" :type="type"
-              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'" @click="$refs.formAddress.rowCell(row, index)">{{
-                row.$cellEdit ? '确认' : '修改' }}
+          @saveColumn="saveColumnTwo('formContacts', 'optionAddress', 'optionAddressBack', 262.2)"
+          >>
+          <template slot-scope="{ type, size, row, index, disabled }" slot="menu">
+            <el-button
+              :size="size"
+              :disabled="disabled||editDisabled"
+              :type="type"
+              :icon="row.$cellEdit ? 'el-icon-plus' : 'el-icon-edit'"
+              @click="$refs.formAddress.rowCell(row, index)"
+              >{{ row.$cellEdit ? "确认" : "修改" }}
             </el-button>
-            <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :type="type"
-              @click="rowDelBox(row, index, 'rowDelBox2')">删除
+            <el-button icon="el-icon-delete" :size="size" :disabled="disabled||editDisabled" :type="type" @click="rowDelBox(row, index, 'rowDelBox2')"
+              >删除
             </el-button>
           </template>
-          <template slot="defaultAddres" slot-scope="{row,index,disabled}">
-            <el-switch active-value="1" inactive-value="0" :disabled="disabled" v-model="row.defaultAddres"
-              @change="addressUnique(row, index)">
+          <template slot="defaultAddres" slot-scope="{ row, index, disabled }">
+            <el-switch active-value="1" inactive-value="0" :disabled="disabled" v-model="row.defaultAddres" @change="addressUnique(row, index)">
             </el-switch>
           </template>
         </avue-crud>
       </trade-card>
       <trade-card title="附件信息">
-        <c-upload basic :data="form.corpsFilesList" :disabled="disabled"
-          deleteUrl="/api/blade-sales-part/corpsfiles/remove" :enumerationValue="262.3" display />
+        <c-upload
+          basic
+          :data="form.corpsFilesList"
+          :disabled="disabled"
+          deleteUrl="/api/blade-sales-part/corpsfiles/remove"
+          :enumerationValue="262.3"
+          display
+        />
       </trade-card>
     </div>
-    <el-dialog title="设置供应商分类" append-to-body v-dialog-drag :visible.sync="corpTypeVisible" class="avue-dialog"
-      width="80%" @closed="corpTypeClosed">
+    <el-dialog
+      title="设置供应商分类"
+      append-to-body
+      v-dialog-drag
+      :visible.sync="corpTypeVisible"
+      class="avue-dialog"
+      width="80%"
+      @closed="corpTypeClosed"
+    >
       <span>
         <corp-type corpType="GYS"></corp-type>
         <!-- <avue-form :key="reload" ref="corpType" v-model="form4" :option="option4" style="margin-top:20px">
@@ -92,18 +125,19 @@
 </template>
 
 <script>
-
 // import {detail, submit} from "@/api/basicData/shipManagement";
 import { getDetails, submit, editenable, corpsattn, itemDel } from "@/api/tirePartsMall/basicData/customerInformation";
-import { getCorpType } from "@/api/tirePartsMall/basicData/customerInformation"
-import corpType from './components/corpType/index.vue'
+import { getCorpType } from "@/api/tirePartsMall/basicData/customerInformation";
+import corpType from "./components/corpType/index.vue";
 export default {
   name: "detailsPage",
   data() {
     return {
+      editButton: false,
+      editDisabled: false,
       props: {
-        label: 'title',
-        value: 'value'
+        label: "title",
+        value: "value"
       },
       corpTypeList: [], //供货商列表
       corpTypeVisible: false, //设置供应商分类
@@ -116,51 +150,62 @@ export default {
       optionForm: {
         menuBtn: false,
         span: 8,
-        column: [{
-          label: '全称',
-          prop: "cname",
-          span: 12,
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '供货商分类',
-          prop: "corpsTypeId",
-          span: 12,
-          rules: [{
-            required: true,
-            message: " ",
-            trigger: "blur"
-          }]
-        }, {
-          label: '电话',
-          prop: "tel",
-          span: 12,
-        }, {
-          label: "业务员",
-          prop: "salesmanId",
-          type: "select",
-          span: 12,
-          props: {
-            label: "name",
-            value: "id"
+        disabled: false,
+        column: [
+          {
+            label: "全称",
+            prop: "cname",
+            span: 12,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "供货商分类",
+            prop: "corpsTypeId",
+            span: 12,
+            rules: [
+              {
+                required: true,
+                message: " ",
+                trigger: "blur"
+              }
+            ]
+          },
+          {
+            label: "电话",
+            prop: "tel",
+            span: 12
           },
-          dicUrl: "/api/blade-user/salerList",
-          filterable: true,
-        }, {
-          label: '备注',
-          prop: "remarks",
-          type: 'textarea',
-          span: 24,
-          minRows: 2
-        }]
+          {
+            label: "业务员",
+            prop: "salesmanId",
+            type: "select",
+            span: 12,
+            props: {
+              label: "name",
+              value: "id"
+            },
+            dicUrl: "/api/blade-user/salerList",
+            filterable: true
+          },
+          {
+            label: "备注",
+            prop: "remarks",
+            type: "textarea",
+            span: 24,
+            minRows: 2
+          }
+        ]
       },
       formContacts: {},
       optionContacts: {},
       optionContactsBack: {
-        align: 'center',
+        align: "center",
         index: true,
         addBtnText: "录入明细",
         refreshBtn: false,
@@ -174,24 +219,28 @@ export default {
         menuWidth: 140,
         dialogTop: 25,
         dialogWidth: "80%",
-        column: [{
-          label: '联系人',
-          prop: 'cname',
-          cell: true
-        }, {
-          label: '电话',
-          prop: 'tel',
-          cell: true
-        }, {
-          label: '备注',
-          prop: 'remarks',
-          cell: true
-        }]
+        column: [
+          {
+            label: "联系人",
+            prop: "cname",
+            cell: true
+          },
+          {
+            label: "电话",
+            prop: "tel",
+            cell: true
+          },
+          {
+            label: "备注",
+            prop: "remarks",
+            cell: true
+          }
+        ]
       },
       formAddress: {},
       optionAddress: {},
       optionAddressBack: {
-        align: 'center',
+        align: "center",
         index: true,
         addBtnText: "录入明细",
         refreshBtn: false,
@@ -205,33 +254,38 @@ export default {
         menuWidth: 140,
         dialogTop: 25,
         dialogWidth: "80%",
-        column: [{
-          label: "地址",
-          prop: "belongtoarea",
-          dicData: [],
-          dataType: "string",
-          type: "cascader",
-          props: {
-            label: 'name',
-            value: 'name'
+        column: [
+          {
+            label: "地址",
+            prop: "belongtoarea",
+            dicData: [],
+            dataType: "string",
+            type: "cascader",
+            props: {
+              label: "name",
+              value: "name"
+            },
+            filterable: true,
+            cell: true
+          },
+          {
+            label: "详细地址",
+            prop: "detailedAddress",
+            cell: true
           },
-          filterable: true,
-          cell: true
-        }, {
-          label: '详细地址',
-          prop: 'detailedAddress',
-          cell: true
-        }, {
-          label: '备注',
-          prop: 'remarks',
-          cell: true
-        }, {
-          label: '默认地址',
-          prop: 'defaultAddres',
-          width: 100,
-        }]
+          {
+            label: "备注",
+            prop: "remarks",
+            cell: true
+          },
+          {
+            label: "默认地址",
+            prop: "defaultAddres",
+            width: 100
+          }
+        ]
       }
-    }
+    };
   },
   components: {
     corpType
@@ -244,51 +298,68 @@ export default {
     this.optionContacts = await this.getColumnData(this.getColumnName(262.1), this.optionContactsBack);
     this.optionAddress = await this.getColumnData(this.getColumnName(262.2), this.optionAddressBack);
     if (this.onLoad.id && this.detailData.id) {
-      this.refresh(this.onLoad.id, true)
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
+      this.refresh(this.onLoad.id, true);
     } else if (this.onLoad.id) {
-      this.refresh(this.onLoad.id, true)
+      this.editButton = true;
+      this.editDisabled = true;
+      this.optionForm.disabled = true;
+      this.refresh(this.onLoad.id, true);
     }
-    this.findObject(this.optionAddress.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem('areaTypeTree'))
-    this.getCorpType()
+    this.findObject(this.optionAddress.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem("areaTypeTree"));
+    this.getCorpType();
   },
   methods: {
+    inEdit() {
+      if (this.form.enableOrNot == 1) {
+        return this.$message.error("请先禁用再进行编辑");
+      }
+      if (this.form.enableOrNot == 0) {
+        this.editButton = false;
+        this.editDisabled = false;
+        this.optionForm.disabled = false;
+      }
+    },
     // 启用或禁用
     editEnable() {
-      let data = this.form
+      let data = this.form;
       editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
         this.$message({
           type: "success",
           message: data.enableOrNot ? "禁用成功!" : "启用成功!"
         });
-        this.refresh(this.onLoad.id, true)
+        this.refresh(this.onLoad.id, true);
         // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
-      })
+      });
     },
     refresh(id, type) {
       const loading = this.$loading({
         lock: true,
-        text: '加载中',
-        spinner: 'el-icon-loading',
-        background: 'rgba(255,255,255,0.7)'
-      })
-      getDetails({ id: id }).then(res => {
-        this.form = res.data.data
+        text: "加载中",
+        spinner: "el-icon-loading",
+        background: "rgba(255,255,255,0.7)"
+      });
+      getDetails({ id: id })
+        .then(res => {
+          this.form = res.data.data;
           if (this.form.enableOrNot == 1) {
-              this.$set(this.optionForm,'disabled',true)
-          }else {
-              this.$set(this.optionForm,'disabled',false)
+            this.editButton = true;
+            this.editDisabled = true;
+            this.$set(this.optionForm, "disabled", true);
           }
-        loading.close();
-      }).catch(() => {
-        loading.close();
-      })
+          loading.close();
+        })
+        .catch(() => {
+          loading.close();
+        });
     },
     getCorpType() {
-      getCorpType({ corpType: 'GYS' }).then(res => {
-        this.corpTypeList = res.data.data
-      })
-    }
-    ,
+      getCorpType({ corpType: "GYS" }).then(res => {
+        this.corpTypeList = res.data.data;
+      });
+    },
     addCorpType() {
       // this.$refs["corpType"].validate((valid, done) => {
       //   done();
@@ -303,19 +374,18 @@ export default {
       //     return false;
       //   }
       // });
-      this.getCorpType()
-      this.corpTypeVisible = false
-    }
-    ,
+      this.getCorpType();
+      this.corpTypeVisible = false;
+    },
     editCustomer() {
       this.$refs["form"].validate((valid, done) => {
-        done()
+        done();
         if (valid) {
           const loading = this.$loading({
             lock: true,
-            text: '加载中',
-            spinner: 'el-icon-loading',
-            background: 'rgba(255,255,255,0.7)'
+            text: "加载中",
+            spinner: "el-icon-loading",
+            background: "rgba(255,255,255,0.7)"
           });
           // 获取联系人信息和地址信息的数据列表
           const contacts = this.form.corpsAttnList;
@@ -338,8 +408,8 @@ export default {
           for (const contact of contacts) {
             if (!contact.cname || !contact.tel) {
               // 联系人地址为空,阻止保存并显示错误提示
-              this.$message.error('联系人不能为空');
-              loading.close()
+              this.$message.error("联系人不能为空");
+              loading.close();
               return;
             }
           }
@@ -348,8 +418,8 @@ export default {
           for (const address of addresses) {
             if (!address.belongtoarea || !address.detailedAddress) {
               // 地址为空,阻止保存并显示错误提示
-              this.$message.error('地址不能为空');
-              loading.close()
+              this.$message.error("地址不能为空");
+              loading.close();
               return;
             }
           }
@@ -357,25 +427,27 @@ export default {
           submit({
             ...this.form,
             corpType: "GYS"
-          }).then(res => {
-            this.$message({
-              type: "success",
-              message: this.form.id ? "修改成功!" : "新增成功!"
-            });
-            loading.close();
-            this.refresh(res.data.data.id)
-            if (!this.form.id) {
-              //添加成功后默认启用
-              let data = this.form
-              editenable({ id: res.data.data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
-                this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
-              })
-            }
-          }).catch(() => {
-            loading.close();
           })
+            .then(res => {
+              this.$message({
+                type: "success",
+                message: this.form.id ? "修改成功!" : "新增成功!"
+              });
+              loading.close();
+              this.refresh(res.data.data.id);
+              if (!this.form.id) {
+                //添加成功后默认启用
+                let data = this.form;
+                editenable({ id: res.data.data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
+                  this.$set(this.form, "enableOrNot", data.enableOrNot == 1 ? 0 : 1);
+                });
+              }
+            })
+            .catch(() => {
+              loading.close();
+            });
         }
-      })
+      });
     },
     addressUnique(row, index) {
       console.log(this.form.corpsAddrList);
@@ -383,8 +455,8 @@ export default {
         if (index != item) {
           if (this.form.corpsAddrList[item].defaultAddres == 1) {
             console.log(1);
-            row.defaultAddres = 0
-            return this.$message.error("已有默认地址请关闭后再选择")
+            row.defaultAddres = 0;
+            return this.$message.error("已有默认地址请关闭后再选择");
           }
         }
       }
@@ -396,7 +468,7 @@ export default {
         type: "warning"
       }).then(() => {
         if (row.id) {
-          if (isButton === 'rowDelBox1') {
+          if (isButton === "rowDelBox1") {
             //有id的时候删除
             corpsattn(row.id).then(res => {
               if (res.data.code == 200) {
@@ -425,7 +497,7 @@ export default {
           // this.$message.success("操作成功!");
           // });
         } else {
-          if (isButton === 'rowDelBox1') {
+          if (isButton === "rowDelBox1") {
             this.form.corpsAttnList.splice(index, 1);
           } else {
             this.form.corpsAddrList.splice(index, 1);
@@ -433,15 +505,13 @@ export default {
           // this.form.contactsList.splice(index, 1);
           this.$message.success("操作成功!");
         }
-      }
-      )
-        ;
+      });
     },
     rowSave(form, done, loading) {
-      done(form)
+      done(form);
     },
     rowUpdate(form, index, done, loading) {
-      done(form)
+      done(form);
     },
     //自定义列保存
     async saveColumnTwo(ref, option, optionBack, code) {
@@ -470,7 +540,7 @@ export default {
       this.$emit("backToList", type);
     }
   }
-}
+};
 </script>
 
 <style lang="scss" scoped>