index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <basic-container v-if="show">
  3. <avue-crud :option="option"
  4. :data="dataList"
  5. ref="crud"
  6. v-model="form"
  7. :page.sync="page"
  8. :search.sync="search"
  9. @row-del="rowDel"
  10. :before-open="beforeOpen"
  11. :before-close="beforeClose"
  12. @row-save="rowSave"
  13. @search-change="searchChange"
  14. @search-reset="searchReset"
  15. @selection-change="selectionChange"
  16. @current-change="currentChange"
  17. @size-change="sizeChange"
  18. @refresh-change="refreshChange"
  19. @on-load="onLoad"
  20. @expand-change="expandChange"
  21. @saveColumn="saveColumn">
  22. <template slot="corpIdSearch">
  23. <select-component
  24. v-model="search.corpId"
  25. :configuration="configuration"
  26. ></select-component>
  27. </template>
  28. <template slot-scope="{row,size}" slot="search">
  29. </template>
  30. <template slot-scope="scope" slot="expand" width="48px">
  31. <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
  32. <el-table-column align="center" width="40"></el-table-column>
  33. <el-table-column label="提单号" prop="billNo" align="center" show-overflow-tooltip width="150"></el-table-column>
  34. <el-table-column label="合同号" prop="orgOrderNo" align="center" show-overflow-tooltip width="150"></el-table-column>
  35. <el-table-column label="货物名称" prop="priceCategory" align="center" show-overflow-tooltip width="150"></el-table-column>
  36. <el-table-column label="件数" prop="orderQuantity" align="center" show-overflow-tooltip width="120"></el-table-column>
  37. <el-table-column label="发票重量" prop="invoiceWeight" align="center" show-overflow-tooltip width="150"></el-table-column>
  38. <el-table-column label="码单重量" prop="billWeight" align="center" show-overflow-tooltip width="120"></el-table-column>
  39. <el-table-column label="发票金额" prop="amount" align="center" show-overflow-tooltip width="120"></el-table-column>
  40. <el-table-column label="已发件数" prop="actualQuantity" align="center" show-overflow-tooltip width="120"></el-table-column>
  41. </el-table>
  42. </template>
  43. <template slot="menuLeft">
  44. <el-button size="small"
  45. type="success"
  46. :disabled="true"
  47. @click.stop=""
  48. >复制单据
  49. </el-button>
  50. <el-button size="small"
  51. type="info"
  52. @click.stop=""
  53. >报表
  54. </el-button>
  55. </template>
  56. <template slot-scope="scope" slot="menu">
  57. <el-button
  58. type="text"
  59. icon="el-icon-edit"
  60. size="small"
  61. @click.stop="editOpen(scope.row,2)"
  62. >编辑
  63. </el-button>
  64. <el-button
  65. type="text"
  66. icon="el-icon-delete"
  67. size="small"
  68. @click.stop="rowDel(scope.row,scope.index)"
  69. >删除
  70. </el-button>
  71. </template>
  72. <template slot-scope="scope" slot="orderNo">
  73. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orderNo }}</span>
  74. </template>
  75. <template slot-scope="scope" slot="corpsName">
  76. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.corpsName }}</span>
  77. </template>
  78. <template slot-scope="scope" slot="orderQuantity">
  79. <span>{{ scope.row.orderQuantity | roundNumbers}}</span>
  80. </template>
  81. <template slot-scope="scope" slot="actualQuantity">
  82. <span>{{ scope.row.actualQuantity | roundNumbers}}</span>
  83. </template>
  84. </avue-crud>
  85. </basic-container>
  86. <detail-page
  87. ref="detail"
  88. @goBack="goBack"
  89. :detailData="detailData"
  90. v-else
  91. ></detail-page>
  92. </template>
  93. <script>
  94. import option from "./config/mainList.json";
  95. import {selectSaleList,removeList,detailSaleList} from "@/api/importTrade/salesContract"
  96. import detailPage from "./detailsPage.vue";
  97. import { roundNumbers } from "@/util/validate";
  98. export default {
  99. name: "index",
  100. data() {
  101. return {
  102. option: option,
  103. dataList: [],
  104. show:true,
  105. page: {
  106. pageSize: 10,
  107. pagerCount: 5,
  108. total: 0,
  109. },
  110. form: {},
  111. detailData:{},
  112. search: {},
  113. viewDisabled:false,
  114. configuration:{
  115. multipleChoices:false,
  116. multiple:false,
  117. disabled:false,
  118. searchShow:true,
  119. collapseTags:false,
  120. clearable:true,
  121. placeholder:'请点击右边按钮选择',
  122. dicData:[]
  123. },
  124. }
  125. },
  126. components:{
  127. detailPage
  128. },
  129. filters: {
  130. roundNumbers(val){
  131. return roundNumbers(val);
  132. }
  133. },
  134. mounted() {
  135. // this.option.height = window.innerHeight - 200;
  136. },
  137. async created() {
  138. // this.option = await this.getColumnData(this.getColumnName(38), option);
  139. },
  140. methods: {
  141. //删除列表后面的删除按钮触发触发(row, index, done)
  142. rowDel(row, index, done) {
  143. this.$confirm("确定将选择数据删除?", {
  144. confirmButtonText: "确定",
  145. cancelButtonText: "取消",
  146. type: "warning"
  147. }).then(() => {
  148. return removeList(row.id);
  149. }).then(() => {
  150. this.$message({
  151. type: "success",
  152. message: "操作成功!"
  153. });
  154. this.page.currentPage = 1;
  155. this.onLoad(this.page);
  156. });
  157. },
  158. //新增修改时保存触发
  159. rowSave(row, done, loading) {
  160. typeSave(row).then(res => {
  161. console.log(res)
  162. done()
  163. })
  164. },
  165. //新增子项触发
  166. handleAdd(row) {
  167. this.parentId = row.id;
  168. const column = this.findObject(this.option.column, "parentId");
  169. column.value = row.id;
  170. column.addDisabled = true;
  171. this.$refs.crud.rowAdd();
  172. },
  173. //查看跳转页面
  174. beforeOpenPage(row, index) {
  175. this.detailData = {
  176. id: row.id,
  177. view:true,
  178. };
  179. this.show = false;
  180. },
  181. //新增跳转页面
  182. beforeOpen(row, status) {
  183. this.detailData = {
  184. id: row.id,
  185. status: status
  186. };
  187. this.show = false;
  188. },
  189. editOpen(row, status) {
  190. this.detailData = {
  191. id: row.id,
  192. status: status
  193. };
  194. this.show = false;
  195. },
  196. //点击新增时触发
  197. beforeClose(done) {
  198. this.parentId = "";
  199. const column = this.findObject(this.option.column, "parentId");
  200. column.value = "";
  201. column.addDisabled = false;
  202. done();
  203. },
  204. //点击搜索按钮触发
  205. searchChange(params, done) {
  206. console.log(params)
  207. this.page.currentPage = 1;
  208. this.onLoad(this.page, params);
  209. done()
  210. },
  211. openDisabled(){
  212. this.viewDisabled = false
  213. },
  214. searchReset() {
  215. console.log('1')
  216. },
  217. selectionChange() {
  218. console.log('1')
  219. },
  220. currentChange() {
  221. console.log('1')
  222. },
  223. sizeChange() {
  224. console.log('1')
  225. },
  226. refreshChange() {
  227. this.onLoad(this.page)
  228. },
  229. onLoad(page, params) {
  230. if(params){
  231. if (params.businesDate != undefined) { //发货
  232. params.contractStartDate = params.businesDate[0]+ " " + "00:00:00";
  233. params.contractEndDate = params.businesDate[1] + " " + "23:59:59";
  234. this.$delete(params,'businesDate')
  235. }
  236. if (params.advanceCollectionDate!= undefined) {
  237. params.orderStartDate = params.advanceCollectionDate[0]+ " " + "00:00:00";
  238. params.orderEndDate = params.advanceCollectionDate[1] + " " + "23:59:59";
  239. this.$delete(params,'advanceCollectionDate')
  240. }
  241. }
  242. let queryParams = Object.assign({}, params, {
  243. size: page.pageSize,
  244. current: page.currentPage,
  245. })
  246. selectSaleList(queryParams).then(res => {
  247. this.dataList = res.data.data.records
  248. this.page.total = res.data.data.total
  249. this.dataList.forEach(item => {
  250. this.$set(item,'insideList',[])
  251. this.$set(item,'loading', true)
  252. })
  253. })
  254. },
  255. //表格展开触发
  256. expandChange(row, expendList) {
  257. if (row.loading == true) {
  258. detailSaleList(row.id).then(res => {
  259. row.insideList = res.data.data.orderItemsList
  260. row.loading = false;
  261. })
  262. }
  263. },
  264. goBack() {
  265. this.detailData=this.$options.data().detailData
  266. this.show = true;
  267. },
  268. //列保存触发
  269. async saveColumn() {
  270. const inSave = await this.saveColumnData(
  271. this.getColumnName(38),
  272. this.option
  273. );
  274. if (inSave) {
  275. this.$message.success("保存成功");
  276. //关闭窗口
  277. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  278. }
  279. },
  280. },
  281. }
  282. </script>
  283. <style scoped>
  284. ::v-deep .el-table__expanded-cell{
  285. padding: 0 !important;
  286. }
  287. /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
  288. font-size: 8px !important;
  289. }
  290. /deep/ .el-table__body-wrapper .cell {
  291. font-size: 8px;
  292. }
  293. </style>