123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <div class="app-container">
- <el-form
- :model="queryParams"
- ref="queryForm"
- :inline="true"
- v-show="showSearch"
- label-width="90px"
- >
- <el-form-item label="盲票组名称">
- <el-input
- v-model="queryParams.title"
- placeholder="请输入盲票组名称"
- clearable
- size="small"
- style="width: 240px"
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="盲票组类型">
- <el-select
- v-model="queryParams.ticketType"
- placeholder="请选择盲票组类型"
- clearable
- size="small"
- @change="handleQuery"
- >
- <el-option
- v-for="item in ticketTypeArr"
- :key="item.areaId"
- :label="item.areaName"
- :value="item.areaId"
- />
- </el-select>
- </el-form-item>
- <el-form-item label="盲票组状态">
- <el-select
- v-model="queryParams.ticketState"
- placeholder="请选择盲票组状态"
- clearable
- size="small"
- @change="handleQuery"
- >
- <el-option
- v-for="item in ticketStateArr"
- :key="item.areaId"
- :label="item.areaName"
- :value="item.areaId"
- />
- </el-select>
- </el-form-item>
- <el-form-item>
- <el-button
- type="primary"
- icon="el-icon-search"
- size="mini"
- @click="handleQuery"
- >搜索</el-button
- >
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
- >重置</el-button
- >
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['business:ticket:add']"
- >添加盲票组</el-button
- >
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="info"
- plain
- icon="el-icon-upload2"
- size="mini"
- @click="handleImport"
- v-hasPermi="['admin:ticket:import']"
- >导入</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- :loading="exportLoading"
- @click="handleExport"
- v-hasPermi="['admin:ticket:export']"
- >导出</el-button>
- </el-col>
- <right-toolbar
- :showSearch.sync="showSearch"
- @queryTable="getList"
- ></right-toolbar>
- </el-row>
- <el-table
- v-loading="loading"
- :data="list"
- @selection-change="handleSelectionChange"
- class="el-table"
- >
- <el-table-column
- type="selection"
- width="55"
- align="center"
- fixed="left"
- />
- <el-table-column label="盲票组ID" prop="boxId" min-width="80" />
- <el-table-column label="盲票图片" prop="picUrl" min-width="100">
- <template slot-scope="scope">
- <div>
- <el-image
- style="width: 100px; height: 100px"
- :src="scope.row.picUrl"
- :preview-src-list="[scope.row.picUrl]"
- />
- </div>
- </template>
- </el-table-column>
- <el-table-column label="盲票组名称" prop="title" min-width="85" />
- <el-table-column label="盲票组面值" prop="facePrice" min-width="85">
- <template slot-scope="scope">
- <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
- </template>
- </el-table-column>
- <el-table-column label="盲票总数" prop="quantity" width="90">
- <template slot-scope="scope">
- <div>{{ scope.row.quantity }}张</div>
- </template>
- </el-table-column>
- <el-table-column label="已售张数" prop="saleQty" min-width="90">
- <template slot-scope="scope">
- <div>{{ scope.row.saleQty }}张</div>
- </template>
- </el-table-column>
- <el-table-column label="盲票类型" prop="type" min-width="80">
- <template slot-scope="scope">
- {{ scope.row.type.desc }}
- </template>
- </el-table-column>
- <el-table-column label="采购单价" prop="pkgSalePrice" min-width="90">
- <template slot-scope="scope">
- <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
- </template>
- </el-table-column>
- <el-table-column label="已采购数量" prop="salePkgQty" min-width="90">
- <template slot-scope="scope">
- <div>{{ scope.row.salePkgQty }}张</div>
- </template>
- </el-table-column>
- <el-table-column label="状态" prop="status" min-width="80">
- <template slot-scope="scope">
- {{ scope.row.status.desc }}
- </template>
- </el-table-column>
- <el-table-column
- label="操作"
- align="center"
- show-overflow-tooltip
- class-name="small-padding fixed-width"
- min-width="150"
- fixed="right"
- >
- <template>
- <div>
- <el-button
- size="mini"
- type="text"
- disabled
- @click="handleDetail(scope.row)"
- v-hasPermi="['']"
- >查看</el-button
- >
- </div>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total > 0"
- :total="total"
- :page.sync="pageParams.pageNum"
- :limit.sync="pageParams.pageSize"
- @pagination="getList"
- />
- <!-- 导入 -->
- <ticket-import
- v-if="importShow"
- :dialog-visible="importShow"
- @close="hideDialog"
- />
- </div>
- </template>
- <script>
- import { getTicketList , exportTicket} from "@/api/business/ticket";
- import { publicFileGetUrl } from "@/api/common";
- import TicketImport from './import'
- export default {
- name: "Ticket",
- components: {
- TicketImport
- },
- data() {
- return {
- loading: false,
- exportLoading: false,
- showSearch: true,
- queryParams: {
- title: "",
- ticketType: "",
- ticketState: "",
- },
- pageParams: {
- pageNum: 1,
- pageSize: 10,
- },
- ticketTypeArr: [],
- ticketStateArr: [],
- // 总条数
- total: 10,
- list: [],
- ids: [],
- importShow:false
- };
- },
- created() {
- this.getList();
- },
- methods: {
- // 盲票组列表
- getList() {
- this.loading = true;
- getTicketList(
- "pageNum=" +
- this.pageParams.pageNum +
- "&pageSize=" +
- this.pageParams.pageSize +
- "&",
- this.queryParams
- )
- .then((res) => {
- this.loading = false;
- if (res.code == 0) {
- res.rows.forEach((item) => {
- let picUrlArr = item.picUrl.split(",");
- item.picUrl = publicFileGetUrl + picUrlArr[0];
- item.status = JSON.parse(item.status);
- item.type = JSON.parse(item.type);
- });
- this.total = res.total;
- this.list = res.rows;
- }
- })
- .catch(() => {
- this.loading = false;
- });
- },
- // 搜索
- handleQuery() {
- this.getList()
- },
- // 重置
- resetQuery() {},
- // 添加盲票组
- handleAdd() {
- this.$router.push({ name: "TicketCreate" });
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.boxId);
- },
- handleDetail() {},
- handleImport(){
- console.log("handleImport ====================")
- this.importShow = true;
- },
- hideDialog(){
- this.importShow = false;
- },
- /** 导出按钮操作 */
- handleExport() {
- const boxIds = this.ids;
- this.$confirm('是否确认导出所选盲票数据项?', "警告", {
- confirmButtonText: "确定",
- cancelButtonText: "取消",
- type: "warning"
- }).then(() => {
- this.exportLoading = true;
- return exportTicket({ids:boxIds});
- }).then(response => {
- this.download(response.msg);
- this.exportLoading = false;
- }).catch(() => {});
- },
- },
- mounted() {},
- destroyed() {},
- };
- </script>
- <style lang="scss" scoped>
- </style>
|