retrieval.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  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. <treeselect class="filter-item" default-expand-all v-model="listQuery.requireDepartmentId" :options="deptOptions"
  12. :normalizer="normalizer" placeholder="出库部门" style="width: 200px" />
  13. <el-select v-model="listQuery.storeId" clearable placeholder="门店" class="filter-item" style="width: 200px">
  14. <el-option :key="item.id" v-for="item in storeList" :label="item.storeName" :value="item.id">
  15. </el-option>
  16. </el-select>
  17. <el-select v-model="listQuery.warehouseId" clearable placeholder="仓库" class="filter-item" style="width: 200px">
  18. <el-option :key="item.id" v-for="item in warehouseList" :label="item.warehouseName" :value="item.id">
  19. </el-option>
  20. </el-select>
  21. <el-select v-model="listQuery.isRunFinish" clearable placeholder="发货状态" class="filter-item" style="width: 200px">
  22. <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
  23. </el-option>
  24. </el-select>
  25. <el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">查找</el-button>
  26. <el-button class="filter-item" v-waves icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  27. <el-button class="filter-item" type="primary" @click="handleCreate" icon="el-icon-plus">添加</el-button>
  28. <el-button class="filter-item" v-waves icon="el-icon-download"
  29. @click="handleDownload">导出</el-button>
  30. <!-- <el-button class="filter-item" type="success" icon="el-icon-takeaway-box" @click="executeAll">批量发货</el-button> -->
  31. <el-button class="filter-item" type="warning" icon="el-icon-delete" @click="delAll">批量删除</el-button>
  32. </div>
  33. <!-- 查询结果 -->
  34. <el-table size="small" :data="list" @selection-change="handleSelectionChange" v-loading="listLoading"
  35. element-loading-text="正在查询中。。。" border fit highlight-current-row>
  36. <el-table-column type="selection" width="55px" align="center"> </el-table-column>
  37. <el-table-column type="index" label="序号" header-align="center" align="center">
  38. </el-table-column>
  39. <el-table-column align="center" min-width="150px" label="出库单号">
  40. <template slot-scope="scope">
  41. <router-link :to="{ name: 'retrievalDetail', params: { id: scope.row.id } }">
  42. <div style="color: #337ab7;cursor: pointer;">{{ scope.row.serialCode }}</div>
  43. </router-link>
  44. </template>
  45. </el-table-column>
  46. <el-table-column align="center" min-width="100px" label="出库时间" prop="serialDate">
  47. </el-table-column>
  48. <el-table-column align="center" min-width="100px" label="出库部门" prop="requireDepartmentName">
  49. </el-table-column>
  50. <el-table-column align="center" min-width="100px" label="门店" prop="storeName">
  51. </el-table-column>
  52. <el-table-column align="center" min-width="100px" label="仓库" prop="warehouseName">
  53. </el-table-column>
  54. <el-table-column align="center" min-width="100px" label="发货状态">
  55. <template slot-scope="props">
  56. <span v-if="props.row.isRunFinish == '0'" style="color: #67C23A;font-weight: bold;">已发货</span>
  57. <span v-if="props.row.isRunFinish == '1'" style="color: #E6A23C;font-weight: bold;">待发货</span>
  58. </template>
  59. </el-table-column>
  60. <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
  61. <template slot-scope="scope">
  62. <el-button v-if="scope.row.isRunFinish == '1'" type="success" size="small" @click="handleExecute(scope.row)">发货</el-button>
  63. <el-button v-if="scope.row.isRunFinish == '1'" type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
  64. <el-button type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
  65. </template>
  66. </el-table-column>
  67. </el-table>
  68. <!-- 分页 -->
  69. <div class="pagination-container">
  70. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  71. :current-page="listQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="listQuery.limit"
  72. layout="total, sizes, prev, pager, next, jumper" :total="total">
  73. </el-pagination>
  74. </div>
  75. </div>
  76. </template>
  77. <script>
  78. import { listRetrieval, deleteRetrieval, executeRetrieval } from "@/api/retrieval";
  79. import { storeList } from "@/api/store";
  80. import { warehouseList } from "@/api/warehouse";
  81. import { listDept } from "@/api/dept";
  82. import Treeselect from "@riophae/vue-treeselect";
  83. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  84. import waves from "@/directive/waves"; // 水波纹指令
  85. export default {
  86. components: { Treeselect },
  87. directives: { waves },
  88. data() {
  89. return {
  90. // 树选项
  91. deptOptions: [],
  92. storeList: [],
  93. warehouseList: [],
  94. typeList: [
  95. {
  96. type: '0',
  97. name: "已发货",
  98. },
  99. {
  100. type: '1',
  101. name: "待发货",
  102. },
  103. ],
  104. list: [
  105. ],
  106. delarr: [],
  107. multipleSelection: [],
  108. total: 0,
  109. listLoading: false,
  110. listQuery: {
  111. page: 1,
  112. limit: 10,
  113. startDate: '',
  114. endDate: '',
  115. responsibleDept: undefined,
  116. storeId: '',
  117. warehouseId: '',
  118. isRunFinish: '',
  119. },
  120. }
  121. },
  122. created() {
  123. this.getStoreList();
  124. this.getWarehouseList();
  125. this.getList();
  126. this.getListDept();
  127. },
  128. methods: {
  129. getListDept() {
  130. listDept().then(response => {
  131. this.deptOptions = this.handleTree(response.data.data, "deptId");
  132. });
  133. },
  134. /** 转换部门数据结构 */
  135. normalizer(node) {
  136. if (node.children && !node.children.length) {
  137. delete node.children;
  138. }
  139. return {
  140. id: node.deptId,
  141. label: node.deptName,
  142. children: node.children
  143. };
  144. },
  145. /** 获取仓库列表数据 */
  146. getStoreList() {
  147. storeList().then(response => {
  148. this.storeList = response.data.data;
  149. }).catch(() => { });
  150. },
  151. /** 获取仓库列表数据 */
  152. getWarehouseList() {
  153. warehouseList().then(response => {
  154. this.warehouseList = response.data.data;
  155. }).catch(() => { });
  156. },
  157. /** 重置按钮操作 */
  158. resetQuery() {
  159. this.listQuery = {
  160. page: 1,
  161. limit: 10,
  162. page: 1,
  163. limit: 10,
  164. startDate: '',
  165. endDate: '',
  166. responsibleDept: undefined,
  167. storeId: '',
  168. warehouseId: '',
  169. isRunFinish: '',
  170. },
  171. this.getList()
  172. },
  173. handleDownload() {
  174. window.location.href = process.env.BASE_API + '/warehouse-out/export';
  175. },
  176. handleCreate() {
  177. this.$router.push({
  178. name: 'retrievalAdd',
  179. // params: { callback: this.getList }
  180. })
  181. },
  182. getList() {
  183. this.listLoading = true
  184. listRetrieval(this.listQuery).then(response => {
  185. this.list = response.data.data.items
  186. this.total = response.data.data.total
  187. this.listLoading = false
  188. }).catch(() => {
  189. this.list = []
  190. this.total = 0
  191. this.listLoading = false
  192. })
  193. },
  194. handleFilter() {
  195. this.listQuery.page = 1
  196. this.getList()
  197. },
  198. handleSizeChange(val) {
  199. this.listQuery.limit = val
  200. this.getList()
  201. },
  202. handleCurrentChange(val) {
  203. this.listQuery.page = val
  204. this.getList()
  205. },
  206. handleUpdate(row) {
  207. this.$router.push({
  208. name: 'retrievalEdit',
  209. params: { id: row.id }
  210. })
  211. },
  212. handleExecute(row) {
  213. this.$confirm('确认发货吗?', '提示', {
  214. confirmButtonText: '确定',
  215. cancelButtonText: '取消',
  216. type: 'warning'
  217. }).then(() => {
  218. executeRetrieval({ ids: row.id }).then(response => {
  219. this.$notify({
  220. title: '成功',
  221. message: '发货成功',
  222. type: 'success',
  223. duration: 2000
  224. })
  225. this.getList()
  226. })
  227. }).catch(() => { })
  228. },
  229. executeAll() {
  230. const length = this.multipleSelection.length;
  231. if (length > 0) {
  232. this.$confirm("确认发货吗?", "提示", {
  233. confirmButtonText: "确定",
  234. cancelButtonText: "取消",
  235. type: "warning",
  236. }).then(() => {
  237. for (let i = 0; i < length; i++) {
  238. this.delarr.push(this.multipleSelection[i].id);
  239. }
  240. const ids = this.delarr.join(",");
  241. executeRetrieval({ ids: ids }).then(() => {
  242. this.$notify({
  243. title: "成功",
  244. message: "发货成功",
  245. type: "success",
  246. duration: 2000,
  247. });
  248. this.getList();
  249. })
  250. })
  251. } else {
  252. this.$notify({
  253. title: "提示",
  254. message: "请选择要发货的信息!",
  255. type: "warning",
  256. });
  257. }
  258. },
  259. handleDelete(row) {
  260. this.$confirm('确认删除吗?', '提示', {
  261. confirmButtonText: '确定',
  262. cancelButtonText: '取消',
  263. type: 'warning'
  264. }).then(() => {
  265. deleteRetrieval({ ids: row.id }).then(response => {
  266. this.$notify({
  267. title: '成功',
  268. message: '删除成功',
  269. type: 'success',
  270. duration: 2000
  271. })
  272. this.getList()
  273. })
  274. }).catch(() => { })
  275. },
  276. delAll() {
  277. const length = this.multipleSelection.length;
  278. if (length > 0) {
  279. this.$confirm("确认删除吗?", "提示", {
  280. confirmButtonText: "确定",
  281. cancelButtonText: "取消",
  282. type: "warning",
  283. }).then(() => {
  284. for (let i = 0; i < length; i++) {
  285. this.delarr.push(this.multipleSelection[i].id);
  286. }
  287. const ids = this.delarr.join(",");
  288. deleteRetrieval({ ids: ids }).then(() => {
  289. this.$notify({
  290. title: "成功",
  291. message: "删除成功",
  292. type: "success",
  293. duration: 2000,
  294. });
  295. this.getList();
  296. })
  297. })
  298. } else {
  299. this.$notify({
  300. title: "提示",
  301. message: "请选择要删除的信息!",
  302. type: "warning",
  303. });
  304. }
  305. },
  306. handleSelectionChange(val) {
  307. this.multipleSelection = val;
  308. },
  309. }
  310. }
  311. </script>