Blame view

src/views/workflow/components/tdytTable.vue 6.32 KB
xiaomiao committed
1 2 3 4 5 6 7
<!--
 * @Description:
 * @Autor: renchao
 * @LastEditTime: 2023-06-16 10:38:23
-->
<template>
  <div>
xiaomiao committed
8
    <lb-table :column="InformationTable" :pagination="false" :key="key" :heightNumSetting="true" :minHeight="150"
xiaomiao committed
9 10
      :data="tableDataList">
    </lb-table>
xiaomiao committed
11
    <addTdyt v-model="dialog" :details="details" :showButton="showButton" @updateDetail="handleupdateDetail" />
xiaomiao committed
12 13 14 15 16
  </div>
</template>
<script>
  import { mapGetters } from 'vuex'
  import { getIdCardInfo } from '@/utils/operation.js'
xiaomiao committed
17
  import addTdyt from './dialog/addTdyt.vue'
xiaomiao committed
18 19
  export default {
    components: {
xiaomiao committed
20
      addTdyt
xiaomiao committed
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
    },
    computed: {
      ...mapGetters(["dictData"]),
    },
    props: {
      tableData: {
        type: Array,
        default: function () {
          return []
        }
      },
    },
    data () {
      return {
        key: 0,
        dataIndex: 0,
        dialog: false,
        isaddupdate: false,
        showButton: this.$route.query.viewtype ? false : true,
        details: {},
        tableDataList: [],
        InformationTable: [
          {
            width: '50',
            renderHeader: (h, scope) => {
              return <div> {
                this.$route.query.viewtype == 1 ? '序号' : <i class="el-icon-plus pointer" onClick={() => { this.addClick() }}></i>
              }
              </div>
            },
            render: (h, scope) => {
              return (
                <div>
                  {
                    this.$route.query.viewtype == 1 ? <span>{scope.$index + 1}</span> :
                      <i class="el-icon-minus pointer" onClick={() => { this.deleClick(scope.$index, scope.row) }}></i>
                  }
                </div>
              )
            }
          },
xiaomiao committed
62
           {
xiaomiao committed
63 64
            label: '土地用途',
            align: 'center',
xiaomiao committed
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
             render: (h, scope) => {
            return (
              <el-select value={scope.row.yt}
                onChange={(val) => { scope.row.yt = val }} clearable>
                {
                  this.dictData['tdyt'].map(option => {
                    return (
                      <el-option label={option.dname} value={option.dcode}></el-option>
                    )
                  })
                }
              </el-select>
            )
           }
           },
xiaomiao committed
80 81 82 83
          {
            prop: "sqrmc",
            label: "土地使用起始时间",
             render: (h, scope) => {
xiaomiao committed
84 85 86 87 88 89 90
            return (
              <el-date-picker
                v-model={scope.row.qssj}
                type="date"
                placeholder="选择日期"
              ></el-date-picker>
            );
xiaomiao committed
91 92 93 94 95
            }
          },
          {
            prop: "zjzl",
            label: "土地使用结束时间",
xiaomiao committed
96 97 98 99 100 101 102 103
              render: (h, scope) => {
            return (
              <el-date-picker
                v-model={scope.row.jssj}
                type="date"
                placeholder="选择日期"
              ></el-date-picker>
            );
xiaomiao committed
104 105 106 107 108 109
            }
          },
          {
            prop: "zjh",
            label: "土地使用期限",
             render: (h, scope) => {
xiaomiao committed
110
               return <el-input v-model={scope.row.syqx} ></el-input>
xiaomiao committed
111 112 113 114 115 116 117 118
            }
          }
        ],
      }
    },
    watch: {
      tableData: {
        handler: function (val, oldVal) {
xiaomiao committed
119
           console.log("什么事件111",val);
xiaomiao committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
          let that = this
          this.$nextTick(() => {
            if (val.length == 0 || !val) {
              that.tableDataList = _.cloneDeep([{
                sqrmc: '',
                dlrzjlx: '',
                dlrzjh: '',
                fr: ''
              }])
            } else {
              that.tableDataList = _.cloneDeep(val)
            }
          })
        },
        immediate: true,
        deep: true
      },
xiaomiao committed
137 138 139 140 141 142 143 144
      // gyfs: {
      //   handler (newVal, oldValue) {
      //     console.log("什么事件222",newVal);
      //     let dataList = _.cloneDeep(this.InformationTable)
      //     let dataList = _.cloneDeep(this.InformationTable)
      //     if (newVal == 0) {
      //       // this.column = _.cloneDeep(dataList).slice(1, dataList.length)
      //       this.column = _.cloneDeep(dataList)
xiaomiao committed
145

xiaomiao committed
146 147 148 149 150 151 152 153
      //     } else if ((newVal == '1' || newVal == '3')) {
      //       this.column = dataList
      //     } else {
      //       this.column = _.cloneDeep(dataList)
      //     }
      //   },
      //   immediate: true
      // }
xiaomiao committed
154 155
    },
    methods: {
xiaomiao committed
156
    //  新增提交事件
xiaomiao committed
157
      handleupdateDetail (value) {
xiaomiao committed
158
        console.log("什么事件33",this.tableData);
xiaomiao committed
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174
        if (this.isaddupdate) {
          if (!_.isEqual(value, this.tableData)) {
            this.tableDataList[this.tableDataList.length] = _.cloneDeep(value);
            this.$emit('upDateQlrxxList', this.tableDataList)
          }
        } else {
          if (!_.isEqual(value, this.tableData)) {
            this.tableDataList[this.dataIndex] = _.cloneDeep(value);
            this.$emit('upDateQlrxxList', this.tableDataList)
          }
        }
        this.key++
      },
      // 新增
      addClick () {
        if (this.gyfs == '0' && this.tableDataList.length > 0) {
xiaomiao committed
175
          this.$message.warning("1")
xiaomiao committed
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
        } else {
          this.dialog = true
          this.isaddupdate = true
        }
      },

      // 删除
      deleClick (index, row) {
        this.$confirm('确定要删除吗, 是否继续?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.tableData.splice(index, 1)
        }).catch(() => {
        });
      },
      // 修改
      editClick (index, row) {
        //   popupDialog("申请人信息", "workflow/components/addQlr", {
        //     showButton: this.$route.query.viewtype ? false : true,
        //   dataIndex :index,
xiaomiao committed
198
        //  details :row,/[^\d]/g
xiaomiao committed
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221
        //  isaddupdate :false
        // });
        this.dataIndex = index
        this.dialog = true
        this.details = row
        this.isaddupdate = false
      },
      queryViewClick (index, row) {
        //   popupDialog("申请人信息", "workflow/components/addQlr", {
        //     showButton: this.$route.query.viewtype ? false : true,
        //   details: row,
        // });
        this.dialog = true
        this.details = row
      }
    }
  }
</script>
<style scoped lang="scss">
.el-input {
  border: none !important;
}
</style>