infsea.vue 10.6 KB
Newer Older
fukai committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 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 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 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 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354
<template>
  <div class="eibs-tab">
    <!-- ----------左 ---------->
    <c-col :span="12" class="col-left">
      <c-col :span="24">
        <el-form-item label="客户编号" prop="extkey">
          <c-input
            v-model="condition.extkey"
            placeholder="请输入客户编号"
          ></c-input>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="经办机构" prop="bchkey">
          <el-select
            v-model="condition.ptabchkey"
            placeholder="请选择经办机构"
            :clearable="true"
          >
            <el-option v-for="item in bchkeylist" :key="item.branch" :label="item.bchname"
                      :value="item.branch">
              <span style="float: left">{{ item.branch }} - {{ item.bchname }}</span></el-option>
          </el-select>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="归属机构" prop="branch">
          <el-select
            v-model="condition.ptabranch"
            placeholder="请选择归属机构"
            :clearable="true"
          >
            <el-option v-for="item in branchlist" :key="item.branch" :label="item.bchname"
                      :value="item.branch">
              <span style="float: left">{{ item.branch }} - {{ item.bchname }}</span></el-option>
          </el-select>
        </el-form-item>
      </c-col>
    </c-col>
    <!-- ----------右 ---------->
    <c-col :span="12" class="col-left">
      <c-col :span="24">
        <el-form-item label="客户中文名称" prop="cnnam">
          <c-input
            v-model="condition.cnnam"
            placeholder="请输入客户中文名称"
          ></c-input>
        </el-form-item>
      </c-col>
      <c-col :span="24">
        <el-form-item label="客户英文名称" prop="ennam">
          <c-input
            v-model="condition.ennam"
            placeholder="请输入客户英文名称"
          ></c-input>
        </el-form-item>
      </c-col>
    </c-col>
    <!--新增/重置/查询按钮-->
    <c-col :span="24">
      <c-col :span="12" style="text-align: left">
        <el-button type="primary" size="small" @click="batchUpdate" v-if="calcBch">批量更新管户机构</el-button>
      </c-col>
      <c-col :span="calcBch?12:24" style="text-align: right">
        <el-button size="small" @click="handleReset">重置</el-button>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="small"
          @click="onSearch()"
          >查询
        </el-button>
      </c-col>
    </c-col>
    <!--列表以及操作栏-->
    <c-col :span="24">
      <c-paging-table
        :data="ptyData"
        :columns="ptyColumns"
        :pageNumber="condition.pageNum"
        :pageSize="condition.pageSize"
        :total="condition.total"
        v-on:queryFunc="queryFunc"
        :border="true"
      >
        <c-table-column fixed="right" prop="op" label="操作" width="240px">
          <template slot-scope="{ scope }">
            <c-button
              style="margin-left: 5px"
              size="small"
              type="primary"
              @click="ptsupd(scope.$index, scope.row)"
              >更新管户机构</c-button
            >
          </template>
        </c-table-column>
      </c-paging-table>
    </c-col>
    <el-dialog
      :title="
      '管户机构变更'"
      :visible.sync="updptsDialog"
      top="10vh"
      v-model="single"
      width="80%"
      :destroy-on-close="true"
      :before-close="handleClose"
    >
      <el-form-item label="管户机构选择" prop="newbchlst">
        <el-select
            v-model="single.newbchlst"
            placeholder="请选择管户机构"
          >
            <el-option v-for="item in bchkeylist" :key="item.branch" :label="item.bchname"
                      :value="item.branch">
              <span style="float: left">{{ item.branch }} - {{ item.bchname }}</span></el-option>
          </el-select>
      </el-form-item>
      <span slot="footer" class="dialog-footer">
        <c-button type="primary" @click="update"
          >确 定</c-button
        >
      </span>
    </el-dialog>
    <el-dialog
      :title="
      '批量管户机构变更'"
      :visible.sync="bthupdptsDialog"
      top="10vh"
      width="80%"
      :destroy-on-close="true"
      :before-close="handleClose"
    >
      <div>
        <div style="margin-bottom: 60px;border-bottom: 1px solid #f1f1f1;">
          <div style="padding: 5px 0;font-size: 16px;"> 待选择 </div>
          <el-form-item label="经办机构选择" prop="ptabchkeyinr">
            <el-select
            v-model="batupd.ptabchkey"
            placeholder="请选择经办机构"
            >
              <el-option v-for="item in bchkeylist" :key="item.branch" :label="item.bchname"
                        :value="item.branch">
                <span style="float: left">{{ item.branch }} - {{ item.bchname }}</span></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="所属机构选择" prop="ptabranchinr">
            <el-select
            v-model="batupd.ptabranch"
            placeholder="请选择所属机构"
          >
            <el-option v-for="item in batbchkeylist" :key="item.branch" :label="item.bchname"
                      :value="item.branch">
              <span style="float: left">{{ item.branch }} - {{ item.bchname }}</span></el-option>
          </el-select>
          </el-form-item>
        </div>
        <div>
          <div style="padding: 5px 0;font-size: 16px;"> 更换管户机构 </div>
          <el-form-item label="管户机构选择" prop="batnewbchlst">
            <el-select
            v-model="batupd.newbchlst"
            placeholder="请选择管户机构"
          >
            <el-option v-for="item in bchkeylist" :key="item.branch" :label="item.bchname"
                      :value="item.branch">
              <span style="float: left">{{ item.branch }} - {{ item.bchname }}</span></el-option>
          </el-select>
          </el-form-item>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <c-button type="primary" @click="updatebatch"
          >确 定</c-button
        >
      </span>
    </el-dialog>
  </div>
