Infsea.vue 5.83 KB
Newer Older
1 2 3 4 5
<template>
  <div class="eibs-tab">
    <!-- ----------左 ---------->
    <c-col :span="12" class="col-left">
      <c-col :span="24">
hewei committed
6 7
        <el-form-item label="货币种类" prop="cod">
          <c-input v-model="model.cod" placeholder="请输入货币种类" style="width: 100%">
nanrui committed
8
          </c-input>
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
        </el-form-item>
      </c-col>
    </c-col>
    <!------------- 右 ---------->
    <c-col :span="12" class="col-right">
      <c-col :span="24">
        <el-form-item label="货币描述" prop="cod">
          <c-select v-model="model.seanam" placeholder="请输入货币描述" style="width: 100%">
          </c-select>
        </el-form-item>
      </c-col>
    </c-col>

    <c-col :span="24" style="text-align: right; height: 36.8px">
      <el-button size="small" @click="handleReset">重置</el-button>
hewei committed
24
      <el-button type="primary" icon="el-icon-search" size="small" @click="onSearch()">查询
25 26 27
      </el-button>
    </c-col>

nanrui committed
28 29 30 31
    <c-col :span="24" style="margin-top: 10px">
      <c-button class="medium_bcs" size="medium" style="margin-left: 0px" type="primary" @click="toBbacur">添加货币</c-button>
    </c-col>

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
    <c-col :span="24">
      <c-paging-table :data="curData" :columns="curColumns" :pageNumber="model.pageNum" :pageSize="model.pageSize"
        :total="model.total" v-on:queryFunc="queryFunc" :border="true">
        <c-table-column fixed="right" prop="op" label="操作" width="240px">
          <template slot-scope="{ scope }">
            <c-button style="margin-left: 0" size="small" @click="curInfo(scope.$index, scope.row)">详情</c-button>
            <c-button style="margin-left: 5px" size="small" type="primary" @click="curEdit(scope.$index, scope.row)">修改
            </c-button>
            <c-button size="small" style="margin-left: 5px" @click="curDelete(scope.$index, scope.row)">删除</c-button>
            <!-- <el-popover placement="top-start" width="50" trigger="click">
              <ul class="table-button-item-list">
                <li>
                  <c-button size="small" style="margin-left: 0">指派</c-button>
                </li>
                <li>
                  <c-button size="small" style="margin-left: 0">删除</c-button>
                </li>
              </ul>
              <a slot="reference" href="javascript:void(0)" style="margin-left: 5px">
                <i class="el-icon-more"></i>
              </a>
            </el-popover> -->
          </template>
        </c-table-column>
      </c-paging-table>
    </c-col>
  </div>
</template>

<script>
import codes from "~/config/CodeTable";

nanrui committed
64
import { queryByPage, deleteById } from "~/service/test/cur.js";
65 66 67 68 69 70 71 72 73

export default {
  name: "",
  props: ["model"],
  inject: ["root"],
  data() {
    return {
      curData: [],
      curColumns: [
zhouqian committed
74 75
        { label: '货币', prop: 'cod', width: 'auto' },
        { label: '描述', prop: 'seanam', width: 'auto' },
76 77 78 79
      ],
    };
  },
  methods: {
nanrui committed
80 81 82
    toBbacur(){
      this.$router.history.push("/statics/dbacur");
    },
hewei committed
83 84 85
    // handleReset() {
    //   this.root.$refs.modelForm.resetFields();
    // },
xionglin committed
86
  async handleReset() {
87 88 89
      this.model.cod = ""
      this.model.seanam = ""
    },
hewei committed
90 91 92 93 94
    onSearch() {
      this.model.pageSize = 5;
      this.model.pageNum = 1;
      this.onInfcurSearch();
    },
95 96 97 98 99 100 101 102 103 104 105 106 107
    onInfcurSearch() {
      queryByPage(this.model).then(res => {
        /**
         * pageNumber: 0
         * pageSize:	0
         * total: 69
         * totalPage: 0
         */
        const list = res.list
        this.curData = list
        this.model.pageNum = res.pageNumber
        this.model.pageSize = res.pageSize
        this.model.total = res.total
nanrui committed
108
        console.log(this.model);
109 110
      })
    },
111 112 113 114 115 116 117 118 119 120 121 122
    // async onInfbutSearow() {
    //   let rtnmsg = await this.executeRule("infbut.searow")
    //   if (rtnmsg.respCode == SUCCESS) {
    //     console.log(rtnmsg.data);
    //     //TODO 处理数据逻辑
    //     this.updateModel(rtnmsg.data);
    //     this.stmData.data = rtnmsg.data.infbut_dspstm.rows;
    //   }
    //   else {
    //     this.$notify.error({ title: '错误', message: '服务请求失败!' });
    //   }
    // },
123 124 125
    queryFunc(pageNumber, pageSize) {
      this.model.pageNum = pageNumber
      this.model.pageSize = pageSize
126
      // console.log(this.model);
127 128
      this.onInfcurSearch()
    },
129 130 131
    // curtypeChange(val) {
    //   this.model.curtyp = val;
    // },
132 133 134 135
    getCodesByKey(key) {
      return codes[key] ?? [];
    },
    curInfo(index, row) {
nanrui committed
136
      // console.log(row);
137 138 139
      this.$router.push(`/statics/dbicur/${row.inr}`)
    },
    curEdit(index, row) {
140
      this.$router.push(`/statics/dbecur/${row.inr}`);
141
    },
nanrui committed
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
    // curDelete(index, row) {
    //   this.$router.push(`/statics/dbdcur/${row.inr}`)
    // },
    curDelete(idx, row) {
      this.$confirm("是否确认删除?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          let paramsData = { };
          paramsData.inr = row.inr;
          deleteById(paramsData)
            .then((res) => {
              console.log(res);
              this.$message.success("删除成功!");
              this.goBack(true)
            })
            .catch((err) => {
              console.log(err);
              this.$message.error("删除失败!");
            });
        }).catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除",
          });
        });
170
      this.onInfcurSearch();
nanrui committed
171 172 173 174
    },
    goBack(update) {
      this.$store.dispatch("TagsView/delView", this.$route);
      this.$router.push({ name: "StaticsInfcur", params: { update } });
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193
    },
  },
};
</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>