Infsea.vue 6.46 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
<template>
  <div class="eibs-tab">
  <c-col :span="18" class="col-left">
      <c-col :span="16">
        <el-form-item label="业务编号" prop="ownref">
          <c-input v-model="model.ownref" clearable placeholder="请输入业务编号"> </c-input>
        </el-form-item>
      </c-col>
    </c-col>
    <c-col :span="6" class="col-right">
      <c-col :span="18">
        <el-button size="small" @click="handleReset">重置</el-button>
        <el-button
          type="primary"
          icon="el-icon-search"
          size="small"
          :loading="searchLoading"
          @click="onSearch()"
          >查询
        </el-button>
      </c-col>
    </c-col>

    <c-col :span="24">
      <c-col :span="18">
        <el-button size="small" v-if="showDeleteBtn" @click="lckMultiDelete">解锁</el-button>
      </c-col>
    </c-col>
    
    <c-col :span="24">
      <c-paging-table :data="lckData"  :pageNumber="model.pageNum" :pageSize="model.pageSize"
        :total="model.total" v-on:queryFunc="queryFunc" :border="true" :showSelection="true" ref="tablelist">
        <c-table-column  v-for="(item, key) in lckColumns" :key="key" :label="item.label" :min-width="item.width" :prop="item.prop" show-overflow-tooltip   >
          <template slot-scope="{ scope }">
              <span v-if="item.prop==='ownref'">
                {{ scope.row.ownref && scope.row.ownref.trim()?scope.row.ownref:scope.row.lckstr }}
              </span>
               <span v-else>
									{{ scope.row[item.prop] }}
								</span>
          </template>
        </c-table-column>
        <c-table-column fixed="right" prop="op" label="操作" width="240px">
          <template slot-scope="{ scope }">
            <c-button size="small" v-if="showDeleteBtn" style="margin-left: 5px" @click="lckDelete(scope.row)">解锁</c-button>
          </template>
        </c-table-column>
      </c-paging-table>
    </c-col>
  </div>
</template>

<script>
import codes from "~/config/CodeTable";
import { queryByPage } from "~/service/manage/lck.js";
import { deleteByVo } from "~/service/manage/lck.js";
import Lck from "./Lck.js";
 import commonFunctions from "~/mixin/commonFunctions.js";

export default {
  name: "",
  props: ["data"],
  inject: ["root"],
  mixins: [commonFunctions],
  data() {
    return {
      showDeleteBtn: false,
      model: new Lck().data,
      lckData: [],
      lckColumns: [
        { label: '业务编号', prop: 'ownref', width: 'auto' },
        { label: '处理柜员', prop: 'lckusr', width: 'auto' },
        { label: '交易码', prop: 'lcktrn', width: 'auto' },
        { label: '加锁时间', prop: 'lckdattim', width: 'auto' },
      ],
      isIndeterminate: true,
      form: new Lck().data,
      searchLoading: false,
    };
  },
  computed: {
  },
  activated() {
    const { update } = this.$route.params
    if (update) {
      this.onInflckSearch()
    }
  },
  created() {
    this.onSearch()
  },
  mounted() {
      this.getHiddenButtonVue();
    },
  methods: {
    getHiddenButtonVue() {
        const loading = this.loading();
        this.$buttonControlService.hiddenBtnList()
          .then((res) => {
            // 删除
            let hasDelete = res.some((item) => {
              return item.ITEMID === 'lckDeleteBtn';
            })
            if (hasDelete) {
              this.showDeleteBtn = false;
            } else {
              this.showDeleteBtn = true;
            }
            loading.close();
          })
      },
    lckMultiDelete() {
      const list = this.$refs.tablelist.multipleSelection;
      this.form = new Lck().data;
      if(list.length == 0) {
            this.$notify.error("至少选择一条数据!");
          } else {
              this.$confirm("是否确认删除? 请确保此锁对象没有被其他会话使用", "提示", {
                confirmButtonText: "确定",
                cancelButtonText: "取消",
                type: "warning",
              })
                .then(() => {
                  
                    for(var i = 0; i < list.length; i++) {
                      if(i == 0) {
                        this.form.strlist = list[i].lckstr;
                      } else {
                        this.form.strlist = this.form.strlist + "," + list[i].lckstr;
                      }
                    }
                    deleteByVo(this.form)
                          .then((res) => {
                            if(res.respCode == SUCCESS){
                              this.$notify.success("解锁成功!");
                              this.onSearch();
                            } else {
                              this.$notify.error("解锁失败!");
                            }
                          })
                          .catch((err) => {
                            this.$notify.error("解锁失败!");
                          });
              });
      };
    },
    handleReset() {
      this.model.ownref = "";

    },
    getCodesByKey(key) {
      return codes[key] || [];
    },
    onSearch() {
      this.model.pageSize=PageSize;
      this.model.pageNum = 1;
      this.onInflckSearch();
    },
    onInflckSearch() {
      this.searchLoading = true;
      queryByPage(this.model).then(res => {
        const list = res.data.list
        this.lckData = list
        this.model.pageNum = res.data.pageNumber
        this.model.pageSize = res.data.pageSize
        this.model.total = res.data.total;
        this.searchLoading = false;
      })
    },
    queryFunc(pageNumber, pageSize) {
      this.model.pageNum = pageNumber
      this.model.pageSize = pageSize
      this.onInflckSearch()
    },
    lckDelete(row) {
      row.strlist = row.lckstr;
      this.$confirm("是否确认删除? 请确保此锁对象没有被其他会话使用", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          deleteByVo(row)
            .then((res) => {
              this.$notify.success("解锁成功!");
              this.onSearch();
            })
            .catch((err) => {
              this.$notify.error("解锁失败!");
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消解锁",
          });
        });
    },
  },
};
</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>