index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <div>
  3. <basic-container v-show="show" class="page-crad">
  4. <avue-crud ref="crud" :option="option" :data="dataList" :page.sync="page" :search.sync="search"
  5. @search-change="searchChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @on-load="onLoad" :table-loading="loading" @saveColumn="saveColumn"
  7. @resetColumn="resetColumn" :cell-style="cellStyle" @search-criteria-switch="searchCriteriaSwitch">
  8. <template slot="menuLeft">
  9. <el-button type="primary" size="mini" @click.stop="newAdd()">新建销售单
  10. </el-button>
  11. </template>
  12. <template slot-scope="{ row, index }" slot="corpId">
  13. <span style="color: #409EFF;cursor: pointer" @click.stop="editOpen(row, 2)">{{ row.corpsName }}
  14. </span>
  15. </template>
  16. <template slot="businesDateSearch">
  17. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期" end-placeholder="结束日期"
  18. format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" :default-time="['00:00:00', '23:59:59']">
  19. </el-date-picker>
  20. </template>
  21. <template slot-scope="{ row, index }" slot="menu">
  22. <!-- <el-tooltip class="item" effect="dark" content="新建销售订单" placement="top">
  23. <i class="tradingIcon icon-add" />
  24. </el-tooltip>
  25. <el-tooltip class="item" effect="dark" content="删除" placement="top">
  26. <i class="tradingIcon icon-del" />
  27. </el-tooltip>
  28. <el-tooltip class="item" effect="dark" content="编辑" placement="top">
  29. <i class="tradingIcon icon-edit" />
  30. </el-tooltip>
  31. <el-tooltip class="item" effect="dark" content="收款" placement="top">
  32. <i class="tradingIcon icon-proceeds" />
  33. </el-tooltip>
  34. <el-tooltip class="item" effect="dark" content="发货" placement="top">
  35. <i class="tradingIcon icon-deliver" />
  36. </el-tooltip>
  37. <el-tooltip class="item" effect="dark" content="对账" placement="top">
  38. <i class="tradingIcon icon-reconciliation" />
  39. </el-tooltip> -->
  40. <!-- <el-button type="text" size="small" @click.stop="editOpen(row, 2)">
  41. 查看
  42. </el-button>
  43. <el-button type="text" size="small" @click.stop="rowDel(row, index)">
  44. 删除
  45. </el-button> -->
  46. </template>
  47. </avue-crud>
  48. </basic-container>
  49. <details-page v-if="!show" @goBack="goBack()" :detailData="detailData" />
  50. </div>
  51. </template>
  52. <script>
  53. import detailsPage from "./detailsPage";
  54. import { option } from "./js/optionList";
  55. import { getList, getCorpsAll, gainUser } from "@/api/basicData/salesOrder";
  56. export default {
  57. name: "index",
  58. data() {
  59. return {
  60. src: '',
  61. show: true,
  62. loading: false,
  63. search: {},
  64. detailData: {},
  65. dataList: [],
  66. selectionList: [],
  67. page: {
  68. pageSize: 20,
  69. currentPage: 1,
  70. total: 0,
  71. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  72. },
  73. option: {},
  74. };
  75. },
  76. components: {
  77. detailsPage
  78. },
  79. async created() {
  80. this.option = await this.getColumnData(this.getColumnName(211), option);
  81. this.option.height = window.innerHeight - 210;
  82. this.getAllWorkDicts()
  83. },
  84. methods: {
  85. getAllWorkDicts() {
  86. getCorpsAll().then(res => {
  87. this.findObject(this.option.column, "corpId").dicData = res.data.data;
  88. })
  89. gainUser().then(res => {
  90. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  91. })
  92. this.$refs.crud.init();
  93. },
  94. searchCriteriaSwitch(type) {
  95. if (type) {
  96. this.option.height = this.option.height - 46;
  97. } else {
  98. this.option.height = this.option.height + 46;
  99. }
  100. this.$refs.crud.getTableHeight();
  101. },
  102. cellStyle() {
  103. return "padding:0;height:40px;";
  104. },
  105. //点击搜索按钮触发
  106. searchChange(params, done) {
  107. this.page.currentPage = 1;
  108. this.onLoad(this.page, params);
  109. done();
  110. },
  111. refreshChange() {
  112. this.onLoad(this.page, this.search);
  113. },
  114. newAdd() {
  115. this.show = false;
  116. },
  117. onLoad(page, params = {}) {
  118. let data = this.deepClone(Object.assign(params, this.search));
  119. data.billType = 'XS';
  120. data.tradeType = 'YPJ';
  121. if (data.businesDate) {
  122. data.orderStartDate = data.businesDate[0];
  123. data.orderEndDate = data.businesDate[1];
  124. }
  125. delete data.businesDate
  126. this.loading = true;
  127. getList(
  128. page.currentPage,
  129. page.pageSize,
  130. data
  131. )
  132. .then(res => {
  133. this.dataList = res.data.data.records ? res.data.data.records : [];
  134. this.page.total = res.data.data.total;
  135. })
  136. .finally(() => {
  137. this.loading = false;
  138. });
  139. },
  140. editOpen(row, status) {
  141. this.detailData = {
  142. id: row.id,
  143. status: status
  144. };
  145. this.show = false;
  146. },
  147. currentChange(val) {
  148. this.page.currentPage = val;
  149. },
  150. sizeChange(val) {
  151. this.page.currentPage = 1;
  152. this.page.pageSize = val;
  153. },
  154. rowDel(row, index, done) {
  155. this.$confirm("确定删除数据?", {
  156. confirmButtonText: "确定",
  157. cancelButtonText: "取消",
  158. type: "warning"
  159. }).then(() => {
  160. // remove(row.id).then(res => {
  161. // if (res.data.code == 200) {
  162. // this.$message({
  163. // type: "success",
  164. // message: "删除成功!"
  165. // });
  166. // this.onLoad(this.page, this.search);
  167. // }
  168. // });
  169. });
  170. },
  171. async saveColumn() {
  172. const inSave = await this.saveColumnData(
  173. this.getColumnName(211),
  174. this.option
  175. );
  176. if (inSave) {
  177. this.$nextTick(() => {
  178. this.$refs.crud.doLayout();
  179. });
  180. this.$message.success("保存成功");
  181. //关闭窗口
  182. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  183. }
  184. },
  185. async resetColumn() {
  186. this.option = option;
  187. const inSave = await this.delColumnData(this.getColumnName(211), option);
  188. if (inSave) {
  189. this.$nextTick(() => {
  190. this.$refs.crud.doLayout();
  191. });
  192. this.getAllWorkDicts()
  193. this.$message.success("重置成功");
  194. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  195. }
  196. },
  197. //返回列表
  198. goBack() {
  199. this.detailData = this.$options.data().detailData;
  200. this.show = true;
  201. this.onLoad(this.page, this.search);
  202. },
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. .page-crad ::v-deep .basic-container__card {
  208. height: 94.2vh;
  209. }
  210. .stat-td {
  211. text-align: center;
  212. position: relative;
  213. }
  214. .stat-img {
  215. width: 95%;
  216. height: 100px;
  217. }
  218. .stat-tip {
  219. position: absolute;
  220. left: 15px;
  221. top: 5px;
  222. .money {
  223. color: #fff;
  224. font-size: 28px;
  225. text-align: left;
  226. font-weight: 600;
  227. }
  228. .title {
  229. color: #fff;
  230. font-size: 14px;
  231. text-align: left;
  232. margin-top: 5px;
  233. margin-bottom: 0px;
  234. }
  235. }
  236. </style>