Tskcfg.vue 10 KB
<template>
	<div class="eContainer">
		<c-page title="任务分配器总配置查询">
			<el-form :model="model" ref="modelForm" label-width="120px" label-position="right" size="small">
				<div class="eibs-tab">
          <el-row>
					<c-col :span="24" class="col-left">
						<c-col :span="8">
							<el-form-item label="机构">
								<c-select v-model="model.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>
          </el-row>
          <el-row>
          <c-col :span="12">
						<c-col :span="10" style="text-align: left">
							<el-button type="primary" size="small" icon="el-icon-plus" @click="add()">新增</el-button>
						</c-col>
					</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>
          </el-row>
				

					<c-col :span="24">
            <el-table id='tableRef' size="small"   :data="tskcfgData">
              <el-table-column label="机构" prop="branchinr" sortable  width="200px">
                <template slot-scope="scope">{{getCodelabel(scope.row.branchinr)}}</template>
              </el-table-column>
              <el-table-column label="自动分配阈值" prop="autoLimit" sortable  width="150px">
                <template slot-scope="scope">{{scope.row.autoLimit}}</template>
              </el-table-column>
               <el-table-column label="手动分配阈值" prop="manualLimit" sortable width="150px"  >
                <template slot-scope="scope">{{scope.row.manualLimit}}</template>
              </el-table-column>
              <el-table-column label="总开关" prop="masterSwitch" sortable  width="150px" >
                <template slot-scope="scope">{{flgFormat(scope.row.masterSwitch)}}</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="lunchModeSwitch" sortable width="150px" >
                <template slot-scope="scope">{{flgFormat(scope.row.lunchModeSwitch)}}</template>
              </el-table-column>
              <el-table-column label="工作模式开关" prop="workModeSwitch" sortable width="150px" >
                <template slot-scope="scope">{{flgFormat(scope.row.workModeSwitch)}}</template>
              </el-table-column>
              <el-table-column label="柜员校验开关" prop="userCheckSwitch" sortable width="150px" >
                <template slot-scope="scope">{{flgFormat(scope.row.userCheckSwitch)}}</template>
              </el-table-column>
              <!-- <el-table-column label="报文分配开关" prop="datagramDistSwitch" sortable width="150px" >
                <template slot-scope="scope">{{flgFormat(scope.row.datagramDistSwitch)}}</template>
              </el-table-column> -->
              <el-table-column label="岗位优先开关" prop="positionPrioritySwitch" sortable  width="150px">
                <template slot-scope="scope">{{flgFormat(scope.row.positionPrioritySwitch)}}</template>
              </el-table-column>
              
                <!-- <el-table-column v-for="(item,key) in tskcfgColumns" :key="key" :prop="item.prop" :width="item.width"  :label="item.label" >

                </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="cfgEdit(scope.row)">修改</c-button>
									<c-button size="small" style="margin-left: 5px" type="text" icon="el-icon-delete" @click="commitDelete(scope.row.branchinr)">删除</c-button>
									<c-button style="margin-left: 5px" size="small" type="text" icon="el-icon-info" @click="cfgDetail(scope.row)">详情</c-button>
								</template>
							</el-table-column>
              </el-table>
            <el-pagination :current-page.sync="model.pageNo" :page-sizes="[5, 10, 20]" :page-size="model.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" @size-change="handleSizeChange" @current-change="handleCurrentChange"></el-pagination>	
	
						<!-- <c-paging-table :data="tskcfgData" :columns="tskcfgColumns" :pageNumber="model.pageNo" :pageSize="model.pageSize" :total="total" @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" icon="el-icon-edit" @click="cfgEdit(scope.row)">修改</c-button>
									<c-button size="small" style="margin-left: 5px" icon="el-icon-delete" @click="commitDelete(scope.row.branchinr)">删除</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>
			<m-tsk v-if="showDialog" ref="tskpolDetail" :diatyp="diatyp" :model="tskcfgModel" :bchtyp-list="bchtypList"
			  @success="hsuccess" @close="hclose" />
		</el-dialog>
	</div>
</template>

<script>
import Utils from "~/utils";
import Api from '~/service/Api';
import commonFunctions from '~/mixin/commonFunctions.js';
import TskcfgDetail from "./TskcfgDetail";

