Blame view

src/views/workflow/components/fdcqxmTable.vue 5.93 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<!--
 * @Description: 房屋多幢明细
 * @Autor:
 * @LastEditTime: 2023年07月31日 13:32:21
-->
<template>
  <div>
    <el-table
      :data="tableDataList"
      border
      :pagination="false"
      :key="key"
      :header-cell-style="{ 'text-align': 'center' }"
      :heightNumSetting="true"
      :minHeight="150"
      height="150"
      style="width: 100%"
    >
      <el-table-column prop="index" width="50" :render-header="renderHeader">
        <template slot-scope="scope">
21
          <div style="text-align: center">{{ scope.$index + 1 }}</div>
22 23 24 25
        </template>
      </el-table-column>
      <el-table-column prop="bdcdyh" label="不动产单元号" min-width="100">
        <template slot-scope="scope">
26
          <div style="text-align: center">{{ scope.row.bdcdyh }}</div>
27 28 29 30
        </template>
      </el-table-column>
      <el-table-column prop="xmmc" label="项目名称" min-width="100">
        <template slot-scope="scope">
31 32 33 34 35 36 37 38
          <el-input
            class="item"
            :disabled="!ableOperation"
            v-model="scope.row.xmmc"
            placeholder="请输入内容"
            @input="updaterow(scope.row)"
          >
          </el-input>
39 40
        </template>
      </el-table-column>
41 42

      <el-table-column prop="ghyt" label="房屋用途" min-width="100">
43
        <template slot-scope="scope">
44 45 46 47 48 49 50 51 52 53 54 55
          <treeselect
            v-model="scope.row.ghyt"
            :disabled="!ableOperation"
            noOptionsText="暂无数据"
            placeholder=""
            :show-count="true"
            :options="dictData['A17']"
            :normalizer="normalizer"
            :appendToBody="true"
            z-index="9999"
            @input="updaterow(scope.row)"
          />
56 57
        </template>
      </el-table-column>
58
      <el-table-column prop="fwjg" label="房屋结构" min-width="100">
59
        <template slot-scope="scope">
60 61 62 63 64 65 66 67 68 69 70 71
          <treeselect
            v-model="scope.row.fwjg"
            :disabled="!ableOperation"
            noOptionsText="暂无数据"
            placeholder=""
            :show-count="true"
            :options="dictData['A46']"
            :normalizer="normalizer"
            :appendToBody="true"
            z-index="9999"
            @input="updaterow(scope.row)"
          />
72 73
        </template>
      </el-table-column>
74
      <el-table-column prop="jzmj" label="建筑面积" min-width="100">
75
        <template slot-scope="scope">
76 77 78 79 80 81 82 83 84
          <el-input
            class="item"
            :disabled="!ableOperation"
            oninput="value = (value.match(/^\d*(\.?\d{0,2})/g)[0]) || null"
            v-model="scope.row.jzmj"
            placeholder="请输入内容"
            @input="updaterow(scope.row)"
          >
          </el-input>
85 86
        </template>
      </el-table-column>
87
      <el-table-column prop="jgsj" label="竣工时间" min-width="100">
88
        <template slot-scope="scope">
89 90 91 92 93 94 95 96 97 98
          <el-date-picker
            v-model="scope.row.jgsj"
            type="date"
            :disabled="!ableOperation"
            placeholder="选择日期"
            value-format="yyyy-MM-dd HH:mm:ss"
            format="yyyy-MM-dd"
            @input="updaterow(scope.row)"
          >
          </el-date-picker>
99 100
        </template>
      </el-table-column>
101
      <el-table-column prop="zcs" label="总层数" min-width="100">
102
        <template slot-scope="scope">
103 104 105 106 107 108 109 110 111
          <el-input
            class="item"
            :disabled="!ableOperation"
            oninput="value = (value.match(/^\d*(\.?\d{0,2})/g)[0]) || null"
            v-model="scope.row.zcs"
            placeholder="请输入内容"
            @input="updaterow(scope.row)"
          >
          </el-input>
112 113
        </template>
      </el-table-column>
114
      <el-table-column prop="zts" label="总套数" min-width="100">
115
        <template slot-scope="scope">
116 117 118 119 120 121 122 123 124
          <el-input
            class="item"
            :disabled="!ableOperation"
            oninput="value = (value.match(/^\d*(\.?\d{0,2})/g)[0]) || null"
            v-model="scope.row.zts"
            placeholder="请输入内容"
            @input="updaterow(scope.row)"
          >
          </el-input>
125 126 127 128 129 130
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
131
import {mapGetters} from "vuex";
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147

export default {
  computed: {
    ...mapGetters(["dictData"]),
  },
  props: {
    tableData: {
      type: Array,
      default: function () {
        return [];
      },
    },
    ableOperation: {
      type: Boolean,
      default: false,
    },
148

149 150 151 152 153
  },
  data() {
    return {
      // 键名转换,方法默认是label和children进行树状渲染
      key: 0,
154
      tableDataList: [],
155 156 157 158 159 160 161 162 163 164
      normalizer(node) {
        if (node.children == null || node.children == "null") {
          delete node.children;
        }
        return {
          id: node.dcode,
          label: node.dname,
          children: node.children,
        };
      },
165 166
    };
  },
167 168
  mounted() {
  },
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199
  watch: {
    tableData: {
      handler: function (val, oldVal) {
        let that = this;
        this.$nextTick(() => {
          if (val.length == 0 || !val) {
            that.tableDataList = _.cloneDeep([
              {
                yt: null,
                qssj: "",
                jssj: "",
                tdsyqx: "",
              },
            ]);
          } else {
            that.tableDataList = _.cloneDeep(val);
          }
        });
      },
      immediate: true,
      deep: true,
    },
  },
  methods: {
    /**
     * @description: renderHeader
     * @author: renchao
     */
    renderHeader() {
      return (
        <div>
200
          {"序号"}
201 202
        </div>
      );
203
    },
204 205 206 207
    updaterow(a) {
      console.log("updaterow:"+JSON.stringify(a));
      this.$emit("updateFdcwxmList", this.tableDataList);
    }
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
  },
};
</script>
<style scoped lang="scss">
.el-input {
  border: none !important;
}

/deep/ .el-table__row {
  border: none !important;
}

.el-date-editor.el-input {
  width: 100%;
}

/deep/ .el-table th {
  height: 30px !important;
}
</style>