<template>
  <div>
    <el-card>
      <el-form :model="formData" :rules="formRules" label-width="140px" ref="dataForm">
        <el-collapse v-model="activeNames">

          <el-collapse-item name="0">
            <template slot="title">
              <p class="form-title">下载设置</p>
            </template>
            <el-row :gutter="20">
              <el-col :span="11" class="el-col">
                <el-form-item label="起始下载时间:" prop="startDownloadTime" label-width="160px">
                  <el-date-picker
                    v-model="formData.startDownloadTime"
                    type="datetime"
                    placeholder="请输入起始下载时间"
                    style="width: 90%"
                    :clearable="false"
                    value-format="yyyy-MM-dd HH:mm:ss"
                    @change="save()"
                  >
                  </el-date-picker>

                </el-form-item>
              </el-col>

            </el-row>
          </el-collapse-item>


          <el-collapse-item name="1">
            <template slot="title">
              <p class="form-title">单据自助上传设置</p>
            </template>
            <el-row :gutter="20">
              <!--            <el-col :span="11" class="el-col">-->
              <!--              <el-form-item label="流通计量层级单位:" prop="distributeLevelUnit" label-width="160px">-->
              <!--                <el-input style="width: 90%" size="small" placeholder="请输入流通计量层级单位"-->
              <!--                          disabled-->
              <!--                          v-model="newProductData.distributeLevelUnit"-->
              <!--                ></el-input>-->
              <!--              </el-form-item>-->
              <!--            </el-col>-->
              <!--            <el-col :span="11" class="el-col">-->
              <!--              <el-form-item label="使用计量层级单位:" prop="useLevelUnit" label-width="160px">-->
              <!--                <el-input style="width: 90%" size="small" placeholder="请输入使用计量层级标识"-->
              <!--                          disabled-->
              <!--                          v-model.trim="newProductData.useLevelUnit"-->
              <!--                ></el-input>-->
              <!--              </el-form-item>-->
              <!--            </el-col>-->
              <!--            <el-col :span="11" class="el-col">-->
              <!--              <el-form-item label="流通时含计量单元数量:" prop="distributeLevelCount" label-width="160px">-->
              <!--                <el-input style="width: 90%" size="small" placeholder="请输入流通时包含计量单元的数量"-->
              <!--                          v-model.trim="newProductData.distributeLevelCount"-->
              <!--                ></el-input>-->
              <!--              </el-form-item>-->
              <!--            </el-col>-->
              <!--            <el-col :span="11" class="el-col">-->
              <!--              <el-form-item label="使用时含计量单元数量:" prop="useLeverCount" label-width="160px">-->
              <!--                <el-input style="width: 90%" size="small" placeholder="请输入使用时包含计量单元的数量"-->
              <!--                          v-model.trim="newProductData.useLeverCount"-->
              <!--                ></el-input>-->
              <!--              </el-form-item>-->
              <!--            </el-col>-->

            </el-row>
          </el-collapse-item>
        </el-collapse>

      </el-form>
    </el-card>
  </div>
</template>

<script>
import { selectSysParamByKey ,systemParamConfigSave} from '@/api/param/systemParamConfig'

export default {
  name: 'timerSetting',

  data() {
    return {
      activeNames: ['0'],
      formData: {
        startDownloadTime: null
      },
      systemParam:null,

    }
  },
  methods: {
    selectSysParam() {
      let query = {
        paramKey: 'startDownloadTime'
      }
      selectSysParamByKey(query).then((response) => {
        if (response.code == 20000) {
          this.formData.startDownloadTime = response.data.paramValue
          this.systemParam = response.data
        }
      })
    },
    save() {
      this.systemParam.paramValue = this.formData.startDownloadTime
      systemParamConfigSave(this.systemParam, 'save')
        .then((response) => {
          if (response.code != 20000) {
            this.$message.error(response.message);
          }else
          this.$message.success("操作成功");
        })
        .catch(() => {
        });
    }
  },
  created() {
    this.selectSysParam()

  }

}
</script>

<style scoped>
.form-title {
  font-size: 16px;
  font-family: Noto Sans SC;
  font-weight: bold;
  color: #303133;
  padding-bottom: 17px;
  padding-top: 17px;
}

</style>
