<template>
  <div>
    <div class="borderless">
      <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">返回列表
          </el-button>
        </div>
        <div class="add-customer-btn">
          <el-button 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>
      <trade-card title="基础资料" style="margin-top: 60px" v-loading="loadingBtn">
        <avue-form ref="form" class="trading-form" v-model="form" :option="option">
          <template slot="corpsTypeId">
            <div style="display:flex;">
              <avue-input-tree v-model="form.corpsTypeId" :disabled="option.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>
            </div>
          </template>
          <template slot="deliveryWarehouseId">
            <div style="display:flex;">
              <avue-input-tree v-model="form.deliveryWarehouseId" :disabled="option.disabled" placeholder="请选择发货仓库" :dic="corpTypeListCk"
                :props="propsCk">
              </avue-input-tree>
              <i class="el-icon-circle-plus-outline" style="font-size:18px;line-height: 32px;margin-left:4px"
                @click="dialogVisibleCK = true"></i>
            </div>
          </template>
        </avue-form>
      </trade-card>
      <trade-card title="客户联系人" v-loading="loadingBtn">
        <avue-crud ref="crudTwo" :option="customerContact" v-model="contactsForm" :data="contactsData"
          @saveColumn="saveColumnTwo" @resetColumn="resetColumnTwo" @row-save="rowSave" @row-update="rowUpdate"
          @row-del="rowDelTwo">
          <template slot-scope="{ type, size, row, disabled,index}" slot="menu">
            <el-button :size="size" :disabled="disabled" :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>
          </template>
        </avue-crud>
      </trade-card>
      <trade-card title="地址信息" v-loading="loadingBtn">
        <avue-crud :option="option2" ref="crud" :data="data" @row-save="rowSave" @row-update="rowUpdate"
          @saveColumn="saveColumn" @resetColumn="resetColumn">
          <template slot="headerSerial">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click.stop="addRow"
              :disabled="detailData.status == 1" circle></el-button>
          </template>
          <!-- <template slot="menuLeft">
                    <el-button type="primary" icon="el-icon-plus" size="small" @click.stop="addRows">录入明细
                    </el-button>
                </template> -->
          <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.crud.rowEdit(row, index)">{{
                row.$cellEdit ? '确认' : '修改' }}
            </el-button>
            <el-button icon="el-icon-delete" :size="size" :disabled="disabled" :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>
          </template>
        </avue-crud>
      </trade-card>
      <containerTitle title="上传附件"></containerTitle>
      <c-upload v-loading="loadingBtn" typeUpload="CD" deleteUrl="/api/blade-sales-part/corpsfiles/remove"
        :data="corpsFiles" display :enumerationValue="35.1" :disabled="detailData.status == 1"></c-upload>
      <el-dialog title="设置客户分类" v-dialogDrag :visible.sync="corpTypeVisible" class="avue-dialog" width="80%"
        append-to-body @closed="corpTypeClosed">
        <span>
          <corp-type></corp-type>
          <!-- <avue-form :key="reload" ref="corpType" v-model="form4" :option="option4" style="margin-top:20px">
        </avue-form> -->
        </span>
        <div class="avue-dialog__footer">
          <el-button @click="corpTypeVisible = false" size="mini">取 消</el-button>
          <el-button @click="addCorpType" type="primary" size="mini">确 定</el-button>
        </div>
      </el-dialog>
    </div>

    <el-dialog title="创建用户" :visible.sync="dialogVisibleBt" append-to-body width="60%">
      <avue-form v-if="dialogVisibleBt" ref="formDataTwo" v-model="formDataTwo" :option="optionData">
      </avue-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleBt = false">取 消</el-button>
        <el-button type="primary" @click="confirmSynchronizationTwo">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog title="新增仓库" :visible.sync="dialogVisibleCK" append-to-body width="60%">
      <avue-form v-if="dialogVisibleCK" ref="formDataThree" v-model="formDataThree" :option="optionDataCK">
      </avue-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisibleCK = false">取 消</el-button>
        <el-button type="primary" @click="confirmSynchronizationThree">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { option2, option3 } from "./js/optionList";
