index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="100px">
  4. <el-form-item label="入库单号" prop="asnNo">
  5. <el-input
  6. v-model="queryParams.asnNo"
  7. placeholder="请输入入库单号"
  8. clearable
  9. size="small"
  10. @keyup.enter.native="handleQuery"
  11. />
  12. </el-form-item>
  13. <el-form-item label="入库类型" prop="asnType">
  14. <el-select v-model="queryParams.asnType" placeholder="请选择入库类型" clearable size="small">
  15. <el-option
  16. v-for="dict in dict.type.asn_type"
  17. :key="dict.value"
  18. :label="dict.label"
  19. :value="dict.value"
  20. />
  21. </el-select>
  22. </el-form-item>
  23. <el-form-item label="单据状态" prop="asnStatus">
  24. <el-select v-model="queryParams.asnStatus" placeholder="请选择单据状态" clearable size="small">
  25. <el-option
  26. v-for="dict in dict.type.asn_status"
  27. :key="dict.value"
  28. :label="dict.label"
  29. :value="dict.value"
  30. />
  31. </el-select>
  32. </el-form-item>
  33. <el-form-item label="采购单号" prop="asnReference1">
  34. <el-input
  35. v-model="queryParams.asnReference1"
  36. placeholder="请输入采购单号"
  37. clearable
  38. size="small"
  39. @keyup.enter.native="handleQuery"
  40. />
  41. </el-form-item>
  42. <el-form-item label="预期到货时间" prop="expectedArriveTime">
  43. <el-date-picker clearable size="small"
  44. v-model="queryParams.expectedArriveTime"
  45. type="date"
  46. value-format="yyyy-MM-dd"
  47. placeholder="选择预期到货时间">
  48. </el-date-picker>
  49. </el-form-item>
  50. <el-form-item label="创建时间">
  51. <el-date-picker
  52. v-model="dateRange"
  53. size="small"
  54. style="width: 240px"
  55. value-format="yyyy-MM-dd"
  56. type="daterange"
  57. range-separator="-"
  58. start-placeholder="开始日期"
  59. end-placeholder="结束日期"
  60. ></el-date-picker>
  61. </el-form-item>
  62. <el-form-item>
  63. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  64. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  65. </el-form-item>
  66. </el-form>
  67. <el-row :gutter="10" class="mb8">
  68. <el-col :span="1.5">
  69. <el-button
  70. type="primary"
  71. plain
  72. icon="el-icon-plus"
  73. size="mini"
  74. @click="handleAdd"
  75. v-hasPermi="['docAsn:docAsn:add']"
  76. >新增</el-button>
  77. </el-col>
  78. <el-col :span="1.5">
  79. <el-button
  80. type="danger"
  81. plain
  82. icon="el-icon-delete"
  83. size="mini"
  84. :disabled="multiple"
  85. @click="handleDelete"
  86. v-hasPermi="['docAsn:docAsn:remove']"
  87. >删除</el-button>
  88. </el-col>
  89. <el-col :span="1.5">
  90. <el-button
  91. type="warning"
  92. plain
  93. icon="el-icon-download"
  94. size="mini"
  95. @click="handleExport"
  96. v-hasPermi="['docAsn:docAsn:export']"
  97. >导出</el-button>
  98. </el-col>
  99. <el-col :span="1.5">
  100. <el-button
  101. type="danger"
  102. plain
  103. icon="el-icon-message"
  104. size="mini"
  105. :disabled="multiple"
  106. @click="handlePush"
  107. v-hasPermi="['docAsn:docAsn:push']"
  108. >发送</el-button>
  109. </el-col>
  110. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  111. </el-row>
  112. <el-table v-loading="loading" :data="docAsnList" @selection-change="handleSelectionChange">
  113. <el-table-column type="selection" width="55" align="center" />
  114. <el-table-column label="入库单号" align="center" prop="asnNo" />
  115. <el-table-column label="入库类型" align="center" prop="asnType">
  116. <template slot-scope="scope">
  117. <dict-tag :options="dict.type.asn_type" :value="scope.row.asnType"/>
  118. </template>
  119. </el-table-column>
  120. <el-table-column label="单据状态" align="center" prop="asnStatus">
  121. <template slot-scope="scope">
  122. <dict-tag :options="dict.type.asn_status" :value="scope.row.asnStatus"/>
  123. </template>
  124. </el-table-column>
  125. <!--<el-table-column label="客户" align="center" prop="customerId" />-->
  126. <el-table-column label="客户单号" align="center" prop="customerNo" />
  127. <el-table-column label="采购单号" align="center" prop="asnReference1" />
  128. <!--<el-table-column label="asn参考信息" align="center" prop="asnReference2" />-->
  129. <el-table-column label="预期到货时间" align="center" prop="expectedArriveTime" width="180">
  130. <template slot-scope="scope">
  131. <span>{{ parseTime(scope.row.expectedArriveTime, '{y}-{m}-{d}') }}</span>
  132. </template>
  133. </el-table-column>
  134. <el-table-column label="创建时间" align="center" prop="createTime" width="180">
  135. <template slot-scope="scope">
  136. <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d} {h}:{i}:{s}') }}</span>
  137. </template>
  138. </el-table-column>
  139. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  140. <template slot-scope="scope">
  141. <el-button
  142. size="mini"
  143. type="text"
  144. icon="el-icon-view"
  145. @click="handleView(scope.row)"
  146. >查看</el-button>
  147. <el-button
  148. size="mini"
  149. type="text"
  150. icon="el-icon-edit"
  151. @click="handleUpdate(scope.row)"
  152. v-hasPermi="['docAsn:docAsn:edit']"
  153. v-if="scope.row.asnStatus != '98' && scope.row.asnStatus != '99' && scope.row.asnStatus != '97'"
  154. >修改</el-button>
  155. <el-button
  156. size="mini"
  157. type="text"
  158. icon="el-icon-delete"
  159. @click="handleDelete(scope.row)"
  160. v-if="scope.row.asnStatus == '00' && scope.row.asnStatus == '97'"
  161. v-hasPermi="['docAsn:docAsn:remove']"
  162. >删除</el-button>
  163. <el-button
  164. size="mini"
  165. type="text"
  166. icon="el-icon-edit"
  167. @click="handleClose(scope.row)"
  168. v-hasPermi="['docAsn:docAsn:close']"
  169. v-if="scope.row.asnStatus != '98' && scope.row.asnStatus != '99' && scope.row.asnStatus != '97'"
  170. >关闭</el-button>
  171. </template>
  172. </el-table-column>
  173. </el-table>
  174. <pagination
  175. v-show="total>0"
  176. :total="total"
  177. :page.sync="queryParams.pageNum"
  178. :limit.sync="queryParams.pageSize"
  179. @pagination="getList"
  180. />
  181. <add-or-update v-if="addOrUpdateVisible" ref="addOrUpdate" @refreshDataList="this.getList"></add-or-update>
  182. </div>
  183. </template>
  184. <script>
  185. import { listDocAsn, getDocAsn, delDocAsn, addDocAsn, updateDocAsn, closeDocAsn,pushDocAsn} from "@/api/docAsn/docAsn";
  186. import AddOrUpdate from './docAsnHeader-add-or-update'
  187. export default {
  188. name: "DocAsn",
  189. dicts: ['asn_status', 'asn_type'],
  190. data() {
  191. return {
  192. // 遮罩层
  193. loading: true,
  194. // 选中数组
  195. ids: [],
  196. // 子表选中数据
  197. checkedWmsDocAsnDetails: [],
  198. // 非单个禁用
  199. single: true,
  200. // 非多个禁用
  201. multiple: true,
  202. // 显示搜索条件
  203. showSearch: true,
  204. // 总条数
  205. total: 0,
  206. // 入库单表格数据
  207. docAsnList: [],
  208. // 入库单体表格数据
  209. wmsDocAsnDetailsList: [],
  210. // 弹出层标题
  211. title: "",
  212. // 是否显示弹出层
  213. open: false,
  214. //明细编辑
  215. addOrUpdateVisible: false,
  216. dateRange: [],
  217. // 查询参数
  218. queryParams: {
  219. pageNum: 1,
  220. pageSize: 10,
  221. asnNo: null,
  222. asnType: null,
  223. asnStatus: null,
  224. asnReference1: null,
  225. asnReference2: null,
  226. releaseStatus: null,
  227. expectedArriveTime: null,
  228. notes: null,
  229. supplierId: null
  230. },
  231. // 表单参数
  232. form: {},
  233. // 表单校验
  234. rules: {
  235. }
  236. };
  237. },
  238. components: {
  239. AddOrUpdate
  240. },
  241. created() {
  242. this.getList();
  243. },
  244. methods: {
  245. /** 查询入库单列表 */
  246. getList() {
  247. this.loading = true;
  248. listDocAsn(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  249. this.docAsnList = response.rows;
  250. this.total = response.total;
  251. this.loading = false;
  252. });
  253. },
  254. // 取消按钮
  255. cancel() {
  256. this.open = false;
  257. this.reset();
  258. },
  259. // 表单重置
  260. reset() {
  261. this.form = {
  262. asnNo: null,
  263. asnType: null,
  264. asnStatus: "0",
  265. customerId: null,
  266. customerNo: null,
  267. asnReference1: null,
  268. asnReference2: null,
  269. releaseStatus: "0",
  270. expectedArriveTime: null,
  271. paNo: null,
  272. qcNo: null,
  273. notes: null,
  274. supplierId: null,
  275. userdefine1: null,
  276. userdefine2: null,
  277. userdefine3: null,
  278. userdefine4: null,
  279. userdefine5: null,
  280. createUserId: null,
  281. createDate: null,
  282. editUserId: null,
  283. editDate: null,
  284. activeFlag: null,
  285. hEdi01: null,
  286. hEdi02: null,
  287. hEdi03: null,
  288. hEdi04: null,
  289. hEdi05: null,
  290. hEdi06: null,
  291. hEdi07: null,
  292. hEdi08: null,
  293. hEdi09: null,
  294. hEdi10: null,
  295. hEdi11: null,
  296. hEdi12: null,
  297. hEdi13: null,
  298. hEdi14: null,
  299. hEdi15: null,
  300. desc2:null
  301. };
  302. this.wmsDocAsnDetailsList = [];
  303. this.resetForm("form");
  304. },
  305. /** 搜索按钮操作 */
  306. handleQuery() {
  307. this.queryParams.pageNum = 1;
  308. this.getList();
  309. },
  310. /** 重置按钮操作 */
  311. resetQuery() {
  312. this.resetForm("queryForm");
  313. this.handleQuery();
  314. },
  315. // 多选框选中数据
  316. handleSelectionChange(selection) {
  317. this.ids = selection.map(item => item.asnNo)
  318. this.single = selection.length!==1
  319. this.multiple = !selection.length
  320. },
  321. /** 新增按钮操作 */
  322. handleAdd() {
  323. this.reset();
  324. this.addOrUpdateVisible = true
  325. this.$nextTick(() => {
  326. this.$refs.addOrUpdate.init('undefine')
  327. })
  328. },
  329. /** 修改按钮操作 */
  330. handleUpdate(row) {
  331. this.reset();
  332. this.addOrUpdateVisible = true
  333. this.$nextTick(() => {
  334. this.$refs.addOrUpdate.init(row.asnNo)
  335. })
  336. },
  337. /** 提交按钮 */
  338. submitForm() {
  339. this.$refs["form"].validate(valid => {
  340. if (valid) {
  341. this.form.wmsDocAsnDetailsList = this.wmsDocAsnDetailsList;
  342. if (this.form.asnNo != null) {
  343. updateDocAsn(this.form).then(response => {
  344. this.$modal.msgSuccess("修改成功");
  345. this.open = false;
  346. this.getList();
  347. });
  348. } else {
  349. addDocAsn(this.form).then(response => {
  350. this.$modal.msgSuccess("新增成功");
  351. this.open = false;
  352. this.getList();
  353. });
  354. }
  355. }
  356. });
  357. },
  358. /** 删除按钮操作 */
  359. handleDelete(row) {
  360. const asnNos = row.asnNo || this.ids;
  361. this.$modal.confirm('是否确认删除入库单编号为"' + asnNos + '"的数据项?').then(function() {
  362. return delDocAsn(asnNos);
  363. }).then(() => {
  364. this.getList();
  365. this.$modal.msgSuccess("删除成功");
  366. }).catch(() => {});
  367. },
  368. /** 发送按钮操作 */
  369. handlePush(row) {
  370. const asnNos = row.asnNo || this.ids;
  371. this.$modal.confirm('是否确认发送入库单编号为"' + asnNos + '"的数据项?').then(function() {
  372. return pushDocAsn(asnNos);
  373. }).then(() => {
  374. this.getList();
  375. this.$modal.msgSuccess("发送成功");
  376. }).catch(() => {});
  377. },
  378. /** 入库单体序号 */
  379. rowWmsDocAsnDetailsIndex({ row, rowIndex }) {
  380. row.index = rowIndex + 1;
  381. },
  382. /** 入库单体添加按钮操作 */
  383. handleAddWmsDocAsnDetails() {
  384. let obj = {};
  385. obj.sku = "";
  386. obj.expectedQty = "";
  387. obj.expectedQtyEach = "";
  388. obj.receivedQty = "";
  389. obj.receivedQtyEach = "";
  390. obj.lineStatus = "";
  391. obj.holdRejectreason = "";
  392. obj.notes = "";
  393. obj.packId = "";
  394. obj.locationZone = "";
  395. obj.lotatt01 = "";
  396. obj.lotatt02 = "";
  397. obj.lotatt03 = "";
  398. obj.lotatt04 = "";
  399. obj.lotatt05 = "";
  400. obj.lotatt06 = "";
  401. obj.lotatt07 = "";
  402. obj.lotatt08 = "";
  403. obj.lotatt09 = "";
  404. obj.lotatt10 = "";
  405. obj.lotatt11 = "";
  406. obj.lotatt12 = "";
  407. obj.lotatt13 = "";
  408. obj.lotatt14 = "";
  409. obj.lotatt15 = "";
  410. obj.lotatt16 = "";
  411. obj.lotatt17 = "";
  412. obj.lotatt18 = "";
  413. obj.createUserId = "";
  414. obj.createDate = "";
  415. obj.editUserId = "";
  416. obj.editDate = "";
  417. obj.locationId = "";
  418. obj.documentId = "";
  419. obj.dEdi01 = "";
  420. obj.dEdi02 = "";
  421. obj.dEdi03 = "";
  422. obj.dEdi04 = "";
  423. obj.dEdi05 = "";
  424. obj.dEdi06 = "";
  425. obj.dEdi07 = "";
  426. obj.dEdi08 = "";
  427. obj.dEdi09 = "";
  428. obj.dEdi10 = "";
  429. obj.dEdi11 = "";
  430. obj.dEdi12 = "";
  431. obj.dEdi13 = "";
  432. obj.dEdi14 = "";
  433. obj.dEdi15 = "";
  434. this.wmsDocAsnDetailsList.push(obj);
  435. },
  436. /** 入库单体删除按钮操作 */
  437. handleDeleteWmsDocAsnDetails() {
  438. if (this.checkedWmsDocAsnDetails.length == 0) {
  439. this.$modal.msgError("请先选择要删除的入库单体数据");
  440. } else {
  441. const wmsDocAsnDetailsList = this.wmsDocAsnDetailsList;
  442. const checkedWmsDocAsnDetails = this.checkedWmsDocAsnDetails;
  443. this.wmsDocAsnDetailsList = wmsDocAsnDetailsList.filter(function(item) {
  444. return checkedWmsDocAsnDetails.indexOf(item.index) == -1
  445. });
  446. }
  447. },
  448. /** 复选框选中数据 */
  449. handleWmsDocAsnDetailsSelectionChange(selection) {
  450. this.checkedWmsDocAsnDetails = selection.map(item => item.index)
  451. },
  452. /** 导出按钮操作 */
  453. handleExport() {
  454. this.download('docAsn/docAsn/export', {
  455. ...this.queryParams
  456. }, `docAsn_${new Date().getTime()}.xlsx`)
  457. },
  458. handleClose(row) {
  459. this.$modal.confirm('是否确认关闭入库单编号为"' + row.asnNo + '"的数据项?').then(function() {
  460. return closeDocAsn(row.asnNo);
  461. }).then(() => {
  462. this.getList();
  463. this.$modal.msgSuccess("删除成功");
  464. }).catch(() => {});
  465. },
  466. handleView(row) {
  467. this.addOrUpdateVisible = true
  468. this.$refs.addOrUpdate.init(row.asnNo, true)
  469. }
  470. }
  471. };
  472. </script>