<template>
  <div class="content-main">
    <el-form :inline="true" :model="formInline" class="search-bm-boder">
      <el-form-item label="主题：">
        <el-input
          v-model="formInline.wjmc"
          placeholder="主题名称"
          clearable
        ></el-input>
      </el-form-item>
      <el-form-item label="日期：">
        <el-date-picker
          v-model="formInline.scrq"
          type="date"
          placeholder="上传日期"
          value-format="yyyy-MM-dd"
          clearable
        ></el-date-picker>
      </el-form-item>
      <el-form-item label="状态：">
        <!-- <el-input v-model="formInline.wjmc" placeholder="请选择" clearable></el-input> -->
        <el-select v-model="formInline.wjmc" placeholder="请选择">
          <el-option
            v-for="item in ztList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <div class="search-button">
          <span class="search-line"></span>
          <el-button
            type="primary"
            size="small"
            class="iconfont iconchaxun"
            @click="getList"
            >查询</el-button
          >
          <el-button
            type="primary"
            @click="chongzhi"
            size="small"
            class="iconfont iconzhongzhi"
            >清空</el-button
          >
        </div>
      </el-form-item>
    </el-form>

    <!-- <el-row class="addBtnBg" v-if="showOrfalse">
      <el-button type="primary" size="small" class="iconfont iconxinzeng11" @click="addList">新增</el-button>
    </el-row>-->
    <el-row class="addBtnBg">
      <el-button
        type="primary"
        size="small"
        class="iconfont iconxinzeng11"
        @click="addList"
        >新增</el-button
      >
    </el-row>
    <el-row>
      <el-table
        :data="tableData"
        v-loading="loading"
        border
        stripe
        tooltip-effect="dark"
        style="width: 100%"
      >
        <el-table-column
          type="index"
          label="序号"
          align="center"
          width="70"
        ></el-table-column>
        <el-table-column
          prop="wjmc"
          label="主题"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="wjnr"
          label="报送单位"
          align="center"
        ></el-table-column>
        <el-table-column
          prop="scrq"
          label="日期"
          align="center"
        ></el-table-column>
        <el-table-column label="状态" align="center">
          <template slot-scope="scope">
            <span v-show="scope.row.zt == 0">未报送</span>
            <span v-show="scope.row.zt == 1">已报送</span>
            <span v-show="scope.row.zt == 2">未读</span>
            <span v-show="scope.row.zt == 3">已读</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" width="160">
          <template slot-scope="scope">
            <el-tooltip
              class="item"
              effect="light"
              content="查看"
              placement="top"
            >
              <el-button
                type="text"
                size="small"
                style="color: #fff"
                class="operate_show_btn el-icon-search"
                @click="showList(scope.row, 0)"
              ></el-button>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="light"
              content="编辑"
              placement="top"
            >
              <el-button
                style="color: #fff"
                type="text"
                size="small"
                class="operate_edit_btn el-icon-edit-outline"
                @click="editor(scope.row, 1)"
              ></el-button>
            </el-tooltip>
            <el-tooltip
              class="item"
              effect="light"
              content="报送"
              placement="top"
            >
              <el-button
                style="color: #fff"
                type="text"
                size="small"
                class="operate_delete_btn el-icon-position"
                v-show="scope.row.zt != 1"
                @click="baosong(scope.row)"
              ></el-button>
            </el-tooltip>
            <!-- <el-tooltip class="item" effect="light" content="报送" placement="top">
              <el-button
                style="color:#fff;"
                type="text"
                size="small"
                class="operate_delete_btn el-icon-position"
                @click="deleteRow(scope.row)"
                v-show="scope.row.bs == '0'"
              ></el-button>
            </el-tooltip> -->
            <!-- <el-tooltip class="item" effect="light" content="下发" placement="top">
              <el-button
                type="text"
                size="small"
                class="operate_show_btn iconfont iconxiafa1"
                @click="downSendBtn(scope.row)"
                v-show="scope.row.bs != '2'"
              ></el-button>
            </el-tooltip>
            <el-tooltip class="item" effect="light" content="下载" placement="top">
              <el-button
                type="text"
                size="small"
                class="operate_download_btn iconfont iconxiazai"
                @click="xiazai(scope.row)"
              ></el-button>
            </el-tooltip>-->
          </template>
        </el-table-column>
      </el-table>
    </el-row>

    <el-row class="pagination-wrap">
      <el-pagination
        @size-change="handleSizeChange"
        @current-chanfilesdleCurrentChange"
        :current-page="pageForm.applyNum"
        :page-sizes="[10, 20, 30, 40]"
        :page-size="100"
        layout="total, sizes, prev, pager, next, jumper"
        :total="pageForm.total"
      ></el-pagination>
    </el-row>

    <el-dialog
      title="粮食与物资储备管理制度"
      :visible.sync="dialogFormVisible"
      @close="handlerDialogClose"
    >
      <el-form :model="form" ref="form" v-loading="loading">
        <el-form-item label="上报单位:" :label-width="formLabelWidth">
          <el-input v-model="form.scrq" style="width: 80%" autocomplete="off">{{
            this.orgN
          }}</el-input>
        </el-form-item>
        <el-form-item label="主题:" :label-width="formLabelWidth">
          <el-input v-model="form.fbr" style="width: 80%" autocomplete="off">{{
            this.orgN
          }}</el-input>
        </el-form-item>
        <!-- <el-form-item label="上传日期:" :label-width="formLabelWidth">
          <el-date-picker
            v-model="form.scrq"
            type="date"
            :disabled="!detailF"
            value-format="yyyy-MM-dd"
            style="width: 80%;"
            autocomplete="off"
          ></el-date-picker>
        </el-form-item>-->
        <!-- <el-form-item label="文件名称:" :label-width="formLabelWidth">
          <el-input
            v-model="form.wjmc"
            :disabled="!detailFlags"
            style="width: 80%;"
            autocomplete="off"
            maxlength="50"
            show-word-limit
          ></el-input>
        </el-form-item>-->
        <el-form-item label="内容:" :label-width="formLabelWidth">
          <el-input
            v-model="form.wjnr"
            :disabled="!detailFlags"
            type="textarea"
            :autosize="{ minRows: 11, maxRows: 11 }"
            style="width: 80%; height: 300px; overflow: auth"
            autocomplete="off"
            maxlength="1000"
            show-word-limit
          ></el-input>
        </el-form-item>

        <el-form-item
          label="附    件:"
          v-model="form.fjid"
          :label-width="formLabelWidth"
        >
          <el-upload
            :action="files"
            :limit="1"
            :with-credentials="true"
            style="margin-top: 20px; width: 80%"
            :headers="myHeader"
            :fileList="fileList"
            :on-remove="handleFileRemove"
            :on-success="handleFileSuccess"
            :on-error="handlerError"
            :on-exceed="handleExceed"
            :before-upload="handleBeforeUpload"
          >
            <el-button size="small" type="primary" :disabled="!detailFileBtn"
              >点击上传</el-button
            >
          </el-upload>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button
          @click="dialogFormVisible = false"
          class="iconfont iconquxiao"
          type="primary"
          size="small"
          >取 消</el-button
        >
        <el-button
          type="primary"
          @click="save"
          size="small"
          v-show="showType"
          class="iconfont icontijiao"
          >保存</el-button
        >
        <el-button
          type="primary"
          @click="baosong"
          size="small"
          v-show="showType"
          class="iconfont icontijiao"
          >报送</el-button
        >
      </div>
    </el-dialog>

    <!--new 彈窗-->
    <el-dialog
      title="提示"
      :visible.sync="dialogVisibless"
      width="30%"
      :before-close="handleCloses"
    >
      <el-form :inline="true" :model="formInlines" class="demo-form-inline">
        <el-form-item label="文件名称:" :label-width="formLabelWidth">
          <el-input v-model="formInlines.wjmc" clearable></el-input>
        </el-form-item>
        <el-form-item
          label="接收部门:"
          :label-width="formLabelWidth"
          multiple="true"
        >
          <el-cascader
            v-model="value"
            clearable
            filterable
            :options="options"
            @change="handleChange"
            :show-all-levels="false"
            :props="{ multiple: true }"
            ref="addr"
          ></el-cascader>
          <!-- :change-on-select="true" -->
        </el-form-item>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button
          type="primary"
          size="small"
          class="iconfont iconchaxun"
          @click="downSend"
          >确定</el-button
        >
        <el-button
          type="primary"
          size="small"
          class="iconfont iconxinzeng11"
          @click="addLists"
          >取消</el-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
