index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <basic-container v-if="show">
  3. <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :table-loading="loading"
  4. :search.sync="search" @row-del="rowDel" :before-open="beforeOpen" :before-close="beforeClose"
  5. :cell-style="cellStyle" @search-change="searchChange" @search-reset="searchReset"
  6. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  7. @refresh-change="refreshChange" @on-load="onLoad" @expand-change="expandChange" @saveColumn="saveColumn"
  8. @resetColumn="resetColumn" @search-criteria-switch="searchCriteriaSwitch">
  9. <template slot="corpIdSearch">
  10. <select-component v-model="search.corpId" :configuration="configuration"></select-component>
  11. </template>
  12. <template slot="salesNameSearch">
  13. <user-com v-model="search.salesName" style="width: 100%"></user-com>
  14. </template>
  15. <template slot-scope="{row,size}" slot="search">
  16. </template>
  17. <template slot-scope="scope" slot="expand" width="48px">
  18. <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
  19. <el-table-column align="center" width="40"></el-table-column>
  20. <el-table-column label="提单号" prop="billNo" align="center" show-overflow-tooltip width="150"></el-table-column>
  21. <el-table-column label="合同号" prop="orgOrderNo" align="center" show-overflow-tooltip width="150">
  22. </el-table-column>
  23. <el-table-column label="货物名称" prop="priceCategoryNames" align="center" show-overflow-tooltip width="150">
  24. </el-table-column>
  25. <el-table-column label="件数" prop="orderQuantity" align="center" show-overflow-tooltip width="120">
  26. </el-table-column>
  27. <el-table-column label="发票重量" prop="invoiceWeight" align="center" show-overflow-tooltip width="150">
  28. </el-table-column>
  29. <el-table-column label="码单重量" prop="billWeight" align="center" show-overflow-tooltip width="120">
  30. </el-table-column>
  31. <el-table-column label="发票金额" prop="amount" align="center" show-overflow-tooltip width="120">
  32. </el-table-column>
  33. <el-table-column label="已发件数" prop="actualQuantity" align="center" show-overflow-tooltip width="120">
  34. </el-table-column>
  35. </el-table>
  36. </template>
  37. <template slot="menuLeft">
  38. <el-button size="small" type="success" :disabled="selectionList.length != 1" @click.stop="copyBill">复制单据
  39. </el-button>
  40. <el-button type="warning" icon="el-icon-download" size="mini" @click="outExport">导出
  41. </el-button>
  42. </template>
  43. <template slot-scope="scope" slot="menu">
  44. <el-button type="text" icon="el-icon-delete" size="small" v-if="scope.row.status == 0 || scope.row.status == 4"
  45. @click.stop="rowDel(scope.row, scope.index)">删除
  46. </el-button>
  47. </template>
  48. <template slot-scope="scope" slot="orderNo">
  49. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.orderNo
  50. }}</span>
  51. </template>
  52. <template slot-scope="scope" slot="corpId">
  53. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.corpsName
  54. }}</span>
  55. </template>
  56. <template slot-scope="scope" slot="orderQuantity">
  57. <span>{{ scope.row.orderQuantity | roundNumbers }}</span>
  58. </template>
  59. <template slot-scope="scope" slot="actualQuantity">
  60. <span>{{ scope.row.actualQuantity | roundNumbers }}</span>
  61. </template>
  62. </avue-crud>
  63. </basic-container>
  64. <detail-page ref="detail" @goBack="goBack" :detailData="detailData" v-else></detail-page>
  65. </template>
  66. <script>
  67. import option from "./config/mainList.json";
  68. import { selectSaleList, removeList, detailSaleList } from "@/api/importTrade/salesContract"
  69. import detailPage from "./detailsPage.vue";
  70. import { roundNumbers } from "@/util/validate";
  71. import { getToken } from "@/util/auth";
  72. export default {
  73. name: "index",
  74. data() {
  75. return {
  76. option: {},
  77. dataList: [],
  78. loading: false,
  79. show: true,
  80. selectionList: [],
  81. page: {
  82. pageSize: 10,
  83. pagerCount: 5,
  84. total: 0,
  85. },
  86. form: {},
  87. detailData: {},
  88. search: {
  89. orderType:'棉花'
  90. },
  91. viewDisabled: false,
  92. configuration: {
  93. multipleChoices: false,
  94. multiple: false,
  95. disabled: false,
  96. searchShow: true,
  97. collapseTags: false,
  98. clearable: true,
  99. placeholder: '请点击右边按钮选择',
  100. dicData: []
  101. },
  102. }
  103. },
  104. components: {
  105. detailPage
  106. },
  107. filters: {
  108. roundNumbers(val) {
  109. return roundNumbers(val);
  110. }
  111. },
  112. mounted() {
  113. },
  114. async created() {
  115. this.option = await this.getColumnData(this.getColumnName(38), option);
  116. this.getWorkDicts("contractType").then(res => {
  117. this.findObject(this.option.column, "orderType").dicData =
  118. res.data.data;
  119. })
  120. },
  121. activated() {
  122. if (!this.show && !this.$store.getters.entranceXsStatus) {
  123. this.show = true;
  124. }
  125. setTimeout(() => {
  126. if (this.$route.query.check && this.show) {
  127. this.detailData = {
  128. check: this.$route.query.check
  129. }
  130. this.show = false;
  131. this.$store.commit("XSACE_IN_DETAIL");
  132. } else if (this.$route.query.params) {
  133. this.detailData = {
  134. id: this.$route.query.params,
  135. view: true,
  136. }
  137. this.show = false;
  138. this.$store.commit("XSACE_IN_DETAIL");
  139. }
  140. }, 100);
  141. },
  142. methods: {
  143. //表格展开触发
  144. expandChange(row, expendList) {
  145. if (row.loading == true) {
  146. detailSaleList(row.id).then(res => {
  147. row.insideList = res.data.data.orderItemsList
  148. row.loading = false;
  149. })
  150. }
  151. },
  152. //删除列表后面的删除按钮触发触发(row, index, done)
  153. rowDel(row, index, done) {
  154. this.$confirm("确定将选择数据删除?", {
  155. confirmButtonText: "确定",
  156. cancelButtonText: "取消",
  157. type: "warning"
  158. }).then(() => {
  159. return removeList(row.id);
  160. }).then(() => {
  161. this.$message({
  162. type: "success",
  163. message: "操作成功!"
  164. });
  165. this.page.currentPage = 1;
  166. this.onLoad(this.page);
  167. });
  168. },
  169. copyBill() {
  170. this.detailData = {
  171. id: this.selectionList[0].id,
  172. status: 'copy'
  173. };
  174. this.show = false;
  175. },
  176. //新增跳转页面
  177. beforeOpen(row, status) {
  178. this.show = false;
  179. this.$store.commit("XSACE_IN_DETAIL");
  180. },
  181. //查看跳转页面
  182. beforeOpenPage(row) {
  183. let lockData = {
  184. moduleName: 'xs',
  185. tableName: 'business_order',
  186. billId: row.id,
  187. no: localStorage.getItem('browserID'),
  188. billNo: row.orderNo
  189. }
  190. this.detailData = {
  191. id: row.id,
  192. view: true,
  193. lockData: lockData,
  194. };
  195. this.show = false;
  196. this.$store.commit("XSACE_IN_DETAIL");
  197. },
  198. //点击新增时触发
  199. beforeClose(done) {
  200. this.parentId = "";
  201. const column = this.findObject(this.option.column, "parentId");
  202. column.value = "";
  203. column.addDisabled = false;
  204. done();
  205. },
  206. //点击搜索按钮触发
  207. searchChange(params, done) {
  208. this.page.currentPage = 1;
  209. this.onLoad(this.page, params);
  210. done()
  211. },
  212. openDisabled() {
  213. this.viewDisabled = false
  214. },
  215. searchReset() {
  216. console.log('1')
  217. },
  218. selectionChange(row) {
  219. this.selectionList = row
  220. },
  221. currentChange(val) {
  222. this.page.currentPage = val;
  223. },
  224. sizeChange() {
  225. console.log('1')
  226. },
  227. refreshChange() {
  228. this.onLoad(this.page)
  229. },
  230. paramsAdjustment(params) {
  231. params = Object.assign({}, this.search);
  232. if (params.businesDate && params.businesDate.length !== 0) { //发货
  233. params.contractStartDate = params.businesDate[0] + " " + "00:00:00";
  234. params.contractEndDate = params.businesDate[1] + " " + "23:59:59";
  235. this.$delete(params, 'businesDate')
  236. }
  237. if (params.advanceCollectionDate && params.advanceCollectionDate.length !== 0) {
  238. params.orderStartDate = params.advanceCollectionDate[0] + " " + "00:00:00";
  239. params.orderEndDate = params.advanceCollectionDate[1] + " " + "23:59:59";
  240. this.$delete(params, 'advanceCollectionDate')
  241. }
  242. return params
  243. },
  244. onLoad(page, params) {
  245. this.loading = true
  246. params = this.paramsAdjustment(params)
  247. params.size = page.pageSize
  248. params.current = page.currentPage
  249. selectSaleList(params).then(res => {
  250. this.dataList = res.data.data.records
  251. this.page.total = res.data.data.total
  252. this.dataList.forEach(item => {
  253. this.$set(item, 'insideList', [])
  254. this.$set(item, 'loading', true)
  255. })
  256. if (this.page.total) {
  257. this.option.height = window.innerHeight - 200;
  258. }
  259. }).finally(() => {
  260. this.loading = false
  261. })
  262. },
  263. goBack() {
  264. this.detailData = this.$options.data().detailData
  265. this.show = true;
  266. this.onLoad(this.page, this.search)
  267. },
  268. searchCriteriaSwitch(type) {
  269. if (type) {
  270. this.option.height = this.option.height - 145
  271. } else {
  272. this.option.height = this.option.height + 145
  273. }
  274. this.$refs.crud.getTableHeight()
  275. },
  276. cellStyle() {
  277. return "padding:0;height:40px;";
  278. },
  279. //导出
  280. outExport() {
  281. let params = { ...this.search }
  282. if (params.businesDate && params.businesDate.length > 0) {
  283. params = {
  284. ...params,
  285. contractStartDate: params.businesDate[0] + ' 00:00:00',
  286. contractEndDate: params.businesDate[1] + ' 23:59:59',
  287. }
  288. } else {
  289. params = {
  290. ...params,
  291. contractStartDate: '',
  292. contractEndDate: '',
  293. }
  294. }
  295. if (params.advanceCollectionDate && params.advanceCollectionDate.length > 0) {
  296. params = {
  297. ...params,
  298. orderStartDate: params.advanceCollectionDate[0] + ' 00:00:00',
  299. orderEndDate: params.advanceCollectionDate[1] + ' 23:59:59',
  300. }
  301. } else {
  302. params = {
  303. ...params,
  304. orderStartDate: '',
  305. orderEndDate: '',
  306. }
  307. }
  308. this.$confirm('是否导出数据?', '提示', {
  309. confirmButtonText: '确定',
  310. cancelButtonText: '取消',
  311. type: 'warning'
  312. }).then(() => {
  313. window.open(
  314. `/api/blade-purchase-sales/entranceOrder/selOrderExportB?${this.website.tokenHeader
  315. }=${getToken()}&orderNo=${params.orderNo}&billNo=${params.billNo}&corpId=${params.corpId}&salesName=${params.salesName}&orderRemark=${params.orderRemark}&orderAmount=${params.orderAmount}&invoiceAmount=${params.invoiceAmount}&contractStartDate=${params.contractStartDate}&contractEndDate=${params.contractEndDate}&orderStartDate=${params.orderStartDate}&orderEndDate=${params.orderEndDate}`
  316. );
  317. }).catch(() => {
  318. this.$message({
  319. type: 'info',
  320. message: '已取消' //
  321. });
  322. })
  323. },
  324. //列保存触发
  325. async saveColumn() {
  326. const inSave = await this.saveColumnData(
  327. this.getColumnName(38),
  328. this.option
  329. );
  330. if (inSave) {
  331. this.$message.success("保存成功");
  332. //关闭窗口
  333. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  334. }
  335. },
  336. async resetColumn() {
  337. const inSave = await this.delColumnData(
  338. this.getColumnName(38),
  339. option
  340. );
  341. if (inSave) {
  342. this.$message.success("重置成功");
  343. this.option = option;
  344. //关闭窗口
  345. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  346. }
  347. },
  348. },
  349. }
  350. </script>
  351. <style scoped>
  352. ::v-deep .el-table__expanded-cell {
  353. padding: 0 !important;
  354. }
  355. /* /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
  356. font-size: 8px !important;
  357. }
  358. /deep/ .el-table__body-wrapper .cell {
  359. font-size: 8px;
  360. } */
  361. </style>