index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @expand-change="expandChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 274.4)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 274.4)" :page.sync="page">
  9. <template slot-scope="{ row }" slot="expand">
  10. <avue-crud :data="row.itemData" :option="itemOption" :table-loading="row.itemLoading" :cell-style="cellStyle"
  11. class="itemTable"></avue-crud>
  12. </template>
  13. <template slot-scope="{type,size,row,index}" slot="menu">
  14. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  15. <el-button :size="size" :type="type"
  16. :disabled="row.status != '录入' && row.status != '待确认' && row.item >= 1 || row.businessSource == '外部销售' || row.numberRows >= 1"
  17. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  18. </template>
  19. <template slot="corpNameSearch">
  20. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  21. </template>
  22. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  23. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新建订单</el-button>
  24. <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>
  25. </template>
  26. <template slot-scope="{ row, index }" slot="ordNo">
  27. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.ordNo }}
  28. </span>
  29. </template>
  30. <template slot-scope="{ row, index }" slot="srcOrdNo">
  31. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 3)">{{ row.srcOrdNo }}
  32. </span>
  33. </template>
  34. </avue-crud>
  35. </basic-container>
  36. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  37. </div>
  38. </template>
  39. <script>
  40. import { getList, remove, getGoodsInfo } from "@/api/tirePartsMall/salesManagement/saleOrder";
  41. import detailsPage from "./detailsPage"
  42. import { getDetails } from "@/api/tirePartsMall/salesManagement/saleOrder";
  43. import {getToken} from "@/util/auth";
  44. export default {
  45. name: "index",
  46. components: {
  47. detailsPage
  48. },
  49. data() {
  50. return {
  51. detailsOpen: false,
  52. loading: false,
  53. search: {},
  54. form: {},
  55. dataList: [],
  56. detailData: {},
  57. page: {
  58. pageSize: 20,
  59. currentPage: 1,
  60. total: 0,
  61. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  62. },
  63. key: 0,
  64. itemOption: {
  65. align: "center",
  66. header: false,
  67. border: true,
  68. menu: false,
  69. column: [
  70. {
  71. label: '轮胎名称',
  72. prop: 'goodsId',
  73. width: 200,
  74. disabled: false,
  75. remote: true,
  76. overHidden: true,
  77. type: 'select',
  78. // dicData: [],
  79. props: {
  80. label: 'cname',
  81. value: 'id'
  82. },
  83. dicUrl: "/api/blade-sales-part/goodsDesc/goodsListAll"
  84. }, {
  85. label: '数量',
  86. prop: 'goodsNum',
  87. overHidden: true,
  88. disabled: false,
  89. width: 100,
  90. rules: [{
  91. required: true,
  92. message: " ",
  93. trigger: "blur"
  94. }, {
  95. validator: (rule, value, callback) => {
  96. console.log(this.formContacts.inventory);
  97. if (value < 0) {
  98. callback(new Error("数量不能小于0"));
  99. } else {
  100. callback();
  101. }
  102. },
  103. trigger: "blur"
  104. }]
  105. },
  106. {
  107. label: '价格',
  108. prop: 'price',
  109. overHidden: true,
  110. width: 100,
  111. disabled: false,
  112. rules: [{
  113. required: true,
  114. message: " ",
  115. trigger: "blur"
  116. }, {
  117. validator: (rule, value, callback) => {
  118. if (value < 0) {
  119. callback(new Error("价格不能小于0"));
  120. } else {
  121. callback();
  122. }
  123. },
  124. trigger: "blur"
  125. }]
  126. },
  127. {
  128. label: '库存',
  129. prop: 'inventory',
  130. overHidden: true,
  131. hide: true,
  132. width: 100
  133. }, {
  134. label: '批次号',
  135. prop: 'dot',
  136. type: "select",
  137. disabled: true,
  138. allowCreate: true,
  139. filterable: true,
  140. dicData: [],
  141. props: {
  142. label: "dot",
  143. value: "dot"
  144. },
  145. dicUrl: "/api/blade-sales-part/stockDesc/dotList",
  146. overHidden: true,
  147. }, {
  148. label: '轮胎编码',
  149. prop: 'goodsNo',
  150. overHidden: true,
  151. disabled: false,
  152. width: 100
  153. },
  154. {
  155. label: '品牌',
  156. prop: 'brandId',
  157. disabled: false,
  158. width: 100,
  159. overHidden: true,
  160. type: 'select',
  161. props: {
  162. label: 'cname',
  163. value: 'id'
  164. },
  165. dicUrl: '/api/blade-sales-part/brandDesc/listAll'
  166. },
  167. {
  168. label: '规格型号',
  169. prop: 'propertyName',
  170. overHidden: true,
  171. disabled: false,
  172. width: 100
  173. }, {
  174. label: '花纹',
  175. prop: 'pattern',
  176. overHidden: true,
  177. disabled: false,
  178. width: 100
  179. }, {
  180. label: '轮胎描述',
  181. prop: 'goodsDescription',
  182. disabled: false,
  183. overHidden: true,
  184. width: 100
  185. },
  186. {
  187. label: '收货数量',
  188. prop: 'sendNum',
  189. disabled: false,
  190. overHidden: true,
  191. width: 100,
  192. disabled: true,
  193. editDisplay: false,
  194. addDisplay: false
  195. }
  196. ]
  197. },
  198. option: {},
  199. optionList: {
  200. viewBtn: false,
  201. editBtn: false,
  202. delBtn: false,
  203. addBtn: false,
  204. index: true,
  205. span: 8,
  206. border: true,
  207. height: "auto",
  208. searchMenuPosition: "right",
  209. align: "center",
  210. size: "small",
  211. menuWidth: 50,
  212. searchSpan: 8,
  213. searchIcon: true,
  214. searchIndex: 2,
  215. highlightCurrentRow: true,
  216. expand: true,
  217. expandWidth: 60,
  218. dialogWidth: "70%",
  219. summaryText: "合计",
  220. showSummary: true,
  221. sumColumnList: [{
  222. name: 'goodsTotalNum',
  223. type: 'sum',
  224. decimals: 1
  225. }, {
  226. name: 'totalMoney',
  227. type: 'sum',
  228. decimals: 1
  229. },],
  230. column: [{
  231. label: '采购单号',
  232. prop: "ordNo",
  233. search: true,
  234. overHidden: true,
  235. },
  236. // {
  237. // label: '来源单号',
  238. // prop: "srcOrdNo",
  239. // search: true,
  240. // overHidden: true,
  241. // },
  242. // {
  243. // label: "业务来源",
  244. // prop: "businessSource",
  245. // overHidden: true,
  246. // search: true,
  247. // type: 'select',
  248. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=business_Source",
  249. // props: {
  250. // label: "dictValue",
  251. // value: "dictKey"
  252. // }
  253. // },
  254. {
  255. label: '所属公司',
  256. prop: "salesCompanyName",
  257. overHidden: true,
  258. }, {
  259. label: '业务对象',
  260. prop: "customerId",
  261. type: 'select',
  262. remote:true,
  263. search: true,
  264. overHidden: true,
  265. props: {
  266. label: 'cname',
  267. value: 'id'
  268. },
  269. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?cname={{key}}&corpType=GYS',
  270. }, {
  271. label: '仓库',
  272. prop: "storageId",
  273. search: true,
  274. // remote:true,
  275. overHidden: true,
  276. type: 'select',
  277. props: {
  278. label: 'cname',
  279. value: 'id'
  280. },
  281. dicUrl: '/api/blade-sales-part/storageDesc/listAll?cname={{key}}',
  282. }, {
  283. label: '行数',
  284. prop: "numberRows",
  285. overHidden: true,
  286. }, {
  287. label: '数量',
  288. prop: "goodsTotalNum",
  289. overHidden: true,
  290. }, {
  291. label: '金额',
  292. prop: "totalMoney",
  293. overHidden: true,
  294. }, {
  295. label: '已付金额',
  296. prop: "paymentAmountTl",
  297. disabled: true
  298. }, {
  299. label: '状态',
  300. prop: "status",
  301. search: true,
  302. overHidden: true,
  303. type: 'select',
  304. dicUrl: "/api/blade-system/dict-biz/dictionary?code=procurement_Status",
  305. props: {
  306. label: "dictValue",
  307. value: "dictKey"
  308. }
  309. },
  310. {
  311. label: '结算状态',
  312. prop: "actualPaymentStatus",
  313. searchProp:'actualPaymentType',
  314. search: true,
  315. overHidden: true,
  316. type: 'select',
  317. dicData: [
  318. {
  319. label: "待付款",
  320. value: 1,
  321. },
  322. {
  323. label: "已付款",
  324. value: 2,
  325. },
  326. {
  327. label: "尾款",
  328. value: 3,
  329. }
  330. ],
  331. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=settlement_Status",
  332. // props: {
  333. // label: "dictValue",
  334. // value: "dictKey"
  335. // }
  336. },
  337. // {
  338. // label: '应结日期',
  339. // prop: "dueDate",
  340. // overHidden: true,
  341. // },
  342. {
  343. label: "制单人",
  344. prop: "createUserName",
  345. searchProp: "createUser",
  346. overHidden: true,
  347. width: 100,
  348. filterable: true,
  349. remote: true,
  350. type: "select",
  351. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  352. props: {
  353. label: "account",
  354. value: "id",
  355. res: 'data.records'
  356. }
  357. }, {
  358. label: "制单日期",
  359. prop: "createTime",
  360. searchProp: "createTimeList",
  361. type: "date",
  362. overHidden: true,
  363. width: 100,
  364. searchRange: true,
  365. searchDefaultTime: ["00:00:00", "23:59:59"],
  366. format: "yyyy-MM-dd",
  367. valueFormat: "yyyy-MM-dd HH:mm:ss"
  368. }, {
  369. label: '业务日期',
  370. prop: "businesDate",
  371. overHidden: true,
  372. searchProp: "businesDateList",
  373. type: "date",
  374. overHidden: true,
  375. search: true,
  376. width: 100,
  377. searchRange: true,
  378. searchDefaultTime: ["00:00:00", "23:59:59"],
  379. format: "yyyy-MM-dd",
  380. valueFormat: "yyyy-MM-dd HH:mm:ss"
  381. }, {
  382. label: "更新人",
  383. prop: "updateUserName",
  384. searchProp: "updateUser",
  385. overHidden: true,
  386. width: 100,
  387. filterable: true,
  388. remote: true,
  389. type: "select",
  390. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  391. props: {
  392. label: "account",
  393. value: "id",
  394. res: 'data.records'
  395. }
  396. }, {
  397. label: "更新日期",
  398. prop: "updateTime",
  399. searchProp: "updateTimeList",
  400. type: "date",
  401. overHidden: true,
  402. width: 100,
  403. searchRange: true,
  404. searchDefaultTime: ["00:00:00", "23:59:59"],
  405. format: "yyyy-MM-dd",
  406. valueFormat: "yyyy-MM-dd HH:mm:ss"
  407. }]
  408. }
  409. }
  410. },
  411. activated() {
  412. console.log(213213213213);
  413. setTimeout(() => {
  414. console.log(this.$route.query.check);
  415. if (this.$route.query.check) {
  416. this.editOpen({ id: this.$route.query.check.srcBillId }, 1)
  417. this.$store.commit("IN_LTCG_STATUS");
  418. }
  419. if(this.$route.query.type == 'F'){
  420. this.editOpen({ id: this.$route.query.detail.srcParentId }, 1)
  421. }
  422. this.detailData = {
  423. id: this.$route.query.check.billId,
  424. check: this.$route.query.check,
  425. auditId: this.$route.query.check.id
  426. };
  427. }, 100);
  428. },
  429. async created() {
  430. this.option = await this.getColumnData(this.getColumnName(274.4), this.optionList);
  431. this.key++
  432. let i = 0;
  433. this.option.column.forEach(item => {
  434. if (item.search) i++
  435. })
  436. if (i % 3 !== 0) {
  437. const num = 3 - Number(i % 3)
  438. this.option.searchMenuSpan = num * 8;
  439. this.option.searchMenuPosition = "right";
  440. }
  441. },
  442. methods: {
  443. // 导出
  444. outExport() {
  445. console.log(this.search,412)
  446. let config = { params: { ...this.search } }
  447. if (config.params) {
  448. for (const propName of Object.keys(config.params)) {
  449. const value = config.params[propName];
  450. if (value !== null && typeof (value) !== "undefined") {
  451. if (value instanceof Array) {
  452. for (const key of Object.keys(value)) {
  453. let params = propName + '[' + key + ']';
  454. config.params[params] = value[key]
  455. }
  456. delete config.params[propName]
  457. }
  458. }
  459. }
  460. }
  461. config.params.bsType = 'CG'
  462. console.log(config,427)
  463. const routeData = this.$router.resolve({
  464. path: '/api/blade-sales-part/order/listExport', //跳转目标下载地址
  465. query: {
  466. ...config.params //括号内是要传递给新窗口的参数
  467. }
  468. })
  469. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  470. },
  471. check(row) {
  472. this.form = row
  473. this.detailsOpen = true
  474. },
  475. backToList(type) {
  476. this.form = {}
  477. this.detailsOpen = false
  478. if (type === 0) {
  479. this.detailData = {}
  480. }
  481. this.$store.commit("OUT_LTCG_STATUS");
  482. this.onLoad(this.page, this.search)
  483. },
  484. editOpen(row, status) {
  485. this.form = row
  486. this.detailData = {
  487. id: row.id,
  488. status: status
  489. };
  490. console.log(status);
  491. this.$store.commit("IN_LTCG_STATUS");
  492. this.detailsOpen = true;
  493. },
  494. //刷新
  495. refreshChange() {
  496. this.onLoad(this.page, this.search)
  497. },
  498. rowDel(form, index) {
  499. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  500. confirmButtonText: '确定',
  501. cancelButtonText: '取消',
  502. type: 'warning'
  503. }).then(() => {
  504. remove({ id: form.id }).then(res => {
  505. this.$message({
  506. type: 'success',
  507. message: '删除成功!'
  508. });
  509. this.dataList.splice(index, 1);
  510. this.onLoad(this.page)
  511. })
  512. }).catch(() => {
  513. });
  514. },
  515. // 点击搜索触发
  516. searchChange(params, done) {
  517. done();
  518. this.onLoad(this.page, params)
  519. },
  520. onLoad(page, params = {}) {
  521. params = {
  522. ...params,
  523. current: page.currentPage,
  524. size: page.pageSize,
  525. bsType: "CG",
  526. ...Object.assign(params, this.search)
  527. }
  528. this.loading = true
  529. this.dataList.forEach(item => {
  530. this.$refs.crud.toggleRowExpansion(item, false);
  531. });
  532. getList(params).then(res => {
  533. if (res.data.data.records) {
  534. res.data.data.records.forEach(e => {
  535. e.itemLoading = true;
  536. });
  537. }
  538. this.dataList = res.data.data.records
  539. this.page.total = res.data.data.total
  540. this.$nextTick(() => {
  541. this.$refs.crud.doLayout()
  542. })
  543. this.loading = false
  544. }).finally(() => {
  545. this.loading = false
  546. })
  547. },
  548. expandChange(row) {
  549. if (!row.itemData) {
  550. getDetails({ id: row.id})
  551. .then(res => {
  552. this.dataList[row.$index].itemData = res.data.data.orderItemsList;
  553. })
  554. .finally(() => {
  555. this.dataList[row.$index].itemLoading = false;
  556. });
  557. }
  558. },
  559. //自定义列保存
  560. async saveColumnTwo(ref, option, optionBack, code) {
  561. /**
  562. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  563. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  564. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  565. */
  566. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  567. if (inSave) {
  568. this.$message.success("保存成功");
  569. //关闭窗口
  570. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  571. }
  572. },
  573. //自定义列重置
  574. async resetColumnTwo(ref, option, optionBack, code) {
  575. this[option] = this[optionBack];
  576. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  577. if (inSave) {
  578. this.$message.success("重置成功");
  579. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  580. }
  581. }
  582. }
  583. }
  584. </script>
  585. <style scoped></style>