import {
  downLoads,
  saveMaterialInfo,
  downloadFile,
  updateEditor,
  deleteList,
  selectList,
  downLoad,
  onSend,
  showMaterialInfo,
  // tre,
  cha,
} from "@/api/municipalityManager/index";
import { files } from "@/api/index";
import { getToken } from "@/utils/auth";

function formatData(list) {
  return list.map((item) => {
    let newItem = {};
    newItem.label = "2019年库存粮食质量安全监测方案";
    newItem.value = "2019年库存粮食质量安全监测方案";
    newItem.code = item.orgCode;
    newItem.isSelected = false;
    newItem.disabled = false;
    if (item.hasOwnProperty("children") && item.children.length > 0) {
      newItem.children = formatData(item.children);
    }
    return newItem;
  });
}

function formatNewData(list) {
  return list.filter((item) => {
    if (item.hasOwnProperty("children") && item.children.length > 0) {
      item.children = formatNewData(item.children);
    }
    return !item.isSelected;
  });
}

function getCascaderObj(val, opt) {
  return val.map(function (value, index, array) {
    for (var itm of opt) {
      if (itm.value == value) {
        opt = itm.children;
        return itm;
      }
    }
    return null;
  });
}
// 处理多级联动列表
var arrName = [],
  arrCode = [],
  cascaderName = [],
  countedNames = {};

