index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. <template>
  2. <div class="sellOutOrder pagePadding">
  3. <div
  4. v-if="powers && powers.length > 0 && powers.some((item) => item == '001')"
  5. >
  6. <ex-table
  7. v-loading="loading"
  8. :table="table"
  9. :data="tableData"
  10. :columns="columns"
  11. :page="pageInfo"
  12. :size="size"
  13. @page-curr-change="handlePageChange"
  14. @page-size-change="handleSizeChange"
  15. @screen-reset="
  16. pageInfo.curr = 1;
  17. parmValue.page = 1;
  18. searchList();
  19. "
  20. @screen-submit="
  21. pageInfo.curr = 1;
  22. parmValue.page = 1;
  23. searchList();
  24. "
  25. @selection="selection_change"
  26. >
  27. <template #table-header="{}">
  28. <div style="width: 100%">
  29. <el-row style="padding: 0 0 0 80px">
  30. <el-col :span="4" style="width: 291px">
  31. <period-date-picker
  32. :type="1"
  33. :start="parmValue.start"
  34. :end="parmValue.end"
  35. :width="'134px'"
  36. :size="searchSize"
  37. @timeReturned="handleTime"
  38. />
  39. </el-col>
  40. <el-col :span="4" style="width: 320px; padding: 0px 0 0 10px">
  41. <search-customer
  42. :value="customerCode"
  43. :size="searchSize"
  44. :placeholder="'客户公司名称'"
  45. :names="parmValue.supplierName"
  46. :is-detail="true"
  47. @searchChange="customerChange"
  48. />
  49. </el-col>
  50. <el-col :span="3" style="width: 66px; float: right">
  51. <el-button
  52. :size="searchSize"
  53. type="primary"
  54. style="float: right; margin-left: 5px"
  55. @click="searchList"
  56. >
  57. 刷新
  58. </el-button>
  59. </el-col>
  60. <el-col
  61. :span="4"
  62. style="width: 66px; float: right"
  63. v-if="
  64. powers &&
  65. powers.length > 0 &&
  66. powers.some((item) => item == '087')
  67. "
  68. >
  69. <el-button
  70. type="primary"
  71. style="margin-left: 30px"
  72. @click="download"
  73. :size="searchSize"
  74. class="fr"
  75. >
  76. 导出
  77. </el-button>
  78. </el-col>
  79. </el-row>
  80. <el-row style="padding-top: 10px">
  81. <el-col :span="4" style="width: 150px">
  82. <el-select
  83. :size="searchSize"
  84. v-model="parmValue.status"
  85. filterable
  86. clearable
  87. placeholder="状态"
  88. style="width: 100%"
  89. @change="
  90. pageInfo.curr = 1;
  91. parmValue.page = 1;
  92. searchList();
  93. "
  94. >
  95. <el-option
  96. v-for="item in statusOptions"
  97. :key="'status' + item.id"
  98. :label="item.label"
  99. :value="item.id"
  100. />
  101. </el-select>
  102. </el-col>
  103. <el-col :span="4" style="width: 500px; padding: 0 0 0 10px">
  104. <el-input
  105. clearable
  106. :size="searchSize"
  107. placeholder="关键字"
  108. v-model="s_input"
  109. maxlength="40"
  110. class="input-with-select"
  111. >
  112. <el-select
  113. style="width: 140px"
  114. v-model="select"
  115. slot="prepend"
  116. placeholder="关键字类型"
  117. >
  118. <el-option label="销售订单编号" value="orderCode" />
  119. <el-option label="发货申请单编号" value="outCode" />
  120. <!-- <el-option label="供应商编号" value="supplierNo" /> -->
  121. <el-option label="商品编号" value="good_code" />
  122. <el-option label="商品名称" value="good_name" />
  123. <el-option label="申请人部门" value="company_name" />
  124. <el-option label="申请人" value="apply_name" />
  125. <el-option label="采购单编号" value="cgdNo" />
  126. </el-select>
  127. <el-button
  128. slot="append"
  129. icon="el-icon-search"
  130. @click="
  131. pageInfo.curr = 1;
  132. parmValue.page = 1;
  133. handleValue();
  134. "
  135. ></el-button>
  136. </el-input>
  137. </el-col>
  138. <el-col :span="4" style="width: 66px" class="fr">
  139. <el-button
  140. type="warning"
  141. class="fr"
  142. :size="searchSize"
  143. @click="restSearch"
  144. >
  145. 重置
  146. </el-button>
  147. </el-col>
  148. <el-col
  149. :span="4"
  150. style="width: 66px; float: right"
  151. v-if="
  152. powers &&
  153. powers.length > 0 &&
  154. powers.some((item) => item == '090')
  155. "
  156. >
  157. <el-button
  158. type="primary"
  159. style="margin-left: 30px"
  160. @click="routeGoto('sendOutOrder', {})"
  161. :size="searchSize"
  162. class="fr"
  163. >
  164. 批量发货
  165. </el-button>
  166. </el-col>
  167. </el-row>
  168. </div>
  169. </template>
  170. <template #status="{ scope }">
  171. <el-tag
  172. :size="tablebtnSize"
  173. :type="scope.row.status == '0' ? 'warning' : ''"
  174. v-text="
  175. (statusOptions.find((item) => item.id == scope.row.status) || {})
  176. .label || '--'
  177. "
  178. ></el-tag>
  179. </template>
  180. <template #order_type="{ scope }">
  181. <el-tag
  182. :size="'mini'"
  183. v-text="
  184. (
  185. xs_order_type_options.find(
  186. (item) => item.id == scope.row.order_type
  187. ) || {}
  188. ).label || '--'
  189. "
  190. ></el-tag>
  191. </template>
  192. <template #operation="{ scope }">
  193. <el-tooltip
  194. v-if="powers.some((item) => item == '007')"
  195. effect="dark"
  196. content="详情"
  197. placement="top"
  198. >
  199. <i
  200. class="el-icon-view tb-icon"
  201. @click="getRouter('sellOutOrderDetail', scope.row.outCode)"
  202. ></i>
  203. </el-tooltip>
  204. </template>
  205. </ex-table>
  206. <add-edit
  207. :id="modelId"
  208. :sitem="sitem"
  209. :show-model="showModel"
  210. :is-detail="isDetail"
  211. @refresh="searchList"
  212. @cancel="showModel = false"
  213. />
  214. </div>
  215. <div v-else>
  216. <no-auth></no-auth>
  217. </div>
  218. </div>
  219. </template>
  220. <script>
  221. import mixinPage from "@/mixins/elPaginationHandle";
  222. import resToken from "@/mixins/resToken";
  223. import { mapGetters } from "vuex";
  224. import urlConfig from "@/apis/url-config";
  225. import asyncRequest from "@/apis/service/sellOut/sellOutOrder";
  226. import addEdit from "./components/addEdit.vue";
  227. import { columns } from "./columns";
  228. import { xs_order_type_options } from "@/assets/js/statusList";
  229. export default {
  230. name: "sellOutOrder",
  231. mixins: [mixinPage, resToken],
  232. components: {
  233. addEdit,
  234. },
  235. computed: {
  236. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  237. powers() {
  238. let tran =
  239. this.$store.getters.btnList.find(
  240. (item) => item.menu_route == "sellOutOrder"
  241. ) || {};
  242. if (tran && tran.action && tran.action.length > 0) {
  243. return tran.action;
  244. } else {
  245. return [];
  246. }
  247. },
  248. },
  249. data() {
  250. return {
  251. select: "orderCode",
  252. s_input: "",
  253. customerCode: [], //客户公司code
  254. fileUrl: urlConfig.baseURL,
  255. changeList: [],
  256. xs_order_type_options,
  257. // post_ownOptions: [
  258. // { id: "1", label: "客户承担" },
  259. // { id: "2", label: "公司承担" },
  260. // { id: "3", label: "供应商承担" },
  261. // ],
  262. sitem: null,
  263. // 状态
  264. statusOptions: [
  265. { id: "0", label: "待发货" },
  266. { id: "1", label: "待库管发货" },
  267. { id: "2", label: "已发货待收货" },
  268. { id: "3", label: "已收货" },
  269. { id: "4", label: "已全部退货" },
  270. ],
  271. loading: true,
  272. showModel: false,
  273. isDetail: false,
  274. modelId: 0,
  275. parmValue: {
  276. order_type: "",
  277. orderCode: "",
  278. apply_name: "", //申请人名称
  279. cgdNo: "",
  280. start: "",
  281. end: "",
  282. // supplierNo: "",
  283. companyNo: "",
  284. good_code: "",
  285. good_name: "",
  286. outCode: "",
  287. status: "",
  288. company_name: "", //申请人部门
  289. page: 1, // 页码
  290. size: 15, // 每页显示条数
  291. },
  292. // 表格 - 数据
  293. tableData: [],
  294. // 表格 - 参数
  295. table: {
  296. stripe: true,
  297. border: true,
  298. _defaultHeader_: ["setcol"],
  299. },
  300. // 表格 - 分页
  301. pageInfo: {
  302. size: 15,
  303. curr: 1,
  304. total: 0,
  305. },
  306. // 表格 - 列参数
  307. columns: columns,
  308. };
  309. },
  310. mounted() {
  311. // return;
  312. const { back } = this.$route.query;
  313. if (back) {
  314. this.parmValue = JSON.parse(back);
  315. console.log(this.parmValue);
  316. const { page, size } = this.parmValue;
  317. // this.parmValue.start = start || last_start;
  318. // this.parmValue.end = end || last_end;
  319. if (this.parmValue.companyNo.length > 0) {
  320. this.customerCode = [this.parmValue.companyNo];
  321. }
  322. this.pageInfo = {
  323. size: size,
  324. curr: page,
  325. total: 0,
  326. };
  327. //多选条件
  328. this.select = this.parmValue.select;
  329. // this.sselect = this.parmValue.sselect;
  330. this.s_input = this.parmValue.s_input;
  331. } else {
  332. this.select = "orderCode";
  333. // this.sselect = "创建时间"
  334. }
  335. this.searchList();
  336. },
  337. methods: {
  338. getRouter(toRouter, queryId) {
  339. if (toRouter && queryId) {
  340. let model = {
  341. id: queryId,
  342. // type: 'view',
  343. };
  344. //有多选框的条件
  345. this.parmValue.select = this.select;
  346. // this.parmValue.sselect = this.sselect ;
  347. this.parmValue.s_input = this.s_input;
  348. //
  349. let routerModel = {
  350. options: JSON.parse(JSON.stringify(this.parmValue)),
  351. router: this.$route.path,
  352. };
  353. model.preModel = JSON.stringify(routerModel);
  354. this.routeGoto(toRouter, model);
  355. } else {
  356. this.$message.warning("暂未找到相关流程!");
  357. }
  358. },
  359. //选中触发函数
  360. selection_change(e) {
  361. const { list } = e;
  362. //选中的数组集合
  363. this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
  364. },
  365. //导出文件 ()
  366. async download() {
  367. if (this.changeList.length <= 0) {
  368. this.$message.warning("请选择有效数据");
  369. return;
  370. }
  371. let model = {
  372. outCodes: [],
  373. };
  374. this.changeList.forEach((item) => {
  375. model.outCodes.push(item.outCode);
  376. });
  377. // const res = await asyncRequest.exportcgdlist(model)
  378. if (!this.loading) {
  379. this.loading = true;
  380. let httpType = `aplication/zip`;
  381. axios({
  382. method: "post",
  383. url: this.fileUrl + "admin/exportsaleout",
  384. responseType: "blob",
  385. data: model,
  386. headers: {
  387. // 'Content-Type': 'multipart/form-data',
  388. // Accept: "application/vnd.ms-excel"
  389. Accept: httpType,
  390. },
  391. })
  392. .then((res) => {
  393. // console.log(res)
  394. // console.log(this.fileUrl)
  395. // return;
  396. if (res && res.status == 200 && res.data) {
  397. let url = window.URL.createObjectURL(
  398. new Blob([res.data], {
  399. // type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
  400. type: httpType,
  401. })
  402. );
  403. let link = document.createElement("a");
  404. link.style.display = "none";
  405. link.href = url;
  406. let excelName = "发货申请单.zip";
  407. link.setAttribute("download", excelName);
  408. document.body.appendChild(link);
  409. link.click();
  410. link.remove();
  411. window.URL.revokeObjectURL(url); //释放掉blob对象
  412. this.$message.success(`${message}导出成功!`);
  413. setTimeout(() => {
  414. this.loading = false;
  415. }, 500);
  416. } else {
  417. this.$message.error(res.data.message);
  418. setTimeout(() => {
  419. this.loading = false;
  420. }, 500);
  421. }
  422. })
  423. .catch((error) => {
  424. console.log(error);
  425. this.loading = false;
  426. });
  427. }
  428. },
  429. restSearch() {
  430. this.customerCode = [];
  431. this.select = "orderCode";
  432. this.s_input = "";
  433. this.parmValue = {
  434. order_type: "",
  435. orderCode: "",
  436. apply_name: "", //申请人名称
  437. cgdNo: "",
  438. start: "",
  439. end: "",
  440. // supplierNo: "",
  441. companyNo: "",
  442. good_code: "",
  443. good_name: "",
  444. outCode: "",
  445. status: "",
  446. company_name: "", //申请人部门
  447. page: 1, // 页码
  448. size: 15, // 每页显示条数
  449. };
  450. // 表格 - 分页
  451. this.pageInfo = {
  452. size: 15,
  453. curr: 1,
  454. total: 0,
  455. };
  456. this.searchList();
  457. },
  458. openModal(id, isDetail, sitem) {
  459. this.showModel = true;
  460. this.modelId = id;
  461. this.isDetail = isDetail;
  462. this.sitem = sitem;
  463. },
  464. async deleteById(id, status) {
  465. await this.$confirm("确定要删除?", {
  466. confirmButtonText: "确定",
  467. cancelButtonText: "取消",
  468. type: "warning",
  469. })
  470. .then(async () => {
  471. const model = {
  472. id: id,
  473. status: status === "1" ? "0" : "1",
  474. };
  475. const res = await asyncRequest.status(model);
  476. if (res && res.code === 0) {
  477. this.$notify.success({
  478. title: "删除成功",
  479. message: "",
  480. });
  481. this.searchList();
  482. } else if (res && res.code >= 100 && res.code <= 104) {
  483. await this.logout();
  484. } else {
  485. this.$message.warning(res.message);
  486. }
  487. })
  488. .catch(() => {
  489. console.log("取消");
  490. });
  491. },
  492. // 列表搜索
  493. async searchList() {
  494. if (
  495. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  496. (this.parmValue.start === "" && this.parmValue.end !== "")
  497. ) {
  498. this.$message.warning("时间区间不完整!");
  499. return;
  500. }
  501. this.loading = true;
  502. let model = JSON.parse(JSON.stringify(this.parmValue));
  503. const res = await asyncRequest.list(model);
  504. if (res && res.code === 0 && res.data) {
  505. this.tableData = res.data.list;
  506. this.pageInfo.total = Number(res.data.count);
  507. this.tableData.forEach((v) => {
  508. v.good_class = "";
  509. if (v.can && v.can.length > 0) {
  510. v.can.forEach((x, i) => {
  511. v.good_class += i === 0 ? x.name : "/" + x.name;
  512. });
  513. }
  514. });
  515. } else if (res && res.code >= 100 && res.code <= 104) {
  516. await this.logout();
  517. } else {
  518. this.tableData = [];
  519. this.pageInfo.total = 0;
  520. }
  521. this.loading = false;
  522. },
  523. async statusConfirm(id, status) {
  524. let str = status === "1" ? "禁用" : "启用";
  525. await this.$confirm("确定要改为" + str + "?", {
  526. confirmButtonText: "确定",
  527. cancelButtonText: "取消",
  528. type: "warning",
  529. })
  530. .then(async () => {
  531. this.loading = true;
  532. const model = {
  533. id: id,
  534. status: status === "1" ? "0" : "1",
  535. };
  536. const res = await asyncRequest.status(model);
  537. if (res && res.code === 0) {
  538. this.loading = false;
  539. this.$notify.success({
  540. title: "状态修改成功!",
  541. message: "",
  542. });
  543. await this.searchList();
  544. } else if (res && res.code >= 100 && res.code <= 104) {
  545. await this.logout();
  546. } else {
  547. this.$message.warning(res.message);
  548. }
  549. })
  550. .catch(() => {
  551. console.log("取消");
  552. });
  553. },
  554. // 时间选择事件
  555. async handleTime(e) {
  556. if (e.startTime !== "") {
  557. this.parmValue.start = e.startTime;
  558. } else {
  559. this.parmValue.start = "";
  560. }
  561. if (e.endTime !== "") {
  562. this.parmValue.end = e.endTime;
  563. } else {
  564. this.parmValue.end = "";
  565. }
  566. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  567. this.pageInfo.curr = 1;
  568. this.parmValue.page = 1;
  569. await this.searchList();
  570. }
  571. },
  572. async customerChange(e) {
  573. if (e && e.id) {
  574. this.customerCode = [e.code];
  575. this.parmValue.supplierName = e.label;
  576. this.parmValue.companyNo = e.code;
  577. } else {
  578. this.customerCode = [];
  579. this.parmValue.supplierName = "";
  580. this.parmValue.companyNo = "";
  581. }
  582. this.pageInfo.curr = 1;
  583. this.parmValue.page = 1;
  584. await this.searchList();
  585. },
  586. async handleValue() {
  587. this.parmValue.orderCode =
  588. this.select === "orderCode" ? this.s_input : "";
  589. this.parmValue.outCode = this.select === "outCode" ? this.s_input : "";
  590. // this.parmValue.supplierNo =
  591. // this.select === "supplierNo" ? this.s_input : "";
  592. this.parmValue.good_code =
  593. this.select === "good_code" ? this.s_input : "";
  594. this.parmValue.good_name =
  595. this.select === "good_name" ? this.s_input : "";
  596. this.parmValue.apply_name =
  597. this.select === "apply_name" ? this.s_input : "";
  598. this.parmValue.cgdNo = this.select === "cgdNo" ? this.s_input : "";
  599. this.parmValue.company_name =
  600. this.select === "company_name" ? this.s_input : "";
  601. await this.searchList();
  602. },
  603. },
  604. };
  605. </script>
  606. <style lang="scss" scoped>
  607. .zxoutOrder {
  608. }
  609. </style>