index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="app-container">
  3. <el-form
  4. :model="queryParams"
  5. ref="queryForm"
  6. :inline="true"
  7. v-show="showSearch"
  8. label-width="90px"
  9. >
  10. <el-form-item label="盲票组名称">
  11. <el-input
  12. v-model="queryParams.title"
  13. placeholder="请输入盲票组名称"
  14. clearable
  15. size="small"
  16. style="width: 240px"
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="盲票组类型">
  21. <el-select
  22. v-model="queryParams.ticketType"
  23. placeholder="请选择盲票组类型"
  24. clearable
  25. size="small"
  26. @change="handleQuery"
  27. >
  28. <el-option
  29. v-for="item in ticketTypeArr"
  30. :key="item.areaId"
  31. :label="item.areaName"
  32. :value="item.areaId"
  33. />
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="盲票组状态">
  37. <el-select
  38. v-model="queryParams.ticketState"
  39. placeholder="请选择盲票组状态"
  40. clearable
  41. size="small"
  42. @change="handleQuery"
  43. >
  44. <el-option
  45. v-for="item in ticketStateArr"
  46. :key="item.areaId"
  47. :label="item.areaName"
  48. :value="item.areaId"
  49. />
  50. </el-select>
  51. </el-form-item>
  52. <el-form-item>
  53. <el-button
  54. type="primary"
  55. icon="el-icon-search"
  56. size="mini"
  57. @click="handleQuery"
  58. >搜索</el-button
  59. >
  60. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery"
  61. >重置</el-button
  62. >
  63. </el-form-item>
  64. </el-form>
  65. <el-row :gutter="10" class="mb8">
  66. <el-col :span="1.5">
  67. <el-button
  68. type="primary"
  69. icon="el-icon-plus"
  70. size="mini"
  71. @click="handleAdd"
  72. v-hasPermi="['business:ticket:add']"
  73. >添加盲票组</el-button
  74. >
  75. </el-col>
  76. <el-col :span="1.5">
  77. <el-button
  78. type="info"
  79. plain
  80. icon="el-icon-upload2"
  81. size="mini"
  82. @click="handleImport"
  83. v-hasPermi="['admin:ticket:import']"
  84. >导入</el-button>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-button
  88. type="warning"
  89. plain
  90. icon="el-icon-download"
  91. size="mini"
  92. :loading="exportLoading"
  93. @click="handleExport"
  94. v-hasPermi="['admin:ticket:export']"
  95. >导出</el-button>
  96. </el-col>
  97. <right-toolbar
  98. :showSearch.sync="showSearch"
  99. @queryTable="getList"
  100. ></right-toolbar>
  101. </el-row>
  102. <el-table
  103. v-loading="loading"
  104. :data="list"
  105. @selection-change="handleSelectionChange"
  106. class="el-table"
  107. >
  108. <el-table-column
  109. type="selection"
  110. width="55"
  111. align="center"
  112. fixed="left"
  113. />
  114. <el-table-column label="盲票组ID" prop="boxId" min-width="80" />
  115. <el-table-column label="盲票图片" prop="picUrl" min-width="100">
  116. <template slot-scope="scope">
  117. <div>
  118. <el-image
  119. style="width: 100px; height: 100px"
  120. :src="scope.row.picUrl"
  121. :preview-src-list="[scope.row.picUrl]"
  122. />
  123. </div>
  124. </template>
  125. </el-table-column>
  126. <el-table-column label="盲票组名称" prop="title" min-width="85" />
  127. <el-table-column label="盲票组面值" prop="facePrice" min-width="85">
  128. <template slot-scope="scope">
  129. <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
  130. </template>
  131. </el-table-column>
  132. <el-table-column label="盲票总数" prop="quantity" width="90">
  133. <template slot-scope="scope">
  134. <div>{{ scope.row.quantity }}张</div>
  135. </template>
  136. </el-table-column>
  137. <el-table-column label="已售张数" prop="saleQty" min-width="90">
  138. <template slot-scope="scope">
  139. <div>{{ scope.row.saleQty }}张</div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="盲票类型" prop="type" min-width="80">
  143. <template slot-scope="scope">
  144. {{ scope.row.type.desc }}
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="采购单价" prop="pkgSalePrice" min-width="90">
  148. <template slot-scope="scope">
  149. <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
  150. </template>
  151. </el-table-column>
  152. <el-table-column label="已采购数量" prop="salePkgQty" min-width="90">
  153. <template slot-scope="scope">
  154. <div>{{ scope.row.salePkgQty }}张</div>
  155. </template>
  156. </el-table-column>
  157. <el-table-column label="状态" prop="status" min-width="80">
  158. <template slot-scope="scope">
  159. {{ scope.row.status.desc }}
  160. </template>
  161. </el-table-column>
  162. <el-table-column
  163. label="操作"
  164. align="center"
  165. show-overflow-tooltip
  166. class-name="small-padding fixed-width"
  167. min-width="150"
  168. fixed="right"
  169. >
  170. <template>
  171. <div>
  172. <el-button
  173. size="mini"
  174. type="text"
  175. disabled
  176. @click="handleDetail(scope.row)"
  177. v-hasPermi="['']"
  178. >查看</el-button
  179. >
  180. </div>
  181. </template>
  182. </el-table-column>
  183. </el-table>
  184. <pagination
  185. v-show="total > 0"
  186. :total="total"
  187. :page.sync="pageParams.pageNum"
  188. :limit.sync="pageParams.pageSize"
  189. @pagination="getList"
  190. />
  191. <!-- 导入 -->
  192. <ticket-import
  193. v-if="importShow"
  194. :dialog-visible="importShow"
  195. @close="hideDialog"
  196. />
  197. </div>
  198. </template>
  199. <script>
  200. import { getTicketList , exportTicket} from "@/api/business/ticket";
  201. import { publicFileGetUrl } from "@/api/common";
  202. import TicketImport from './import'
  203. export default {
  204. name: "Ticket",
  205. components: {
  206. TicketImport
  207. },
  208. data() {
  209. return {
  210. loading: false,
  211. exportLoading: false,
  212. showSearch: true,
  213. queryParams: {
  214. title: "",
  215. ticketType: "",
  216. ticketState: "",
  217. },
  218. pageParams: {
  219. pageNum: 1,
  220. pageSize: 10,
  221. },
  222. ticketTypeArr: [],
  223. ticketStateArr: [],
  224. // 总条数
  225. total: 10,
  226. list: [],
  227. ids: [],
  228. importShow:false
  229. };
  230. },
  231. created() {
  232. this.getList();
  233. },
  234. methods: {
  235. // 盲票组列表
  236. getList() {
  237. this.loading = true;
  238. getTicketList(
  239. "pageNum=" +
  240. this.pageParams.pageNum +
  241. "&pageSize=" +
  242. this.pageParams.pageSize +
  243. "&",
  244. this.queryParams
  245. )
  246. .then((res) => {
  247. this.loading = false;
  248. if (res.code == 0) {
  249. res.rows.forEach((item) => {
  250. let picUrlArr = item.picUrl.split(",");
  251. item.picUrl = publicFileGetUrl + picUrlArr[0];
  252. item.status = JSON.parse(item.status);
  253. item.type = JSON.parse(item.type);
  254. });
  255. this.total = res.total;
  256. this.list = res.rows;
  257. }
  258. })
  259. .catch(() => {
  260. this.loading = false;
  261. });
  262. },
  263. // 搜索
  264. handleQuery() {
  265. this.getList()
  266. },
  267. // 重置
  268. resetQuery() {},
  269. // 添加盲票组
  270. handleAdd() {
  271. this.$router.push({ name: "TicketCreate" });
  272. },
  273. // 多选框选中数据
  274. handleSelectionChange(selection) {
  275. this.ids = selection.map(item => item.boxId);
  276. },
  277. handleDetail() {},
  278. handleImport(){
  279. console.log("handleImport ====================")
  280. this.importShow = true;
  281. },
  282. hideDialog(){
  283. this.importShow = false;
  284. },
  285. /** 导出按钮操作 */
  286. handleExport() {
  287. const boxIds = this.ids;
  288. this.$confirm('是否确认导出所选盲票数据项?', "警告", {
  289. confirmButtonText: "确定",
  290. cancelButtonText: "取消",
  291. type: "warning"
  292. }).then(() => {
  293. this.exportLoading = true;
  294. return exportTicket({ids:boxIds});
  295. }).then(response => {
  296. this.download(response.msg);
  297. this.exportLoading = false;
  298. }).catch(() => {});
  299. },
  300. },
  301. mounted() {},
  302. destroyed() {},
  303. };
  304. </script>
  305. <style lang="scss" scoped>
  306. </style>