tdsyq.vue 4.32 KB
<!--
 * @Description:
 * @Autor: miaofang
 * @LastEditTime: 2023-08-23 15:54:12
-->
<template>
  <div class="djxxTable">
    <djbDetail :title="title" :shows="shows" :propsParam="propsParam"
      :columns="columns" :tableData="tableData" />
  </div>
</template>

<script>
  import { datas } from "./qlxxFormData.js";
  import { getSjlx } from "@/utils/dictionary.js";
  import { getTdsyqList } from "@/api/djbDetail.js";
  import printTemplate from "./components/printTemplate.vue";
  export default {
    components: {
      printTemplate,
    },
    data () {
      return {
        printObj: {
          id: "box",
          //其他配置项,
        },
        shows: false,
        title: "土地所有权信息",
        qsztList: datas.columns().qsztList,
        checkList: datas.columns().checkList,
        //传递参数
        propsParam: this.$attrs,
        //列表数据
        tableData: [],
        //空列值个数
        emptycolNum: datas.columns().emptycolNum,
        //列名称对象
        columns: datas.columns().TDSYQ,
        render: false,
      };
    },
    created () {
      this.loadData();
    },
    methods: {
      openPrint () {
        this.render = true;
        setTimeout(() => {
          this.prinsss();
        }, 100);
      },
      prinsss () {
        printJS({
          printable: "boxtdsyq", // // 文档来源:pdf或图像的url,html元素的id或json数据的对象
          type: "html",
          maxWidth: 800, // 最大宽度
          font_size: "", // 不设置则使用默认字体大小
          style: `@font-face {
          font-family: "STZHONGS";
          src: url(${window.ttf}) format("truetype");
        }`,
          // 继承原来的所有样式
          targetStyles: ["*"],
        });
        this.render = false;
      },
      /**
       * @description: loadData
       * @author: miaofang
       */
      loadData () {
        if (this.$parent.addRepairRecord) {
          this.columns.unshift({
            prop: "cz",
            label: "操作",
          });
        }
        getTdsyqList({
          bdcdyid: this.propsParam.bdcdyid,
          qllx: this.propsParam.qllx,
          qszt: this.checkList,
        }).then((res) => {
          if (res.code === 200) {
            this.tableData = res.result;
            this.shows = this.tableData.length > 0;
            this.tableData.forEach((item) => {
              item.sjlx = getSjlx(item.sjlx);
            });
            if (this.tableData.length < datas.columns().emptycolNum) {
              this.emptycolNum =
                datas.columns().emptycolNum - this.tableData.length;
            } else {
              this.emptycolNum = 0;
            }
          }
        });
      },
      /**
       * @description: checkChange
       * @author: miaofang
       */
      checkChange () {
        if (this.checkList.length === 0) {
          this.tableData = [];
          this.emptycolNum = datas.columns().emptycolNum;
        } else {
          this.loadData();
        }
      },
      /**
       * @description: getQsztName
       * @param {*} code
       * @author: miaofang
       */
      getQsztName (code) {
        let name = "";
        for (let item of this.qsztList) {
          if (item.value == code) {
            name = item.label;
            break;
          }
        }
        return name;
      },
      // 新增一条补录信息
      /**
       * @description: 新增一条补录信息
       * @param {*} row
       * @param {*} del
       * @author: miaofang
       */
      editDialog (row, del) {
        this.$confirm("此操作将新增一条补录信息, 是否继续?", "提示", {
          confirmButtonText: "确定",
          cancelButtonText: "取消",
          type: "warning",
        })
          .then(() => {
            this.$parent.addRepairRecord(row, del);

            this.$message({
              type: "success",
              message: "补录成功!",
            });
          })
          .catch(() => {
            this.$message({
              type: "info",
              message: "取消编辑",
            });
          });
      },
    },
  };
</script>

<style lang="scss" scoped>
  @import "./qlxxCommon.scss";
  .title {
    position: relative;
    .print {
      // background-color: #0079fe;
      z-index: 10;
      position: absolute;
      left: 11px;
      top: 5px;
    }
  }
</style>