details.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646
  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: "part",
  209. placeholder: "请选择部件",
  210. value: "",
  211. option: [],
  212. },
  213. {
  214. title: "入库状态",
  215. name: "Select",
  216. serverName: "sub_state",
  217. placeholder: "入库状态",
  218. value: "",
  219. option: [
  220. { label: "未指派", value: 0 },
  221. { label: "可以派工", value: 1 },
  222. { label: "已派工", value: 2 },
  223. { label: "已完成", value: 3 },
  224. ],
  225. },
  226. {
  227. title: "出库状态",
  228. name: "Select",
  229. serverName: "in_out_value",
  230. placeholder: "出库状态",
  231. value: "",
  232. option: [
  233. { label: "已出库", value: 1 },
  234. { label: "未出库", value: 0 },
  235. ],
  236. },
  237. ],
  238. logList: [],
  239. tableColums: [
  240. { type: "selection", align: "center", width: "100", fixed: "left" },
  241. {
  242. title: "房号",
  243. align: "center",
  244. minWidth: 100,
  245. key: "number_detail",
  246. render: (h, params) => {
  247. const { row } = params;
  248. return h(
  249. "span",
  250. `${row.house}-${row.unit}-${row.layer}-${row.number_detail}`
  251. );
  252. },
  253. },
  254. {
  255. title: "产品名称",
  256. align: "center",
  257. minWidth: 200,
  258. key: "product_title",
  259. },
  260. { title: "部件", align: "center", minWidth: 200, key: "part_title" },
  261. {
  262. title: "零部件",
  263. align: "center",
  264. minWidth: 200,
  265. key: "part_detail_title",
  266. },
  267. this.$route.query.type == 4
  268. ? {
  269. title: "包装码",
  270. align: "center",
  271. minWidth: 200,
  272. key: "order_in_no",
  273. }
  274. : {
  275. title: "运输单号",
  276. align: "center",
  277. minWidth: 200,
  278. key: "transport_no",
  279. },
  280. { title: "单位", align: "center", minWidth: 100, key: "company" },
  281. {
  282. title: "状态",
  283. align: "center",
  284. minWidth: 200,
  285. key: "",
  286. render: (h, params) =>
  287. h(
  288. "span",
  289. {},
  290. params.row.sub_state == 0
  291. ? "未指派"
  292. : params.row.sub_state == 1
  293. ? "可以派工"
  294. : params.row.sub_state == 2
  295. ? "已派工"
  296. : "已完成"
  297. ),
  298. },
  299. {
  300. title: this.$route.query.type == 2 ? "确认出库状态" : "出库状态",
  301. align: "center",
  302. minWidth: 200,
  303. render: (h, params) =>
  304. h(
  305. "span",
  306. params.row.in_out_value == 1
  307. ? this.$route.query.type == 2
  308. ? "已确认"
  309. : "已出库"
  310. : this.$route.query.type == 2
  311. ? "未确认"
  312. : "未出库"
  313. ),
  314. },
  315. { title: "芯片编号", align: "center", minWidth: 200, key: "chip" },
  316. this.$route.query.type == 2
  317. ? {
  318. title: "运输状态",
  319. align: "center",
  320. minWidth: 200,
  321. render: (h, params) =>
  322. h(
  323. "span",
  324. params.row.transportation_value == 1 ? "已确认" : "未确认"
  325. ),
  326. }
  327. : {},
  328. {
  329. title: "操作",
  330. align: "center",
  331. width: "150",
  332. fixed: "right",
  333. slot: "set",
  334. },
  335. ],
  336. tableData: [],
  337. pageIndex: 1,
  338. total: 0,
  339. pageSize: 10,
  340. loading: false,
  341. selectedReturnArr:[],
  342. selects: [],
  343. selects_out: [],
  344. showStock: false,
  345. info: {
  346. user_id: "",
  347. work_type: 2,
  348. order_in_no: "",
  349. start_time: "",
  350. end_time: "",
  351. user_salary: "",
  352. },
  353. users: [],
  354. time: "",
  355. shipArray: [],
  356. options: {
  357. disabledDate(date) {
  358. return date && date.valueOf() < Date.now() - 86400000;
  359. },
  360. },
  361. };
  362. },
  363. computed: {
  364. setList() {
  365. const { type } = this.$route.query;
  366. if (type == 2) {
  367. const result = [
  368. {
  369. title: "运输单号",
  370. name: "Input",
  371. serverName: "transport_no",
  372. value: "",
  373. placeholder: "运输单号",
  374. },
  375. {
  376. title: "确认出库状态",
  377. name: "Select",
  378. serverName: "in_out_value",
  379. value: "",
  380. option: [
  381. { label: "未确认", value: 0 },
  382. { label: "已确认", value: 1 },
  383. ],
  384. },
  385. {
  386. title: "确认运输状态",
  387. name: "Select",
  388. serverName: "transportation_value",
  389. value: "",
  390. option: [
  391. { label: "未确认", value: 0 },
  392. { label: "已确认", value: 1 },
  393. ],
  394. },
  395. ];
  396. this.list = this.list.concat(result);
  397. }
  398. return this.list;
  399. },
  400. },
  401. created() {
  402. this.getOptions();
  403. },
  404. methods: {
  405. init(row) {
  406. this.axios("/api/user").then((res) => (this.users = res.data.data));
  407. this.pageIndex = 1;
  408. row.page_index = this.pageIndex;
  409. row.page_size = this.pageSize;
  410. if (this.func.isType(row.house) == "Array") {
  411. row.house = row.house.join(",");
  412. }
  413. if (this.func.isType(row.unit) == "Array") {
  414. row.unit = row.unit.join(",");
  415. }
  416. if (this.func.isType(row.layer) == "Array") {
  417. row.layer = row.layer.join(",");
  418. }
  419. if (this.func.isType(row.number_detail) == "Array") {
  420. row.number_detail = row.number_detail.join(",");
  421. }
  422. if (this.func.isType(row.product) == "Array") {
  423. row.product = row.product.join(",");
  424. }
  425. if (this.func.isType(row.part) == "Array") {
  426. row.part = row.part.join(",");
  427. }
  428. Object.assign(row, this.$route.query);
  429. this.proxyObj = row;
  430. this.getData(row);
  431. },
  432. getOptions() {
  433. this.axios("/api/order_detail_word", {
  434. params: { order_no: this.$route.query.order_no },
  435. }).then((res) => {
  436. res.data.house.map((v) => {
  437. v.value = v.house;
  438. v.label = v.house;
  439. });
  440. res.data.unit.map((v) => {
  441. v.value = v.unit;
  442. v.label = v.unit;
  443. });
  444. res.data.layer.map((v) => {
  445. v.value = v.layer;
  446. v.label = v.layer;
  447. });
  448. res.data.number_detail.map((v) => {
  449. v.value = v.number_detail;
  450. v.label = v.number_detail;
  451. });
  452. res.data.product.map((v) => {
  453. (v.value = v.title), (v.label = v.title);
  454. });
  455. res.data.part.map((v) => {
  456. (v.value = v.title), (v.label = v.title);
  457. });
  458. this.list[0].option = res.data.house;
  459. this.list[1].option = res.data.unit;
  460. this.list[2].option = res.data.layer;
  461. this.list[3].option = res.data.number_detail;
  462. this.list[4].option = res.data.product;
  463. this.list[5].option = res.data.part;
  464. });
  465. },
  466. getData(row) {
  467. this.loading = true;
  468. this.axios("/api/orders_list_detail", { params: row }).then((res) => {
  469. this.loading = false;
  470. this.tableData = res.data.data;
  471. this.logList = res.data.detail;
  472. this.total = res.data.total || 0;
  473. });
  474. },
  475. changePage(e) {
  476. this.pageIndex = e;
  477. this.proxyObj.page_index = e;
  478. this.getData(this.proxyObj);
  479. },
  480. changeSize(e) {
  481. this.pageSize = e;
  482. this.proxyObj.page_size = this.pageSize;
  483. this.getData(this.proxyObj);
  484. },
  485. back() {
  486. this.$router.go(-1);
  487. },
  488. handleOrderReturn(row) {
  489. let params = [];
  490. if (!this.selectedReturnArr || this.selectedReturnArr.length < 1) {
  491. return this.$Message.error("请至少选择一项");
  492. }
  493. params = this.selectedReturnArr.map((v) => {
  494. return v.chip;
  495. });
  496. this.$Modal.confirm({
  497. title: "确认退回?",
  498. content: "此操作无法恢复,请确认!",
  499. onOk: () => {
  500. this.axios({
  501. method: "post",
  502. url: "/api/transport_callback",
  503. data: {
  504. tag: params,
  505. },
  506. }).then((res) => {
  507. if (res.code == 200) {
  508. this.$Message.success(res.msg);
  509. this.getData(this.proxyObj);
  510. }
  511. });
  512. },
  513. onCancel: () => {},
  514. });
  515. },
  516. selectTable(row) {
  517. this.selectedReturnArr = row
  518. let result = [],
  519. outResult = [];
  520. if (this.$route.query.type == 2) {
  521. row.map((v) => {
  522. v.id ? result.push(v.id) : "";
  523. v.order_in_no ? outResult.push(v.order_in_no) : "";
  524. });
  525. } else {
  526. row.map((v) => {
  527. v.orders_procedure_id ? result.push(v.orders_procedure_id) : "";
  528. v.order_in_no ? outResult.push(v.order_in_no) : "";
  529. });
  530. }
  531. this.selects = result || [];
  532. this.selects_out = outResult || [];
  533. },
  534. confirmSuccess(row) {
  535. let params = "";
  536. if (!row || row.length < 1) {
  537. return this.$Message.error("请至少选择一项");
  538. }
  539. params = Array.isArray(row) ? row.join(",") : row.orders_procedure_id;
  540. this.confirmDelete({
  541. title: "确认入库",
  542. content: "确认入库?",
  543. type: "primary",
  544. then: () => {
  545. this.axios
  546. .post("/api/orders_in", { orders_procedure_id: params })
  547. .then((res) => {
  548. if (res.code == 200) {
  549. this.$Message.success(res.msg);
  550. this.getData(this.proxyObj);
  551. }
  552. });
  553. },
  554. cancel: () => {
  555. this.$Message.warning("您取消了确认入库操作");
  556. },
  557. });
  558. },
  559. outStock(row) {
  560. console.log("row :>> ", row);
  561. if (!row || row.length < 1) {
  562. return this.$Message.error("您未选择或者未确认入库");
  563. }
  564. this.info.order_in_no = Array.isArray(row)
  565. ? row.join(",")
  566. : row.order_in_no;
  567. this.showStock = true;
  568. },
  569. confirmOutStock() {
  570. if (this.time) {
  571. this.info.start_time = new Date(this.time)
  572. .toLocaleDateString()
  573. .replace(/\//g, "-");
  574. this.info.end_time = new Date(this.time)
  575. .toLocaleDateString()
  576. .replace(/\//g, "-");
  577. }
  578. this.axios.post("/api/orders_out", this.info).then((res) => {
  579. if (res.code == 200) {
  580. this.$Message.success(res.msg);
  581. this.getData(this.proxyObj);
  582. // setTimeout(()=>this.back(),500)
  583. }
  584. });
  585. },
  586. outShip(row, type) {
  587. //type 1出库 2运输
  588. if(type == 3){
  589. this.confirmDelete({
  590. title: "确认出库" ,
  591. content: "确认出库么?" ,
  592. type: "primary",
  593. then: (e) => {
  594. this.axios.post('/api/orders_transport', {transport_no:row.transport_no}).then((res) => {
  595. if (res.code == 200) {
  596. this.$Message.success(res.msg);
  597. this.getData(this.proxyObj);
  598. }
  599. });
  600. },
  601. cancel: (e) => {},
  602. });
  603. }else{
  604. if (!row || row.length < 1) {
  605. return this.$Message.error("请至少选择一项");
  606. }
  607. let id = Array.isArray(row) ? row.join(",") : row.id;
  608. let post_url =
  609. type == 1 ? "/api/orders_transport" : "/api/orders_transport_confirm";
  610. let params = {};
  611. params.id = id;
  612. this.confirmDelete({
  613. title: type == 1 ? "确认出库" : "确认运输",
  614. content: type == 1 ? "确认出库么?" : "确认运输么",
  615. type: "primary",
  616. then: (e) => {
  617. this.axios.post(post_url, params).then((res) => {
  618. if (res.code == 200) {
  619. this.$Message.success(res.msg);
  620. this.getData(this.proxyObj);
  621. }
  622. });
  623. },
  624. cancel: (e) => {},
  625. });}
  626. },
  627. async exportData() {
  628. const res = await this.axios("/api/orders_list_detail", {
  629. params: { ...this.proxyObj, sub_type: "excel" },
  630. });
  631. if (res.code == 200) {
  632. let url = `${this.$store.state.ip}/api/storage/${res.data.file}`;
  633. location.href = url;
  634. }
  635. },
  636. },
  637. };
  638. </script>
  639. <style lang="scss" scoped></style>