Blame view

src/views/ywbl/ywsq/components/nydsyq100.vue 6.74 KB
1
<!--
2
 * @Description:
3
 * @Autor: renchao
4
 * @LastEditTime: 2023-11-16 16:48:43
5
-->
蔡俊立 committed
6 7 8 9
<template>
  <div class="from-clues">
    <!-- 表单部分 国有建设用地使用权 -->
    <div class="from-clues-header">
10
      <el-form :model="queryForm" ref="queryForm" label-width="100px">
蔡俊立 committed
11
        <el-row>
12
          <el-col :span="8">
蔡俊立 committed
13
            <el-form-item label="不动产单元号">
14
              <el-input placeholder="请输入不动产单元号" maxlength="28" v-model="queryForm.bdcdyh" clearable class="width100">
蔡俊立 committed
15 16 17
              </el-input>
            </el-form-item>
          </el-col>
18 19 20
          <el-col :span="8">
            <el-form-item label="坐落" label-width="60px">
              <el-input placeholder="请输入坐落" v-model.trim="queryForm.zl" clearable class="width100">
蔡俊立 committed
21 22 23
              </el-input>
            </el-form-item>
          </el-col>
24
          <el-col :span="8" class="btnColRight">
蔡俊立 committed
25
            <el-form-item>
yangwei committed
26
              <el-button type="primary" @click="handleSearch">查询</el-button>
蔡俊立 committed
27 28 29 30 31 32
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
    </div>
    <!-- 表格 -->
33
    <div class="from-clues-content loadingtext">
34
      <lb-table ref="table" @row-click="handleRowClick" :page-size="pageData.pageSize" :calcHeight="300"
35
        :current-page.sync="pageData.currentPage" :total="tableData.total" @size-change="handleSizeChange" @select="select"
蔡俊立 committed
36 37 38 39 40
        @p-current-change="handleCurrentChange" @selection-change="handleSelectionChange" :column="tableData.columns"
        :data="tableData.data">
      </lb-table>
    </div>
    <div class="submit_button">
41
      <el-button @click="$popupCacel">取消</el-button>
42
      <el-button type="primary" plain @click="submitForm" :loading="loading">发起申请</el-button>
蔡俊立 committed
43 44 45 46
    </div>
  </div>
</template>
<script>
47 48
  //首次登记
  import store from '@/store/index.js'
49
  import ywsqTable from "@/utils/mixin/ywsqTable";
50
  import jump from "../components/mixin/jump";
51 52 53
  import { ywPopupDialog } from "@/utils/popup.js";
  import { datas, sendThis } from "../javascript/nydsyq100.js";
  import { defaultParameters } from "../javascript/publicDefaultPar.js";
54
  import { selectZdjbxx } from "@/api/ywsq.js";
55
  import { startBusinessFlow } from "@/api/workFlow.js";