function getChildren(code, options) {
  for (var i = 0, len = options.length; i < len; i++) {
    var item = options[i];
    if (item.code == code) {
      if (item.children) {
        item.children.forEach((child) => {
          if (child.children) {
            delete child.children;
          }
        });
      }
      return [item];
    }
    if (item.code != code && item.children) {
      return getChildren(code, item.children);
    }
  }
}

function getcascName(arr, options) {
  options.forEach((item) => {
    if (arr.includes(item.code)) {
      cascaderName.push(item.label);
    }
    if (item.children && item.children.length) {
      getcascName(arr, item.children);
    }
  });
}

function parseCode(obj, options) {
  options.forEach((item) => {
    var label = item.label;
    var code = item.code;
    if (item.children) {
      if (item.children.length == obj[label]) {
        arrName.push(label);
        arrCode.push(code);
      }
      parseCode(obj, item.children);
    } else {
      if (obj[label] == 1) {
        arrName.push(label);
        arrCode.push(code);
      }
    }
  });
}
// 处理的要传值的联动列表数据
function stringifyVal(value, options) {
  var values = value.toString().split(",");
  countedNames = values.reduce(function (allNames, name) {
    if (name in allNames) {
      allNames[name]++;
    } else {
      allNames[name] = 1;
    }
    return allNames;
  }, {});
  parseCode(countedNames, options);
}
// 回显 禁用选项 递归
function disListNav(arr, options, isFirst) {
  options.forEach((opt) => {
    if (arr.includes(opt.code) && !isFirst) {
      opt.disabled = true;
    } else {
      opt.disabled = false;
    }
    if (opt.children) {
      disListNav(arr, opt.children);
    }
  });
}

