index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  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. @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. >
  25. <template slot="corpIdSearch">
  26. <select-component
  27. v-model="search.corpId"
  28. :configuration="configuration"
  29. ></select-component>
  30. </template>
  31. <template slot-scope="scope" slot="expand">
  32. <el-table :data="scope.row.insideList" v-loading="scope.row.loading">
  33. <el-table-column type="selection" align="center" width="50"></el-table-column>
  34. <el-table-column label="提单号" prop="billNo" align="center" show-overflow-tooltip width="150"></el-table-column>
  35. <el-table-column label="货物品种" prop="priceCategoryNames" align="center" show-overflow-tooltip width="180"></el-table-column>
  36. <el-table-column label="规格" prop="itemType" align="center" show-overflow-tooltip width="140"></el-table-column>
  37. <el-table-column label="件数" prop="orderQuantity" align="center" show-overflow-tooltip width="80"></el-table-column>
  38. <el-table-column label="发票重量" prop="invoiceWeight" align="center" show-overflow-tooltip width="120"></el-table-column>
  39. <el-table-column label="码单重量" prop="billWeight" align="center" show-overflow-tooltip width="120"></el-table-column>
  40. <el-table-column label="单价" prop="price" align="center" show-overflow-tooltip width="80"></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="80"></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="corpId">
  63. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.strCorpName }}</span>
  64. </template>
  65. <template slot-scope="scope" slot="orderNo">
  66. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row)">{{ scope.row.orderNo }}</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. </div>
  83. </template>
  84. <script>
  85. import option from "./config/mainList.json";
  86. import {selectPurchaseList,removeData,getItemByPid} from "@/api/importTrade/purchase";
  87. import detailPage from "./detailsPage.vue";
  88. import { roundNumbers } from "@/util/validate";
  89. export default {
  90. name: "index",
  91. data() {
  92. return {
  93. loading:false,
  94. option: {},
  95. detailData:{},
  96. dataList: [],
  97. selectionList:[],
  98. page: {
  99. pageSize: 10,
  100. pagerCount: 5,
  101. total: 0,
  102. },
  103. form: {},
  104. show: true,
  105. search: {},
  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. filters: {
  119. roundNumbers(val){
  120. return roundNumbers(val);
  121. }
  122. },
  123. components:{
  124. detailPage
  125. },
  126. async created() {
  127. this.option = await this.getColumnData(this.getColumnName(36), option);
  128. },
  129. activated() {
  130. if(!this.show && !this.$store.getters.entranceCgStatus){
  131. this.show = true;
  132. }
  133. setTimeout(() => {
  134. if(this.$route.query.check && this.show){
  135. this.detailData={
  136. check:this.$route.query.check
  137. }
  138. this.show = false;
  139. this.$store.commit("ENTRANCE_IN_DETAIL");
  140. }
  141. }, 100);
  142. },
  143. mounted() {
  144. },
  145. methods: {
  146. //表格展开触发
  147. expandChange(row, expendList) {
  148. if(row){
  149. getItemByPid(row.id).then(res =>{
  150. this.$set(this.dataList[row.$index],"insideList", res.data.data)
  151. row.loading = false
  152. })
  153. }else{
  154. return
  155. }
  156. },
  157. //删除列表后面的删除按钮触发触发(row, index, done)
  158. rowDel(row, index, done) {
  159. this.$confirm("确定将选择数据删除?", {
  160. confirmButtonText: "确定",
  161. cancelButtonText: "取消",
  162. type: "warning"
  163. }).then(() => {
  164. removeData(row.id).then(res =>{
  165. if(res.data.success){
  166. this.$message({
  167. type: "success",
  168. message: "操作成功!"
  169. });
  170. this.onLoad(this.page );
  171. }
  172. })
  173. })
  174. },
  175. copyBill(){
  176. this.detailData = {
  177. id: this.selectionList[0].id,
  178. status: 'copy'
  179. };
  180. this.show = false;
  181. },
  182. //查看跳转页面
  183. beforeOpenPage(row) {
  184. let lockData = {
  185. moduleName: 'cg',
  186. tableName: 'business_order',
  187. billId: row.id,
  188. no: localStorage.getItem('browserID'),
  189. billNo:row.orderNo
  190. }
  191. this.detailData = {
  192. id: row.id,
  193. view:true,
  194. lockData:lockData,
  195. };
  196. this.show = false;
  197. this.$store.commit("ENTRANCE_IN_DETAIL");
  198. },
  199. //新增跳转页面
  200. beforeOpen(row, status) {
  201. this.detailData = {
  202. id: row.id,
  203. status: status
  204. };
  205. this.show = false;
  206. this.$store.commit("ENTRANCE_IN_DETAIL");
  207. },
  208. //点击新增时触发
  209. beforeClose(done) {
  210. this.parentId = "";
  211. const column = this.findObject(this.option.column, "parentId");
  212. column.value = "";
  213. column.addDisabled = false;
  214. done();
  215. },
  216. //点击搜索按钮触发
  217. searchChange(params, done) {
  218. this.page.currentPage = 1;
  219. this.onLoad(this.page, params);
  220. done()
  221. },
  222. searchReset() {
  223. console.log('1')
  224. },
  225. selectionChange(row) {
  226. this.selectionList = row
  227. },
  228. currentChange(val) {
  229. this.page.currentPage = val;
  230. },
  231. sizeChange() {
  232. console.log('1')
  233. },
  234. refreshChange() {
  235. this.onLoad(this.page);
  236. },
  237. paramsAdjustment(params){
  238. params = Object.assign({},this.search);
  239. if (params.businesDate && params.businesDate.length !=0 ) { //合同
  240. params.businesStartDate = params.businesDate[0]+ " " + "00:00:00";
  241. params.businesEndDate = params.businesDate[1] + " " + "23:59:59";
  242. this.$delete(params,'businesDate')
  243. }
  244. if (params.requiredDeliveryDate && params.requiredDeliveryDate.length !=0 ) { //发货
  245. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0]+ " " + "00:00:00";
  246. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1] + " " + "23:59:59";
  247. this.$delete(params,'requiredDeliveryDate')
  248. }
  249. if (params.requiredArrivalDate && params.requiredArrivalDate.length !=0 ) { //到货
  250. params.requiredArrivalStartDate = params.requiredArrivalDate[0]+ " " + "00:00:00";
  251. params.requiredArrivalEndDate = params.requiredArrivalDate[1] + " " + "23:59:59";
  252. this.$delete(params,'requiredArrivalDate')
  253. }
  254. if (params.accountsCollectionDate && params.accountsCollectionDate.length !=0 ) { //付款
  255. params.accountsCollectionStartDate = params.accountsCollectionDate[0]+ " " + "00:00:00";
  256. params.accountsCollectionEndDate = params.accountsCollectionDate[1] + " " + "23:59:59";
  257. this.$delete(params,'accountsCollectionDate')
  258. }
  259. if (params.dateOfArrival && params.dateOfArrival.length !=0 ) { //到港
  260. params.dateOfStartArrival = params.dateOfArrival[0]+ " " + "00:00:00";
  261. params.dateOfEndArrival = params.dateOfArrival[1] + " " + "23:59:59";
  262. this.$delete(params,'dateOfArrival')
  263. }
  264. if (params.creditDate && params.creditDate.length !=0 ) { //信用
  265. params.creditStartDate = params.creditDate[0]+ " " + "00:00:00";
  266. params.creditEndDate = params.creditDate[1] + " " + "23:59:59";
  267. this.$delete(params,'creditDate')
  268. }
  269. return params
  270. },
  271. onLoad(page, params) {
  272. this.loading = true
  273. params = this.paramsAdjustment(params)
  274. params.size = page.pageSize
  275. params.current = page.currentPage
  276. params.tradeType = "JK" //进口参数
  277. selectPurchaseList(params).then(res => {
  278. this.dataList = res.data.data.records
  279. this.page.total = res.data.data.total
  280. })
  281. .finally(()=>{
  282. this.loading = false
  283. })
  284. },
  285. goBack() {
  286. this.detailData=this.$options.data().detailData
  287. this.show = true;
  288. this.onLoad(this.page, this.search)
  289. },
  290. //列保存触发
  291. async saveColumn() {
  292. const inSave = await this.saveColumnData(
  293. this.getColumnName(36),
  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(36),
  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>