<<template>
  <div>
    <div class="my-title">授权</div>
      <el-form   
        :model="dataForm"
        :rules="dataRule"
        ref="dataForm"
        label-width="160px"
      >
        <el-row>
          <el-col :span="8">
            <el-form-item label="状态" prop="state">
              <el-select
              v-model="dataForm.state"
              placeholder="请选择"
              style="width: 100%"
            >
              <el-option
                v-for="item in stateOption"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col>
            <el-form-item label="授权情况" prop="accredit">
              <el-input v-model="dataForm.accredit" placeholder="请输入" type="textarea"></el-input>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>

      <span slot="footer" class="dialog-footer">
      <el-button @click="onChose">取消</el-button>
      <el-button type="primary" @click="dataFormSubmit()" v-reClick>确定</el-button>
    </span>
  </div>
</template>

<script>
export default {
  name: '',
  components: {},
  props: {},
  data () {
    return {
      stateOption: [
        { label: '通过', value: 1 },
        { label: '不通过', value: 2 }
      ],
      dataForm: {
        priceId: '',
        state: '',
        accredit: ''
      },
      dataRule: {
        state: [{required: true, message: '请选择', trigger: 'change'}]
      }
    }
  },
  watch: {},
  computed: {},
  created () {},
  mounted () {},
  activated () {},
  methods: {
    onChose () {
      this.$emit('onChose')
    },
    async init (id) {
      this.dataForm.priceId = id
    },
    dataFormSubmit () {
      this.$refs['dataForm'].validate((valid) => {
        if (valid) {
          this.$http({
            url: this.$http.adornUrl(`/biz-service/quoted/updateAccredit`),
            method: 'post',
            data: this.$http.adornData({ ...this.dataForm, orgId: this.orgId })
          }).then(({ data }) => {
            if (data && data.code === '200') {
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                  this.onChose()
                  this.$emit('refreshDataList')
                }
              })
            } else {
              this.$message.error(data.msg)
            }
          })
        }
      })
    }
  }
}
</script>

<style scoped>
</style>