disassembly.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349
  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.addHandlerId" clearable filterable placeholder="经手人" class="filter-item" style="width: 200px">
  16. <el-option :key="item.loginId" v-for="item in userSelsctList" :label="item.deptName+'_'+item.userName" :value="item.loginId">
  17. </el-option>
  18. </el-select>
  19. <el-select v-model="listQuery.isRunFinish" clearable placeholder="拆卸状态" class="filter-item" style="width: 200px">
  20. <el-option :key="item.type" v-for="item in typeList" :label="item.name" :value="item.type">
  21. </el-option>
  22. </el-select>
  23. <el-input v-model="listQuery.assembleProductName" clearable placeholder="拆卸商品名称" class="filter-item" style="width: 200px;" >
  24. </el-input>
  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: 'disassemblyDetail', 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="warehouseName">
  49. </el-table-column>
  50. <el-table-column align="center" min-width="100px" label="经手人" prop="addHandlerName">
  51. </el-table-column>
  52. <el-table-column align="center" min-width="200px" label="拆卸商品名称" prop="assembleProductName">
  53. </el-table-column>
  54. <el-table-column align="center" min-width="200px" label="拆卸原因" prop="remarks">
  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 { listDisassembly, deleteDisassembly, executeDisassembly, cancelDisassembly } from "@/api/disassembly";
  97. import { warehouseList } from "@/api/warehouse";
  98. import { allUserList } from "@/api/public";
  99. import waves from "@/directive/waves"; // 水波纹指令
  100. export default {
  101. directives: { waves },
  102. data() {
  103. return {
  104. cancelId: '',
  105. dialogFormVisible: false,
  106. dataForm: {
  107. cancelMsg: ''
  108. },
  109. rules: {
  110. cancelMsg: [{ required: true, message: "作废原因不能为空", trigger: "blur" }],
  111. },
  112. warehouseList: [],
  113. userSelsctList:[],
  114. typeList: [
  115. {
  116. type: '0',
  117. name: "已拆卸",
  118. },
  119. {
  120. type: '1',
  121. name: "待拆卸",
  122. },
  123. {
  124. type: '2',
  125. name: "已作废",
  126. },
  127. ],
  128. list: [
  129. ],
  130. delarr: [],
  131. multipleSelection: [],
  132. total: 0,
  133. listLoading: false,
  134. listQuery: {
  135. page: 1,
  136. limit: 10,
  137. startDate: '',
  138. endDate: '',
  139. warehouseId: '',
  140. addHandlerId: '',
  141. isRunFinish: '',
  142. assembleProductName:'',
  143. },
  144. }
  145. },
  146. created() {
  147. this.getStoreList();
  148. this.getAllUserList();
  149. this.getList();
  150. },
  151. methods: {
  152. handleCancelShow(id) {
  153. this.dialogFormVisible = true;
  154. this.cancelId = id;
  155. this.$nextTick(() => {
  156. this.dataForm.cancelMsg = '';
  157. this.$refs["dataForm"].clearValidate();
  158. });
  159. },
  160. handleCancel() {
  161. this.$refs["dataForm"].validate((valid) => {
  162. if (valid) {
  163. cancelDisassembly({ id: this.cancelId, cancelMsg: this.dataForm.cancelMsg }).then(() => {
  164. this.dialogFormVisible = false;
  165. this.$notify({
  166. title: "成功",
  167. message: "操作成功",
  168. type: "success",
  169. duration: 2000,
  170. });
  171. this.getList();
  172. });
  173. }
  174. })
  175. },
  176. /** 获取仓库列表数据 */
  177. getStoreList() {
  178. warehouseList().then(response => {
  179. this.warehouseList = response.data.data;
  180. }).catch(() => { });
  181. },
  182. /** 获取人员列表数据 */
  183. getAllUserList() {
  184. allUserList().then(response => {
  185. this.userSelsctList = response.data.data;
  186. }).catch(() => { });
  187. },
  188. /** 重置按钮操作 */
  189. resetQuery() {
  190. this.listQuery = {
  191. page: 1,
  192. limit: 10,
  193. startDate: '',
  194. endDate: '',
  195. warehouseId: '',
  196. addHandlerId: '',
  197. isRunFinish: '',
  198. assembleProductName:'',
  199. },
  200. this.getList()
  201. },
  202. handleDownload() {
  203. window.location.href = process.env.BASE_API + '/warehouse-disassembly/export';
  204. },
  205. handleCreate() {
  206. this.$router.push({
  207. name: 'disassemblyAdd',
  208. // params: { callback: this.getList }
  209. })
  210. },
  211. getList() {
  212. this.listLoading = true
  213. listDisassembly(this.listQuery).then(response => {
  214. this.list = response.data.data.items
  215. this.total = response.data.data.total
  216. this.listLoading = false
  217. }).catch(() => {
  218. this.list = []
  219. this.total = 0
  220. this.listLoading = false
  221. })
  222. },
  223. handleFilter() {
  224. this.listQuery.page = 1
  225. this.getList()
  226. },
  227. handleSizeChange(val) {
  228. this.listQuery.limit = val
  229. this.getList()
  230. },
  231. handleCurrentChange(val) {
  232. this.listQuery.page = val
  233. this.getList()
  234. },
  235. handleUpdate(row) {
  236. this.$router.push({
  237. name: 'disassemblyEdit',
  238. params: { id: row.id }
  239. })
  240. },
  241. handleExecute(row) {
  242. this.$confirm('确认拆卸吗?', '提示', {
  243. confirmButtonText: '确定',
  244. cancelButtonText: '取消',
  245. type: 'warning'
  246. }).then(() => {
  247. executeDisassembly({ ids: row.id }).then(response => {
  248. this.$notify({
  249. title: '成功',
  250. message: '拆卸成功',
  251. type: 'success',
  252. duration: 2000
  253. })
  254. this.getList()
  255. })
  256. }).catch(() => { })
  257. },
  258. executeAll() {
  259. const length = this.multipleSelection.length;
  260. if (length > 0) {
  261. this.$confirm("确认拆卸吗?", "提示", {
  262. confirmButtonText: "确定",
  263. cancelButtonText: "取消",
  264. type: "warning",
  265. }).then(() => {
  266. for (let i = 0; i < length; i++) {
  267. this.delarr.push(this.multipleSelection[i].id);
  268. }
  269. const ids = this.delarr.join(",");
  270. executeDisassembly({ ids: ids }).then(() => {
  271. this.$notify({
  272. title: "成功",
  273. message: "拆卸成功",
  274. type: "success",
  275. duration: 2000,
  276. });
  277. this.getList();
  278. })
  279. })
  280. } else {
  281. this.$notify({
  282. title: "提示",
  283. message: "请选择要拆卸的信息!",
  284. type: "warning",
  285. });
  286. }
  287. },
  288. handleDelete(row) {
  289. this.$confirm('确认删除吗?', '提示', {
  290. confirmButtonText: '确定',
  291. cancelButtonText: '取消',
  292. type: 'warning'
  293. }).then(() => {
  294. deleteDisassembly({ ids: row.id }).then(response => {
  295. this.$notify({
  296. title: '成功',
  297. message: '删除成功',
  298. type: 'success',
  299. duration: 2000
  300. })
  301. this.getList()
  302. })
  303. }).catch(() => { })
  304. },
  305. delAll() {
  306. const length = this.multipleSelection.length;
  307. if (length > 0) {
  308. this.$confirm("确认删除吗?", "提示", {
  309. confirmButtonText: "确定",
  310. cancelButtonText: "取消",
  311. type: "warning",
  312. }).then(() => {
  313. for (let i = 0; i < length; i++) {
  314. this.delarr.push(this.multipleSelection[i].id);
  315. }
  316. const ids = this.delarr.join(",");
  317. deleteDisassembly({ ids: ids }).then(() => {
  318. this.$notify({
  319. title: "成功",
  320. message: "删除成功",
  321. type: "success",
  322. duration: 2000,
  323. });
  324. this.getList();
  325. })
  326. })
  327. } else {
  328. this.$notify({
  329. title: "提示",
  330. message: "请选择要删除的信息!",
  331. type: "warning",
  332. });
  333. }
  334. },
  335. handleSelectionChange(val) {
  336. this.multipleSelection = val;
  337. },
  338. }
  339. }
  340. </script>