infsea.vue 10.6 KB
<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>