index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  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. @row-update="rowUpdate"
  13. :before-open="beforeOpen"
  14. :before-close="beforeClose"
  15. @row-save="rowSave"
  16. @search-change="searchChange"
  17. @search-reset="searchReset"
  18. @selection-change="selectionChange"
  19. @current-change="currentChange"
  20. @size-change="sizeChange"
  21. @refresh-change="refreshChange"
  22. @on-load="onLoad"
  23. @expand-change="expandChange"
  24. @saveColumn="saveColumn">
  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="40"></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="true"
  49. @click.stop=""
  50. >复制新单
  51. </el-button>
  52. <el-button size="small"
  53. type="info"
  54. @click.stop="openReport()"
  55. >报表
  56. </el-button>
  57. </template>
  58. <template slot-scope="scope" slot="menu">
  59. <!-- <el-button
  60. type="text"
  61. icon="el-icon-view"
  62. size="small"
  63. @click.stop="beforeOpenPage(scope.row,1)"
  64. >查看
  65. </el-button>-->
  66. <el-button
  67. type="text"
  68. icon="el-icon-edit"
  69. size="small"
  70. @click.stop="editOpen(scope.row,2)"
  71. >编辑
  72. </el-button>
  73. <el-button
  74. type="text"
  75. icon="el-icon-delete"
  76. size="small"
  77. @click.stop="rowDel(scope.row,scope.index)"
  78. >删除
  79. </el-button>
  80. </template>
  81. <template slot-scope="scope" slot="orderNo">
  82. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.orderNo }}</span>
  83. </template>
  84. <template slot-scope="scope" slot="strCorpName">
  85. <span style="color: #409EFF;cursor: pointer" @click.stop="beforeOpenPage(scope.row,scope.index)">{{ scope.row.strCorpName }}</span>
  86. </template>
  87. </avue-crud>
  88. </basic-container>
  89. <detail-page
  90. ref="detail"
  91. @goBack="goBack"
  92. :detailData="detailData"
  93. v-else
  94. ></detail-page>
  95. </div>
  96. </template>
  97. <script>
  98. import option from "./config/mainList.json";
  99. import {selectPurchaseList,removeData,getItemByPid} from "@/api/importTrade/purchase";
  100. import detailPage from "./detailsPage.vue";
  101. export default {
  102. name: "index",
  103. data() {
  104. return {
  105. loading:false,
  106. option: option,
  107. detailData:{},
  108. dataList: [],
  109. page: {
  110. pageSize: 10,
  111. pagerCount: 5,
  112. total: 0,
  113. },
  114. form: {},
  115. show: true,
  116. search: {},
  117. configuration:{
  118. multipleChoices:false,
  119. multiple:false,
  120. disabled:false,
  121. searchShow:true,
  122. collapseTags:false,
  123. clearable:true,
  124. placeholder:'请点击右边按钮选择',
  125. dicData:[]
  126. },
  127. }
  128. },
  129. components:{
  130. detailPage
  131. },
  132. async created() {
  133. // this.option = await this.getColumnData(this.getColumnName(36), option);
  134. },
  135. activated() {
  136. setTimeout(() => {
  137. if(this.$route.query.check){
  138. this.detailData={
  139. check:this.$route.query.check
  140. }
  141. this.show = false;
  142. }
  143. }, 100);
  144. },
  145. mounted() {
  146. },
  147. methods: {
  148. //删除列表后面的删除按钮触发触发(row, index, done)
  149. rowDel(row, index, done) {
  150. this.$confirm("确定将选择数据删除?", {
  151. confirmButtonText: "确定",
  152. cancelButtonText: "取消",
  153. type: "warning"
  154. }).then(() => {
  155. removeData(row.id).then(res =>{
  156. if(res.data.success){
  157. this.$message({
  158. type: "success",
  159. message: "操作成功!"
  160. });
  161. this.onLoad(this.page );
  162. }
  163. })
  164. })
  165. },
  166. //修改时的修改按钮点击触发
  167. rowUpdate(row, index, done, loading) {
  168. typeSave(row).then(() => {
  169. this.$message({
  170. type: "success",
  171. message: "操作成功!"
  172. });
  173. // 数据回调进行刷新
  174. done(row);
  175. }, error => {
  176. window.console.log(error);
  177. loading();
  178. });
  179. },
  180. //新增修改时保存触发
  181. rowSave(row, done, loading) {
  182. typeSave(row).then(res => {
  183. console.log(res)
  184. done()
  185. })
  186. },
  187. //查询全部
  188. initData() {
  189. customerList().then(res => {
  190. const column = this.findObject(this.option.column, "parentId");
  191. column.dicData = res.data.data.records;
  192. });
  193. },
  194. //新增子项触发
  195. handleAdd(row) {
  196. this.parentId = row.id;
  197. const column = this.findObject(this.option.column, "parentId");
  198. column.value = row.id;
  199. column.addDisabled = true;
  200. this.$refs.crud.rowAdd();
  201. },
  202. //查看跳转页面
  203. beforeOpenPage(row, status) {
  204. this.detailData = {
  205. id: row.id,
  206. view:true,
  207. status: status
  208. };
  209. this.show = false;
  210. },
  211. //新增跳转页面
  212. beforeOpen(row, status) {
  213. this.detailData = {
  214. id: row.id,
  215. status: status
  216. };
  217. this.show = false;
  218. },
  219. editOpen(row, status) {
  220. this.detailData = {
  221. id: row.id,
  222. status: status
  223. };
  224. this.show = false;
  225. },
  226. //点击新增时触发
  227. beforeClose(done) {
  228. this.parentId = "";
  229. const column = this.findObject(this.option.column, "parentId");
  230. column.value = "";
  231. column.addDisabled = false;
  232. done();
  233. },
  234. //点击搜索按钮触发
  235. searchChange(params, done) {
  236. console.log(params)
  237. this.page.currentPage = 1;
  238. this.onLoad(this.page, params);
  239. done()
  240. },
  241. searchReset() {
  242. console.log('1')
  243. },
  244. selectionChange() {
  245. console.log('1')
  246. },
  247. currentChange() {
  248. console.log('1')
  249. },
  250. sizeChange() {
  251. console.log('1')
  252. },
  253. refreshChange() {
  254. this.onLoad(this.page);
  255. },
  256. onLoad(page, params) {
  257. if(params){
  258. if (params.businesDate != undefined) { //合同
  259. params.businesStartDate = params.businesDate[0]+ " " + "00:00:00";
  260. params.businesEndDate = params.businesDate[1] + " " + "23:59:59";
  261. this.$delete(params,'businesDate')
  262. }
  263. if (params.requiredDeliveryDate!= undefined) { //发货
  264. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0]+ " " + "00:00:00";
  265. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1] + " " + "23:59:59";
  266. this.$delete(params,'requiredDeliveryDate')
  267. }
  268. if (params.requiredArrivalDate!= undefined) { //到货
  269. params.requiredArrivalStartDate = params.requiredArrivalDate[0]+ " " + "00:00:00";
  270. params.requiredArrivalEndDate = params.requiredArrivalDate[1] + " " + "23:59:59";
  271. this.$delete(params,'requiredArrivalDate')
  272. }
  273. if (params.accountsCollectionDate!= undefined) { //付款
  274. params.accountsCollectionStartDate = params.accountsCollectionDate[0]+ " " + "00:00:00";
  275. params.accountsCollectionEndDate = params.accountsCollectionDate[1] + " " + "23:59:59";
  276. this.$delete(params,'accountsCollectionDate')
  277. }
  278. if (params.dateOfArrival!= undefined) { //到港
  279. params.dateOfStartArrival = params.dateOfArrival[0]+ " " + "00:00:00";
  280. params.dateOfEndArrival = params.dateOfArrival[1] + " " + "23:59:59";
  281. this.$delete(params,'dateOfArrival')
  282. }
  283. if (params.creditDate!= undefined) { //信用
  284. params.creditStartDate = params.creditDate[0]+ " " + "00:00:00";
  285. params.creditEndDate = params.creditDate[1] + " " + "23:59:59";
  286. this.$delete(params,'creditDate')
  287. }
  288. }
  289. let queryParams = Object.assign({}, params, {
  290. size: page.pageSize,
  291. current: page.currentPage,
  292. tradeType:"JK" //进口参数
  293. })
  294. this.loading = true
  295. selectPurchaseList(queryParams).then(res => {
  296. this.dataList = res.data.data.records
  297. this.page.total = res.data.data.total
  298. })
  299. .finally(()=>{
  300. this.loading = false
  301. })
  302. },
  303. //表格展开触发
  304. expandChange(row, expendList) {
  305. if(row){
  306. getItemByPid(row.id).then(res =>{
  307. this.$set(this.dataList[row.$index],"insideList", res.data.data)
  308. row.loading = false
  309. })
  310. }else{
  311. return
  312. }
  313. },
  314. goBack() {
  315. this.detailData=this.$options.data().detailData
  316. this.show = true;
  317. },
  318. //列保存触发
  319. async saveColumn() {
  320. const inSave = await this.saveColumnData(
  321. this.getColumnName(36),
  322. this.option
  323. );
  324. if (inSave) {
  325. this.$message.success("保存成功");
  326. //关闭窗口
  327. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  328. }
  329. },
  330. },
  331. }
  332. </script>
  333. <style scoped>
  334. ::v-deep .el-table__expanded-cell{
  335. padding: 0 !important;
  336. }
  337. /deep/ .el-table__expanded-cell .el-table__header-wrapper .cell {
  338. font-size: 8px !important;
  339. }
  340. /deep/ .el-table__body-wrapper .cell {
  341. font-size: 8px;
  342. }
  343. </style>