56
  export default {
57
    mixins: [ywsqTable, jump],
58 59 60 61 62 63
    props: {
      isJump: { type: Boolean, default: false },
      sqywInfo: { type: Object, default: () => { } },
    },
    data () {
      return {
64
        loading: false,
65 66 67 68 69 70 71 72 73 74 75 76 77
        queryForm: defaultParameters.defaultParameters(),
        tableData: {
          total: 0,
          columns: datas.columns(),
          data: [],
        },
        bdcdysz: [],
      };
    },
    mounted () {
      sendThis(this);
    },
    methods: {
yuanbo committed
78 79 80 81
      /**
       * @description: queryClick
       * @author: renchao
       */
82 83 84 85 86 87 88 89 90 91 92
      queryClick () {
        this.$startLoading();
        this.queryForm.sqywbm = this.sqywInfo.djywbm;
        selectZdjbxx({ ...this.queryForm, ...this.pageData }).then((res) => {
          this.$endLoading();
          if (res.code === 200) {
            let { total, records } = res.result;
            this.tableData.total = total;
            this.tableData.data = records;
          }
        });
蔡俊立 committed
93
      },
yuanbo committed
94 95 96 97
      /**
       * @description: submitForm
       * @author: renchao
       */
98 99 100 101
      submitForm () {
        if (this.bdcdysz.length == 0) {
          this.$message.error("请至少选择一条数据");
          return;
蔡俊立 committed
102
        }
103
        this.loading = true
104
        startBusinessFlow({
105
          bsmSqyw: this.sqywInfo.bsmSqyw,
106 107
          bdcdysz: this.bdcdysz,
        }).then((res) => {
108
          this.loading = false
109 110 111 112 113 114 115 116 117 118 119
          if (res.code == 200) {
            this.$message({
              showClose: true,
              message: '发起申请成功',
              type: 'success'
            })
            if (!this.isJump) {
              this.jump(res.result, this.djywbm)
            } else {
              store.dispatch('user/refreshPage', true);
            }
120
            this.$popupCacel()
蔡俊立 committed
121
          } else {
122 123 124 125 126
            if (res.result && res.result.length > 0) {
              ywPopupDialog("申请错误明细", "components/ywdialog", { result: res.result }, '36%', true)
            } else {
              ywPopupDialog("申请错误明细", "components/ywdialog", { message: res.message }, '36%', true)
            }
蔡俊立 committed
127
          }
128 129
        }).catch(() => {
          this.loading = false
130 131
        })
      },
yuanbo committed
132 133 134 135 136
      /**
       * @description: handleSelectionChange
       * @param {*} val
       * @author: renchao
       */
137
      handleSelectionChange (val) {
138 139 140 141 142 143 144 145 146
        if (this.sqywInfo.sqywdylx == "1") {
          if (val.length > 1) {
            this.bdcdysz = [...val[val.length - 1]];
          } else {
            this.bdcdysz = val;
          }
        } else {
          this.bdcdysz = val;
        }
147
      },
yuanbo committed
148 149 150 151 152 153
      /**
       * @description: select
       * @param {*} selection
       * @param {*} row
       * @author: renchao
       */
154 155 156 157 158 159 160 161 162
      select (selection, row) {
        if (this.sqywInfo.sqywdylx == "1") {
          // 清除 所有勾选项
          this.$refs.table.clearSelection()
          // 当表格数据都没有被勾选的时候 就返回
          // 主要用于将当前勾选的表格状态清除
          if (selection.length == 0) return
          this.$refs.table.toggleRowSelection(row, true);
        }
163
      },
yuanbo committed
164 165 166 167 168
      /**
       * @description: handleRowClick
       * @param {*} row
       * @author: renchao
       */
169
      handleRowClick (row) {
170
        // 如果状态是1,那就是单选
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
        if (this.sqywInfo.sqywdylx == "1") {
          const bdcdysz = this.bdcdysz
          this.$refs.table.clearSelection()
          if (bdcdysz.length == 1) {
            bdcdysz.forEach(item => {
              // 判断 如果当前的一行被勾选, 再次点击的时候就会取消选中
              if (item == row) {
                this.$refs.table.toggleRowSelection(row, false);
              }
              // 不然就让当前的一行勾选
              else {
                this.$refs.table.toggleRowSelection(row, true);
              }
            })
          }
          else {
            this.$refs.table.toggleRowSelection(row, true);
          }
        } else {
190
          this.$refs.table.toggleRowSelection(row);
191
        }
192
      },
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
      /**
       * @description: openBook
       * @param {*} row
       * @author: renchao
       */
      openBook (row) {
        var param = {
          bdcdyid: row.bdcdyid,
          qllx: row.qllx,
          bdcdyh: row.bdcdyh,
          bsmQlxx: row.bsmQlxx,
        };
        this.$popup("登记簿详情", "registerBook/djbFrame", {
          formData: param
        })
208
      }
蔡俊立 committed
209 210 211 212
    }
  }
</script>
<style scoped lang="scss">
213 214
  @import "~@/styles/mixin.scss";
  @import "~@/styles/public.scss";
蔡俊立 committed
215 216
</style>