index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <div class="salesOrder 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. >
  26. <template #table-header="{ selection }">
  27. <div style="width: 100%">
  28. <el-row style="padding: 0 0 0 80px">
  29. <el-col :span="6" style="width: 293px; padding: 0 0 0 0px">
  30. <period-date-picker
  31. :type="1"
  32. :width="'135px'"
  33. :size="searchSize"
  34. :start="parmValue.start"
  35. :end="parmValue.end"
  36. @timeReturned="handleTime"
  37. />
  38. </el-col>
  39. <el-col :span="4" style="width: 148px; padding: 0 0 0 8px">
  40. <el-select
  41. :size="searchSize"
  42. v-model="parmValue.status"
  43. filterable
  44. clearable
  45. placeholder="订单状态"
  46. style="width: 100%"
  47. @change="
  48. pageInfo.curr = 1;
  49. parmValue.page = 1;
  50. searchList();
  51. "
  52. >
  53. <el-option
  54. v-for="item in statusOptions"
  55. :key="'status' + item.id"
  56. :label="item.label"
  57. :value="item.id"
  58. />
  59. </el-select>
  60. </el-col>
  61. <!-- 客户公司 -->
  62. <el-col :span="4" style="width: 240px; padding: 0 0 0 10px">
  63. <search-work-company
  64. :type="'1'"
  65. :value="parmValue.supplierNo"
  66. :size="'mini'"
  67. :placeholder="'销售方公司'"
  68. :disabled="false"
  69. :isDetail="false"
  70. @searchChange="supplierChange"
  71. />
  72. </el-col>
  73. <el-col :span="3" style="width: 66px; float: right">
  74. <el-button
  75. :size="searchSize"
  76. type="primary"
  77. style="float: right; margin-left: 5px"
  78. @click="searchList"
  79. >
  80. 刷新
  81. </el-button>
  82. </el-col>
  83. <el-col :span="3" style="width: 66px; float: right">
  84. <el-button
  85. :size="searchSize"
  86. type="primary"
  87. style="float: right; margin-left: 5px"
  88. @click="set_user(selection)"
  89. >
  90. 设置订单用途
  91. </el-button>
  92. </el-col>
  93. </el-row>
  94. <el-row style="padding: 10px 0 0 0">
  95. <el-col :span="6" style="width: 371px">
  96. <search-customer
  97. :value="customerCode"
  98. :size="searchSize"
  99. :names="parmValue.supplierName"
  100. :is-detail="true"
  101. :placeholder="'客户公司名称'"
  102. @searchChange="customerChange"
  103. />
  104. </el-col>
  105. <el-col :span="4" style="width: 150px; padding: 0 0 0 9px">
  106. <el-select
  107. :size="searchSize"
  108. v-model="parmValue.order_type"
  109. filterable
  110. clearable
  111. placeholder="订单类型"
  112. style="width: 100%"
  113. @change="
  114. pageInfo.curr = 1;
  115. parmValue.page = 1;
  116. searchList();
  117. "
  118. >
  119. <el-option
  120. v-for="item in xs_order_type_options"
  121. :key="'orderstatus' + item.id"
  122. :label="item.label"
  123. :value="item.id"
  124. />
  125. </el-select>
  126. </el-col>
  127. <el-col :span="6" style="width: 325px; padding: 0 0 0 10px">
  128. <el-input
  129. clearable
  130. placeholder="关键字"
  131. v-model="input"
  132. maxlength="40"
  133. :size="searchSize"
  134. @blur="searchList"
  135. class="input-with-select"
  136. >
  137. <el-select
  138. v-model="select"
  139. style="width: 100px"
  140. slot="prepend"
  141. placeholder="关键字类型"
  142. @change="searchList"
  143. >
  144. <el-option label="订单编号" value="orderCode"></el-option>
  145. <!-- <el-option
  146. label="商品属性编号"
  147. value="good_code"
  148. ></el-option> -->
  149. <!-- <el-option
  150. label="供应商编号"
  151. value="supplierNo"
  152. ></el-option> -->
  153. <!-- <el-option
  154. label="客户编号"
  155. value="customer_code"
  156. ></el-option> -->
  157. <el-option label="商品名称" value="good_name"></el-option>
  158. <el-option label="创建人" value="apply_name"></el-option>
  159. <el-option label="创建人部门" value="company_name"></el-option>
  160. </el-select>
  161. </el-input>
  162. </el-col>
  163. <el-col :span="4" style="width: 66px; float: right">
  164. <el-button
  165. type="warning"
  166. class="fr"
  167. :size="searchSize"
  168. @click="restSearch"
  169. >
  170. 重置
  171. </el-button>
  172. </el-col>
  173. <el-col
  174. :span="3"
  175. style="width: 56px; float: right"
  176. v-if="powers.some((item) => item == '003')"
  177. >
  178. <el-button
  179. :size="searchSize"
  180. type="success"
  181. style="float: right"
  182. @click="
  183. routeGoto('salesOrderDetail', { id: 'add', type: 'add' })
  184. "
  185. >
  186. 新建
  187. </el-button>
  188. </el-col>
  189. </el-row>
  190. </div>
  191. </template>
  192. <template #good_name="{ scope }">
  193. <span>{{ scope.row.good_name }}</span>
  194. <span v-for="(si, i) in scope.row.speclist" :key="si.spec_id + i">
  195. <span v-if="i !== 0">-</span>
  196. <span v-else>_</span>
  197. <span>{{ si.spec_name }}[{{ si.spec_value }}]</span>
  198. </span>
  199. </template>
  200. <template #status="{ scope }">
  201. <el-tag
  202. :size="tablebtnSize"
  203. :type="scope.row.status == '0' ? 'warning' : ''"
  204. v-text="
  205. (statusOptions.find((item) => item.id == scope.row.status) || {})
  206. .label || '--'
  207. "
  208. ></el-tag>
  209. </template>
  210. <template #order_type="{ scope }">
  211. <el-tag
  212. :size="tablebtnSize"
  213. v-text="
  214. (
  215. xs_order_type_options.find((item) => item.id == scope.row.order_type) ||
  216. {}
  217. ).label || '--'
  218. "
  219. ></el-tag>
  220. </template>
  221. <template #operation="{ scope }">
  222. <el-tooltip effect="dark" content="详情" placement="top">
  223. <i
  224. class="el-icon-view tb-icon"
  225. @click="getRouter('salesOrderDetail', scope.row.id )"
  226. ></i>
  227. </el-tooltip>
  228. </template>
  229. </ex-table>
  230. <add-edit
  231. :id="modelId"
  232. :sitem="sitem"
  233. :show-model="showModel"
  234. :is-detail="isDetail"
  235. @refresh="searchList"
  236. @cancel="showModel = false"
  237. />
  238. <!--订单用途设置-->
  239. <user-add-edit
  240. :code="orderCodeList"
  241. :show-model="userShowModel"
  242. @refresh="searchList"
  243. @cancel="userShowModel = false"
  244. />
  245. </div>
  246. <div v-else>
  247. <no-auth></no-auth>
  248. </div>
  249. </div>
  250. </template>
  251. <script>
  252. import mixinPage from "@/mixins/elPaginationHandle";
  253. import resToken from "@/mixins/resToken";
  254. import asyncRequest from "@/apis/service/sellOut/salesOrder";
  255. import columns from "./columns"; //表格列参数
  256. import addEdit from "./components/addEdit";
  257. import userAddEdit from "./userAddEdit";
  258. import { mapGetters } from "vuex";
  259. import { xs_order_type_options } from "@/assets/js/statusList";
  260. export default {
  261. name: "salesOrder",
  262. mixins: [mixinPage, resToken],
  263. components: {
  264. addEdit,
  265. userAddEdit,
  266. },
  267. computed: {
  268. ...mapGetters(["tablebtnSize", "searchSize", "size",]),
  269. powers() {
  270. let tran =
  271. this.$store.getters.btnList.find(
  272. (item) => item.menu_route == "salesOrder"
  273. ) || {};
  274. if (tran && tran.action && tran.action.length > 0) {
  275. return tran.action;
  276. } else {
  277. return [];
  278. }
  279. },
  280. },
  281. data() {
  282. return {
  283. sitem: null,
  284. select: "orderCode",
  285. input: "",
  286. customerCode: [],
  287. // 状态
  288. statusOptions: [
  289. { id: "0", label: "待发货" },
  290. { id: "1", label: "待发货完成" },
  291. { id: "2", label: "发货已完成" },
  292. { id: "3", label: "订单已取消" },
  293. ],
  294. xs_order_type_options,
  295. loading: false,
  296. showModel: false,
  297. isDetail: false,
  298. modelId: 0,
  299. parmValue: {
  300. order_type: "", //订单类型
  301. orderCode: "", //销售订单code
  302. apply_name: "", // 申请人
  303. good_name: "", // 产品名称
  304. good_code: "", // 产品属性编号
  305. status: "", //状态
  306. page: 1, // 页码
  307. size: 15, // 每页显示条数
  308. supplierNo: "", //供应商编号
  309. customer_code: "", //客户编号
  310. start: "", //新建起始时间
  311. end: "", // 新建结束时间
  312. company_name:"", //创建人部门
  313. },
  314. // 表格 - 数据
  315. tableData: [],
  316. // 表格 - 参数
  317. table: {
  318. stripe: true,
  319. border: true,
  320. _defaultHeader_: ["setcol"],
  321. },
  322. // 表格 - 分页
  323. pageInfo: {
  324. size: 15,
  325. curr: 1,
  326. total: 0,
  327. },
  328. // 表格 - 列参数
  329. columns: columns,
  330. orderCodeList: [],
  331. userShowModel: false,
  332. };
  333. },
  334. mounted() {
  335. const { back } = this.$route.query;
  336. if (back) {
  337. this.parmValue = JSON.parse(back);
  338. console.log(this.parmValue)
  339. const {page,size}=this.parmValue;
  340. // this.parmValue.start = start || last_start;
  341. // this.parmValue.end = end || last_end;
  342. if(this.parmValue.customer_code.length>0){
  343. this.customerCode = [this.parmValue.customer_code] ;
  344. }
  345. this.pageInfo= {
  346. size: size,
  347. curr: page,
  348. total: 0,
  349. }
  350. //多选条件
  351. this.select = this.parmValue.select;
  352. // this.sselect = this.parmValue.sselect;
  353. this.input = this.parmValue.input
  354. }else{
  355. this.select = "orderCode";
  356. // this.sselect = "创建时间"
  357. }
  358. this.searchList();
  359. },
  360. methods: {
  361. getRouter(toRouter, queryId){
  362. if (toRouter && queryId) {
  363. let model = {
  364. id: queryId,
  365. type: 'view',
  366. };
  367. //有多选框的条件
  368. this.parmValue.select = this.select ;
  369. // this.parmValue.sselect = this.sselect ;
  370. this.parmValue.input= this.input;
  371. //
  372. let routerModel = {
  373. options: JSON.parse(JSON.stringify(this.parmValue)),
  374. router: this.$route.path,
  375. };
  376. model.preModel = JSON.stringify(routerModel);
  377. this.routeGoto(toRouter, model);
  378. } else {
  379. this.$message.warning("暂未找到相关流程!");
  380. }
  381. },
  382. restSearch() {
  383. this.select = "orderCode";
  384. this.input = "";
  385. this.customerCode = [];
  386. this.parmValue = {
  387. order_type: "",
  388. orderCode: "", //销售订单code
  389. apply_name: "", // 申请人
  390. good_name: "", // 产品名称
  391. good_code: "", // 产品属性编号
  392. status: "", //状态
  393. page: 1, // 页码
  394. size: 15, // 每页显示条数
  395. supplierNo: "", //供应商编号
  396. customer_code: "", //客户编号
  397. start: "", //新建起始时间
  398. end: "", // 新建结束时间
  399. company_name:"", //部门
  400. };
  401. // 表格 - 分页
  402. this.pageInfo = {
  403. size: 15,
  404. curr: 1,
  405. total: 0,
  406. };
  407. this.searchList();
  408. },
  409. openModal(id, isDetail, sitem) {
  410. this.modelId = id;
  411. this.isDetail = isDetail;
  412. this.sitem = sitem;
  413. this.showModel = true;
  414. },
  415. async supplierChange(e) {
  416. const { id, code, label } = e;
  417. this.parmValue.supplierNo = code || "";
  418. this.parmValue.page = 1;
  419. this.pageInfo.curr = 1;
  420. await this.searchList();
  421. },
  422. set_user(selection) {
  423. if (selection.length === 0) {
  424. this.$message.warning("至少选择一个订单!");
  425. return;
  426. }
  427. this.orderCodeList = [];
  428. let isok = true;
  429. selection.forEach((e) => {
  430. this.orderCodeList.push(e.orderCode);
  431. if (e.use_order) {
  432. isok = false;
  433. }
  434. });
  435. if (!isok) {
  436. this.$message.warning("只能选择未绑定的订单!");
  437. return;
  438. }
  439. this.userShowModel = true;
  440. },
  441. // 客户选择
  442. async customerChange(e) {
  443. if (e && e.id) {
  444. this.customerCode = [e.code];
  445. this.parmValue.supplierName = e.label;
  446. this.parmValue.customer_code = e.code;
  447. } else {
  448. this.customerCode = [];
  449. this.parmValue.supplierName = '';
  450. this.parmValue.customer_code = "";
  451. }
  452. this.parmValue.page = 1;
  453. this.pageInfo.curr = 1;
  454. await this.searchList();
  455. },
  456. async stockChange(e) {
  457. if (e && e.id) {
  458. this.parmValue.stockNo = [e.code];
  459. } else {
  460. this.parmValue.stockNo = [];
  461. }
  462. this.parmValue.page = 1;
  463. this.pageInfo.curr = 1;
  464. await this.searchList();
  465. },
  466. async searchList() {
  467. if (
  468. (this.parmValue.start !== "" && this.parmValue.end === "") ||
  469. (this.parmValue.start === "" && this.parmValue.end !== "")
  470. ) {
  471. this.$message.warning("时间区间不完整!");
  472. return;
  473. }
  474. this.loading = true;
  475. this.parmValue.orderCode = this.select === "orderCode" ? this.input : "";
  476. this.parmValue.good_name = this.select === "good_name" ? this.input : "";
  477. this.parmValue.apply_name =
  478. this.select === "apply_name" ? this.input : "";
  479. this.parmValue.company_name = this.select === "company_name" ? this.input : "";
  480. const res = await asyncRequest.list(this.parmValue);
  481. if (res && res.code === 0 && res.data) {
  482. this.tableData = res.data.list;
  483. this.tableData.forEach((v) => {
  484. v.good_class = "";
  485. if (v.can && v.can.length > 0) {
  486. v.can.forEach((x, i) => {
  487. v.good_class += i === 0 ? x.name : "_" + x.name;
  488. });
  489. }
  490. });
  491. this.pageInfo.total = Number(res.data.count);
  492. } else if (res && res.code >= 100 && res.code <= 104) {
  493. await this.logout();
  494. } else {
  495. this.tableData = [];
  496. this.pageInfo.total = 0;
  497. }
  498. this.loading = false;
  499. },
  500. // 时间
  501. async handleTime(e) {
  502. if (e.startTime !== "") {
  503. this.parmValue.start = e.startTime;
  504. } else {
  505. this.parmValue.start = "";
  506. }
  507. if (e.endTime !== "") {
  508. this.parmValue.end = e.endTime;
  509. } else {
  510. this.parmValue.end = "";
  511. }
  512. },
  513. },
  514. };
  515. </script>
  516. <style lang="scss" scoped>
  517. .salesOrder {
  518. // text-align: right;
  519. }
  520. </style>