export default {
	name: "StaticsTsk",
	mixins: [commonFunctions],
  components: {
    "m-tsk": TskcfgDetail,
  },
  data() {
    return {
       title: "",
      polmodel: {
        branchinr: ""
      },
      showDialog: false, //弹窗
      formList: [],
      isEdit: false, //false为新增,true为修改
      model: {
        branchinr: "",
        pageNo: 1,
        pageSize:5,
			},
			total: 0,
      type: "",
      diatyp:'',
			bchtypList: [],
      tskcfgData: [],
      // switch:[
      //   {label:'开',value:'Y'},
      //   {label:'关',value:'N'}
      // ],
      tskcfgModel:{
      },
      tskcfgColumns: [
        // { label: "主键", prop: "id", width: "80px" },
        { label: "机构", prop: "branchinr", width: "90px" },
        // { label: "分组", prop: "grp", width: "80px" },
        { label: "自动分配阈值", prop: "autoLimit", width: "150px" },
        { label: "手动分配阈值", prop: "manualLimit", width: "150px" },
        { label: "总开关", prop: "masterSwitch", width: "90px",format: "flgFormat" },
        { label: "自动分配开关", prop: "autoSwitch", width: "120px" },
        { label: "午休模式开关", prop: "lunchModeSwitch", width: "120px" },
        { label: "工作模式开关", prop: "workModeSwitch", width: "120px" },
        { label: "柜员校验开关", prop: "userCheckSwitch", width: "120px" },
        { label: "报文分配开关", prop: "datagramDistSwitch", width: "120px" },
        { label: "岗位优先开关", prop: "positionPrioritySwitch", width: "120px"},
        // { label: "溢出模式", prop: "overflowMode", width: "100px" }
      ],
    };
	},
	mounted() {
		this.getBranchList();
		this.onSearch()
	},

  methods: {
		// 机构列表
		async getBranchList() {
			const loading = this.loading();
			let res = await Api.post('/public/taskdist/config/getBranchList');
			if (res.respCode == SUCCESS) {
				this.bchtypList = res.data;
			}
			loading.close();
		},
    //重置
    handleReset() {
      this.model.branchinr = "";
		},
		//查询
		async onSearch() {
			const loading = this.loading();
			let res = await Api.post('/public/taskdist/config/list', this.model);
			if (res.respCode == SUCCESS) {
				this.tskcfgData = res.data.records
				this.total = res.data.total
				this.model.pageSize = res.data.pageSize
				this.model.pageNo = res.data.pageNo
			}
			loading.close();
    },
    
		//回调
		queryFunc(currentPage,size){
			console.log(111,currentPage,size)
			this.model.pageNo = currentPage;
			this.model.pageSize = size;
			this.onSearch();
    },
      handleSizeChange(val) {
        console.log('handleSizeChange:',val)
      this.queryFunc(1,val);
    },
    handleCurrentChange(val) {
      console.log('handleCurrentChange:',val)
      this.queryFunc(val,this.model.pageSize);
		},
    //新增
    add() {
      this.showDialog = true;
      this.isEdit = false;
      this.tskcfgModel = {};
      this.diatyp='add'
    },
    //修改
    cfgEdit(row) {
		 this.isEdit = true;
      this.showDialog = true;
      this.tskcfgModel = row
      this.diatyp = 'edit'
    },
    //详情
    cfgDetail(row){
      this.showDialog = true;
      this.tskcfgModel = row
      this.diatyp = 'info'
    },
     hsuccess() {
      this.showDialog = false;
      this.onSearch();
    },
    hclose() {
      this.showDialog = false;
    },
		//删除
		async commitDelete(val) {
			this.$confirm("是否确认删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
			})
			.then(async() => {
				try{
					let params= {
						branchinr: val
					}
					const res = await Api.post('/public/taskdist/config/delete', params)
					this.$notify.success("删除成功!");
					this.onSearch()
				}catch(err){
					this.$notify.error("删除失败!");
				}				
			})
			.catch(() => {
        this.$message({
          type: "info",
          message: "已取消删除",
        });
      });
    },
    //格式化列表显示
     flgFormat(flg){
			if(flg == 'Y'){
				return '开';
			}else{
				return '关';
			}
			
    },
    getCodelabel(value) {
          const codeobj = this.bchtypList.find(obj => obj.inr === value)
          return codeobj ? codeobj.bchname : value;
    },
  }
};
</script>

<style></style>