// import {getDetails, addCorpType, getCorpType, submit, customerList, itemDel} from "@/api/basicData/client";
import {
  getDetails,
  getCorpType,
  submit,
  customerList,
  itemDel,
  corpsattn,
  editenable
} from "@/api/tirePartsMall/basicData/customerInformation"
import corpType from './components/index'
import { creatingUsersTwo } from "@/api/basicData/customerInformation";
import { getRoleTree } from "@/api/system/role";
import { getDeptTree } from "@/api/system/dept";
import { getPostList } from "@/api/system/post";
import website from "@/config/website";
import {
  typeSave,
  customerListAll
} from "@/api/tirePartsMall/basicData/warehouse";

export default {
  name: "index",
  data() {
    return {
      propsCk: {
        label: 'cname',
        value: 'id'
      },
      props: {
        label: 'title',
        value: 'value'
      },
      optionData: {
        span: 8,
        menuBtn: false,
        column: [
          {
            label: "所属角色",
            prop: "roleId",
            multiple: true,
            type: "tree",
            dicData: [],
            props: {
              label: "title"
            },
            checkStrictly: true,
            slot: true,
            rules: [
              {
                required: true,
                message: "请选择所属角色",
                trigger: "click"
              }
            ]
          },
          {
            label: "所属部门",
            prop: "deptId",
            type: "tree",
            multiple: true,
            dicData: [],
            props: {
              label: "title"
            },
            checkStrictly: true,
            slot: true,
            rules: [
              {
                required: true,
                message: "请选择所属部门",
                trigger: "click"
              }
            ]
          },
          {
            label: "所属岗位",
            prop: "postId",
            type: "tree",
            multiple: true,
            dicData: [],
            props: {
              label: "postName",
              value: "id"
            },
            rules: [
              {
                required: true,
                message: "请选择所属岗位",
                trigger: "click"
              }
            ]
          }
        ]
      },
      optionDataCK: {
        span: 8,
        menuBtn: false,
        column: [{
          label: "仓库编码",
          prop: "code",
          search: true,
          overHidden: true,
          width: 120,
          rules: [
            {
              required: true,
              message: " ",
              trigger: "blur"
            }
          ]
        }, {
          label: "仓库名称",
          prop: "cname",
          search: true,
          overHidden: true,
          width: 120,
          rules: [
            {
              required: true,
              message: " ",
              trigger: "blur"
            }
          ]
        }, {
          label: "联系人",
          prop: "contacts",
          search: true,
          overHidden: true,
          width: 120,
          rules: [
            {
              required: true,
              message: " ",
              trigger: "blur"
            }
          ]
        }, {
          label: "联系电话",
          prop: "tel",
          search: true,
          overHidden: true,
          width: 120,
          // rules: [
          //   {
          //     required: true,
          //     message: " ",
          //     trigger: "blur"
          //   }
          // ]
        }, {
          label: "是否计费",
          prop: "chargeOrNot",
          search: true,
          overHidden: true,
          width: 120,
          type: "select",
          dicData: [{
            label: "是",
            value: "0"
          }, {
            label: "否",
            value: "1"
          }],
          // rules: [
          //   {
          //     required: true,
          //     message: " ",
          //     trigger: "blur"
          //   }
          // ]
        }, {
          label: "库容",
          prop: "storageCapacity",
          search: true,
          overHidden: true,
          width: 120,
          // rules: [
          //   {
          //     required: true,
          //     message: " ",
          //     trigger: "blur"
          //   }
          // ]
        }, {
          label: "所属公司",
          prop: "salesCompanyId",
          search: true,
          overHidden: true,
          width: 120,
          type: 'select',
          props: {
            label: 'fullName',
            value: 'id'
          },
          dicUrl: '/api/blade-system/dept/top-list',
          rules: [
            {
              required: true,
              message: " ",
              trigger: "blur"
            }
          ]
        },
        // {
        //   label: "共享公司",
        //   prop: "sharedCompany",
        //   search: true,
        //   overHidden: true,
        //   width: 120,
        //   rules: [
        //     {
        //       required: true,
        //       message: " ",
        //       trigger: "blur"
        //     }
        //   ]
        // },
        {
          label: "备注",
          prop: "remarks",
          type: "textarea",
          minRows: 3,
          span: 24,
          overHidden: true,
          width: 200
        }]
      },
      dialogVisibleBt: false,
      formDataTwo: false,
      dialogVisibleCK: false,
      formDataThree: false,
      customerContact: {},
      contactsForm: {},
      contactsData: [],
      corpTypeList: [],
      corpTypeListCk: [],
      corpTypeVisible: false,
      activeName: 'first',
      loadingBtn: false,
      addressTitle: null,
      addressVisible: false,
      form: {},
      form2: {},
      form3: {},
      form4: {},
      data: [],
      data1: [],
      data2: [],
      option: {
        menuBtn: false,
        labelWidth: 130,
        column: [
          {
            label: "客户名称",
            prop: "cname",
            rules: [
              {
                required: true,
                message: "",
                trigger: "blur"
              }
            ],
            span: 8,
          },
          {
            label: "客户分类",
            prop: "corpsTypeId",
            span: 8,
            rules: [{
              required: true,
              message: " ",
              trigger: "blur"
            }]
          },
          {
            label: "电话",
            prop: "tel",
            span: 8,
          },
          {
            label: "业务员",
            span: 8,
            prop: "salesmanId",
            type: "select",
            props: {
              label: "name",
              value: "id"
            },
            dicUrl: "/api/blade-user/client/getUserByRole",
            filterable: true,
            rules: [{
              required: true,
              message: " ",
              trigger: "blur"
            }]
          },
          {
            label: "账期",
            prop: "accountPeriod",
            span: 8,
          },
          {
            label: "发货仓库",
            prop: "deliveryWarehouseId",
            span: 8,
            type: 'select',
            props: {
              label: 'cname',
              value: 'id'
            },
            dicUrl: '/api/blade-sales-part/storageDesc/listAll',
            rules: [{
              required: true,
              message: " ",
              trigger: "blur"
            }]
          },
          {
            label: "商城价格",
            prop: "priceSystem",
            span: 8, filterable: true, type: "select", dicUrl: "/api/blade-system/dict-biz/dictionary?code=mall_price",
            props: {
              label: "dictValue",
              value: "dictKey"
            },
            rules: [{
              required: true,
              message: " ",
              trigger: "blur"
            }]
          }, {
            label: "信用额度",
            prop:
              "creditLimit", span: 8,
            type: "number", controls: false,
            precision: 2
          }
          ,
          {
            label: "使用信用额度",
            prop: "useCreditLimit", span: 8,
            type: "number",
            disabled: true,
            controls: false,
            precision: 2
          }, {
            label: "备注",
            prop: "remarks", type: "textarea",
            minRows: 2, span: 24,
          }
        ]
      },
      option2: {},
      option3: {},
      option4: {
        menuBtn: false,
        labelWidth: 80,
        column: [{
          label: "分类名称",
          prop: "cname",
          rules: [
            {
              required: true,
              message: "",
              trigger: "blur"
            }
          ],
          span: 24,
        },
        {
          label: "上级类型",
          prop: "parentId",
          dicData: [],
          type: "tree",
          props: {
            label: "cname",
            value: "id"
          },
          span: 24,
        }
        ]
      },
      corpsFiles: [],
      customerContactBack: {
        align: 'center',
        index: true,
        addBtnText: "录入明细",
        refreshBtn: false,
        dialogDrag: true,
        addBtn: true,
        span: 8,
        height: 600,
        addRowBtn: false,
        editBtn: false,
        delBtn: false,
        menuWidth: 200,
        dialogTop: 25,
        dialogWidth: "80%",
        column: [{
          label: '联系人',
          prop: 'cname',
          cell: true,
          rules: [
            {
              required: true,
              message: " ",
              trigger: "blur"
            }
          ]
        }, {
          label: '电话',
          prop: 'tel',
          cell: true,
          rules: [
            {
              required: true,
              message: " ",
              trigger: "blur"
            }
          ]
        }, {
          label: '备注',
          prop: 'remarks',
          cell: true
        }]
      }
    }
  },
  components: {
    corpType
  },
  props: {
    detailData: {
      type: Object
    }
  },
  async created() {
    this.customerContact = await this.getColumnData(
      this.getColumnName(263.1),
      this.customerContactBack
    );
    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.getDetail(this.detailData.id);
    }
    if (this.detailData.status == 1) {
      this.option.disabled = true;
    }
    if (!website.tenantMode) {
      this.initData(website.tenantId);
    } else {
      this.initData();
    }
    this.getCorpType()
    this.getAllWorkDicts()
    this.getCorpTypeCk()
  },
  activated() {
    setTimeout(() => {
      this.$nextTick(() => {
        this.$refs.crud.doLayout()
      })
    }, 100)
  },
  methods: {
    // 启用或禁用
    editEnable() {
      let data = this.form
      editenable({ id: data.id, enableOrNot: data.enableOrNot ? 0 : 1 }).then(res => {
        this.$message({
          type: "success",
          message: data.enableOrNot ? "禁用成功!" : "启用成功!"
        });
        this.getDetail(this.detailData.id)
        // this.$set(this.form, 'enableOrNot', data.enableOrNot == 1 ? 0 : 1)
      })
    },
    addressUnique(row, index) {
      for (let item in this.data) {
        if (index != item) {
          if (this.data[item].defaultAddres == 1) {
            this.$message.warning("默认地址只能唯一")
            return row.defaultAddres = 0
          }
        }
      }
    },
    initData(tenantId) {
      getRoleTree(tenantId).then(res => {
        const column = this.findObject(this.optionData.column, "roleId");
        column.dicData = res.data.data;
      });
      getDeptTree(tenantId).then(res => {
        const column = this.findObject(this.optionData.column, "deptId");
        column.dicData = res.data.data;
      });
      getPostList(tenantId).then(res => {
        const column = this.findObject(this.optionData.column, "postId");
        column.dicData = res.data.data;
      });
    },
    //确认创建用户
    confirmSynchronizationTwo() {
      this.$refs["formDataTwo"].validate((valid, done) => {
        done();
        if (valid) {
          let data = JSON.parse(JSON.stringify(this.formDataTwo));
          data.deptId = data.deptId.join(",");
          data.roleId = data.roleId.join(",");
          data.postId = data.postId.join(",");
          creatingUsersTwo({
            ...data,
            id: this.formRow.id
          }).then(res => {
            this.dialogVisibleBt = false;
            this.formDataTwo = {}
            this.$message.success(
              "创建用户成功,默认帐号：手机号。默认密码：123456"
            );
          });
        } else {
          return false;
        }
      });
    }
    ,
    //确认创建仓库
    confirmSynchronizationThree() {

      this.formDataThree.salesCompanyName = this.formDataThree.$salesCompanyId
      this.$refs["formDataThree"].validate((valid, done) => {
        done();
        if (valid) {
          typeSave({
            ...this.formDataThree,
          }).then(res => {
            this.dialogVisibleCK = false;
            this.$message.success('新增成功')
            this.formDataThree = {}
            this.getCorpTypeCk()
          });
        } else {
          return false;
        }
      });
    }
    ,
    getAllWorkDicts() {
      customerList({ corpType: "KH" }).then(res => {
        this.findObject(this.option4.column, "parentId").dicData = res.data.data.records
      });
      this.getWorkDicts("abbreviation").then(res => {
        this.findObject(this.option2.column, "abbreviation").dicData = res.data.data;
      });
      this.findObject(this.option2.column, "belongtoarea").dicData = JSON.parse(localStorage.getItem('areaTypeTree'))
      this.$refs.crud.init();
    }
    ,
    cellStyle() {
      return "padding:0;height:40px;";
    }
    ,
    selectValue(value, row) {
      if (row.feesId) {
        row.feesName = value.cname
      } else {
        row.feesName = ""
      }
    }
    ,
    getDetail(id) {
      this.loadingBtn = true
      getDetails({ id: id })
        .then(res => {
          this.form = res.data.data;
            if (this.form.enableOrNot == 1) {
                this.$set(this.option,'disabled',true)
            }else {
                this.$set(this.option,'disabled',false)
            }
          this.data = res.data.data.corpsAddrList
          this.corpsFiles = res.data.data.corpsFilesList
          this.contactsData = res.data.data.corpsAttnList
        })
        .finally(() => {
          this.loadingBtn = false;
        });
    }
    ,
    getCorpData(row) {
      this.form.corpName = row.cname
    }
    ,
    addRow() {
      console.log('1234');
      this.data.push({ $cellEdit: true })
    }
    ,
    rowCell(row, index) {
      if (row.$cellEdit == true) {
        this.$set(row, "$cellEdit", false);
      } else {
        this.$set(row, "$cellEdit", true);
      }
    }
    ,
    rowDel(row, index) {
      this.$confirm("确定删除数据?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        if (row.id) {
          itemDel(row.id).then(res => {
            this.$message({
              type: "success",
              message: "删除成功!"
            });
            this.data.splice(index, 1);
          });
        } else {
          this.$message({
            type: "success",
            message: "删除成功!"
          });
          this.data.splice(index, 1);
        }
      });
    }
    ,
    addRow2() {
      this.data2.push({ $cellEdit: true, type: 1 })
    }
    ,
    rowCell2(row, index) {
      if (row.$cellEdit == true) {
        this.$set(row, "$cellEdit", false);
      } else {
        this.$set(row, "$cellEdit", true);
      }
    }
    ,
    rowDe2(row, index) {
      this.$confirm("确定删除数据?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        if (row.id) {
          // itemDel(row.id).then(res => {
          //   this.$message({
          //     type: "success",
          //     message: "删除成功!"
          //   });
          //   this.data2.splice(index, 1);
          // });
        } else {
          this.$message({
            type: "success",
            message: "删除成功!"
          });
          this.data2.splice(index, 1);
        }
      });
    }
    ,
    corpTypeClosed() {
      // this.reload = Math.random();
      // this.form4 = this.$options.data().form4
    }
    ,
    getCorpType() {
      getCorpType({ corpType: 'KH' }).then(res => {
        this.corpTypeList = res.data.data
      })
    }
    ,
    getCorpTypeCk() {
      customerListAll().then(res => {
        this.corpTypeListCk = res.data.data
      })
    }
    ,
    addCorpType() {
      // this.$refs["corpType"].validate((valid, done) => {
      //   done();
      //   if (valid) {
      //     addCorpType({ ...this.form4, corpType: 'KH', status: 0 })
      //       .then(res => {
      //         this.$message.success("保存成功");
      //         this.getCorpType()
      //         this.corpTypeVisible = false
      //       })
      //   } else {
      //     return false;
      //   }
      // });
      this.getCorpType()
      this.corpTypeVisible = false
    }
    ,
    //修改提交触发
    editCustomer() {
      this.$refs["form"].validate((valid, done) => {
        done();

        if (valid) {
          this.loadingBtn = true;
          if(!this.form.id) {
              this.form.checkStatus = '通过'
          }
          submit({
            ...this.form,
            code: this.form.cname,
            corpType: "KH",
            corpsAddrList: this.data,
            corpsFilesList: this.corpsFiles,
            corpsAttnList: this.contactsData,
            billType: 1
          }).then(res => {
            this.$message.success("保存成功");
            this.form = res.data.data;
            this.data = res.data.data.corpsAddrList
            this.corpsFiles = res.data.data.corpsFilesList
            this.getDetail(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(() => {
            this.loadingBtn = false;
          });
        } else {
          return false;
        }
      });
    }
    ,
    async saveColumn() {
      const inSave = await this.saveColumnData(
        this.getColumnName(263.2),
        this.option2
      );
      if (inSave) {
        this.$nextTick(() => {
          this.$refs.crud.doLayout();
        });
        this.$message.success("保存成功");
        //关闭窗口
        this.$refs.crud.$refs.dialogColumn.columnBox = false;
      }
    }
    ,
    async resetColumn() {
      this.option2 = option2;
      const inSave = await this.delColumnData(
        this.getColumnName(263.2),
        option2
      );
      if (inSave) {
        this.$nextTick(() => {
          this.$refs.crud.doLayout();
        });
        this.getAllWorkDicts()
        this.$message.success("重置成功");
        this.$refs.crud.$refs.dialogColumn.columnBox = false;
      }
    }
    ,


    creatingUsers(row) {
      console.log("row", row)
      if (row.id) {
        if (row.tel) {
          this.dialogVisibleBt = true;
          this.formDataTwo = {};
          this.formRow = row;
        } else {
          this.$message.error("请输入手机号");
        }
      } else {
        this.$message.error("请保存数据后再点击");
      }
    }
    ,
    //新增客户联系人保存触发
    rowSave(row, done, loading) {
      done(row);
    }
    ,
    //修改客户联系人触发
    rowUpdate(row, index, done, loading) {
      done(row);
    }
    ,
    //删除客户联系人触发
    rowDelTwo(row, index, donerowDel) {
      this.$confirm("确定将选择数据删除?", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        // 数据回调进行刷新
        if (row.id) {
          corpsattn(row.id).then(res => {
            this.$message({
              type: "success",
              message: "操作成功!"
            });
            this.contactsData.splice(index, 1);
          });
        } else {
          this.$message({
            type: "success",
            message: "操作成功!"
          });
          this.contactsData.splice(index, 1);
        }
      });
    }
    ,
    async saveColumnTwo() {
      const inSave = await this.saveColumnData(
        this.getColumnName(263.1),
        this.customerContact
      );
      if (inSave) {
        this.$nextTick(() => {
          this.$refs.crudTwo.doLayout();
        });
        this.$message.success("保存成功");
        //关闭窗口
        this.$refs.crudTwo.$refs.dialogColumn.columnBox = false;
      }
    }
    ,
    async resetColumnTwo() {
      this.customerContact = this.customerContactBack;
      const inSave = await this.delColumnData(
        this.getColumnName(263.1),
        this.customerContactBack
      );
      if (inSave) {
        this.$nextTick(() => {
          this.$refs.crudTwo.doLayout();
        });
        this.$message.success("重置成功");
        this.$refs.crudTwo.$refs.dialogColumn.columnBox = false;
      }
    }
    ,
    async saveColumn2() {
      const inSave = await this.saveColumnData(
        this.getColumnName(208.4),
        this.option3
      );
      if (inSave) {
        this.$nextTick(() => {
          this.$refs.crud.doLayout();
        });
        this.$message.success("保存成功");
        //关闭窗口
        this.$refs.crud2.$refs.dialogColumn.columnBox = false;
      }
    }
    ,
    async resetColumn2() {
      this.option3 = option3;
      const inSave = await this.delColumnData(
        this.getColumnName(208.4),
        option3
      );
      if (inSave) {
        this.$nextTick(() => {
          this.$refs.crud.doLayout();
        });
        this.getAllWorkDicts()
        this.$message.success("重置成功");
        this.$refs.crud2.$refs.dialogColumn.columnBox = false;
      }
    }
    ,
    //返回列表
    backToList() {
      this.$emit("goBack");
    }
  }
}
  ;
</script>

<style lang="scss" scoped>
.trading-form ::v-deep .el-form-item {
  margin-bottom: 8px !important;
}

::v-deep .el-dialog__body {
  padding: 0px 20px 15px 20px;
}

::v-deep .el-form-item__error {
  display: none !important;
}

.el-dialog ::v-deep .el-form-item__error {
  display: none !important;
}

.img-form ::v-deep .el-form-item {
  height: 150px;
  line-height: 150px;
  margin-bottom: 8px !important;
}

.img-form ::v-deep .avue-upload__icon {
  font-size: 20px;
  width: 150px;
  height: 150px;
  line-height: 150px;
}

::v-deep .el-table .cell {
  padding: 0 2px !important;
}

::v-deep .avue-crud .el-table .el-form-item__label {
  left: -1px;
}

.addressTabs {
  display: flex;
  justify-content: center;

  span {
    width: 100px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
  }
}
</style>
