assembly.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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: 'assemblyDetail', 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. </template>
  61. </el-table-column>
  62. <el-table-column align="center" label="操作" width="240px" class-name="small-padding fixed-width">
  63. <template slot-scope="scope">
  64. <el-button v-if="scope.row.isRunFinish == '1'" type="success" size="small" @click="handleExecute(scope.row)">组装</el-button>
  65. <el-button v-if="scope.row.isRunFinish == '1'" type="primary" size="small" @click="handleUpdate(scope.row)">编辑</el-button>
  66. <el-button v-if="scope.row.isRunFinish == '1'" type="danger" size="small" @click="handleDelete(scope.row)">删除</el-button>
  67. </template>
  68. </el-table-column>
  69. </el-table>
  70. <!-- 分页 -->
  71. <div class="pagination-container">
  72. <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
  73. :current-page="listQuery.page" :page-sizes="[10, 20, 30, 50]" :page-size="listQuery.limit"
  74. layout="total, sizes, prev, pager, next, jumper" :total="total">
  75. </el-pagination>
  76. </div>
  77. </div>
  78. </template>
  79. <script>
  80. import { listAssembly, deleteAssembly, executeAssembly } from "@/api/assembly";
  81. import { warehouseList } from "@/api/warehouse";
  82. import { allUserList } from "@/api/public";
  83. import waves from "@/directive/waves"; // 水波纹指令
  84. export default {
  85. directives: { waves },
  86. data() {
  87. return {
  88. warehouseList: [],
  89. userSelsctList:[],
  90. typeList: [
  91. {
  92. type: '0',
  93. name: "已组装",
  94. },
  95. {
  96. type: '1',
  97. name: "待组装",
  98. },
  99. ],
  100. list: [
  101. ],
  102. delarr: [],
  103. multipleSelection: [],
  104. total: 0,
  105. listLoading: false,
  106. listQuery: {
  107. page: 1,
  108. limit: 10,
  109. startDate: '',
  110. endDate: '',
  111. warehouseId: '',
  112. addHandlerId: '',
  113. isRunFinish: '',
  114. assembleProductName:'',
  115. },
  116. }
  117. },
  118. created() {
  119. this.getStoreList();
  120. this.getAllUserList();
  121. this.getList();
  122. },
  123. methods: {
  124. /** 获取仓库列表数据 */
  125. getStoreList() {
  126. warehouseList().then(response => {
  127. this.warehouseList = response.data.data;
  128. }).catch(() => { });
  129. },
  130. /** 获取人员列表数据 */
  131. getAllUserList() {
  132. allUserList().then(response => {
  133. this.userSelsctList = response.data.data;
  134. }).catch(() => { });
  135. },
  136. /** 重置按钮操作 */
  137. resetQuery() {
  138. this.listQuery = {
  139. page: 1,
  140. limit: 10,
  141. startDate: '',
  142. endDate: '',
  143. warehouseId: '',
  144. addHandlerId: '',
  145. isRunFinish: '',
  146. assembleProductName:'',
  147. },
  148. this.getList()
  149. },
  150. handleDownload() {
  151. window.location.href = process.env.BASE_API + '/warehouse-assembly/export';
  152. },
  153. handleCreate() {
  154. this.$router.push({
  155. name: 'assemblyAdd',
  156. // params: { callback: this.getList }
  157. })
  158. },
  159. getList() {
  160. this.listLoading = true
  161. listAssembly(this.listQuery).then(response => {
  162. this.list = response.data.data.items
  163. this.total = response.data.data.total
  164. this.listLoading = false
  165. }).catch(() => {
  166. this.list = []
  167. this.total = 0
  168. this.listLoading = false
  169. })
  170. },
  171. handleFilter() {
  172. this.listQuery.page = 1
  173. this.getList()
  174. },
  175. handleSizeChange(val) {
  176. this.listQuery.limit = val
  177. this.getList()
  178. },
  179. handleCurrentChange(val) {
  180. this.listQuery.page = val
  181. this.getList()
  182. },
  183. handleUpdate(row) {
  184. this.$router.push({
  185. name: 'assemblyEdit',
  186. params: { id: row.id }
  187. })
  188. },
  189. handleExecute(row) {
  190. this.$confirm('确认组装吗?', '提示', {
  191. confirmButtonText: '确定',
  192. cancelButtonText: '取消',
  193. type: 'warning'
  194. }).then(() => {
  195. executeAssembly({ ids: row.id }).then(response => {
  196. this.$notify({
  197. title: '成功',
  198. message: '组装成功',
  199. type: 'success',
  200. duration: 2000
  201. })
  202. this.getList()
  203. })
  204. }).catch(() => { })
  205. },
  206. executeAll() {
  207. const length = this.multipleSelection.length;
  208. if (length > 0) {
  209. this.$confirm("确认组装吗?", "提示", {
  210. confirmButtonText: "确定",
  211. cancelButtonText: "取消",
  212. type: "warning",
  213. }).then(() => {
  214. for (let i = 0; i < length; i++) {
  215. this.delarr.push(this.multipleSelection[i].id);
  216. }
  217. const ids = this.delarr.join(",");
  218. executeAssembly({ ids: ids }).then(() => {
  219. this.$notify({
  220. title: "成功",
  221. message: "组装成功",
  222. type: "success",
  223. duration: 2000,
  224. });
  225. this.getList();
  226. })
  227. })
  228. } else {
  229. this.$notify({
  230. title: "提示",
  231. message: "请选择要组装的信息!",
  232. type: "warning",
  233. });
  234. }
  235. },
  236. handleDelete(row) {
  237. this.$confirm('确认删除吗?', '提示', {
  238. confirmButtonText: '确定',
  239. cancelButtonText: '取消',
  240. type: 'warning'
  241. }).then(() => {
  242. deleteAssembly({ ids: row.id }).then(response => {
  243. this.$notify({
  244. title: '成功',
  245. message: '删除成功',
  246. type: 'success',
  247. duration: 2000
  248. })
  249. this.getList()
  250. })
  251. }).catch(() => { })
  252. },
  253. delAll() {
  254. const length = this.multipleSelection.length;
  255. if (length > 0) {
  256. this.$confirm("确认删除吗?", "提示", {
  257. confirmButtonText: "确定",
  258. cancelButtonText: "取消",
  259. type: "warning",
  260. }).then(() => {
  261. for (let i = 0; i < length; i++) {
  262. this.delarr.push(this.multipleSelection[i].id);
  263. }
  264. const ids = this.delarr.join(",");
  265. deleteAssembly({ ids: ids }).then(() => {
  266. this.$notify({
  267. title: "成功",
  268. message: "删除成功",
  269. type: "success",
  270. duration: 2000,
  271. });
  272. this.getList();
  273. })
  274. })
  275. } else {
  276. this.$notify({
  277. title: "提示",
  278. message: "请选择要删除的信息!",
  279. type: "warning",
  280. });
  281. }
  282. },
  283. handleSelectionChange(val) {
  284. this.multipleSelection = val;
  285. },
  286. }
  287. }
  288. </script>