index.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  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="priceCategory" 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. </template>
  41. <template slot-scope="scope" slot="menu">
  42. <el-button type="text" icon="el-icon-delete" size="small" v-if="scope.row.status == 0 || scope.row.status == 4"
  43. @click.stop="rowDel(scope.row, scope.index)">删除
  44. </el-button>
  45. </template>
  46. <template slot-scope="scope" slot="orderNo">
  47. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.orderNo
  48. }}</span>
  49. </template>
  50. <template slot-scope="scope" slot="corpId">
  51. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.corpsName
  52. }}</span>
  53. </template>
  54. <template slot-scope="scope" slot="orderQuantity">
  55. <span>{{ scope.row.orderQuantity | roundNumbers }}</span>
  56. </template>
  57. <template slot-scope="scope" slot="actualQuantity">
  58. <span>{{ scope.row.actualQuantity | roundNumbers }}</span>
  59. </template>
  60. </avue-crud>
  61. </basic-container>
  62. <detail-page ref="detail" @goBack="goBack" :detailData="detailData" v-else></detail-page>
  63. </template>
  64. <script>
  65. import option from "./config/mainList.json";
  66. import { selectSaleList, removeList, detailSaleList } from "@/api/importTrade/salesContract"
  67. import detailPage from "./detailsPage.vue";
  68. import { roundNumbers } from "@/util/validate";
  69. export default {
  70. name: "index",
  71. data() {
  72. return {
  73. option: {},
  74. dataList: [],
  75. loading: false,
  76. show: true,
  77. selectionList: [],
  78. page: {
  79. pageSize: 10,
  80. pagerCount: 5,
  81. total: 0,
  82. },
  83. form: {},
  84. detailData: {},
  85. search: {},
  86. viewDisabled: false,
  87. configuration: {
  88. multipleChoices: false,
  89. multiple: false,
  90. disabled: false,
  91. searchShow: true,
  92. collapseTags: false,
  93. clearable: true,
  94. placeholder: '请点击右边按钮选择',
  95. dicData: []
  96. },
  97. }
  98. },
  99. components: {
  100. detailPage
  101. },
  102. filters: {
  103. roundNumbers(val) {
  104. return roundNumbers(val);
  105. }
  106. },
  107. mounted() {
  108. },
  109. async created() {
  110. this.option = await this.getColumnData(this.getColumnName(38), option);
  111. },
  112. activated() {
  113. if (!this.show && !this.$store.getters.entranceXsStatus) {
  114. this.show = true;
  115. }
  116. setTimeout(() => {
  117. if (this.$route.query.check && this.show) {
  118. this.detailData = {
  119. check: this.$route.query.check
  120. }
  121. this.show = false;
  122. this.$store.commit("XSACE_IN_DETAIL");
  123. } else if (this.$route.query.params) {
  124. this.detailData = {
  125. id: this.$route.query.params,
  126. view: true,
  127. }
  128. this.show = false;
  129. this.$store.commit("XSACE_IN_DETAIL");
  130. }
  131. }, 100);
  132. },
  133. methods: {
  134. //表格展开触发
  135. expandChange(row, expendList) {
  136. if (row.loading == true) {
  137. detailSaleList(row.id).then(res => {
  138. row.insideList = res.data.data.orderItemsList
  139. row.loading = false;
  140. })
  141. }
  142. },
  143. //删除列表后面的删除按钮触发触发(row, index, done)
  144. rowDel(row, index, done) {
  145. this.$confirm("确定将选择数据删除?", {
  146. confirmButtonText: "确定",
  147. cancelButtonText: "取消",
  148. type: "warning"
  149. }).then(() => {
  150. return removeList(row.id);
  151. }).then(() => {
  152. this.$message({
  153. type: "success",
  154. message: "操作成功!"
  155. });
  156. this.page.currentPage = 1;
  157. this.onLoad(this.page);
  158. });
  159. },
  160. copyBill() {
  161. this.detailData = {
  162. id: this.selectionList[0].id,
  163. status: 'copy'
  164. };
  165. this.show = false;
  166. },
  167. //新增跳转页面
  168. beforeOpen(row, status) {
  169. this.show = false;
  170. this.$store.commit("XSACE_IN_DETAIL");
  171. },
  172. //查看跳转页面
  173. beforeOpenPage(row) {
  174. let lockData = {
  175. moduleName: 'xs',
  176. tableName: 'business_order',
  177. billId: row.id,
  178. no: localStorage.getItem('browserID'),
  179. billNo: row.orderNo
  180. }
  181. this.detailData = {
  182. id: row.id,
  183. view: true,
  184. lockData: lockData,
  185. };
  186. this.show = false;
  187. this.$store.commit("XSACE_IN_DETAIL");
  188. },
  189. //点击新增时触发
  190. beforeClose(done) {
  191. this.parentId = "";
  192. const column = this.findObject(this.option.column, "parentId");
  193. column.value = "";
  194. column.addDisabled = false;
  195. done();
  196. },
  197. //点击搜索按钮触发
  198. searchChange(params, done) {
  199. this.page.currentPage = 1;
  200. this.onLoad(this.page, params);
  201. done()
  202. },
  203. openDisabled() {
  204. this.viewDisabled = false
  205. },
  206. searchReset() {
  207. console.log('1')
  208. },
  209. selectionChange(row) {
  210. this.selectionList = row
  211. },
  212. currentChange(val) {
  213. this.page.currentPage = val;
  214. },
  215. sizeChange() {
  216. console.log('1')
  217. },
  218. refreshChange() {
  219. this.onLoad(this.page)
  220. },
  221. paramsAdjustment(params) {
  222. params = Object.assign({}, this.search);
  223. if (params.businesDate && params.businesDate.length !== 0) { //发货
  224. params.contractStartDate = params.businesDate[0] + " " + "00:00:00";
  225. params.contractEndDate = params.businesDate[1] + " " + "23:59:59";
  226. this.$delete(params, 'businesDate')
  227. }
  228. if (params.advanceCollectionDate && params.advanceCollectionDate.length !== 0) {
  229. params.orderStartDate = params.advanceCollectionDate[0] + " " + "00:00:00";
  230. params.orderEndDate = params.advanceCollectionDate[1] + " " + "23:59:59";
  231. this.$delete(params, 'advanceCollectionDate')
  232. }
  233. return params
  234. },
  235. onLoad(page, params) {
  236. this.loading = true
  237. params = this.paramsAdjustment(params)
  238. params.size = page.pageSize
  239. params.current = page.currentPage
  240. selectSaleList(params).then(res => {
  241. this.dataList = res.data.data.records
  242. this.page.total = res.data.data.total
  243. this.dataList.forEach(item => {
  244. this.$set(item, 'insideList', [])
  245. this.$set(item, 'loading', true)
  246. })
  247. if (this.page.total) {
  248. this.option.height = window.innerHeight - 200;
  249. }
  250. }).finally(() => {
  251. this.loading = false
  252. })
  253. },
  254. goBack() {
  255. this.detailData = this.$options.data().detailData
  256. this.show = true;
  257. this.onLoad(this.page, this.search)
  258. },
  259. searchCriteriaSwitch(type) {
  260. if (type) {
  261. this.option.height = this.option.height - 145
  262. } else {
  263. this.option.height = this.option.height + 145
  264. }
  265. this.$refs.crud.getTableHeight()
  266. },
  267. cellStyle() {
  268. return "padding:0;height:40px;";
  269. },
  270. //列保存触发
  271. async saveColumn() {
  272. const inSave = await this.saveColumnData(
  273. this.getColumnName(38),
  274. this.option
  275. );
  276. if (inSave) {
  277. this.$message.success("保存成功");
  278. //关闭窗口
  279. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  280. }
  281. },
  282. async resetColumn() {
  283. const inSave = await this.delColumnData(
  284. this.getColumnName(38),
  285. option
  286. );
  287. if (inSave) {
  288. this.$message.success("重置成功");
  289. this.option = option;
  290. //关闭窗口
  291. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  292. }
  293. },
  294. },
  295. }
  296. </script>
  297. <style scoped>
  298. ::v-deep .el-table__expanded-cell {
  299. padding: 0 !important;
  300. }
  301. /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
  302. font-size: 8px !important;
  303. }
  304. /deep/ .el-table__body-wrapper .cell {
  305. font-size: 8px;
  306. }
  307. </style>