retrieval.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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 filterable 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="经手人" prop="outHandlerName">
  55. </el-table-column>
  56. <el-table-column align="center" min-width="100px" label="发货状态">
  57. <template slot-scope="props">
  58. <span v-if="props.row.isRunFinish == '0'" style="color: #67C23A;font-weight: bold;">已发货</span>
  59. <span v-if="props.row.isRunFinish == '1'" style="color: #E6A23C;font-weight: bold;">待发货</span>
  60. <span v-if="props.row.isRunFinish == '2'" style="color: #E6A23C;font-weight: bold;">已作废</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
  64. <template slot-scope="scope">
  65. <el-button v-if="scope.row.isRunFinish == '1'" type="success" size="small" @click="handleExecute(scope.row)">发货</el-button>
  66. <el-button v-if="scope.row.isRunFinish == '1'" type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
  67. <el-button v-if="scope.row.isRunFinish != '0'" type="danger" size="small"
  68. @click="handleDelete(scope.row)">删除</el-button>
  69. <el-button v-if="scope.row.isRunFinish == '0'" type="warning" size="small"
  70. @click="handleCancelShow(scope.row.id)">作废</el-button>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <!-- 分页 -->
  75. <div class="pagination-container">
  76. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  77. :current-page="listQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="listQuery.limit"
  78. layout="total, sizes, prev, pager, next, jumper" :total="total">
  79. </el-pagination>
  80. </div>
  81. <!-- 作废原因对话框 -->
  82. <el-dialog :close-on-click-modal="false" title="单据作废" :visible.sync="dialogFormVisible" width="40%">
  83. <el-form :rules="rules" ref="dataForm" :model="dataForm" status-icon label-position="left" label-width="80px">
  84. <el-form-item label="作废原因" prop="cancelMsg">
  85. <el-input type="textarea" :rows="2" placeholder="请输入作废原因" v-model="dataForm.cancelMsg"></el-input>
  86. </el-form-item>
  87. </el-form>
  88. <div slot="footer" class="dialog-footer">
  89. <el-button @click="dialogFormVisible = false">取消</el-button>
  90. <el-button type="primary" @click="handleCancel()">确定</el-button>
  91. </div>
  92. </el-dialog>
  93. </div>
  94. </template>
  95. <script>
  96. import { listRetrieval, deleteRetrieval, executeRetrieval,cancelRetrieval } from "@/api/retrieval";
  97. import { storeList } from "@/api/store";
  98. import { warehouseList } from "@/api/warehouse";
  99. import { listDept } from "@/api/dept";
  100. import Treeselect from "@riophae/vue-treeselect";
  101. import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  102. import waves from "@/directive/waves"; // 水波纹指令
  103. export default {
  104. components: { Treeselect },
  105. directives: { waves },
  106. data() {
  107. return {
  108. cancelId: '',
  109. dialogFormVisible: false,
  110. dataForm: {
  111. cancelMsg: ''
  112. },
  113. rules: {
  114. cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
  115. },
  116. // 树选项
  117. deptOptions: [],
  118. storeList: [],
  119. warehouseList: [],
  120. typeList: [
  121. {
  122. type: '0',
  123. name: "已发货",
  124. },
  125. {
  126. type: '1',
  127. name: "待发货",
  128. },
  129. {
  130. type: '2',
  131. name: "已作废",
  132. },
  133. ],
  134. list: [
  135. ],
  136. delarr: [],
  137. multipleSelection: [],
  138. total: 0,
  139. listLoading: false,
  140. listQuery: {
  141. page: 1,
  142. limit: 10,
  143. startDate: '',
  144. endDate: '',
  145. responsibleDept: undefined,
  146. storeId: '',
  147. warehouseId: '',
  148. isRunFinish: '',
  149. },
  150. }
  151. },
  152. created() {
  153. this.getStoreList();
  154. this.getWarehouseList();
  155. this.getList();
  156. this.getListDept();
  157. },
  158. methods: {
  159. handleCancelShow(id) {
  160. this.dialogFormVisible = true;
  161. this.cancelId = id;
  162. this.$nextTick(() => {
  163. this.dataForm.cancelMsg = '';
  164. this.$refs["dataForm"].clearValidate();
  165. });
  166. },
  167. handleCancel() {
  168. this.$refs["dataForm"].validate((valid) => {
  169. if (valid) {
  170. cancelRetrieval({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
  171. this.dialogFormVisible = false;
  172. this.$notify({
  173. title: "成功",
  174. message: "操作成功",
  175. type: "success",
  176. duration: 2000,
  177. });
  178. this.getList();
  179. });
  180. }
  181. })
  182. },
  183. getListDept() {
  184. listDept().then(response => {
  185. this.deptOptions = this.handleTree(response.data.data, "deptId");
  186. });
  187. },
  188. /** 转换部门数据结构 */
  189. normalizer(node) {
  190. if (node.children && !node.children.length) {
  191. delete node.children;
  192. }
  193. return {
  194. id: node.deptId,
  195. label: node.deptName,
  196. children: node.children
  197. };
  198. },
  199. /** 获取仓库列表数据 */
  200. getStoreList() {
  201. storeList().then(response => {
  202. this.storeList = response.data.data;
  203. }).catch(() => { });
  204. },
  205. /** 获取仓库列表数据 */
  206. getWarehouseList() {
  207. warehouseList().then(response => {
  208. this.warehouseList = response.data.data;
  209. }).catch(() => { });
  210. },
  211. /** 重置按钮操作 */
  212. resetQuery() {
  213. this.listQuery = {
  214. page: 1,
  215. limit: 10,
  216. page: 1,
  217. limit: 10,
  218. startDate: '',
  219. endDate: '',
  220. responsibleDept: undefined,
  221. storeId: '',
  222. warehouseId: '',
  223. isRunFinish: '',
  224. },
  225. this.getList()
  226. },
  227. handleDownload() {
  228. window.location.href = process.env.BASE_API + '/warehouse-out/export';
  229. },
  230. handleCreate() {
  231. this.$router.push({
  232. name: 'retrievalAdd',
  233. // params: { callback: this.getList }
  234. })
  235. },
  236. getList() {
  237. this.listLoading = true
  238. listRetrieval(this.listQuery).then(response => {
  239. this.list = response.data.data.items
  240. this.total = response.data.data.total
  241. this.listLoading = false
  242. }).catch(() => {
  243. this.list = []
  244. this.total = 0
  245. this.listLoading = false
  246. })
  247. },
  248. handleFilter() {
  249. this.listQuery.page = 1
  250. this.getList()
  251. },
  252. handleSizeChange(val) {
  253. this.listQuery.limit = val
  254. this.getList()
  255. },
  256. handleCurrentChange(val) {
  257. this.listQuery.page = val
  258. this.getList()
  259. },
  260. handleUpdate(row) {
  261. this.$router.push({
  262. name: 'retrievalEdit',
  263. params: { id: row.id }
  264. })
  265. },
  266. handleExecute(row) {
  267. this.$confirm('确认发货吗?', '提示', {
  268. confirmButtonText: '确定',
  269. cancelButtonText: '取消',
  270. type: 'warning'
  271. }).then(() => {
  272. executeRetrieval({ ids: row.id }).then(response => {
  273. this.$notify({
  274. title: '成功',
  275. message: '发货成功',
  276. type: 'success',
  277. duration: 2000
  278. })
  279. this.getList()
  280. })
  281. }).catch(() => { })
  282. },
  283. executeAll() {
  284. const length = this.multipleSelection.length;
  285. if (length > 0) {
  286. this.$confirm("确认发货吗?", "提示", {
  287. confirmButtonText: "确定",
  288. cancelButtonText: "取消",
  289. type: "warning",
  290. }).then(() => {
  291. for (let i = 0; i < length; i++) {
  292. this.delarr.push(this.multipleSelection[i].id);
  293. }
  294. const ids = this.delarr.join(",");
  295. executeRetrieval({ ids: ids }).then(() => {
  296. this.$notify({
  297. title: "成功",
  298. message: "发货成功",
  299. type: "success",
  300. duration: 2000,
  301. });
  302. this.getList();
  303. })
  304. })
  305. } else {
  306. this.$notify({
  307. title: "提示",
  308. message: "请选择要发货的信息!",
  309. type: "warning",
  310. });
  311. }
  312. },
  313. handleDelete(row) {
  314. this.$confirm('确认删除吗?', '提示', {
  315. confirmButtonText: '确定',
  316. cancelButtonText: '取消',
  317. type: 'warning'
  318. }).then(() => {
  319. deleteRetrieval({ ids: row.id }).then(response => {
  320. this.$notify({
  321. title: '成功',
  322. message: '删除成功',
  323. type: 'success',
  324. duration: 2000
  325. })
  326. this.getList()
  327. })
  328. }).catch(() => { })
  329. },
  330. delAll() {
  331. const length = this.multipleSelection.length;
  332. if (length > 0) {
  333. this.$confirm("确认删除吗?", "提示", {
  334. confirmButtonText: "确定",
  335. cancelButtonText: "取消",
  336. type: "warning",
  337. }).then(() => {
  338. for (let i = 0; i < length; i++) {
  339. this.delarr.push(this.multipleSelection[i].id);
  340. }
  341. const ids = this.delarr.join(",");
  342. deleteRetrieval({ ids: ids }).then(() => {
  343. this.$notify({
  344. title: "成功",
  345. message: "删除成功",
  346. type: "success",
  347. duration: 2000,
  348. });
  349. this.getList();
  350. })
  351. })
  352. } else {
  353. this.$notify({
  354. title: "提示",
  355. message: "请选择要删除的信息!",
  356. type: "warning",
  357. });
  358. }
  359. },
  360. handleSelectionChange(val) {
  361. this.multipleSelection = val;
  362. },
  363. }
  364. }
  365. </script>