details.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <div>
  3. <FullPage
  4. :title="$route.query.type == 2 ? '发货详情' : '包装详情'"
  5. :list="setList"
  6. @init="init"
  7. :logList="logList"
  8. :loading="loading"
  9. @searchData="init"
  10. @changePage="changePage"
  11. @changeSize="changeSize"
  12. @selectTable="selectTable"
  13. :tableColums="tableColums"
  14. :tableData="tableData"
  15. :pageIndex="pageIndex"
  16. :total="total"
  17. >
  18. <div slot="titleButton">
  19. <Button
  20. v-if="$route.query.type == 2"
  21. @click="handleOrderReturn(selects)"
  22. type="primary"
  23. style="margin-right:10px;"
  24. >批量退回</Button
  25. >
  26. <Button @click="back" type="primary" ghost style="margin-right:10px;"
  27. >返回</Button
  28. >
  29. <Button
  30. v-if="$route.query.type == 2"
  31. @click="exportData"
  32. type="warning"
  33. ghost
  34. style="margin-right:10px;"
  35. >待出库清单打印</Button
  36. >
  37. <Button
  38. v-if="$route.query.type == 4"
  39. @click="confirmSuccess(selects)"
  40. type="success"
  41. ghost
  42. style="margin-right:10px;"
  43. >批量包装完成</Button
  44. >
  45. <Button
  46. v-if="$route.query.type == 4"
  47. type="warning"
  48. ghost
  49. @click="outStock(selects_out)"
  50. >批量发货指令</Button
  51. >
  52. <Button
  53. v-if="$route.query.type == 2"
  54. @click="outShip(selects, 1)"
  55. type="success"
  56. ghost
  57. style="margin-right:10px;"
  58. >批量确认出库</Button
  59. >
  60. <Button
  61. v-if="$route.query.type == 2"
  62. @click="outShip(selects, 2)"
  63. type="success"
  64. ghost
  65. style="margin-right:10px;"
  66. >批量运输</Button
  67. >
  68. </div>
  69. <template slot-scope="{ row }" slot="set">
  70. <!-- <a
  71. v-if="$route.query.type == 4"
  72. class="map-margin"
  73. :disabled="row.order_in_no"
  74. @click="confirmSuccess(row)"
  75. >确认入库</a
  76. >
  77. <a
  78. v-if="$route.query.type == 4"
  79. class="map-margin"
  80. :disabled="row.in_out_value == 1"
  81. @click="outStock(row)"
  82. >出库</a
  83. >
  84. <a
  85. v-if="$route.query.type == 2 && !row.in_out_value"
  86. class="map-margin"
  87. @click="outShip(row, 1)"
  88. >确认出库</a
  89. >
  90. <a
  91. v-if="$route.query.type == 2 && row.transport_no"
  92. class="map-margin"
  93. @click="row.sub_state != 3 ? outShip(row, 2) : ''"
  94. >{{ row.sub_state != 3 ? "运输" : "" }}</a
  95. > -->
  96. <a
  97. class="map-margin"
  98. v-if="row.in_out_value !== 1"
  99. @click="outShip(row,3)"
  100. >包装完成</a
  101. >
  102. <a
  103. class="map-margin"
  104. @click="row.sub_state != 3 ? outShip(row, 2) : ''"
  105. >{{ row.sub_state != 3 ? "发货指令" : "" }}</a
  106. >
  107. </template>
  108. <Modal
  109. class-name="vertical-center-modal"
  110. width="400"
  111. title="确认出库"
  112. v-model="showStock"
  113. @on-ok="confirmOutStock"
  114. >
  115. <Form :label-width="100">
  116. <FormItem label="选择人员">
  117. <Select clearable v-model="info.user_id">
  118. <Option
  119. v-for="item of users"
  120. :key="item.id"
  121. :value="item.id"
  122. :label="item.nickname"
  123. ></Option>
  124. </Select>
  125. </FormItem>
  126. <FormItem label="出库日期">
  127. <DatePicker
  128. :options="options"
  129. v-model="time"
  130. clearable
  131. type="date"
  132. placeholder="请选择日期"
  133. ></DatePicker>
  134. </FormItem>
  135. <FormItem label="点工单形式">
  136. <RadioGroup v-model="info.work_type">
  137. <Radio :label="1">是</Radio>
  138. <Radio :label="2">否</Radio>
  139. </RadioGroup>
  140. </FormItem>
  141. <FormItem label="日薪" v-if="info.work_type == 1">
  142. <Input v-model="info.user_salary">
  143. <span slot="append">元</span>
  144. </Input>
  145. </FormItem>
  146. </Form>
  147. </Modal>
  148. </FullPage>
  149. </div>
  150. </template>
  151. <script>
  152. import { mapActions } from "vuex";
  153. export default {
  154. data() {
  155. return {
  156. list: [
  157. {
  158. title: "楼幢",
  159. name: "Select",
  160. multiple: true,
  161. filterable: true,
  162. serverName: "house",
  163. placeholder: "请选择楼幢",
  164. value: "",
  165. option: [{ label: 1, value: 1 }],
  166. },
  167. {
  168. title: "单元",
  169. name: "Select",
  170. multiple: true,
  171. filterable: true,
  172. serverName: "unit",
  173. placeholder: "请选择单元",
  174. value: "",
  175. option: [{ label: 1, value: 1 }],
  176. },
  177. {
  178. title: "楼层",
  179. name: "Select",
  180. multiple: true,
  181. filterable: true,
  182. serverName: "layer",
  183. placeholder: "请选择楼层",
  184. value: "",
  185. option: [{ label: 1, value: 1 }],
  186. },
  187. {
  188. title: "房间",
  189. name: "Select",
  190. multiple: true,
  191. filterable: true,
  192. serverName: "number_detail",
  193. placeholder: "请选择房间",
  194. value: "",
  195. option: [{ label: 1, value: 1 }],
  196. },
  197. {
  198. title: "产品",
  199. name: "Select",
  200. serverName: "product",
  201. placeholder: "请选择产品",
  202. value: "",
  203. option: [],
  204. },
  205. {
  206. title: "图号",
  207. name: "Select",
  208. serverName: "url_number",
  209. placeholder: "请选择产品",
  210. value: "",
  211. option: [],
  212. },
  213. {
  214. title: "部件",
  215. name: "Select",
  216. serverName: "part",
  217. placeholder: "请选择部件",
  218. value: "",
  219. option: [],
  220. },
  221. {
  222. title: "入库状态",
  223. name: "Select",
  224. serverName: "sub_state",
  225. placeholder: "入库状态",
  226. value: "",
  227. option: [
  228. { label: "未入库", value: 2 },
  229. { label: "已入库", value: 3 },
  230. ],
  231. },
  232. {
  233. title: "出库状态",
  234. name: "Select",
  235. serverName: "in_out_value",
  236. placeholder: "出库状态",
  237. value: "",
  238. option: [
  239. { label: "已出库", value: 1 },
  240. { label: "未出库", value: 0 },
  241. ],
  242. },
  243. ],
  244. logList: [],
  245. tableColums: [
  246. { type: "selection", align: "center", width: "100", fixed: "left" },
  247. {
  248. title: "房号",
  249. align: "center",
  250. minWidth: 100,
  251. key: "number_detail",
  252. render: (h, params) => {
  253. const { row } = params;
  254. return h(
  255. "span",
  256. `${row.house}-${row.unit}-${row.layer}-${row.number_detail}`
  257. );
  258. },
  259. },
  260. {
  261. title: "产品名称",
  262. align: "center",
  263. minWidth: 200,
  264. key: "product_title",
  265. },
  266. { title: "图号", align: "center", minWidth: 200, key: "url_number" },
  267. { title: "部件", align: "center", minWidth: 200, key: "part_title" },
  268. {
  269. title: "零部件",
  270. align: "center",
  271. minWidth: 200,
  272. key: "part_detail_title",
  273. },
  274. this.$route.query.type == 4
  275. ? {
  276. title: "包装码",
  277. align: "center",
  278. minWidth: 200,
  279. key: "order_in_no",
  280. }
  281. : {
  282. title: "运输单号",
  283. align: "center",
  284. minWidth: 200,
  285. key: "transport_no",
  286. },
  287. { title: "单位", align: "center", minWidth: 100, key: "company" },
  288. {
  289. title: "状态",
  290. align: "center",
  291. minWidth: 200,
  292. key: "",
  293. render: (h, params) =>
  294. h(
  295. "span",
  296. {},
  297. params.row.sub_state == 0
  298. ? "未指派"
  299. : params.row.sub_state == 1
  300. ? "可以派工"
  301. : params.row.sub_state == 2
  302. ? "已派工"
  303. : "已完成"
  304. ),
  305. },
  306. {
  307. title: this.$route.query.type == 2 ? "确认出库状态" : "出库状态",
  308. align: "center",
  309. minWidth: 200,
  310. render: (h, params) =>
  311. h(
  312. "span",
  313. params.row.in_out_value == 1
  314. ? this.$route.query.type == 2
  315. ? "已确认"
  316. : "已出库"
  317. : this.$route.query.type == 2
  318. ? "未确认"
  319. : "未出库"
  320. ),
  321. },
  322. { title: "芯片编号", align: "center", minWidth: 200, key: "chip" },
  323. this.$route.query.type == 2
  324. ? {
  325. title: "运输状态",
  326. align: "center",
  327. minWidth: 200,
  328. render: (h, params) =>
  329. h(
  330. "span",
  331. params.row.transportation_value == 1 ? "已确认" : "未确认"
  332. ),
  333. }
  334. : {},
  335. {
  336. title: "操作",
  337. align: "center",
  338. width: "150",
  339. fixed: "right",
  340. slot: "set",
  341. },
  342. ],
  343. tableData: [],
  344. pageIndex: 1,
  345. total: 0,
  346. pageSize: 10,
  347. loading: false,
  348. selectedReturnArr:[],
  349. selects: [],
  350. selects_out: [],
  351. showStock: false,
  352. info: {
  353. user_id: "",
  354. work_type: 2,
  355. order_in_no: "",
  356. start_time: "",
  357. end_time: "",
  358. user_salary: "",
  359. },
  360. users: [],
  361. time: "",
  362. shipArray: [],
  363. options: {
  364. disabledDate(date) {
  365. return date && date.valueOf() < Date.now() - 86400000;
  366. },
  367. },
  368. };
  369. },
  370. computed: {
  371. setList() {
  372. const { type } = this.$route.query;
  373. if (type == 2) {
  374. const result = [
  375. {
  376. title: "运输单号",
  377. name: "Input",
  378. serverName: "transport_no",
  379. value: "",
  380. placeholder: "运输单号",
  381. },
  382. {
  383. title: "确认出库状态",
  384. name: "Select",
  385. serverName: "in_out_value",
  386. value: "",
  387. option: [
  388. { label: "未确认", value: 0 },
  389. { label: "已确认", value: 1 },
  390. ],
  391. },
  392. {
  393. title: "确认运输状态",
  394. name: "Select",
  395. serverName: "transportation_value",
  396. value: "",
  397. option: [
  398. { label: "未确认", value: 0 },
  399. { label: "已确认", value: 1 },
  400. ],
  401. },
  402. ];
  403. this.list = this.list.concat(result);
  404. }
  405. return this.list;
  406. },
  407. },
  408. created() {
  409. this.getOptions();
  410. },
  411. methods: {
  412. init(row) {
  413. this.axios("/api/user").then((res) => (this.users = res.data.data));
  414. this.pageIndex = 1;
  415. row.page_index = this.pageIndex;
  416. row.page_size = this.pageSize;
  417. if (this.func.isType(row.house) == "Array") {
  418. row.house = row.house.join(",");
  419. }
  420. if (this.func.isType(row.unit) == "Array") {
  421. row.unit = row.unit.join(",");
  422. }
  423. if (this.func.isType(row.layer) == "Array") {
  424. row.layer = row.layer.join(",");
  425. }
  426. if (this.func.isType(row.number_detail) == "Array") {
  427. row.number_detail = row.number_detail.join(",");
  428. }
  429. if (this.func.isType(row.product) == "Array") {
  430. row.product = row.product.join(",");
  431. }
  432. if (this.func.isType(row.part) == "Array") {
  433. row.part = row.part.join(",");
  434. }
  435. Object.assign(row, this.$route.query);
  436. this.proxyObj = row;
  437. this.getData(row);
  438. },
  439. getOptions() {
  440. this.axios("/api/orders_list_detail", {
  441. params: { order_no: this.$route.query.order_no ,type:this.$route.query.type},
  442. }).then((res) => {
  443. res.data.house.map((v) => {
  444. v.value = v.house;
  445. v.label = v.house;
  446. });
  447. res.data.unit.map((v) => {
  448. v.value = v.unit;
  449. v.label = v.unit;
  450. });
  451. res.data.layer.map((v) => {
  452. v.value = v.layer;
  453. v.label = v.layer;
  454. });
  455. res.data.number_detail.map((v) => {
  456. v.value = v.number;
  457. v.label = v.number;
  458. });
  459. res.data.product_title.map((v) => {
  460. (v.value = v.title), (v.label = v.title);
  461. });
  462. res.data.part_title.map((v) => {
  463. (v.value = v.title), (v.label = v.title);
  464. });
  465. res.data.url_number.map(v=>{
  466. (v.value=v.url_number),(v.label = v.url_number);
  467. })
  468. this.list[0].option = res.data.house;
  469. this.list[1].option = res.data.unit;
  470. this.list[2].option = res.data.layer;
  471. this.list[3].option = res.data.number_detail;
  472. this.list[4].option = res.data.product_title;
  473. this.list[5].option = res.data.url_number;
  474. this.list[6].option = res.data.part_title;
  475. });
  476. },
  477. getData(row) {
  478. this.loading = true;
  479. this.axios("/api/orders_list_detail", { params: row }).then((res) => {
  480. this.loading = false;
  481. this.tableData = res.data.data;
  482. this.logList = res.data.detail;
  483. this.total = res.data.total || 0;
  484. });
  485. },
  486. changePage(e) {
  487. this.pageIndex = e;
  488. this.proxyObj.page_index = e;
  489. this.getData(this.proxyObj);
  490. },
  491. changeSize(e) {
  492. this.pageSize = e;
  493. this.proxyObj.page_size = this.pageSize;
  494. this.getData(this.proxyObj);
  495. },
  496. back() {
  497. this.$router.go(-1);
  498. },
  499. handleOrderReturn(row) {
  500. let params = [];
  501. if (!this.selectedReturnArr || this.selectedReturnArr.length < 1) {
  502. return this.$Message.error("请至少选择一项");
  503. }
  504. params = this.selectedReturnArr.map((v) => {
  505. return v.chip;
  506. });
  507. this.$Modal.confirm({
  508. title: "确认退回?",
  509. content: "此操作无法恢复,请确认!",
  510. onOk: () => {
  511. this.axios({
  512. method: "post",
  513. url: "/api/transport_callback",
  514. data: {
  515. tag: params,
  516. },
  517. }).then((res) => {
  518. if (res.code == 200) {
  519. this.$Message.success(res.msg);
  520. this.getData(this.proxyObj);
  521. }
  522. });
  523. },
  524. onCancel: () => {},
  525. });
  526. },
  527. selectTable(row) {
  528. this.selectedReturnArr = row
  529. let result = [],
  530. outResult = [];
  531. if (this.$route.query.type == 2) {
  532. row.map((v) => {
  533. v.id ? result.push(v.id) : "";
  534. v.order_in_no ? outResult.push(v.order_in_no) : "";
  535. });
  536. } else {
  537. row.map((v) => {
  538. v.orders_procedure_id ? result.push(v.orders_procedure_id) : "";
  539. v.order_in_no ? outResult.push(v.order_in_no) : "";
  540. });
  541. }
  542. this.selects = result || [];
  543. this.selects_out = outResult || [];
  544. },
  545. confirmSuccess(row) {
  546. let params = "";
  547. if (!row || row.length < 1) {
  548. return this.$Message.error("请至少选择一项");
  549. }
  550. params = Array.isArray(row) ? row.join(",") : row.orders_procedure_id;
  551. this.confirmDelete({
  552. title: "确认入库",
  553. content: "确认入库?",
  554. type: "primary",
  555. then: () => {
  556. this.axios
  557. .post("/api/orders_in", { orders_procedure_id: params })
  558. .then((res) => {
  559. if (res.code == 200) {
  560. this.$Message.success(res.msg);
  561. this.getData(this.proxyObj);
  562. }
  563. });
  564. },
  565. cancel: () => {
  566. this.$Message.warning("您取消了确认入库操作");
  567. },
  568. });
  569. },
  570. outStock(row) {
  571. console.log("row :>> ", row);
  572. if (!row || row.length < 1) {
  573. return this.$Message.error("您未选择或者未确认入库");
  574. }
  575. this.info.order_in_no = Array.isArray(row)
  576. ? row.join(",")
  577. : row.order_in_no;
  578. this.showStock = true;
  579. },
  580. confirmOutStock() {
  581. if (this.time) {
  582. this.info.start_time = new Date(this.time)
  583. .toLocaleDateString()
  584. .replace(/\//g, "-");
  585. this.info.end_time = new Date(this.time)
  586. .toLocaleDateString()
  587. .replace(/\//g, "-");
  588. }
  589. this.axios.post("/api/orders_out", this.info).then((res) => {
  590. if (res.code == 200) {
  591. this.$Message.success(res.msg);
  592. this.getData(this.proxyObj);
  593. // setTimeout(()=>this.back(),500)
  594. }
  595. });
  596. },
  597. outShip(row, type) {
  598. //type 1出库 2运输
  599. if(type == 3){
  600. this.confirmDelete({
  601. title: "确认出库" ,
  602. content: "确认出库么?" ,
  603. type: "primary",
  604. then: (e) => {
  605. this.axios.post('/api/orders_transport', {transport_no:row.transport_no}).then((res) => {
  606. if (res.code == 200) {
  607. this.$Message.success(res.msg);
  608. this.getData(this.proxyObj);
  609. }
  610. });
  611. },
  612. cancel: (e) => {},
  613. });
  614. }else{
  615. if (!row || row.length < 1) {
  616. return this.$Message.error("请至少选择一项");
  617. }
  618. let id = Array.isArray(row) ? row.join(",") : row.id;
  619. let post_url =
  620. type == 1 ? "/api/orders_transport" : "/api/orders_transport_confirm";
  621. let params = {};
  622. params.id = id;
  623. this.confirmDelete({
  624. title: type == 1 ? "确认出库" : "确认运输",
  625. content: type == 1 ? "确认出库么?" : "确认运输么",
  626. type: "primary",
  627. then: (e) => {
  628. this.axios.post(post_url, params).then((res) => {
  629. if (res.code == 200) {
  630. this.$Message.success(res.msg);
  631. this.getData(this.proxyObj);
  632. }
  633. });
  634. },
  635. cancel: (e) => {},
  636. });}
  637. },
  638. async exportData() {
  639. const res = await this.axios("/api/orders_list_detail", {
  640. params: { ...this.proxyObj, sub_type: "excel" },
  641. });
  642. if (res.code == 200) {
  643. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  644. location.href = url;
  645. }
  646. },
  647. },
  648. };
  649. </script>
  650. <style lang="scss" scoped></style>