index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <div>
  3. <basic-container v-if="show">
  4. <avue-crud :option="option"
  5. :data="dataList"
  6. :table-loading="loading"
  7. ref="crud"
  8. v-model="form"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @row-del="rowDel"
  12. :before-open="beforeOpen"
  13. :before-close="beforeClose"
  14. :cell-style="cellStyle"
  15. @search-change="searchChange"
  16. @search-reset="searchReset"
  17. @selection-change="selectionChange"
  18. @current-change="currentChange"
  19. @size-change="sizeChange"
  20. @refresh-change="refreshChange"
  21. @on-load="onLoad"
  22. @expand-change="expandChange"
  23. @saveColumn="saveColumn"
  24. @resetColumn="resetColumn"
  25. @search-criteria-switch="searchCriteriaSwitch"
  26. >
  27. <template slot="corpIdSearch">
  28. <select-component
  29. v-model="search.corpId"
  30. :configuration="configuration"
  31. ></select-component>
  32. </template>
  33. <template slot="salesNameSearch">
  34. <user-com
  35. v-model="search.salesName"
  36. style="width: 100%"
  37. ></user-com>
  38. </template>
  39. <template slot-scope="scope" slot="expand">
  40. <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
  41. <el-table-column type="selection" align="center" width="50"></el-table-column>
  42. <el-table-column label="提单号" prop="billNo" align="center" show-overflow-tooltip width="150"></el-table-column>
  43. <el-table-column label="货物品种" prop="priceCategoryNames" align="center" show-overflow-tooltip width="180"></el-table-column>
  44. <el-table-column label="规格" prop="itemType" align="center" show-overflow-tooltip width="140"></el-table-column>
  45. <el-table-column label="件数" prop="orderQuantity" align="center" show-overflow-tooltip width="80"></el-table-column>
  46. <el-table-column label="发票重量" prop="invoiceWeight" align="center" show-overflow-tooltip width="120"></el-table-column>
  47. <el-table-column label="码单重量" prop="billWeight" align="center" show-overflow-tooltip width="120"></el-table-column>
  48. <el-table-column label="单价" prop="price" align="center" show-overflow-tooltip width="80"></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="80"></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="corpId">
  71. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.strCorpName }}</span>
  72. </template>
  73. <template slot-scope="scope" slot="orderNo">
  74. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.orderNo }}</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. </div>
  91. </template>
  92. <script>
  93. import option from "./config/mainList.json";
  94. import {selectPurchaseList,removeData,getItemByPid} from "@/api/importTrade/purchase";
  95. import detailPage from "./detailsPage.vue";
  96. import { roundNumbers } from "@/util/validate";
  97. export default {
  98. name: "index",
  99. data() {
  100. return {
  101. loading:false,
  102. option: option,
  103. detailData:{},
  104. dataList: [],
  105. selectionList:[],
  106. page: {
  107. pageSize: 10,
  108. pagerCount: 5,
  109. total: 0,
  110. },
  111. form: {},
  112. show: true,
  113. search: {},
  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. filters: {
  127. roundNumbers(val){
  128. return roundNumbers(val);
  129. }
  130. },
  131. components:{
  132. detailPage
  133. },
  134. async created() {
  135. // this.option = await this.getColumnData(this.getColumnName(36), option);
  136. },
  137. activated() {
  138. if(!this.show && !this.$store.getters.entranceCgStatus){
  139. this.show = true;
  140. }
  141. setTimeout(() => {
  142. if(this.$route.query.check && this.show){
  143. this.detailData={
  144. check:this.$route.query.check
  145. }
  146. this.show = false;
  147. this.$store.commit("ENTRANCE_IN_DETAIL");
  148. } else if (this.$route.query.params) {
  149. this.detailData={
  150. id:this.$route.query.params,
  151. view:true,
  152. }
  153. this.show = false;
  154. this.$store.commit("ENTRANCE_IN_DETAIL");
  155. }
  156. }, 100);
  157. },
  158. mounted() {
  159. },
  160. methods: {
  161. //表格展开触发
  162. expandChange(row, expendList) {
  163. if(row){
  164. getItemByPid(row.id).then(res =>{
  165. this.$set(this.dataList[row.$index],"insideList", res.data.data)
  166. row.loading = false
  167. })
  168. }else{
  169. return
  170. }
  171. },
  172. //删除列表后面的删除按钮触发触发(row, index, done)
  173. rowDel(row, index, done) {
  174. this.$confirm("确定将选择数据删除?", {
  175. confirmButtonText: "确定",
  176. cancelButtonText: "取消",
  177. type: "warning"
  178. }).then(() => {
  179. removeData(row.id).then(res =>{
  180. if(res.data.success){
  181. this.$message({
  182. type: "success",
  183. message: "操作成功!"
  184. });
  185. this.onLoad(this.page );
  186. }
  187. })
  188. })
  189. },
  190. copyBill(){
  191. this.detailData = {
  192. id: this.selectionList[0].id,
  193. status: 'copy'
  194. };
  195. this.show = false;
  196. },
  197. //查看跳转页面
  198. beforeOpenPage(row) {
  199. let lockData = {
  200. moduleName: 'cg',
  201. tableName: 'business_order',
  202. billId: row.id,
  203. no: localStorage.getItem('browserID'),
  204. billNo:row.orderNo
  205. }
  206. this.detailData = {
  207. id: row.id,
  208. view:true,
  209. lockData:lockData,
  210. };
  211. this.show = false;
  212. this.$store.commit("ENTRANCE_IN_DETAIL");
  213. },
  214. //新增跳转页面
  215. beforeOpen(row, status) {
  216. this.detailData = {
  217. id: row.id,
  218. status: status
  219. };
  220. this.show = false;
  221. this.$store.commit("ENTRANCE_IN_DETAIL");
  222. },
  223. //点击新增时触发
  224. beforeClose(done) {
  225. this.parentId = "";
  226. const column = this.findObject(this.option.column, "parentId");
  227. column.value = "";
  228. column.addDisabled = false;
  229. done();
  230. },
  231. //点击搜索按钮触发
  232. searchChange(params, done) {
  233. this.page.currentPage = 1;
  234. this.onLoad(this.page, params);
  235. done()
  236. },
  237. searchReset() {
  238. console.log('1')
  239. },
  240. selectionChange(row) {
  241. this.selectionList = row
  242. },
  243. currentChange(val) {
  244. this.page.currentPage = val;
  245. },
  246. sizeChange() {
  247. console.log('1')
  248. },
  249. refreshChange() {
  250. this.onLoad(this.page);
  251. },
  252. paramsAdjustment(params){
  253. params = Object.assign({},this.search);
  254. if (params.businesDate && params.businesDate.length !=0 ) { //合同
  255. params.businesStartDate = params.businesDate[0]+ " " + "00:00:00";
  256. params.businesEndDate = params.businesDate[1] + " " + "23:59:59";
  257. this.$delete(params,'businesDate')
  258. }
  259. if (params.requiredDeliveryDate && params.requiredDeliveryDate.length !=0 ) { //发货
  260. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0]+ " " + "00:00:00";
  261. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1] + " " + "23:59:59";
  262. this.$delete(params,'requiredDeliveryDate')
  263. }
  264. if (params.requiredArrivalDate && params.requiredArrivalDate.length !=0 ) { //到货
  265. params.requiredArrivalStartDate = params.requiredArrivalDate[0]+ " " + "00:00:00";
  266. params.requiredArrivalEndDate = params.requiredArrivalDate[1] + " " + "23:59:59";
  267. this.$delete(params,'requiredArrivalDate')
  268. }
  269. if (params.accountsCollectionDate && params.accountsCollectionDate.length !=0 ) { //付款
  270. params.accountsCollectionStartDate = params.accountsCollectionDate[0]+ " " + "00:00:00";
  271. params.accountsCollectionEndDate = params.accountsCollectionDate[1] + " " + "23:59:59";
  272. this.$delete(params,'accountsCollectionDate')
  273. }
  274. if (params.dateOfArrival && params.dateOfArrival.length !=0 ) { //到港
  275. params.dateOfStartArrival = params.dateOfArrival[0]+ " " + "00:00:00";
  276. params.dateOfEndArrival = params.dateOfArrival[1] + " " + "23:59:59";
  277. this.$delete(params,'dateOfArrival')
  278. }
  279. if (params.creditDate && params.creditDate.length !=0 ) { //信用
  280. params.creditStartDate = params.creditDate[0]+ " " + "00:00:00";
  281. params.creditEndDate = params.creditDate[1] + " " + "23:59:59";
  282. this.$delete(params,'creditDate')
  283. }
  284. return params
  285. },
  286. onLoad(page, params) {
  287. this.loading = true
  288. params = this.paramsAdjustment(params)
  289. params.size = page.pageSize
  290. params.current = page.currentPage
  291. params.tradeType = "JK" //进口参数
  292. selectPurchaseList(params).then(res => {
  293. this.dataList = res.data.data.records
  294. this.page.total = res.data.data.total
  295. if (this.page.total || this.page.total === 0) {
  296. this.option.height = window.innerHeight - 200;
  297. }
  298. })
  299. .finally(()=>{
  300. this.loading = false
  301. })
  302. },
  303. searchCriteriaSwitch(type){
  304. if (type){
  305. this.option.height = this.option.height - 145
  306. }else {
  307. this.option.height = this.option.height + 145
  308. }
  309. this.$refs.crud.getTableHeight()
  310. },
  311. goBack() {
  312. this.detailData=this.$options.data().detailData
  313. this.show = true;
  314. this.onLoad(this.page, this.search)
  315. },
  316. cellStyle() {
  317. return "padding:0;height:40px;";
  318. },
  319. //列保存触发
  320. async saveColumn() {
  321. const inSave = await this.saveColumnData(
  322. this.getColumnName(36),
  323. this.option
  324. );
  325. if (inSave) {
  326. this.$message.success("保存成功");
  327. //关闭窗口
  328. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  329. }
  330. },
  331. async resetColumn() {
  332. const inSave = await this.delColumnData(
  333. this.getColumnName(36),
  334. option
  335. );
  336. if (inSave) {
  337. this.$message.success("重置成功");
  338. this.option = option;
  339. //关闭窗口
  340. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  341. }
  342. },
  343. },
  344. }
  345. </script>
  346. <style scoped>
  347. ::v-deep .el-table__expanded-cell{
  348. padding: 0 !important;
  349. }
  350. /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
  351. font-size: 8px !important;
  352. }
  353. /deep/ .el-table__body-wrapper .cell {
  354. font-size: 8px;
  355. }
  356. </style>