index.vue 9.2 KB

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