</template>

<script>
import { queryByPage, update, updatebatch, queryJzlist, getBranchlist, getBchkeylist } from "~/service/manage/updpts.js"
import UpdptsData from "../Dbiupdpts/Updpts.js"

export default {
  name: "",
  data() {
    return {
      updptsDialog: false,
      bthupdptsDialog: false,
      // 经办机构列表
      bchkeylist: [],
      // 地址所属机构列表
      branchlist: [],
      batbchkeylist: [],
      batupd: new UpdptsData().data,
      condition: {
        ptabranch: "",
        ptabchkey: "",
        cnnam: "",
        ennam: "",
        extkey: "",
        pageSize: 5,
        pageNum: 1,
        total: 0,
      },
      single: new UpdptsData().data,
      ptyData: [],
      ptyColumns: [
		    { label: '客户号', prop: 'extkey', width: 'auto' },
        { label: '客户中文名称', prop: 'ptanam1', width: 'auto' },
        { label: '管户机构', prop: 'bchkeyinr', width: 'auto' },
        { label: '地址编号', prop: 'adrextkey', width: 'auto' },
        { label: '经办机构', prop: 'ptabchkeyinr', width: 'auto' },
        { label: '所属机构', prop: 'ptabranchinr', width: 'auto' },
      ],
      calcBch: false,
    };
  },
  created() {
      this.getBchkeylist()
      if (this.$store.state.UserContext.currentOrg.departmentNumber == "1000") {
        this.calcBch = true;
      }
  },
  watch: {
    '$store.state.UserContext.currentOrg': {
      handler(newVal) {
        this.handleReset()
        this.getBchkeylistT()
        if (newVal.departmentNumber != "1000") {
          this.calcBch = false;
        }
        if (newVal.departmentNumber == "1000") {
          this.calcBch = true;
        }
      }
    },
    "condition.ptabchkey": {
      handler(newVal) {
        this.getBranchlist(newVal)
      }
    },
    "batupd.ptabchkey": {
      handler(newVal) {
        this.getBatBranchlist(newVal)
      }
    },
  },
  computed: {},
  methods: {
    getBchkeylist() {
      getBchkeylist().then((res) => {
        if (res.respCode == "AAAAAA") {
          const list = res.data
          this.bchkeylist = list
        }
      })
    },
    getBranchlist(bchkeyinr) {
      getBranchlist({"bchkeycode": bchkeyinr}).then((res => {
        if (res.respCode == "AAAAAA") {
          const list = res.data
          this.branchlist = list
        }
      }))
    },
    getBatBranchlist(bchkeyinr) {
      getBranchlist({"bchkeycode": bchkeyinr}).then((res) => {
        if (res.respCode == "AAAAAA") {
          const list = res.data
          this.batbchkeylist = list
        }
      })
    },
    onSearch(){
        this.onInfptySearch();
    },
    onInfptySearch() {
			queryByPage(this.condition).then(res => {
        if(res.respCode == SUCCESS) {
          const list = res.data.list
          this.ptyData = list
          this.condition.pageNum = res.data.pageNumber
          this.condition.pageSize = res.data.pageSize
          this.condition.total = res.data.total
        }
      }) 
		},
    queryFunc(pageNumber, pageSize) {
      this.condition.pageNum = pageNumber
      this.condition.pageSize = pageSize
      this.onInfptySearch()
    },
    batchUpdate() {
      this.bthupdptsDialog = true;
    },
    ptsupd(index, row) {
      this.single.inr = row.inr
      this.single.ptainr = row.ptainr
      this.single.ptabranch = row.ptabranchinr
      this.single.ptabchkey = row.ptabchkeyinr
      this.updptsDialog = true;
    },
    cancel() {
      this.updptsDialog = false;
      this.handleClose();
    },
    handleClose(done) {
      this.updptsDialog = false;
      if (done && typeof done === "function") {
        done();
      }
    },
    update() {
      update(this.single).then((res) => {
        if (res.respCode == "AAAAAA") {
          this.updptsDialog = false;
          this.$notify.success(res.respMsg)
        } else {
          this.$notify.error(res.respMsg)
        }
      })
    },
    updatebatch() {
      updatebatch(this.batupd).then((res) => {
        if (res.respCode == "AAAAAA") {
          this.bthupdptsDialog = false;
          this.$notify.success("批量更改管户机构成功")
        } else {
          this.$notify.error(res.respMsg)
        }
      })
    },
    handleReset() {
      this.condition = new UpdptsData().data;
    },

  },
};
</script>

<style scoped>
.table-button-item-list {
  padding: 0;
  margin: 0;
}
.table-button-item-list li {
  list-style: none;
  padding: 5px 0;
  text-align: center;
  color: #606266;
  cursor: pointer;
}</style>