index.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  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. 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. export default {
  229. name: "sellOutOrder",
  230. mixins: [mixinPage, resToken],
  231. components: {
  232. addEdit,
  233. },
  234. computed: {
  235. ...mapGetters(["tablebtnSize", "searchSize", "size"]),
  236. powers() {
  237. let tran =
  238. this.$store.getters.btnList.find(
  239. (item) => item.menu_route == "sellOutOrder"
  240. ) || {};
  241. if (tran && tran.action && tran.action.length > 0) {
  242. return tran.action;
  243. } else {
  244. return [];
  245. }
  246. },
  247. },
  248. data() {
  249. return {
  250. select: "orderCode",
  251. s_input: "",
  252. customerCode: [], //客户公司code
  253. fileUrl: urlConfig.baseURL,
  254. changeList: [],
  255. order_type_options: [
  256. { id: "1", label: "线上商品销售" },
  257. { id: "2", label: "项目线上商品销售" },
  258. { id: "3", label: "咨询单销售" },
  259. { id: "4", label: "项目咨询单销售" },
  260. { id: "5", label: "平台部订单销售" },
  261. ],
  262. // post_ownOptions: [
  263. // { id: "1", label: "客户承担" },
  264. // { id: "2", label: "公司承担" },
  265. // { id: "3", label: "供应商承担" },
  266. // ],
  267. sitem: null,
  268. // 状态
  269. statusOptions: [
  270. { id: "0", label: "待发货" },
  271. { id: "1", label: "待库管发货" },
  272. { id: "2", label: "已发货待收货" },
  273. { id: "3", label: "已收货" },
  274. { id: "4", label: "已全部退货" },
  275. ],
  276. loading: true,
  277. showModel: false,
  278. isDetail: false,
  279. modelId: 0,
  280. parmValue: {
  281. order_type: "",
  282. orderCode: "",
  283. apply_name: "", //申请人名称
  284. cgdNo: "",
  285. start: "",
  286. end: "",
  287. // supplierNo: "",
  288. companyNo: "",
  289. good_code: "",
  290. good_name: "",
  291. outCode: "",
  292. status: "",
  293. company_name:"", //申请人部门
  294. page: 1, // 页码
  295. size: 15, // 每页显示条数
  296. },
  297. // 表格 - 数据
  298. tableData: [],
  299. // 表格 - 参数
  300. table: {
  301. stripe: true,
  302. border: true,
  303. _defaultHeader_: ["setcol"],
  304. },
  305. // 表格 - 分页
  306. pageInfo: {
  307. size: 15,
  308. curr: 1,
  309. total: 0,
  310. },
  311. // 表格 - 列参数
  312. columns: columns,
  313. };
  314. },
  315. mounted() {
  316. const { back } = this.$route.query;
  317. if (back) {
  318. this.parmValue = JSON.parse(back);
  319. console.log(this.parmValue);
  320. const { page, size } = this.parmValue;
  321. // this.parmValue.start = start || last_start;
  322. // this.parmValue.end = end || last_end;
  323. if (this.parmValue.companyNo.length > 0) {
  324. this.customerCode = [this.parmValue.companyNo];
  325. }
  326. this.pageInfo = {
  327. size: size,
  328. curr: page,
  329. total: 0,
  330. };
  331. //多选条件
  332. this.select = this.parmValue.select;
  333. // this.sselect = this.parmValue.sselect;
  334. this.s_input = this.parmValue.s_input;
  335. } else {
  336. this.select = "orderCode";
  337. // this.sselect = "创建时间"
  338. }
  339. this.searchList();
  340. },
  341. methods: {
  342. getRouter(toRouter, queryId) {
  343. if (toRouter && queryId) {
  344. let model = {
  345. id: queryId,
  346. // type: 'view',
  347. };
  348. //有多选框的条件
  349. this.parmValue.select = this.select;
  350. // this.parmValue.sselect = this.sselect ;
  351. this.parmValue.s_input = this.s_input;
  352. //
  353. let routerModel = {
  354. options: JSON.parse(JSON.stringify(this.parmValue)),
  355. router: this.$route.path,
  356. };
  357. model.preModel = JSON.stringify(routerModel);
  358. this.routeGoto(toRouter, model);
  359. } else {
  360. this.$message.warning("暂未找到相关流程!");
  361. }
  362. },
  363. //选中触发函数
  364. selection_change(e) {
  365. const { list } = e;
  366. //选中的数组集合
  367. this.changeList = list.length > 0 ? JSON.parse(JSON.stringify(list)) : [];
  368. },
  369. //导出文件 ()
  370. async download() {
  371. if (this.changeList.length <= 0) {
  372. this.$message.warning("请选择有效数据");
  373. return;
  374. }
  375. let model = {
  376. outCodes: [],
  377. };
  378. this.changeList.forEach((item) => {
  379. model.outCodes.push(item.outCode);
  380. });
  381. // const res = await asyncRequest.exportcgdlist(model)
  382. if (!this.loading) {
  383. this.loading = true;
  384. let httpType = `aplication/zip`;
  385. axios({
  386. method: "post",
  387. url: this.fileUrl + "admin/exportsaleout",
  388. responseType: "blob",
  389. data: model,
  390. headers: {
  391. // 'Content-Type': 'multipart/form-data',
  392. // Accept: "application/vnd.ms-excel"
  393. Accept: httpType,
  394. },
  395. })
  396. .then((res) => {
  397. // console.log(res)
  398. // console.log(this.fileUrl)
  399. // return;
  400. if (res && res.status == 200 && res.data) {
  401. let url = window.URL.createObjectURL(
  402. new Blob([res.data], {
  403. // type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8",
  404. type: httpType,
  405. })
  406. );
  407. let link = document.createElement("a");
  408. link.style.display = "none";
  409. link.href = url;
  410. let excelName = "发货申请单.zip";
  411. link.setAttribute("download", excelName);
  412. document.body.appendChild(link);
  413. link.click();
  414. link.remove();
  415. window.URL.revokeObjectURL(url); //释放掉blob对象
  416. this.$message.success(`${message}导出成功!`);
  417. setTimeout(() => {
  418. this.loading = false;
  419. }, 500);
  420. } else {
  421. this.$message.error(res.data.message);
  422. setTimeout(() => {
  423. this.loading = false;
  424. }, 500);
  425. }
  426. })
  427. .catch((error) => {
  428. console.log(error);
  429. this.loading = false;
  430. });
  431. }
  432. },
  433. restSearch() {
  434. this.customerCode = [];
  435. this.select = "orderCode";
  436. this.s_input = "";
  437. this.parmValue = {
  438. order_type: "1",
  439. orderCode: "",
  440. apply_name: "", //申请人名称
  441. cgdNo: "",
  442. start: "",
  443. end: "",
  444. // supplierNo: "",
  445. companyNo: "",
  446. good_code: "",
  447. good_name: "",
  448. outCode: "",
  449. status: "",
  450. company_name:"", //申请人部门
  451. page: 1, // 页码
  452. size: 15, // 每页显示条数
  453. };
  454. // 表格 - 分页
  455. this.pageInfo = {
  456. size: 15,
  457. curr: 1,
  458. total: 0,
  459. };
  460. this.searchList();
  461. },
  462. openModal(id, isDetail, sitem) {
  463. this.showModel = true;
  464. this.modelId = id;
  465. this.isDetail = isDetail;
  466. this.sitem = sitem;
  467. },
  468. async deleteById(id, status) {
  469. await this.$confirm("确定要删除?", {
  470. confirmButtonText: "确定",
  471. cancelButtonText: "取消",
  472. type: "warning",
  473. })
  474. .then(async () => {
  475. const model = {
  476. id: id,
  477. status: status === "1" ? "0" : "1",
  478. };
  479. const res = await asyncRequest.status(model);
  480. if (res && res.code === 0) {
  481. this.$notify.success({
  482. title: "删除成功",
  483. message: "",
  484. });
  485. this.searchList();
  486. } else if (res && res.code >= 100 && res.code <= 104) {
  487. await this.logout();
  488. } else {
  489. this.$message.warning(res.message);
  490. }
  491. })
  492. .catch(() => {
  493. console.log("取消");
  494. });
  495. },
  496. // 列表搜索
  497. async searchList() {
  498. if (
  499. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  500. (this.parmValue.start === "" && this.parmValue.end !== "")
  501. ) {
  502. this.$message.warning("时间区间不完整!");
  503. return;
  504. }
  505. this.loading = true;
  506. let model = JSON.parse(JSON.stringify(this.parmValue));
  507. const res = await asyncRequest.list(model);
  508. if (res && res.code === 0 && res.data) {
  509. this.tableData = res.data.list;
  510. this.pageInfo.total = Number(res.data.count);
  511. this.tableData.forEach((v) => {
  512. v.good_class = "";
  513. if (v.can && v.can.length > 0) {
  514. v.can.forEach((x, i) => {
  515. v.good_class += i === 0 ? x.name : "/" + x.name;
  516. });
  517. }
  518. });
  519. } else if (res && res.code >= 100 && res.code <= 104) {
  520. await this.logout();
  521. } else {
  522. this.tableData = [];
  523. this.pageInfo.total = 0;
  524. }
  525. this.loading = false;
  526. },
  527. async statusConfirm(id, status) {
  528. let str = status === "1" ? "禁用" : "启用";
  529. await this.$confirm("确定要改为" + str + "?", {
  530. confirmButtonText: "确定",
  531. cancelButtonText: "取消",
  532. type: "warning",
  533. })
  534. .then(async () => {
  535. this.loading = true;
  536. const model = {
  537. id: id,
  538. status: status === "1" ? "0" : "1",
  539. };
  540. const res = await asyncRequest.status(model);
  541. if (res && res.code === 0) {
  542. this.loading = false;
  543. this.$notify.success({
  544. title: "状态修改成功!",
  545. message: "",
  546. });
  547. await this.searchList();
  548. } else if (res && res.code >= 100 && res.code <= 104) {
  549. await this.logout();
  550. } else {
  551. this.$message.warning(res.message);
  552. }
  553. })
  554. .catch(() => {
  555. console.log("取消");
  556. });
  557. },
  558. // 时间选择事件
  559. async handleTime(e) {
  560. if (e.startTime !== "") {
  561. this.parmValue.start = e.startTime;
  562. } else {
  563. this.parmValue.start = "";
  564. }
  565. if (e.endTime !== "") {
  566. this.parmValue.end = e.endTime;
  567. } else {
  568. this.parmValue.end = "";
  569. }
  570. if (this.parmValue.start !== "" && this.parmValue.end !== "") {
  571. this.pageInfo.curr = 1;
  572. this.parmValue.page = 1;
  573. await this.searchList();
  574. }
  575. },
  576. async customerChange(e) {
  577. if (e && e.id) {
  578. this.customerCode = [e.code];
  579. this.parmValue.supplierName = e.label;
  580. this.parmValue.companyNo = e.code;
  581. } else {
  582. this.customerCode = [];
  583. this.parmValue.supplierName = "";
  584. this.parmValue.companyNo = "";
  585. }
  586. this.pageInfo.curr = 1;
  587. this.parmValue.page = 1;
  588. await this.searchList();
  589. },
  590. async handleValue() {
  591. this.parmValue.orderCode =
  592. this.select === "orderCode" ? this.s_input : "";
  593. this.parmValue.outCode = this.select === "outCode" ? this.s_input : "";
  594. // this.parmValue.supplierNo =
  595. // this.select === "supplierNo" ? this.s_input : "";
  596. this.parmValue.good_code =
  597. this.select === "good_code" ? this.s_input : "";
  598. this.parmValue.good_name =
  599. this.select === "good_name" ? this.s_input : "";
  600. this.parmValue.apply_name =
  601. this.select === "apply_name" ? this.s_input : "";
  602. this.parmValue.cgdNo = this.select === "cgdNo" ? this.s_input : "";
  603. this.parmValue.company_name = this.select === "company_name" ? this.s_input : "";
  604. await this.searchList();
  605. },
  606. },
  607. };
  608. </script>
  609. <style lang="scss" scoped>
  610. .zxoutOrder {
  611. }
  612. </style>