 <template>
  <div class="app-container">
    <el-table v-loading="loading" :data="adjustList">
      <el-table-column label="调价自增主键id" v-if="false" align="center" prop="adjustPriceId" />
      <el-table-column label="油品名称" align="center" prop="oilName" />
      <el-table-column label="调整价格" align="center" prop="oilAdjustPrice" />
      <el-table-column label="生效状态" align="center" prop="takeEffectStatus"  :formatter="statusFormat" />
      <el-table-column label="生效时间" align="center" prop="takeEffectDate" width="180"/>
      <el-table-column label="调价时间" align="center" prop="adjustDate" width="180"/>
      <el-table-column label="油站id" v-if="false" align="center" prop="stationId" />
      <el-table-column label="油站名称" align="center" prop="stationName" />
      <el-table-column label="操作员" align="center" prop="operator" />
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />


  </div>
</template>

<script>
import { listAdjust } from "@/api/station/adjust";
import {stationinfo} from "@/api/station/gun";

export default {
  name: "Adjust",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 油品调价信息表格数据
      adjustList: [],
      oilNameOptions: [],
      takeEffectStatusOptions: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        oilName: null,
        oilAdjustPrice: null,
        takeEffectStatus: null,
        takeEffectDate: null,
        adjustDate: null,
        stationId: null,
        stationName: null,
        operator: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
    this.getDicts("take_effect_status").then(response => {
      this.takeEffectStatusOptions = response.data;
    });

  },
  methods: {
    /** 查询油品调价信息列表 */
    getList() {
      this.loading = true;
      this.queryParams.stationId= this.$store.selectDeptId;
      if(this.queryParams.stationId==null || this.queryParams.stationId==""){
        this.queryParams.stationId =this.$store.state.user.deptId;
      }
      listAdjust(this.queryParams).then(response => {
        this.adjustList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 菜单状态字典翻译
    statusFormat(row, column) {
      return this.selectDictLabel(this.takeEffectStatusOptions, row.takeEffectStatus);
    }
  }
};
</script>
