index.vue 10.1 KB
<template>
	<div>
		<c-page title="任务池分配查询">
			<el-form ref="modelForm" :model="polmodel" label-width="120px" label-position="right" size="small">
				<div class="eibs-tab">
					<c-col :span="24" class="col-left">
						<c-col :span="8">
							<el-form-item label="机构" style="width: 100%">
								<c-select v-model="polmodel.branchinr" filterable style="width: 100%" placeholder="请选择业务机构">
									<el-option v-for="item in bchtypList" :key="item.branch" :label="item.bchname" :value="item.inr">
									</el-option>
								</c-select>
							</el-form-item>
						</c-col>
            	<c-col :span="8">
                <el-form-item label="组别" style="width: 100%">
                    <c-select v-model="polmodel.bizGroup" filterable style="width: 100%" placeholder="请选择业务组别" dbCode="bizgrp">
                    </c-select>
                  </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" icon="el-icon-plus" @click="hAdd">新增</el-button>
						</c-col>
						<c-col :span="12" 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">
             <el-table id='tableRef' size="small"   :data="tskpolData">
              <el-table-column label="机构" prop="branchinr" sortable  width="200px">
                <template slot-scope="scope">{{getBchNamelByValue(scope.row.branchinr)}}</template>
              </el-table-column>
              <el-table-column label="任务池编号" prop="poolNumber" sorqtable  width="150px">
                <template slot-scope="scope">{{scope.row.poolNumber}}</template>
              </el-table-column>
               <el-table-column label="任务池名称" prop="poolName" sortable width="150px"  >
                <template slot-scope="scope">{{scope.row.poolName}}</template>
              </el-table-column>
              <el-table-column label="业务组别" prop="bizGroup" sortable  width="150px" >
                <template slot-scope="scope">{{getCodelabel(scope.row.bizGroup,"bizGrp")}}</template>
              </el-table-column>
              <el-table-column label="支持的交易代码" prop="trades" sortable width="150px" show-overflow-tooltip>
                <template slot-scope="scope">{{scope.row.trades}}</template>
              </el-table-column>
              <el-table-column label="自动分配开关" prop="autoSwitch" sortable width="150px" >
                <template slot-scope="scope">{{flgFormat(scope.row.autoSwitch)}}</template>
              </el-table-column>
              <el-table-column label="备注" prop="remark" sortable width="150px" >
                <template slot-scope="scope">{{scope.row.remark}}</template>
              </el-table-column>
                <el-table-column fixed="right" prop="op" label="操作"  width="240px">
								<template slot-scope="scope">
										<c-button style="margin-left: 5px" size="small" type="text" icon="el-icon-edit" @click="hEdit(scope.row)">修改</c-button>
									<c-button size="small" style="margin-left: 5px"  type="text" icon="el-icon-delete" @click="hDelete(scope.row)">删除</c-button>
										<c-button style="margin-left: 5px" size="small" type="text" icon="el-icon-info" @click="hDetail(scope.row)">详情</c-button>
								</template>
							</el-table-column>
              </el-table>
            <el-pagination :current-page.sync="pagenation.pageNum" :page-sizes="[5, 10, 20]" :page-size="pagenation.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="pagenation.total" @size-change="handleSizeChange" @current-change="handleCurrentChange"></el-pagination>	
	
						<!-- <c-paging-table :data="tskpolData" :columns="tskpolColumns" :border="true" :pageNumber="pagenation.pageNum" :pageSize="pagenation.pageSize"
						  :total="pagenation.total" @queryFunc="queryFunc">
							<c-table-column fixed="right" prop="op" label="操作" width="240px">
								<template slot-scope="{ scope }">
									<c-button style="margin-left: 5px" size="small" type="primary" icon="el-icon-edit" @click="hEdit(scope.row)">修改</c-button>
									<c-button size="small" style="margin-left: 5px" icon="el-icon-delete" @click="hDelete(scope.row)">删除</c-button>
								</template>
							</c-table-column>
						</c-paging-table> -->
					</c-col>
				</div>
			</el-form>
		</c-page>
		<!-- 弹框 -->
		<el-dialog :title="'任务池配置:' +(diatyp =='edit' ? '编辑' :(diatyp =='info' ? '详情' :'新增'))" :visible.sync="showDialog" :modal-append-to-body="false" :close-on-click-modal="false"
		  width="80%" center>
			<TskpolDetail v-if="showDialog" ref="tskpolDetail" :is-edit="isEdit" :diatyp="diatyp" :tskpol-data="tskpolData" :bchtyp-list="bchtypList"
			  @success="hsuccess" @close="hclose" />
		</el-dialog>
		<!-- <div style="text-align: center">
			<c-button type="primary" @click="goBack">返 回</c-button>
		</div> -->
	</div>
</template>
<script>
import TskpolDetail from "./TskpolDetail.vue";
import Api from "~/service/Api";
import commonFunctions from "~/mixin/commonFunctions.js";

