index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  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. :search.sync="search"
  9. @row-del="rowDel"
  10. @row-update="rowUpdate"
  11. :before-open="beforeOpen"
  12. :before-close="beforeClose"
  13. @row-save="rowSave"
  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. <template slot="corpIdSearch">
  24. <select-component
  25. v-model="search.corpId"
  26. :configuration="configuration"
  27. ></select-component>
  28. </template>
  29. <template slot-scope="{row,size}" slot="search">
  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 align="center" width="60"></el-table-column>
  34. <el-table-column type="selection" align="center" width="50"></el-table-column>
  35. <el-table-column label="序号" type="index" align="center" width="50"></el-table-column>
  36. <el-table-column label="提单号" prop="billNO" align="center" show-overflow-tooltip width="150"></el-table-column>
  37. <el-table-column label="货物名称" prop="cname" align="center" show-overflow-tooltip width="150"></el-table-column>
  38. <el-table-column label="件数" prop="actualQuantity" align="center" show-overflow-tooltip width="120"></el-table-column>
  39. <el-table-column label="销售价格" prop="price" align="center" show-overflow-tooltip width="150"></el-table-column>
  40. <el-table-column label="销售数量" prop="actualQuantity" align="center" show-overflow-tooltip width="120"></el-table-column>
  41. <el-table-column label="码单数量" prop="billWeight" align="center" show-overflow-tooltip width="120"></el-table-column>
  42. <el-table-column label="是否发货" prop="isSend" align="center" show-overflow-tooltip width="120"></el-table-column>
  43. <el-table-column label="付款金额" prop="amount" align="center" show-overflow-tooltip width="150"></el-table-column>
  44. </el-table>
  45. </template>
  46. <template slot="menuLeft">
  47. <el-button size="small"
  48. type="success"
  49. :disabled="true"
  50. @click.stop=""
  51. >复制新单
  52. </el-button>
  53. <el-button size="small"
  54. type="info"
  55. @click.stop=""
  56. >报表
  57. </el-button>
  58. </template>
  59. <template slot-scope="scope" slot="menu">
  60. <el-button
  61. type="text"
  62. icon="el-icon-view"
  63. size="small"
  64. @click.stop="beforeOpenPage(scope.row,1)"
  65. >查看
  66. </el-button>
  67. <el-button
  68. type="text"
  69. icon="el-icon-edit"
  70. size="small"
  71. @click.stop="editOpen(scope.row,2)"
  72. >编辑
  73. </el-button>
  74. <el-button
  75. type="text"
  76. icon="el-icon-delete"
  77. size="small"
  78. @click.stop="rowDel(scope.row,scope.index)"
  79. >删除
  80. </el-button>
  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. export default {
  96. name: "index",
  97. data() {
  98. return {
  99. option: option,
  100. dataList: [],
  101. show:true,
  102. page: {
  103. pageSize: 10,
  104. pagerCount: 5,
  105. total: 0,
  106. },
  107. form: {},
  108. detailData:{},
  109. search: {},
  110. configuration:{
  111. multipleChoices:false,
  112. multiple:false,
  113. disabled:false,
  114. searchShow:true,
  115. collapseTags:false,
  116. clearable:true,
  117. placeholder:'请点击右边按钮选择',
  118. dicData:[]
  119. },
  120. }
  121. },
  122. components:{
  123. detailPage
  124. },
  125. async created() {
  126. // this.option = await this.getColumnData(this.getColumnName(38), option);
  127. },
  128. methods: {
  129. //删除列表后面的删除按钮触发触发(row, index, done)
  130. rowDel(row, index, done) {
  131. this.$confirm("确定将选择数据删除?", {
  132. confirmButtonText: "确定",
  133. cancelButtonText: "取消",
  134. type: "warning"
  135. }).then(() => {
  136. return removeList(row.id);
  137. }).then(() => {
  138. this.$message({
  139. type: "success",
  140. message: "操作成功!"
  141. });
  142. this.page.currentPage = 1;
  143. this.onLoad(this.page);
  144. });
  145. },
  146. //修改时的修改按钮点击触发
  147. rowUpdate(row, index, done, loading) {
  148. typeSave(row).then(() => {
  149. this.$message({
  150. type: "success",
  151. message: "操作成功!"
  152. });
  153. // 数据回调进行刷新
  154. done(row);
  155. }, error => {
  156. window.console.log(error);
  157. loading();
  158. });
  159. },
  160. //新增修改时保存触发
  161. rowSave(row, done, loading) {
  162. typeSave(row).then(res => {
  163. console.log(res)
  164. done()
  165. })
  166. },
  167. //查询全部
  168. initData() {
  169. customerList().then(res => {
  170. console.log(this.form);
  171. const column = this.findObject(this.option.column, "parentId");
  172. column.dicData = res.data.data.records;
  173. });
  174. },
  175. //新增子项触发
  176. handleAdd(row) {
  177. this.parentId = row.id;
  178. const column = this.findObject(this.option.column, "parentId");
  179. column.value = row.id;
  180. column.addDisabled = true;
  181. this.$refs.crud.rowAdd();
  182. },
  183. //查看跳转页面
  184. beforeOpenPage(row, index) {
  185. this.detailData = {
  186. id: row.id,
  187. status: status
  188. };
  189. this.show = false;
  190. },
  191. //新增跳转页面
  192. beforeOpen(row, status) {
  193. this.detailData = {
  194. id: row.id,
  195. status: status
  196. };
  197. this.show = false;
  198. },
  199. editOpen(row, status) {
  200. this.detailData = {
  201. id: row.id,
  202. status: status
  203. };
  204. this.show = false;
  205. },
  206. //点击新增时触发
  207. beforeClose(done) {
  208. this.parentId = "";
  209. const column = this.findObject(this.option.column, "parentId");
  210. column.value = "";
  211. column.addDisabled = false;
  212. done();
  213. },
  214. //点击搜索按钮触发
  215. searchChange(params, done) {
  216. console.log(params)
  217. this.page.currentPage = 1;
  218. this.onLoad(this.page, params);
  219. done()
  220. },
  221. searchReset() {
  222. console.log('1')
  223. },
  224. selectionChange() {
  225. console.log('1')
  226. },
  227. currentChange() {
  228. console.log('1')
  229. },
  230. sizeChange() {
  231. console.log('1')
  232. },
  233. refreshChange() {
  234. this.onLoad(this.page)
  235. },
  236. onLoad(page, params) {
  237. let queryParams = Object.assign({}, params, {
  238. size: page.pageSize,
  239. current: page.currentPage,
  240. })
  241. selectSaleList(queryParams).then(res => {
  242. this.dataList = res.data.data.records
  243. this.page.total = res.data.data.total
  244. if (this.page.total) {
  245. this.option.height = window.innerHeight - 350;
  246. } else {
  247. this.option.height = window.innerHeight - 305;
  248. }
  249. this.dataList.forEach(item => {
  250. this.$set(item,'insideList',[])
  251. this.$set(item,'loading', true)
  252. })
  253. })
  254. },
  255. //表格展开触发
  256. expandChange(row, expendList) {
  257. if (row.loading == true) {
  258. detailSaleList(row.id).then(res => {
  259. row.insideList = res.data.data.orderItemsList
  260. row.loading = false;
  261. })
  262. }
  263. },
  264. goBack() {
  265. this.detailData=this.$options.data().detailData
  266. this.show = true;
  267. },
  268. //列保存触发
  269. async saveColumn() {
  270. const inSave = await this.saveColumnData(
  271. this.getColumnName(38),
  272. this.option
  273. );
  274. if (inSave) {
  275. this.$message.success("保存成功");
  276. //关闭窗口
  277. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  278. }
  279. },
  280. },
  281. }
  282. </script>
  283. <style scoped>
  284. ::v-deep .el-table__expanded-cell{
  285. padding: 0 !important;
  286. }
  287. </style>