<template>
  <div>
    <span style="float: right; color: #8492a6; font-size: 13px">
      <el-button size="mini" @click.stop="setConfig(true)" title="配置属性">
        设置
      </el-button>
    </span>

    <ht-load-data
      url="/form/customDialog/v1/getAll"
      requestMethod="get"
      context="form"
      @after-load-data="afterCustomDialogLoadData"
    ></ht-load-data>
    <ht-load-data
      url="/form/customQuery/v1/list"
      requestMethod="post"
      context="form"
      @after-load-data="afterCustomQueryLoadData"
    ></ht-load-data>

    <el-dialog
      title="设置"
      width="800px"
      :visible.sync="dialogVisible"
      :before-close="handleClose"
      :close-on-click-modal="false"
      append-to-body
      class="param-setting-dialog"
    >
      <el-form v-if="outConfig.type == 'select'||outConfig.type == 'radio'||outConfig.type == 'checkbox'"  label-width="120px">
        <el-form-item label="选项配置:">
          <el-radio-group
            v-model="outConfig.choiceType"
            size="small"
            class="btn-radio"
          >
            <el-radio-button label="static">固定选项</el-radio-button>
            <el-radio-button label="dynamic">动态选项</el-radio-button>
          </el-radio-group>
        </el-form-item>
        <template v-if="outConfig.choiceType == 'dynamic'">
          <el-form-item label="选择关联查询">
            <ht-select
              filterable
              @change="setCurrentCustomQuery"
              v-model="outConfig.customQuery.alias"
              :options="customQuerys"
              :props="{key: 'alias', value: 'name'}"
            />
          </el-form-item>
          <el-form-item label="值">
            <ht-select
              clearable
              v-model="outConfig.customQuery.valueBind"
              :options="outConfig.customQuery.resultfield"
              :props="{key: 'field', value: 'comment'}"
            />
          </el-form-item>
          <el-form-item label="标签">
            <ht-select
              clearable
              v-model="outConfig.customQuery.labelBind"
              :options="outConfig.customQuery.resultfield"
              :props="{key: 'field', value: 'comment'}"
            />
          </el-form-item>
        </template>
        <template v-else>
          <el-form-item>
            <el-table style="width: 100%" :data="outConfig.selectData" border>
              <el-table-column label="选项值" width="300px" align="left">
                <template slot-scope="scope">
                  <ht-input
                    v-model="scope.row.key"
                    style="width: 100%"
                  ></ht-input>
                </template>
              </el-table-column>
              <el-table-column label="选项标签" align="left">
                <template slot-scope="scope">
                  <ht-input
                    v-model="scope.row.value"
                    style="width: 100%"
                  ></ht-input>
                </template>
              </el-table-column>
              <el-table-column label="操作" width="100px" align="left">
                <template slot="header">
                  操作
                </template>
                <template slot-scope="scope">
                  <el-button
                    class="btn-padding"
                    type="text"
                    @click="outConfig.selectData.remove(scope.row)"
                    >删除</el-button
                  >
                </template>
              </el-table-column>
            </el-table>
            <el-button
              style="width: 100%"
              icon="el-icon-plus"
              plain
              @click="outConfig.selectData.push({key: '', value: ''})"
              >添加</el-button
            >
          </el-form-item>
        </template>
      </el-form>
      <el-form v-else-if="outConfig.type == 'dictionary'" label-width="120px">
        <ht-form-item label="数据字典" label-width="100px">
           <el-select
            @visible-change="dicClick"
            clearable
            v-model="outConfig.parameter.dic"
            placeholder="请选择数据字典"
            style="width: 100%"
            ref="dicSelect"
          >
            <el-option
              :value="outConfig.parameter.dic"
              :label="outConfig.parameter.dicName"
              style="
                width: 100%;
                height: 100%;
                overflow: auto;
                background-color: #fff;
              "
            >
              <el-tree
                :data="dicData"
                :props="dicDefaultProps"
                @node-click="dicNodeClick"
              ></el-tree>
            </el-option>
            </el-select>
            </ht-form-item>
      </el-form>
      <el-form v-else-if="outConfig.type == 'dialog'" label-width="120px">
        <ht-form-item label="按钮名称">
          <el-input v-model="outConfig.dialogConfig.btnName" style="width:320px;" placeholder="请输入按钮名称"></el-input>
        </ht-form-item>
        <ht-form-item>
          <template slot="label">
            <el-tooltip content="所选择的自定义查询作为选项时的绑定">
              <i class="property-tip icon-question" />
            </el-tooltip>
            <span>选择对话框</span>
          </template>
          <ht-select
            filterable
            @change="changeCustDialog"
            v-model="outConfig.dialogConfig.alias"
            :options="customDialogs"
            :props="{key: 'alias', value: 'name'}"
            style="width: 320px"
          />
          <table class="form-table" cellspacing="0" cellpadding="0" border="0">
            <tbody>
              <tr class="linkageTable-tr" style="background-color:#F9F9F9;">
                <td width="150px">返回结果字段</td>
                <td width="220px">绑定显示的属性</td>
                <!-- <td width="80px">解除绑定</td> -->
              </tr>

              <tr
                class="linkageTable-tr"
                v-for="(field, index) in outConfig.dialogConfig.resultField"
                :key="index"
              >
                <td>{{ field.comment }}</td>
                <td>
                  <ht-select
                    clearable
                    v-model="outConfig.parameter[field.comment]"
                    :options="showColumnList(outConfig.parameter[field.comment])"
                    :props="{key: 'comment', value: 'fieldName'}"
                    @change="selectFieldChange"
                  >
                    <template slot-scope="{options}">
                      <el-option
                        v-for="item in options"
                        :key="item.id"
                        :label="item.comment"
                        :value="item.fieldName"
                      ></el-option>
                    </template>
                  </ht-select>
                </td>
              </tr>
            </tbody>
          </table>
        </ht-form-item>
      </el-form>

      <el-form v-else v-form data-vv-scope="form" :model="outConfig">
        <el-form-item>
          <template>
            <el-checkbox v-model="outConfig.isSingle">单选</el-checkbox>
            <el-checkbox
              v-model="outConfig.selectCurrent"
              v-if="outConfig.type == 'user'"
              >当前用户</el-checkbox
            >
            <el-checkbox
              v-model="outConfig.selectCurrent"
              v-else-if="outConfig.type == 'org'"
              >当前组织</el-checkbox
            >
          </template>
        </el-form-item>
        <el-form-item>
          <template slot="label">
            <el-tooltip
              content="选择器的返回值绑定的属性，选择器控件绑定的属性不能作为返回值绑定"
            >
              <i class="property-tip icon-question" />
            </el-tooltip>
            <span>返回值</span>
          </template>
          <br />
          <template v-if="outConfig.type == 'user'">
            <ht-form-item label="用户ID" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.id"
                :options="showColumnList(outConfig.parameter.id)"
                :props="{key: 'fieldName', value: 'comment'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="用户账号" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.account"
                :options="showColumnList(outConfig.parameter.account)"
                :props="{key: 'fieldName', value: 'comment'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="用户姓名" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.fullname"
                :options="showColumnList(outConfig.parameter.fullname)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="用户手机" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.mobile"
                :options="showColumnList(outConfig.parameter.mobile)"
                :props="{key: 'fieldName', value: 'comment'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="用户邮箱" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.email"
                :options="showColumnList(outConfig.parameter.email)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
          </template>
          <template v-else-if="outConfig.type == 'org'">
            <ht-form-item label="组织ID" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.id"
                :options="showColumnList(outConfig.parameter.id)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="组织代码" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.code"
                :options="showColumnList(outConfig.parameter.code)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="组织名称" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.name"
                :options="showColumnList(outConfig.parameter.name)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
          </template>
          <template v-else-if="outConfig.type == 'post'">
            <ht-form-item label="岗位ID" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.id"
                :options="showColumnList(outConfig.parameter.id)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="岗位代码" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.code"
                :options="showColumnList(outConfig.parameter.code)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="岗位名称" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.name"
                :options="showColumnList(outConfig.parameter.name)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
          </template>
          <template v-else-if="outConfig.type == 'job'">
            <ht-form-item label="职务ID" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.id"
                :options="showColumnList(outConfig.parameter.id)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="职务代码" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.code"
                :options="showColumnList(outConfig.parameter.code)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="职务名称" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.name"
                :options="showColumnList(outConfig.parameter.name)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
          </template>
          <template v-else-if="outConfig.type == 'dem'">
            <ht-form-item label="维度ID" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.id"
                :options="showColumnList(outConfig.parameter.id)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="维度代码" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.code"
                :options="showColumnList(outConfig.parameter.code)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="维度名称" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.demName"
                :options="showColumnList(outConfig.parameter.demName)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
          </template>
          <template v-else-if="outConfig.type == 'role'">
            <ht-form-item label="角色ID" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.id"
                :options="showColumnList(outConfig.parameter.id)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="角色代码" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.code"
                :options="showColumnList(outConfig.parameter.code)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
            <ht-form-item label="角色名称" label-width="100px">
              <ht-select
                clearable
                v-model="outConfig.parameter.name"
                :options="showColumnList(outConfig.parameter.name)"
                :props="{key: 'comment', value: 'fieldName'}"
                @change="selectFieldChange"
              >
                <template slot-scope="{options}">
                  <el-option
                    v-for="item in options"
                    :key="item.id"
                    :label="item.comment"
                    :value="item.fieldName"
                  ></el-option>
                </template>
              </ht-select>
            </ht-form-item>
          </template>
        </el-form-item>
      </el-form>

      <div slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="outValueOk">确 定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import form from '@/api/form.js'