export default {
  mixins: [commonFunctions],
  name: "StaticsTskpol",
  components: {
    TskpolDetail
  },
  data() {
    return {
      title: "",
      bchtypList: [], //机构列表
      polmodel: {
        branchinr: ""
      },
      showDialog: false, //弹窗
      formList: [],
      isEdit: false, //false为新增,true为修改
      diatyp:'',
      pagenation: {
        pageNum: 1,
        pageSize:5,
        total: 0
      },
      tskpolData: [],
      tskpolColumns: [
        { label: "机构ID", prop: "branchinr", width: "90px" },
        { label: "任务池编号", prop: "poolNumber", width: "80px" },
        { label: "任务池名称", prop: "poolName", width: "120px" },
        { label: "业务组别", prop: "bizGroup", width: "120px" },
        { label: "支持的交易代码", prop: "trades", width: "90px" },
        { label: "自动分配开关", prop: "autoSwitch", width: "120px" },
        { label: "备注", prop: "remark", width: "120px" }
      ],
     dbCodes:{
       bizGrp:[],
     },
    };
  },
  methods: {
     //格式化列表显示
     flgFormat(flg){
			if(flg == 'Y'){
				return '开';
			}else{
				return '关';
			}
			
		},
    handleSizeChange(val) {
      this.queryFunc(1,val);
    },
    handleCurrentChange(val) {
      this.queryFunc(val,this.pagenation.pageSize);
		},
    // 页码修改
    queryFunc(num, size) {
      console.log(111, num, size);
      this.pagenation.pageNum = num;
      this.pagenation.pageSize = size;
      this.onSearch();
    },
    //重置
    handleReset() {
      this.polmodel.branchinr = "";
      this.onSearch();
    },
		//查询
    async onSearch() {
      const loading = this.loading();
      this.total = 0;
      const params = {
        pageNo: this.pagenation.pageNum,
        pageSize: this.pagenation.pageSize
      };
      if(this.polmodel.branchinr )
         params.branchinr=this.polmodel.branchinr;
      const res = await Api.post("/public/taskdist/pool/config/list", params);
      if (res.respCode == SUCCESS) {
        this.tskpolData = res.data.records;
        this.pagenation.total = res.data.total;
        this.pagenation.pageNum = res.data.pageNo;
        this.pagenation.pageSize = res.data.pageSize;
      }
      loading.close();
    },
    //新增
    hAdd() {
      this.showDialog = true;
      this.isEdit = false;
    },
    //修改
    hEdit(row) {
      this.isEdit = true;
      this.showDialog = true;
      this.$nextTick(() => {
        this.$refs.tskpolDetail.getdialogDetail(row);
      });
      this.diatyp = 'edit'
    },
    hDetail(row){
      this.showDialog = true;
      this.$nextTick(() => {
        this.$refs.tskpolDetail.getdialogDetail(row);
      });
      this.diatyp = 'info'
    },
    //初始化码表
async getdbCode(codeType, uil, codeNam) {
    let params = {
      codeType: codeType,
      uil: uil ? uil : 'EN'
    }
    let rtnmsg = await Api.post("/manager/dic/listDicInfo", params)
    if (rtnmsg.respCode === SUCCESS) {
      let curList = rtnmsg.data.map(item => ({
        value: item.codeValue,
        label: item.codeName
      }));
      this.dbCodes[codeNam] = curList
    }
  },
    //删除
    async hDelete(row) {
      this.$confirm("是否删除, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(async () => {
          try {
            const res = await Api.post(
              "/public/taskdist/pool/config/delete/",
              { id: row.id }
            );
            if(res.respCode === SUCCESS){
            this.$message({
              type: "success",
              message: "删除成功!"
            });
            }
            //刷新页面
            this.onSearch();
          } catch (error) {
            console.log(error);
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },
    //表格码表格式化
    getCodelabel(value,codenam) {
          const codeobj = this.dbCodes[codenam].find(obj => obj.value === value)
          return codeobj ? codeobj.label : value;
    },
    //机构格式化
     getBchNamelByValue(value) {
          const codeobj = this.bchtypList.find(obj => obj.inr === value)
          return codeobj ? codeobj.bchname : value;
    },
    
    // 机构列表
    async getBranchList() {
      const res = await Api.post("/public/taskdist/config/getBranchList");
      if (res.respCode == SUCCESS) {
        this.bchtypList = res.data;
      }
    },
    //返回
    goBack() {
      this.$router.push({
        path: "/business/tsk"
      });
    },
    hsuccess() {
      this.showDialog = false;
      this.onSearch();
    },
    hclose() {
      this.showDialog = false;
    }
  },
  mounted() {
    this.getBranchList();
    this.onSearch();
    this.getdbCode("bizgrp","","bizGrp");
  }
};
</script>

<style></style>