Tskcfg.vue 10 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
<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>