index.vue 10.1 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
<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>