index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  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="['business: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="['business: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. ref="table"
  104. v-loading="loading"
  105. :data="list"
  106. @select="handleSelect"
  107. class="ticket-table"
  108. >
  109. <el-table-column
  110. type="selection"
  111. width="55"
  112. align="center"
  113. fixed="left"
  114. />
  115. <el-table-column label="盲票组ID" prop="boxId" min-width="80" />
  116. <el-table-column label="盲票图片" prop="picUrl" min-width="100">
  117. <template slot-scope="scope">
  118. <div>
  119. <el-image
  120. style="width: 100px; height: 100px"
  121. :src="scope.row.picUrl"
  122. :preview-src-list="[scope.row.picUrl]"
  123. />
  124. </div>
  125. </template>
  126. </el-table-column>
  127. <el-table-column label="盲票组名称" prop="title" min-width="85" />
  128. <el-table-column label="盲票组面值" prop="facePrice" min-width="85">
  129. <template slot-scope="scope">
  130. <div>¥{{ $numberFormat(scope.row.facePrice) }}</div>
  131. </template>
  132. </el-table-column>
  133. <el-table-column label="盲票总数" prop="quantity" width="90">
  134. <template slot-scope="scope">
  135. <div>{{ scope.row.quantity }}张</div>
  136. </template>
  137. </el-table-column>
  138. <el-table-column label="已售张数" prop="saleQty" min-width="90">
  139. <template slot-scope="scope">
  140. <div>{{ scope.row.saleQty }}张</div>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="盲票类型" prop="type" min-width="80">
  144. <template slot-scope="scope">
  145. {{ scope.row.type.desc }}
  146. </template>
  147. </el-table-column>
  148. <el-table-column label="采购单价" prop="pkgSalePrice" min-width="90">
  149. <template slot-scope="scope">
  150. <div>¥{{ $numberFormat(scope.row.pkgSalePrice) }}/包</div>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="已采购数量" prop="salePkgQty" min-width="90">
  154. <template slot-scope="scope">
  155. <div>{{ scope.row.salePkgQty }}张</div>
  156. </template>
  157. </el-table-column>
  158. <el-table-column label="状态" prop="status" min-width="80">
  159. <template slot-scope="scope">
  160. {{ scope.row.status.desc }}
  161. </template>
  162. </el-table-column>
  163. <el-table-column
  164. label="操作"
  165. align="center"
  166. show-overflow-tooltip
  167. class-name="small-padding fixed-width"
  168. min-width="150"
  169. fixed="right"
  170. >
  171. <template>
  172. <div>
  173. <el-button
  174. size="mini"
  175. type="text"
  176. disabled
  177. @click="handleDetail(scope.row)"
  178. v-hasPermi="['']"
  179. >查看</el-button
  180. >
  181. </div>
  182. </template>
  183. </el-table-column>
  184. </el-table>
  185. <pagination
  186. v-show="total > 0"
  187. :total="total"
  188. :page.sync="pageParams.pageNum"
  189. :limit.sync="pageParams.pageSize"
  190. @pagination="getList"
  191. />
  192. <!-- 导入 -->
  193. <ticket-import
  194. v-if="importShow"
  195. :dialog-visible="importShow"
  196. @close="hideDialog"
  197. />
  198. </div>
  199. </template>
  200. <script>
  201. import { getTicketList , exportTicket} from "@/api/business/ticket";
  202. import { publicFileGetUrl } from "@/api/common";
  203. import TicketImport from './import'
  204. export default {
  205. name: "Ticket",
  206. components: {
  207. TicketImport
  208. },
  209. data() {
  210. return {
  211. loading: false,
  212. exportLoading: false,
  213. showSearch: true,
  214. queryParams: {
  215. title: "",
  216. ticketType: "",
  217. ticketState: "",
  218. },
  219. pageParams: {
  220. pageNum: 1,
  221. pageSize: 10,
  222. },
  223. ticketTypeArr: [],
  224. ticketStateArr: [],
  225. // 总条数
  226. total: 10,
  227. list: [],
  228. ids: [],
  229. importShow:false
  230. };
  231. },
  232. created() {
  233. this.getList();
  234. },
  235. methods: {
  236. // 盲票组列表
  237. getList() {
  238. this.loading = true;
  239. getTicketList(
  240. "pageNum=" +
  241. this.pageParams.pageNum +
  242. "&pageSize=" +
  243. this.pageParams.pageSize +
  244. "&",
  245. this.queryParams
  246. )
  247. .then((res) => {
  248. this.loading = false;
  249. if (res.code == 0) {
  250. res.rows.forEach((item) => {
  251. let picUrlArr = item.picUrl.split(",");
  252. item.picUrl = publicFileGetUrl + picUrlArr[0];
  253. item.status = JSON.parse(item.status);
  254. item.type = JSON.parse(item.type);
  255. });
  256. this.total = res.total;
  257. this.list = res.rows;
  258. }
  259. })
  260. .catch(() => {
  261. this.loading = false;
  262. });
  263. },
  264. // 搜索
  265. handleQuery() {
  266. this.getList()
  267. },
  268. // 重置
  269. resetQuery() {},
  270. // 添加盲票组
  271. handleAdd() {
  272. this.$router.push({ name: "TicketCreate" });
  273. },
  274. handleSelect(selection, row) {
  275. const isSelect = selection.find(item => item.boxId === row.boxId)
  276. this.$refs.table.clearSelection()
  277. if (isSelect) {
  278. this.$refs.table.toggleRowSelection(row, true)
  279. this.ids = row.boxId
  280. } else {
  281. this.ids = ''
  282. }
  283. },
  284. handleDetail() {},
  285. handleImport(){
  286. console.log("handleImport ====================")
  287. this.importShow = true;
  288. },
  289. hideDialog(){
  290. this.importShow = false;
  291. },
  292. /** 导出按钮操作 */
  293. handleExport() {
  294. const boxIds = this.ids || [];
  295. if(boxIds.length == 0){
  296. this.$alert("请选择你要导出的盲票组!",'提示',{type:'warning'});
  297. }else{
  298. this.$confirm('是否确认导出所选盲票数据项?', "警告", {
  299. confirmButtonText: "确定",
  300. cancelButtonText: "取消",
  301. type: "warning"
  302. }).then(() => {
  303. this.exportLoading = true;
  304. return exportTicket({ids:boxIds});
  305. }).then(response => {
  306. this.download(response.msg);
  307. this.exportLoading = false;
  308. }).catch(() => {});
  309. }
  310. },
  311. },
  312. mounted() {},
  313. destroyed() {},
  314. };
  315. </script>
  316. <style lang="scss">
  317. .ticket-table {
  318. thead {
  319. .el-checkbox {
  320. display: none !important;
  321. }
  322. }
  323. }
  324. </style>