export default {
  name: 'param-setting-dialog',
  props: {
    //条件字段用户输入配置
    config: {
      type: Object,
      required: true
    },
    //字段
    fieldList: {
      type: Array
    },
    //条件字段
    conditionColumnList: {
      type: Array
    },
    //返回字段
    resultList: {
      type: Array
    },
    dsType:{
      type:String
    }
  },
  data() {
    return {
      dialogVisible: false,
      customQuerys: [],
      customDialogs: [],
      outConfig: {
        choiceType: 'static',
        parameter: {},
        selectData: [],
        customQuery: {alias: '', valueBind: '', labelBind: ''},
        dialogConfig: {name: '请选择'},
        bind: ''
      },
      columnList: [],
      dicData:[],
      dicDefaultProps: {
        children: 'children',
        label: 'name'
      },
    }
  },
  computed: {
    showColumnList() {
      return function(val){
        const arr = Object.values(this.outConfig.parameter)
        const condition = this.conditionColumnList.filter((item)=> {
        return item.field != this.config.field;
        })
        let newList = JSON.parse(JSON.stringify(this.columnList)).filter((item)=> {
        return !condition.some(row=> row.field == item.fieldName);
        });
        newList = newList.filter(item => {
          if (val == item.fieldName) {
            return item;
          } else {
            if (arr.indexOf(item.fieldName) == -1) {
              return item;
           }
          }
        });
        return newList;
      }
    }
  },
  methods: {
    afterCustomQueryLoadData(data) {
      this.customQuerys = data.rows
    },
    afterCustomDialogLoadData(data) {
      this.customDialogs = data
    },
    setCurrentCustomQuery() {
      const _this = this
      _this.outConfig.customQuery.labelBind = ''
      _this.outConfig.customQuery.valueBind = ''
      _this.customQuerys.forEach(item => {
        if (_this.outConfig.customQuery.alias == item.alias) {
          if (typeof item.conditionfield == 'string') {
            item.conditionfield = JSON.parse(item.conditionfield) //parseToJson(item.customQuery.conditionfield);
            item.resultfield = JSON.parse(item.resultfield) // parseToJson(item.customQuery.resultfield);
          }
          //把当前对象克隆一份到控件属性配置
          Object.assign(_this.outConfig.customQuery, item)
          _this.slimCustomQuery(_this.outConfig.customQuery)
        }
      })
    },
    slimCustomQuery(customQuery) {
      if (customQuery && customQuery.constructor == Object) {
        // 删除多余的属性
        delete customQuery['id']
        delete customQuery['createTime']
        delete customQuery['pkVal']
        delete customQuery['objName']
        delete customQuery['needPage']
        delete customQuery['pageSize']
        delete customQuery['dsalias']
        delete customQuery['dataParam']
        delete customQuery['sortfield']
        delete customQuery['diySql']
        delete customQuery['isTable']
        delete customQuery['sqlBuildType']
        // delete customQuery["dsType"];
        delete customQuery['url']
        delete customQuery['header']
        delete customQuery['requestType']
        delete customQuery['pageKey']
        delete customQuery['pageSizeKey']
        delete customQuery['totalKey']
        delete customQuery['listKey']
      }
    },
    changeCustDialog(value) {
      const _this = this
      _this.outConfig.dialogConfig.conditions = []
      this.outConfig.dialogConfig.mappingConf = []
      this.outConfig.dialogConfig.custQueryJson = []
      this.outConfig.dialogConfig.selectNum = ''
      let obj = this.customDialogs.find(item => item.alias == value)
      if (obj) {
        this.outConfig.dialogConfig.selectNum = obj.selectNum
        let treeData
        if (obj.style === 2) {
          let combineConfig = JSON.parse(obj.combinationRule)
          let listDialog = this.customDialogs.find(
            item => item.alias == combineConfig.rightDialog
          )
          treeData = JSON.parse(listDialog.resultfield)
          this.outConfig.dialogConfig.type = 'combiDialog'
        }
        if (obj.listDialog && obj.listDialog.resultfield) {
          treeData = eval('(' + obj.listDialog.resultfield + ')')
          this.outConfig.dialogConfig.type = 'combiDialog'
        }
        if (obj.resultfield && obj.resultfield !== '[]') {
          treeData = eval('(' + obj.resultfield + ')')
          this.outConfig.dialogConfig.type = 'custDialog'
        }
        for (let q = 0, f; (f = treeData[q++]); ) {
          f.field = f.comment
        }
        this.outConfig.dialogConfig.resultField = treeData
        let conditionList = eval('(' + obj.conditionfield + ')')
        let conditions = []
        //只处理类型等于1的对话框参数（defaultType：1：用户输入，2：固定值 ，3：参数传入）
        if (conditionList && conditionList.length > 0) {
          for (let j = 0, c; (c = conditionList[j++]); ) {
            if (c.defaultType == '3') {
              let has = false
              if (!has) conditions.push(c)
            }
          }
        }
        this.outConfig.dialogConfig.conditions = conditions
      }
    },

    handleClose() {
      this.dialogVisible = false
    },
    outValueOk() {
      this.dialogVisible = false
      // let val = Base64.encode(JSON.stringify(this.outConfig));
      let val = JSON.stringify(this.outConfig)
      this.$emit('returnVal', val)
    },
    setConfig(param) {
      this.dialogVisible = param
      if (this.config) {
        if (this.config.config) {
          // let temp = Base64.decode(this.config.config);
          let temp = this.config.config
          let configJson = temp.replace(/\\/g, '')
          this.outConfig = JSON.parse(configJson)
        } else {
          this.outConfig['parameter'] = {}
        }
        this.outConfig.bind = this.config.field
        switch (this.config.controllerType) {
          case '4':
            this.outConfig.type = 'select'
            break
          case '5':
            this.outConfig.type = 'dialog'
            break
          case '6':
            this.outConfig.type = 'user'
            break
          case '7':
            this.outConfig.type = 'org'
            break
          case '8':
            this.outConfig.type = 'post'
            break
          case '9':
            this.outConfig.type = 'job'
            break
          case '10':
            this.outConfig.type = 'dem'
            break
          case '11':
            this.outConfig.type = 'role'
            break
          case '12':
            this.outConfig.type = 'radio'
            break
          case '13':
            this.outConfig.type = 'checkbox'
            break
          case '14':
            this.outConfig.type = 'dictionary'
            break
        }
      }
    },
    buildField() {
      let conditionFieldName = []
      if (this.conditionColumnList && this.conditionColumnList.length > 0) {
        this.conditionColumnList.forEach(i => {
          conditionFieldName.push(i.field)
        })
      }
      if (this.fieldList && this.fieldList.length > 0 && this.dsType !='restful') {
        this.columnList = this.fieldList.filter(i => {
          return (
            conditionFieldName.indexOf(i.fieldName) == '-1' ||
            i.fieldName == this.config.field
          )
        })
      }
      if (this.columnList.length == 0 && this.dsType =='restful') {
        this.resultList.forEach(item => {
          this.columnList.push({
            comment: item.comment,
            fieldName: item.field
          })
        })
      }
    },

    selectFieldChange() {
      let val = JSON.stringify(this.outConfig)
      this.$emit('selectFieldChange', val)
    },
    dicClick(visible) {
      if (this.dicData && this.dicData.length > 0) return
      form.getCategory('DIC', data => {
        this.dicData = data.data
      })
    },
    dicNodeClick(data) {
      //由于只有一个分类，系统默认字典分类就是5
      if (data.parentId == '5') {
        return
      }
      this.$set(this.outConfig.parameter, 'dic', data.typeKey)
      this.$set(this.outConfig.parameter, 'dicName', data.name)
      this.$refs.dicSelect.blur()
    },
  },
  mounted() {
    this.buildField()
  },

  watch: {
    conditionColumnList: {
      handler(val) {
        this.buildField()
      },
      deep: true
    },
    fieldList:{
      handler(val) {
        this.buildField()
      },
      deep: true
    },
    resultList:{
      handler(val) {
        this.buildField()
      },
      deep: true
    },
  }
}
</script>

<style lang="scss" scoped>
.el-main {
  padding-top: 0px;
}
.linkageTable-tr td {
  text-align: left;
}
.btn-padding {
  padding: 5px;
}
.choiceType-table td {
  padding: 3px;
}
.select_config {
  margin-bottom: 0px;
  margin-right: 0px;
}
.select_config >>> .el-form-item__label {
  text-align: left;
}
.select_config >>> .el-form-item__content {
  text-align: right;
}
.customQuery-inputs >>> .inputs,
.customQuery-inputs >>> .inputs .el-select {
  width: 100%;
}
.custDialog-table td {
  padding: 5px;
}
.param-setting-dialog /deep/.el-dialog__body {
  padding: 24px;
}
.form-table {
  margin-top: 8px;
  border-top: 1px solid #ebebeb;
  border-left: 1px solid #ebebeb;
}
::v-deep .el-dialog__footer {
  text-align: right;
}
</style>
