<!--
 * @Author:zqm
 * @Date: 2021-06-28 15:44:35
 * @LastEditTime: 2022-03-29 15:36:11
 * @LastEditors: Please set LastEditors
 * @Description: 申报按钮
 * @FilePath: \taxFormToolFramework\src\components\declareButton.vue
-->
<template>
  <div>
    <el-button ref="declareButton" type="primary" size="small" v-html="declareProp.name" @click="declareFun" :disabled="state=='success'"></el-button>
  </div>
</template>
<script>
export default {
  name: "declareButton",
  props: {
    declareProp: { type: Object, default: () => ({}) },
    state: { type: String, default: "" }
  },
  methods: {
    declareFun() {
      //点击申报按钮 先保存当前报表 如果单表保存通过，直接走申报，如果没通过，展示表内校验
      var obj = this.recursionChild(this.$parent.$children, "saveButton");
      obj.saveFun("declare");
    },
    //申报
    declareData(operate) {
      var openData = this.$store.state.data.openData;
      if (openData.fillingFlag == 'corrections') {
        openData.gzFlag = '1';
      } else {
        openData.gzFlag = '0';
      }
      if (operate == "continue") {
        openData.sfyczb = "Y"
      }
      var list = [];
      list.push(openData);
      var params = {
        param: JSON.stringify(list),
        djxh: openData.djxh,
        value: openData.value,
        zjhm: openData.zjhm
      }
      var _self = this;
      var declareUrl = "";
      declareUrl = interfacePrefix + config.requestAddress.declareTable;
      this.ajax.post(declareUrl, params,
        function (data) {
          if (data.returnCode == '00') {
            //展示申报结果
            var obj = _self.recursionParent(_self.$parent, "declareResult")
            _self.$store.commit("sbResultData", data.content);
            obj.dataProcessing(data.content, list);
          } else {
            _self.$alert(data.returnMessage, '提示', { type: 'error' });
          }
        }, "json", true);
    }
  }
}
</script>
<style scoped>
</style>