BlkTextarea.vue 3.19 KB
Newer Older
zhengxiaokui committed
1 2 3 4 5 6 7
<template>
  <div>
    <!-- Description of Goods -->
    <c-col :span="19">
      <el-form-item :label="blkMsg.title" :prop="blkMsg.dataUrl">
        <c-input
          type="textarea"
zhengxiaokui committed
8
          :rows="blkMsg.rows ? blkMsg.rows : 20"
zhengxiaokui committed
9
          v-model="blkTextarea"
zhengxiaokui committed
10
          :maxlength="blkMsg.maxlength ? blkMsg.maxlength : 52000"
zhengxiaokui committed
11 12 13 14 15 16 17 18 19 20 21
          show-word-limit
          :placeholder="`请输入${blkMsg.title}`"
        ></c-input>
      </el-form-item>
    </c-col>
    <c-col :span="2" class="BlkTextarea_button">
      <c-button
        size="small"
        type="primary"
        icon="el-icon-search"
        @click="
zhengxiaokui committed
22
          showGridPromptDialog(rulePath, columns, shadow, modelUrl, isCover,'doxpDialog')
zhengxiaokui committed
23 24 25 26 27 28 29 30 31
        "
      >
        ...
      </c-button>
    </c-col>
  </div>
</template>
<script>
import Api from "~/service/Api";
wangren committed
32
import commonProcess from "~/mixin/commonProcess";
zhengxiaokui committed
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
import _ from "~/utils/Lodash.js";

/**
 *
 * @param {String} rulePath  请求路径
 * @param {String} columns 自定义需要展示列
 * @param {String} shadow 自定义列后需要保留的影藏字段
 * @param {String} modelUrl 非机构双击后需要回填的字段路劲,k:对应列,value:应用model路劲,如{TXT:'ledgrp.blk.lcrgod'}
 * @param {String} isCover 非机构双击后需要回填的字段值是覆盖还是叠加,部分覆盖值为对象,false为叠加,如{TXT:false},k值为modelUrl的k,如全部覆盖则isCover='T',如全部叠加则isCover='',默认全部覆盖
 */

export default {
  inject: ["root"],
  props: {
    model: {
      type: Object,
      default: undefined,
    },
    blkMsg: {
      //大字段信息
      type: Object,
      default: function () {
        return {
zhengxiaokui committed
56 57
          title: "",
          dataUrl: "", //字段所在model路劲
zhengxiaokui committed
58
          rows: 20,
zhengxiaokui committed
59
          maxlength: 2000,
zhengxiaokui committed
60 61 62 63 64 65 66 67 68 69
        };
      },
    },

    rulePath: {
      type: String,
      default: "",
    },
    columns: {
      type: String,
zhengxiaokui committed
70 71
      default:
        '1 2 "EXTKEY" 410 50\r\n2 1 "NAM" 410 50\r\nTXT\r\nUIL\r\n5 3 "VER" 410 50\r\nETGEXTKEY\r\nP COLORED TRUE\r\nP VERTLINES TRUE\r\nP HORZLINES TRUE\r\nP MULTISELECT FALSE\r\nP COLUMNSIZING TRUE',
zhengxiaokui committed
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
    },
    shadow: {
      type: Object,
      default: () => {
        return { TXT: 3 };
      },
    },
    modelUrl: {
      type: Object,
      default: function () {
        let obj = { TXT: this.blkMsg.dataUrl };
        return obj;
      },
    },
    isCover: {
      type: Object,
      default: undefined,
    },
  },

wangren committed
92
  mixins: [commonProcess],
zhengxiaokui committed
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
  data() {
    return {
      blkTextarea: _.get(this.model, this.blkMsg.dataUrl, ""),
    };
  },

  watch: {
    getBlk: {
      handler(val, oldVal) {
        this.blkTextarea = _.get(this.model, this.blkMsg.dataUrl, "");
        // console.log("blkTextarea is:", this.blkTextarea);
      },
      immediate: false,
    },

    blkTextarea: {
      handler(val, oldVal) {
        _.set(this.model, this.blkMsg.dataUrl, val);
        // console.log("blkTextarea is 2:", this.blkTextarea);
      },
      immediate: false,
    },
  },
  computed: {
    getBlk() {
      return _.get(this.model, this.blkMsg.dataUrl, "");
    },
  },

  created: function () {},
};
</script>
<style>
.BlkTextarea_button {
  margin: 20px 0 0 0px;
}
</style>