warehousing.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  1. <template>
  2. <div class="app-container calendar-list-container">
  3. <!-- 查询和其他操作 -->
  4. <div class="filter-container">
  5. <el-date-picker v-model="listQuery.startDate" value-format="yyyy-MM-dd" type="date" placeholder="开始日期"
  6. class="filter-item" style="width:200px">
  7. </el-date-picker>
  8. <el-date-picker v-model="listQuery.endDate" value-format="yyyy-MM-dd" type="date" placeholder="结束日期"
  9. class="filter-item" style="width:200px">
  10. </el-date-picker>
  11. <el-select v-model="listQuery.warehouseId" clearable placeholder="请选择仓库" class="filter-item" style="width: 200px">
  12. <el-option :key="item.id" v-for="item in warehouseList" :label="item.warehouseName" :value="item.id">
  13. </el-option>
  14. </el-select>
  15. <el-select v-model="listQuery.isRunFinish" clearable placeholder="请选择状态" class="filter-item" style="width: 200px">
  16. <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
  17. </el-option>
  18. </el-select>
  19. <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
  20. <el-button class="filter-item" v-waves icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  21. <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-plus">添加</el-button>
  22. <!-- <el-button class="filter-item" :loading="downloadLoading" v-waves icon="el-icon-download"
  23. @click="handleDownload">导出</el-button> -->
  24. <!-- <el-button class="filter-item" type="success" icon="el-icon-takeaway-box" @click="executeAll">批量入库</el-button> -->
  25. <el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button>
  26. </div>
  27. <!-- 查询结果 -->
  28. <el-table size="small" :data="list" @selection-change="handleSelectionChange" v-loading="listLoading"
  29. element-loading-text="正在查询中。。。" border fit highlight-current-row>
  30. <el-table-column type="selection" width="55px" align="center"> </el-table-column>
  31. <el-table-column type="index" label="序号" header-align="center" align="center">
  32. </el-table-column>
  33. <el-table-column align="center" min-width="150px" label="入库单号">
  34. <template slot-scope="scope">
  35. <router-link :to="{ name: 'warehousingDetail', params: { id: scope.row.id } }">
  36. <div style="color: #337ab7;cursor: pointer;">{{ scope.row.serialCode }}</div>
  37. </router-link>
  38. </template>
  39. </el-table-column>
  40. <el-table-column align="center" min-width="100px" label="入库时间" prop="serialDate">
  41. </el-table-column>
  42. <el-table-column align="center" min-width="100px" label="供应商" prop="supplierName">
  43. </el-table-column>
  44. <el-table-column align="center" min-width="100px" label="仓库" prop="warehouseName">
  45. </el-table-column>
  46. <el-table-column align="center" min-width="100px" label="经手人" prop="addHandlerName">
  47. </el-table-column>
  48. <el-table-column align="center" min-width="100px" label="入库状态">
  49. <template slot-scope="props">
  50. <span v-if="props.row.isRunFinish == '0'" style="color: #67C23A;font-weight: bold;">已入库</span>
  51. <span v-if="props.row.isRunFinish == '1'" style="color: #E6A23C;font-weight: bold;">待入库</span>
  52. </template>
  53. </el-table-column>
  54. <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
  55. <template slot-scope="scope">
  56. <el-button v-if="scope.row.isRunFinish == '1'" type="success" size="small" @click="handleExecute(scope.row)">入库</el-button>
  57. <el-button type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
  58. <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <!-- 分页 -->
  63. <div class="pagination-container">
  64. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  65. :current-page="listQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="listQuery.limit"
  66. layout="total, sizes, prev, pager, next, jumper" :total="total">
  67. </el-pagination>
  68. </div>
  69. </div>
  70. </template>
  71. <script>
  72. import { listWarehousing, deleteWarehousing, executeWarehousing } from "@/api/warehousing";
  73. import { warehouseList } from "@/api/warehouse";
  74. import waves from "@/directive/waves"; // 水波纹指令
  75. export default {
  76. directives: { waves },
  77. data() {
  78. return {
  79. downloadLoading: false,
  80. warehouseList: [],
  81. typeList: [
  82. {
  83. type: '0',
  84. name: "已入库",
  85. },
  86. {
  87. type: '1',
  88. name: "待入库",
  89. },
  90. ],
  91. list: [
  92. ],
  93. delarr: [],
  94. multipleSelection: [],
  95. total: 0,
  96. listLoading: false,
  97. listQuery: {
  98. page: 1,
  99. limit: 10,
  100. startDate: '',
  101. endDate: '',
  102. warehouseId: '',
  103. isRunFinish: '',
  104. },
  105. }
  106. },
  107. created() {
  108. this.getStoreList();
  109. this.getList();
  110. },
  111. methods: {
  112. /** 获取仓库列表数据 */
  113. getStoreList() {
  114. warehouseList().then(response => {
  115. this.warehouseList = response.data.data;
  116. }).catch(() => { });
  117. },
  118. /** 重置按钮操作 */
  119. resetQuery() {
  120. this.listQuery = {
  121. page: 1,
  122. limit: 10,
  123. startDate: '',
  124. endDate: '',
  125. warehouseId: '',
  126. isRunFinish: '',
  127. },
  128. this.getList()
  129. },
  130. handleDownload() {
  131. this.downloadLoading = true
  132. import('@/vendor/Export2Excel').then(excel => {
  133. const tHeader = ['用户ID', '用户名称', '用户昵称', '用户头像']
  134. const filterVal = ['id', 'username', 'nickname', 'avatar']
  135. excel.export_json_to_excel2(tHeader, this.list, filterVal, '用户信息')
  136. this.downloadLoading = false
  137. })
  138. },
  139. handleCreate() {
  140. this.$router.push({
  141. name: 'warehousingAdd',
  142. // params: { callback: this.getList }
  143. })
  144. },
  145. getList() {
  146. this.listLoading = true
  147. listWarehousing(this.listQuery).then(response => {
  148. this.list = response.data.data.items
  149. this.total = response.data.data.total
  150. this.listLoading = false
  151. }).catch(() => {
  152. this.list = []
  153. this.total = 0
  154. this.listLoading = false
  155. })
  156. },
  157. handleFilter() {
  158. this.listQuery.page = 1
  159. this.getList()
  160. },
  161. handleSizeChange(val) {
  162. this.listQuery.limit = val
  163. this.getList()
  164. },
  165. handleCurrentChange(val) {
  166. this.listQuery.page = val
  167. this.getList()
  168. },
  169. handleUpdate(row) {
  170. this.$router.push({
  171. name: 'warehousingEdit',
  172. params: { id: row.id }
  173. })
  174. },
  175. handleExecute(row) {
  176. this.$confirm('确认入库吗?', '提示', {
  177. confirmButtonText: '确定',
  178. cancelButtonText: '取消',
  179. type: 'warning'
  180. }).then(() => {
  181. executeWarehousing({ ids: row.id }).then(response => {
  182. this.$notify({
  183. title: '成功',
  184. message: '入库成功',
  185. type: 'success',
  186. duration: 2000
  187. })
  188. this.getList()
  189. })
  190. }).catch(() => { })
  191. },
  192. executeAll() {
  193. const length = this.multipleSelection.length;
  194. if (length > 0) {
  195. this.$confirm("确认入库吗?", "提示", {
  196. confirmButtonText: "确定",
  197. cancelButtonText: "取消",
  198. type: "warning",
  199. }).then(() => {
  200. for (let i = 0; i < length; i++) {
  201. this.delarr.push(this.multipleSelection[i].id);
  202. }
  203. const ids = this.delarr.join(",");
  204. executeWarehousing({ ids: ids }).then(() => {
  205. this.$notify({
  206. title: "成功",
  207. message: "入库成功",
  208. type: "success",
  209. duration: 2000,
  210. });
  211. this.getList();
  212. })
  213. })
  214. } else {
  215. this.$notify({
  216. title: "提示",
  217. message: "请选择要入库的信息!",
  218. type: "warning",
  219. });
  220. }
  221. },
  222. handleDelete(row) {
  223. this.$confirm('确认删除吗?', '提示', {
  224. confirmButtonText: '确定',
  225. cancelButtonText: '取消',
  226. type: 'warning'
  227. }).then(() => {
  228. deleteWarehousing({ ids: row.id }).then(response => {
  229. this.$notify({
  230. title: '成功',
  231. message: '删除成功',
  232. type: 'success',
  233. duration: 2000
  234. })
  235. this.getList()
  236. })
  237. }).catch(() => { })
  238. },
  239. delAll() {
  240. const length = this.multipleSelection.length;
  241. if (length > 0) {
  242. this.$confirm("确认删除吗?", "提示", {
  243. confirmButtonText: "确定",
  244. cancelButtonText: "取消",
  245. type: "warning",
  246. }).then(() => {
  247. for (let i = 0; i < length; i++) {
  248. this.delarr.push(this.multipleSelection[i].id);
  249. }
  250. const ids = this.delarr.join(",");
  251. deleteWarehousing({ ids: ids }).then(() => {
  252. this.$notify({
  253. title: "成功",
  254. message: "删除成功",
  255. type: "success",
  256. duration: 2000,
  257. });
  258. this.getList();
  259. })
  260. })
  261. } else {
  262. this.$notify({
  263. title: "提示",
  264. message: "请选择要删除的信息!",
  265. type: "warning",
  266. });
  267. }
  268. },
  269. handleSelectionChange(val) {
  270. this.multipleSelection = val;
  271. },
  272. }
  273. }
  274. </script>