index.vue 10 KB

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