index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="主键" prop="allocationId">
  5. <el-input
  6. v-model="queryParams.allocationId"
  7. placeholder="请输入主键"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="出库单号" prop="orderNo">
  14. <el-input
  15. v-model="queryParams.orderNo"
  16. placeholder="请输入出库单号"
  17. clearable
  18. size="small"
  19. @keyup.enter.native="handleQuery"
  20. />
  21. </el-form-item>
  22. <el-form-item label="状态" prop="status">
  23. <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
  24. <el-option
  25. v-for="dict in dict.type.so_status"
  26. :key="dict.value"
  27. :label="dict.label"
  28. :value="dict.value"
  29. />
  30. </el-select>
  31. </el-form-item>
  32. <el-form-item label="创建时间">
  33. <el-date-picker
  34. v-model="dateRange"
  35. size="small"
  36. style="width: 240px"
  37. value-format="yyyy-MM-dd"
  38. type="daterange"
  39. range-separator="-"
  40. start-placeholder="开始日期"
  41. end-placeholder="结束日期"
  42. ></el-date-picker>
  43. </el-form-item>
  44. <el-form-item>
  45. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  46. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  47. </el-form-item>
  48. </el-form>
  49. <el-row :gutter="10" class="mb8">
  50. <!--<el-col :span="1.5">
  51. <el-button
  52. type="primary"
  53. plain
  54. icon="el-icon-plus"
  55. size="mini"
  56. @click="handleAdd"
  57. v-hasPermi="['ams:allocation:add']"
  58. >新增</el-button>
  59. </el-col>
  60. <el-col :span="1.5">
  61. <el-button
  62. type="success"
  63. plain
  64. icon="el-icon-edit"
  65. size="mini"
  66. :disabled="single"
  67. @click="handleUpdate"
  68. v-hasPermi="['ams:allocation:edit']"
  69. >修改</el-button>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-button
  73. type="danger"
  74. plain
  75. icon="el-icon-delete"
  76. size="mini"
  77. :disabled="multiple"
  78. @click="handleDelete"
  79. v-hasPermi="['ams:allocation:remove']"
  80. >删除</el-button>
  81. </el-col>-->
  82. <el-col :span="1.5">
  83. <el-button
  84. type="warning"
  85. plain
  86. icon="el-icon-download"
  87. size="mini"
  88. @click="handleExport"
  89. v-hasPermi="['ams:allocation:export']"
  90. >导出</el-button>
  91. </el-col>
  92. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  93. </el-row>
  94. <el-table v-loading="loading" :data="allocationList" @selection-change="handleSelectionChange">
  95. <el-table-column type="selection" width="55" align="center" />
  96. <!--<el-table-column label="主键" align="center" prop="allocationId" />-->
  97. <el-table-column label="出库单号" align="center" prop="orderNo" />
  98. <el-table-column label="行号" align="center" prop="lineNo" />
  99. <el-table-column label="物料" align="center" prop="material" />
  100. <el-table-column label="状态" align="center" prop="status">
  101. <template slot-scope="scope">
  102. <dict-tag :options="dict.type.so_status" :value="scope.row.status"/>
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="分配数量" align="center" prop="qty" />
  106. <el-table-column label="lotnum" align="center" prop="lotnum" />
  107. <el-table-column label="拣货数量" align="center" prop="pickQty" />
  108. <el-table-column label="已拣库位" align="center" prop="pickToLocation" />
  109. <el-table-column label="拣货事务" align="center" prop="pickTransactionId" />
  110. <!--<el-table-column label="待检库位" align="center" prop="locationId" />
  111. <el-table-column label="叫料待检事务id" align="center" prop="callTransactionId" />-->
  112. <el-table-column label="创建时间" align="center" prop="createDate" width="180">
  113. <template slot-scope="scope">
  114. <span>{{ parseTime(scope.row.createDate, '{y}-{m}-{d}') }}</span>
  115. </template>
  116. </el-table-column>
  117. <!--<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  118. <template slot-scope="scope">
  119. <el-button
  120. size="mini"
  121. type="text"
  122. icon="el-icon-edit"
  123. @click="handleUpdate(scope.row)"
  124. v-hasPermi="['ams:allocation:edit']"
  125. >修改</el-button>
  126. <el-button
  127. size="mini"
  128. type="text"
  129. icon="el-icon-delete"
  130. @click="handleDelete(scope.row)"
  131. v-hasPermi="['ams:allocation:remove']"
  132. >删除</el-button>
  133. </template>
  134. </el-table-column>-->
  135. </el-table>
  136. <pagination
  137. v-show="total>0"
  138. :total="total"
  139. :page.sync="queryParams.pageNum"
  140. :limit.sync="queryParams.pageSize"
  141. @pagination="getList"
  142. />
  143. <!-- 添加或修改分配查询对话框 -->
  144. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  145. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  146. <el-form-item label="出库单号" prop="orderNo">
  147. <el-input v-model="form.orderNo" placeholder="请输入出库单号" />
  148. </el-form-item>
  149. <el-form-item label="行号" prop="lineNo">
  150. <el-input v-model="form.lineNo" placeholder="请输入行号" />
  151. </el-form-item>
  152. <el-form-item label="物料" prop="material">
  153. <el-input v-model="form.material" placeholder="请输入物料" />
  154. </el-form-item>
  155. <el-form-item label="待检库位" prop="locationId">
  156. <el-input v-model="form.locationId" placeholder="请输入待检库位" />
  157. </el-form-item>
  158. <el-form-item label="叫料待检事务id" prop="callTransactionId">
  159. <el-input v-model="form.callTransactionId" placeholder="请输入叫料待检事务id" />
  160. </el-form-item>
  161. <el-form-item label="状态">
  162. <el-radio-group v-model="form.status">
  163. <el-radio
  164. v-for="dict in dict.type.so_status"
  165. :key="dict.value"
  166. :label="dict.value"
  167. >{{dict.label}}</el-radio>
  168. </el-radio-group>
  169. </el-form-item>
  170. <el-form-item label="lotnum" prop="lotnum">
  171. <el-input v-model="form.lotnum" placeholder="请输入lotnum" />
  172. </el-form-item>
  173. <el-form-item label="拣货数量" prop="qty">
  174. <el-input v-model="form.qty" placeholder="请输入拣货数量" />
  175. </el-form-item>
  176. <el-form-item label="拣货事务id" prop="pickTransactionId">
  177. <el-input v-model="form.pickTransactionId" placeholder="请输入拣货事务id" />
  178. </el-form-item>
  179. <el-form-item label="拣货库位" prop="pickToLocation">
  180. <el-input v-model="form.pickToLocation" placeholder="请输入拣货库位" />
  181. </el-form-item>
  182. <el-form-item label="${comment}" prop="createUserId">
  183. <el-input v-model="form.createUserId" placeholder="请输入${comment}" />
  184. </el-form-item>
  185. <el-form-item label="${comment}" prop="createDate">
  186. <el-date-picker clearable size="small"
  187. v-model="form.createDate"
  188. type="date"
  189. value-format="yyyy-MM-dd"
  190. placeholder="选择${comment}">
  191. </el-date-picker>
  192. </el-form-item>
  193. <el-form-item label="${comment}" prop="editUserId">
  194. <el-input v-model="form.editUserId" placeholder="请输入${comment}" />
  195. </el-form-item>
  196. <el-form-item label="${comment}" prop="editDate">
  197. <el-date-picker clearable size="small"
  198. v-model="form.editDate"
  199. type="date"
  200. value-format="yyyy-MM-dd"
  201. placeholder="选择${comment}">
  202. </el-date-picker>
  203. </el-form-item>
  204. <el-form-item label="${comment}" prop="userdefine1">
  205. <el-input v-model="form.userdefine1" placeholder="请输入${comment}" />
  206. </el-form-item>
  207. <el-form-item label="${comment}" prop="userdefine2">
  208. <el-input v-model="form.userdefine2" placeholder="请输入${comment}" />
  209. </el-form-item>
  210. <el-form-item label="${comment}" prop="userdefine3">
  211. <el-input v-model="form.userdefine3" placeholder="请输入${comment}" />
  212. </el-form-item>
  213. <el-form-item label="${comment}" prop="userdefine4">
  214. <el-input v-model="form.userdefine4" placeholder="请输入${comment}" />
  215. </el-form-item>
  216. <el-form-item label="拣货数量" prop="pickQty">
  217. <el-input v-model="form.pickQty" placeholder="请输入拣货数量" />
  218. </el-form-item>
  219. </el-form>
  220. <div slot="footer" class="dialog-footer">
  221. <el-button type="primary" @click="submitForm">确 定</el-button>
  222. <el-button @click="cancel">取 消</el-button>
  223. </div>
  224. </el-dialog>
  225. </div>
  226. </template>
  227. <script>
  228. import { listAllocation, getAllocation, delAllocation, addAllocation, updateAllocation } from "@/api/ams/allocation";
  229. export default {
  230. name: "Allocation",
  231. dicts: ['so_status'],
  232. data() {
  233. return {
  234. // 遮罩层
  235. loading: true,
  236. // 选中数组
  237. ids: [],
  238. // 非单个禁用
  239. single: true,
  240. // 非多个禁用
  241. multiple: true,
  242. // 显示搜索条件
  243. showSearch: true,
  244. // 总条数
  245. total: 0,
  246. // 分配查询表格数据
  247. allocationList: [],
  248. // 弹出层标题
  249. title: "",
  250. // 是否显示弹出层
  251. open: false,
  252. dateRange: [],
  253. // 查询参数
  254. queryParams: {
  255. pageNum: 1,
  256. pageSize: 10,
  257. allocationId: null,
  258. orderNo: null,
  259. status: null,
  260. createDate: null,
  261. },
  262. // 表单参数
  263. form: {},
  264. // 表单校验
  265. rules: {
  266. orderNo: [
  267. { required: true, message: "出库单号不能为空", trigger: "blur" }
  268. ],
  269. lineNo: [
  270. { required: true, message: "行号不能为空", trigger: "blur" }
  271. ],
  272. material: [
  273. { required: true, message: "物料不能为空", trigger: "blur" }
  274. ],
  275. locationId: [
  276. { required: true, message: "待检库位不能为空", trigger: "blur" }
  277. ],
  278. }
  279. };
  280. },
  281. created() {
  282. this.getList();
  283. },
  284. methods: {
  285. /** 查询分配查询列表 */
  286. getList() {
  287. this.loading = true;
  288. listAllocation(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  289. this.allocationList = response.rows;
  290. this.total = response.total;
  291. this.loading = false;
  292. });
  293. },
  294. // 取消按钮
  295. cancel() {
  296. this.open = false;
  297. this.reset();
  298. },
  299. // 表单重置
  300. reset() {
  301. this.form = {
  302. allocationId: null,
  303. orderNo: null,
  304. lineNo: null,
  305. material: null,
  306. locationId: null,
  307. callTransactionId: null,
  308. status: "0",
  309. lotnum: null,
  310. qty: null,
  311. pickTransactionId: null,
  312. pickToLocation: null,
  313. createUserId: null,
  314. createDate: null,
  315. editUserId: null,
  316. editDate: null,
  317. userdefine1: null,
  318. userdefine2: null,
  319. userdefine3: null,
  320. userdefine4: null,
  321. pickQty: null
  322. };
  323. this.resetForm("form");
  324. },
  325. /** 搜索按钮操作 */
  326. handleQuery() {
  327. this.queryParams.pageNum = 1;
  328. this.getList();
  329. },
  330. /** 重置按钮操作 */
  331. resetQuery() {
  332. this.resetForm("queryForm");
  333. this.handleQuery();
  334. },
  335. // 多选框选中数据
  336. handleSelectionChange(selection) {
  337. this.ids = selection.map(item => item.allocationId)
  338. this.single = selection.length!==1
  339. this.multiple = !selection.length
  340. },
  341. /** 新增按钮操作 */
  342. handleAdd() {
  343. this.reset();
  344. this.open = true;
  345. this.title = "添加分配查询";
  346. },
  347. /** 修改按钮操作 */
  348. handleUpdate(row) {
  349. this.reset();
  350. const allocationId = row.allocationId || this.ids
  351. getAllocation(allocationId).then(response => {
  352. this.form = response.data;
  353. this.open = true;
  354. this.title = "修改分配查询";
  355. });
  356. },
  357. /** 提交按钮 */
  358. submitForm() {
  359. this.$refs["form"].validate(valid => {
  360. if (valid) {
  361. if (this.form.allocationId != null) {
  362. updateAllocation(this.form).then(response => {
  363. this.$modal.msgSuccess("修改成功");
  364. this.open = false;
  365. this.getList();
  366. });
  367. } else {
  368. addAllocation(this.form).then(response => {
  369. this.$modal.msgSuccess("新增成功");
  370. this.open = false;
  371. this.getList();
  372. });
  373. }
  374. }
  375. });
  376. },
  377. /** 删除按钮操作 */
  378. handleDelete(row) {
  379. const allocationIds = row.allocationId || this.ids;
  380. this.$modal.confirm('是否确认删除分配查询编号为"' + allocationIds + '"的数据项?').then(function() {
  381. return delAllocation(allocationIds);
  382. }).then(() => {
  383. this.getList();
  384. this.$modal.msgSuccess("删除成功");
  385. }).catch(() => {});
  386. },
  387. /** 导出按钮操作 */
  388. handleExport() {
  389. this.download('ams/allocation/export', {
  390. ...this.queryParams
  391. }, `allocation_${new Date().getTime()}.xlsx`)
  392. }
  393. }
  394. };
  395. </script>