<template>
  <el-dialog :title="dialogTitle"
             :visible="dialogVisible"
             width="45vw"
             center
             :destroy-on-close="true"
             :show-close="false"
  >
    <div class="dialogForm">
      <el-col>
        <el-col :span="4"><label class="text_label">规则名称：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.filterName" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">关联URL：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.startUrl" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">URL过滤词：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.urlEx" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">URL包含词：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.urlIn" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">标题过滤词：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.titleEx" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">标题包含词：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.titleIn" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">正文过滤词：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.contentEx" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="4"><label class="text_label">正文包含词：</label></el-col>
        <el-col class="card-item" :span="8">
          <el-input v-model="form.contentIn" size="mini" autocomplete="off"></el-input>
        </el-col>
        <el-col :span="6"><label class="text_label">全局过滤分类词库：</label></el-col>
        <el-col class="card-item" :span="18">
          <el-checkbox-group v-model="form.globalEx">
            <el-checkbox v-for="cate in wordBankCategoryList" :label="cate.value" :key="cate.value">
              {{ cate.label }}
            </el-checkbox>
          </el-checkbox-group>
        </el-col>
        <el-col :span="6"><label class="text_label">全局包含分类词库：</label></el-col>
        <el-col class="card-item" :span="18">
          <el-checkbox-group v-model="form.globalIn">
            <el-checkbox v-for="cate in wordBankCategoryList" :label="cate.value" :key="cate.value">
              {{ cate.label }}
            </el-checkbox>
          </el-checkbox-group>
        </el-col>
      </el-col>
    </div>
    <span slot="footer" class="dialog-footer">
          <el-button size="small" type="success" @click="submit" :loading="saveLoading">保存</el-button>
          <el-button style="margin-left: 10px;" size="small" type="primary" @click="closeDialog">关闭</el-button>
    </span>
  </el-dialog>

</template>

<script>
import {
  Button,
  Card,
  Checkbox,
  Col,
  Input,
  InputNumber,
  Option,
  CheckboxGroup,
  Radio,
  Select
} from 'element-ui'
import Vue from "vue";

Vue.use(Card);
Vue.use(Button);
Vue.use(Input);
Vue.use(InputNumber);
Vue.use(Checkbox);
Vue.use(Col);
Vue.use(Radio);
Vue.use(Select);
Vue.use(Option);
Vue.use(CheckboxGroup);

export default {
  name: "RulesFilterDialog",
  props: ["form", "metaData", "dialogTitle", "dialogVisible", "wordBankCategoryList", "closeDialog", "submit"],
  data() {
    return {
      saveLoading: false,
    }
  },
  methods: {
    forceUpdate() {
      this.$forceUpdate();
    },
  },
}
</script>

<style scoped>
.dialogForm {
  display: flex;
  justify-content: center;
}


.text_label {
  text-align: right;
  vertical-align: middle;
  float: left;
  font-size: 14px;
  color: #606266;
  padding: 0 12px 0 0;
  box-sizing: border-box;
  width: 100%;
  line-height: 28px;
}

.el-input__inner {
  height: 28px !important;
  line-height: 28px !important;
}

.card-item {
  height: 32px;
  margin-top: 3px;
}

.parse-button-icon {
  text-align: center;
  color: #409EFF;
}

</style>