function getCascaderObjByCode(val, opt) {
  return val.map(function (value, index, array) {
    for (var itm of opt) {
      if (itm.code == value) {
        opt = itm.children;
        return itm;
      }
    }
    return null;
  });
}
export default {
  name: "municipalityManager",
  computed: {
    myHeader() {
      return {
        token: getToken(),
      };
    },
  },
  data() {
    return {
      ztList: [
        {
          value: "0",
          label: "未报送",
        },
        {
          value: "1",
          label: "已报送",
        },
        {
          value: "2",
          label: "未读",
        },
        {
          value: "3",
          label: "已读",
        },
      ],
      loading: true,
      codes: [], // 当前orgcode下所有child的orgcode
      allOptions: [],
      cascaderName: [],
      cascaderCode: [],
      newTime: "",
      detailFileBtn: true,
      fileList: [], // 文件列表
      files: files + "/file/upload",
      detailF: false,
      wjids: "",
      showOrfalse: false,
      detailFlags: true,
      huixian: [],
      orgC: [],
      list: [],
      options: [],
      value: [],
      code: [],
      label: "",
      aaa: "",
      format: false,
      isEdit: false, // 标记编辑
      disabledFlag: false,
      wjTableRows: [],
      xf: [],
      dialogVisibless: false,
      typeId: 0, //0：新增页面的保存按钮
      dialogMoveInVisible: false,
      showType: false,
      queding: false,
      loading: false,
      formInline: {
        wjmc: "",
        jsbm: "",
        jsbmmc: "",
        scrq: "",
        region: "",
      },
      formInlines: {
        wjmc: "",
        jsbm: "",
        jsbmmc: "",
        scrq: "",
        region: "",
      },
      dialogFormVisible: false,
      formLabelWidth: "120px",
      form: {
        fbr: "2019年库存粮食质量安全监测方案",
        scrq: "呼伦贝尔市粮食调控科",
        wjmc: "",
        wjnr: "",
        fjid: "",
      },
      pageForm: {
        pageNum: 1,
        pageSize: 10,
        total: 0,
      },
      tableData: [
        {
          wjmc: "2019年库存粮食质量安全监测方案",
          wjnr: "呼伦贝尔市粮食调控科",
          scrq: "2019年10月2日",
          zt: "1",
        },
        {
          wjmc: "2018年库存粮食质量安全监测方案",
          wjnr: "呼伦贝尔市粮食调控科",
          scrq: "2019年4月26日",
          zt: "0",
        },
        {
          wjmc: "2017年库存粮食质量安全监测方案",
          wjnr: "呼伦贝尔市粮食调控科",
          scrq: "2019年8月25日",
          zt: "2",
        },
        {
          wjmc: "2018年库存粮食质量安全监测方案",
          wjnr: "呼伦贝尔市粮食调控科",
          scrq: "2019年10月16日",
          zt: "3",
        },
        {
          wjmc: "2019年库存粮食质量安全监测方案",
          wjnr: "呼伦贝尔市粮食调控科",
          scrq: "2019年10月6日",
          zt: "0",
        },
        {
          wjmc: "2018年库存粮食质量安全监测方案",
          wjnr: "呼伦贝尔市粮食调控科",
          scrq: "2019年1月26日",
          zt: "1",
        },
      ],
    };
  },
  created() {
    // this.getList();
    // this.tres();
    this.newTime = new Date();
    this.orgC = window.sessionStorage.getItem("orgCode");
    this.orgN = "2019年库存粮食质量安全监测方案";
    if (window.sessionStorage.getItem("orgCode") == "LS001") {
      this.showOrfalse = true;
    } else {
      this.showOrfalse = false;
    }
  },
  methods: {
    handleBeforeUpload(file, fileList) {
      if (!file.size || file.size >= 200 * 1024 * 1024) {
        this.$message.error("上传文件须不超过200兆");
        return false;
      }
    },
    chongzhi() {
      this.formInline = {
        wjmc: "",
        scrq: "",
      };
    },
    xiazai(row) {
      var a = document.createElement("a");
      // 设置图片地址
      downLoads(row.fjid)
        .then((res) => {
          if (res.infoCode === 200) {
            a.download = "附件";
            a.href = res.data;
            a.click();
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    getFileDetail() {
      downloadFile(this.wjids)
        .then((res) => {
          if (res.infoCode === 200) {
            this.fileList = [
              {
                url: res.data.link,
                name: res.data.name,
              },
            ];
            return;
          }
          this.$message.error("获取文件信息失败");
        })
        .catch((err) => {
          this.$message.error("获取文件信息失败");
        });
    },
    handlerDialogClose() {
      this.detailFileBtn = true;
      this.fileList = [];
      this.tableDataspush = [];
      // this.$refs.ruleForm.resetFields();
      // this.$ShowSeal("", 0);
    },
    handleFileRemove(file, fileList) {
      this.wjids = "";
    },
    handleFileSuccess(res, file) {
      if (res.infoCode === 200) {
        this.wjids = res.data.id;
        return;
      }
      this.fileList = [];
      this.$message.error(res.msg || "上传失败,请重试");
    },
    handleExceed(file, fileList) {
      this.$message.warning(`当前限制上传数量为1`);
    },
    handlerError() {
      this.$message.error("上传失败,请重试");
    },
    // save(form) {
    //   let data = {
    //     vo: form.vo,
    //     scrq: this.newTime,
    //     wjmc: this.form.wjmc,
    //     wjnr: this.form.wjnr,
    //     fbr: this.orgN,
    //     fjid: this.wjids,
    //     zdbm: this.aaa
    //   };
    //   if (this.isEdit) {
    //     //编辑保存
    //     updateEditor(data).then(res => {
    //       if (res.infoCode == 200) {
    //         this.form.fbr = res.data.fbr;
    //         this.form.scrq = res.data.scrq;
    //         this.form.wjmc = res.data.wjmc;
    //         this.form.wjnr = res.data.wjnr;
    //         this.form.fjid = this.wjids;
    //         this.form.zdbm = this.aaa;
    //         this.getList();
    //         this.dialogFormVisible = false;
    //         this.$message({
    //           message: "編輯成功",
    //           type: "success"
    //         });
    //       } else {
    //         this.$message({
    //           type: "error",
    //           message: "获取失败!"
    //         });
    //         this.dialogFormVisible = false;
    //       }
    //     });
    //     this.dialogVisibless = false;
    //   } else {
    //     saveMaterialInfo(data).then(res => {
    //       if (res.infoCode == 200) {
    //         this.tableData.push(data);
    //         this.getList();
    //         this.dialogFormVisible = false;
    //         this.dialogMoveInVisible = false;
    //         this.$message({
    //           message: "保存成功",
    //           type: "success"
    //         });
    //       }
    //       this.dialogFormVisible = false;
    //       this.dialogMoveInVisible = false;
    //     });
    //   }
    // },
    save() {
      this.$message({
        message: "保存成功",
        type: "success",
      });
      this.dialogFormVisible = false;
    },

    tres() {
      let data = {
        orgCode: this.orgC,
      };
      tre(data).then((res) => {
        this.allOptions = formatData([res.data]);
        var list = getChildren(
          window.sessionStorage.getItem("orgCode"),
          this.allOptions
        );
        var childList;
        if (list && list[0]) {
          childList = list[0].children;
        } else {
          childList = [];
        }
        var codes = [];
        if (childList) {
          childList.forEach((item) => {
            codes.push(item.code);
          });
        }
        this.codes = codes;
        this.getList();
      });
    },
    //3级联动菜单
    handleChange(val) {
      arrName = [];
      arrCode = [];
      stringifyVal(val, this.options);
      cascaderName = [];
      getcascName(this.cascaderCode, this.options);
      var names = arrName.concat(cascaderName);
      var codes = arrCode.concat(this.cascaderCode);
      this.formInlines.jsbmmc = [...new Set(names)].join(",");
      this.formInlines.jsbm = [...new Set(codes)].join(",");
      // return;
      // val.map(item => {
      //   var res = getCascaderObj(item, this.options);
      //   arr.push(res[res.length - 1]);
      // });

      // var strArr = [];
      // var strArr1 = [];

      // arr.forEach(item => {
      //   strArr.push(item.code);
      //   strArr.push(this.huixian);
      // });

      // this.formInlines.jsbmmc = strArr.join(",");
      // this.formInlines.jsbm = strArr.join(",");
    },
    //报送
    baosong() {
      this.$confirm("确定要报送吗", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          this.$message({
            type: "success",
            message: "报送成功!",
          });
          this.dialogFormVisible = false;
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消报送",
          });
        });
    },
    //new 彈框
    handleCloses(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          done();
        })
        .catch((_) => {});
    },
    //下发按钮
    downSendBtn(row) {
      this.formInlines.wjmc = row.wjmc;
      this.xf = row;
      this.queding = true;
      this.showType = false;
      this.dialogVisibless = true;
      this.chas();
    },
    //下发
    downSend(row) {
      let data = {
        createDate: this.xf.createDate,
        creator: this.xf.creator,
        creatorCode: this.xf.creatorCode,
        jsbm: this.formInlines.jsbm,
        jsbmmc: this.formInlines.jsbmmc,
        pageNum: this.xf.pageNum,
        pageSize: this.xf.pageSize,
        refreshTime: this.xf.refreshTime,
        refresher: this.xf.refresher,
        refresherCode: this.xf.refresherCode,
        remark: this.xf.remark,
        sxh: 0,
        zdbm: this.xf.zdbm,
      };
      onSend(data).then((res) => {
        if (res.infoCode == 200) {
          this.getList();
          this.$message({
            message: "下发成功",
            type: "success",
          });
          this.value = "";
        } else {
          this.$message({
            type: "error",
            message: "获取失败!",
          });
        }
      });
      this.dialogVisibless = false;
    },
    //下发回显
    chas() {
      let data = {
        zdbm: this.xf.zdbm,
      };
      cha(data.zdbm).then((res) => {
        this.huixian = res.msg;
        var arr = res.msg.split(",");
        var orgcode = window.sessionStorage.getItem("orgCode");
        var idx = arr.findIndex((i) => i == orgcode);
        this.options = getChildren(orgcode, this.allOptions);
        arr.splice(idx, 1);
        this.cascaderCode = arr;
        // 禁止选择项
        disListNav(arr, this.options, true);
      });
    },
    addLists() {
      this.dialogVisibless = false;
    },
    //添加
    addList(form) {
      this.detailFlags = true;
      this.isEdit = false;
      this.format = false;
      this.form = {
        createDate: "",
        creator: "",
        creatorCode: "",
        fbr: this.orgN,
        fjid: "",
        pageNum: 0,
        pageSize: 0,
        refreshTime: "",
        refresher: "",
        refresherCode: "",
        remark: "",
        // scrq: this.newTime,
        scrq: "呼伦贝尔市粮食调控科",
        status: 0,
        wjmc: "",
        wjnr: "",
        zdbm: "",
        zt: 0,
      };
      this.showType = true;
      this.dialogFormVisible = true;
    },
    //查询
    getList() {
      // console.log("1")
      this.format = true;
      this.loading = true;
      let data = {
        wjmc: decodeURIComponent(this.formInline.wjmc) || "",
        scrq: this.formInline.scrq || "",
        pageNum: this.pageForm.pageNum,
        pageSize: this.pageForm.pageSize,
        orgCode: [""],
      };
      selectList(data)
        .then((res) => {
          this.loading = false;
          if (res.infoCode == 200) {
            this.pageForm.total = res.data.total;
            this.tableData = res.data.items;
          }
          if (res.infoCode == 204) {
            this.tableData = [];
          }
        })
        .catch((err) => {
          this.loading = false;
          this.tableData = [];
        });
    },
    showList(row, state) {
      this.detailF = false;
      this.detailFileBtn = false;
      if (state == 0) {
        this.detailFlags = false;
      } else {
        this.detailFlags = true;
      }
      // showMaterialInfo(row.zdbm).then(res => {
      //   if (res.infoCode == "200") {
      //     this.wjids = res.data.fjid || "";
      //     if (this.wjids) {
      //       this.getFileDetail();
      //     }
      //     this.form.fbr = res.data.fbr;
      //     this.form.scrq = res.data.scrq;
      //     this.form.wjmc = res.data.wjmc;
      //     this.form.wjnr = res.data.wjnr;
      //   }
      // });
      this.showType = false;
      this.dialogFormVisible = true;
    },
    //编辑按鈕
    editor(row, state) {
      if (state == 1) {
        this.detailFlags = true;
      } else {
        this.detailFlags = false;
      }
      this.aaa = row.zdbm;
      this.isEdit = true;
      this.form.fbr = this.orgN;
      this.form.scrq = "呼伦贝尔市粮食调控科";
      this.form.wjmc = "";
      this.form.wjnr = "";

      this.loading = true;
      this.loading = false;
      // showMaterialInfo(row.zdbm).then(res => {
      //   this.loading = false;
      //   if (res.infoCode == "200") {
      //     this.wjids = res.data.fjid || "";
      //     if (this.wjids) {
      //       this.getFileDetail();
      //     }
      //     this.form.fbr = res.data.fbr;
      //     this.form.scrq = res.data.scrq;
      //     this.form.wjmc = res.data.wjmc;
      //     this.form.wjnr = res.data.wjnr;
      //   }
      // });
      this.showType = true;
      this.dialogFormVisible = true;
    },

    //刪除
    deleteRow(row) {
      this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let data = {
            zdbm: row.zdbm,
          };
          deleteList(data.zdbm).then((res) => {
            if (res.infoCode == 200) {
              this.getList();
              this.$message({
                type: "success",
                message: "删除成功!",
              });
            } else {
              this.$message({
                type: "error",
                message: "删除失败!",
              });
            }
          });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
    },
    //分页
    handleSizeChange(val) {
      this.pageForm.pageSize = val;
      this.getList();
    },
    //分页
    handleCurrentChange(val) {
      this.pageForm.pageNum = val;
      this.getList();
    },
  },
};
</script>

<style lang="scss" scoped>
.pagination-wrap {
  text-align: right;
  margin-top: 10px;
}

.searchBtn {
  padding-left: 40px;
}

.table_btn {
  margin-left: 10px;
}
.iconfont {
  color: white;
}
</style>