index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <template>
  2. <div>
  3. <basic-container v-if="show" class="page-crad">
  4. <avue-crud
  5. ref="crud"
  6. :option="option"
  7. :data="dataList"
  8. v-model="form"
  9. :page.sync="page"
  10. :search.sync="search"
  11. @search-change="searchChange"
  12. @current-change="currentChange"
  13. @size-change="sizeChange"
  14. @refresh-change="refreshChange"
  15. @on-load="onLoad"
  16. :table-loading="loading"
  17. @saveColumn="saveColumn"
  18. :cell-style="cellStyle"
  19. >
  20. <template slot="createTimeSearch">
  21. <el-date-picker
  22. v-model="search.createTime"
  23. type="daterange"
  24. start-placeholder="开始日期"
  25. end-placeholder="结束日期"
  26. format="yyyy-MM-dd"
  27. value-format="yyyy-MM-dd HH:mm:ss"
  28. :default-time="['00:00:00', '23:59:59']"
  29. >
  30. </el-date-picker>
  31. </template>
  32. <template slot="menuLeft">
  33. <el-button
  34. type="primary"
  35. icon="el-icon-plus"
  36. size="small"
  37. @click.stop="newAdd('new')"
  38. >新单</el-button
  39. >
  40. <el-button type="success" size="small" disabled>复制新单</el-button>
  41. <el-button type="info" size="small">报表</el-button>
  42. </template>
  43. <template slot="corpIdSearch">
  44. <select-component
  45. v-model="search.corpId"
  46. :configuration="configuration"
  47. ></select-component>
  48. </template>
  49. <template slot="businesDateSearch">
  50. <el-date-picker
  51. v-model="search.businesDate"
  52. type="daterange"
  53. start-placeholder="开始日期"
  54. end-placeholder="结束日期"
  55. format="yyyy-MM-dd"
  56. value-format="yyyy-MM-dd HH:mm:ss"
  57. :default-time="['00:00:00', '23:59:59']"
  58. >
  59. </el-date-picker>
  60. </template>
  61. <template slot="plannedDeliveryDateSearch">
  62. <el-date-picker
  63. v-model="search.plannedDeliveryDate"
  64. type="daterange"
  65. start-placeholder="开始日期"
  66. end-placeholder="结束日期"
  67. format="yyyy-MM-dd"
  68. value-format="yyyy-MM-dd HH:mm:ss"
  69. :default-time="['00:00:00', '23:59:59']"
  70. >
  71. </el-date-picker>
  72. </template>
  73. <template slot="requiredDeliveryDateSearch">
  74. <el-date-picker
  75. v-model="search.requiredDeliveryDate"
  76. type="daterange"
  77. start-placeholder="开始日期"
  78. end-placeholder="结束日期"
  79. format="yyyy-MM-dd"
  80. value-format="yyyy-MM-dd HH:mm:ss"
  81. :default-time="['00:00:00', '23:59:59']"
  82. >
  83. </el-date-picker>
  84. </template>
  85. <template slot-scope="scope" slot="corpId">
  86. {{ scope.row.strCorpName }}
  87. </template>
  88. <template slot-scope="scope" slot="createUser">
  89. {{ scope.row.createUserName }}
  90. </template>
  91. <template slot-scope="scope" slot="menu">
  92. <el-button
  93. type="text"
  94. icon="el-icon-edit"
  95. size="small"
  96. @click.stop="editOpen(scope.row, 2)"
  97. >编辑
  98. </el-button>
  99. <el-button
  100. type="text"
  101. icon="el-icon-delete"
  102. size="small"
  103. @click.stop="rowDel(scope.row, scope.index)"
  104. >删除
  105. </el-button>
  106. </template>
  107. </avue-crud>
  108. </basic-container>
  109. <detail-page @goBack="goBack" :detailData="detailData" v-else></detail-page>
  110. </div>
  111. </template>
  112. <script>
  113. import option from "./config/mainList.json";
  114. import { getList, remove, gainUser } from "@/api/exportTrade/purchaseContract";
  115. import detailPage from "./detailsPage.vue";
  116. import { defaultDate } from "@/util/date";
  117. export default {
  118. name: "customerInformation",
  119. data() {
  120. return {
  121. configuration: {
  122. multipleChoices: false,
  123. multiple: false,
  124. collapseTags: false,
  125. placeholder: "请点击右边按钮选择",
  126. dicData: []
  127. },
  128. search: {
  129. businesDate: defaultDate()
  130. },
  131. form: {},
  132. option: {},
  133. parentId: 0,
  134. dataList: [],
  135. page: {
  136. pageSize: 10,
  137. currentPage: 1,
  138. total: 0,
  139. pageSizes:[10,50,100,200,300,400,500]
  140. },
  141. show: true,
  142. detailData: {},
  143. loading: false
  144. };
  145. },
  146. components: { detailPage },
  147. async created() {
  148. this.option = await this.getColumnData(this.getColumnName(2), option);
  149. this.getWorkDicts("payment_term").then(res => {
  150. this.findObject(this.option.column, "paymentType").dicData =
  151. res.data.data;
  152. });
  153. gainUser().then(res => {
  154. this.findObject(this.option.column, "createUser").dicData = res.data.data;
  155. });
  156. },
  157. methods: {
  158. cellStyle() {
  159. return "padding:0;height:40px;";
  160. },
  161. //删除列表后面的删除按钮触发触发(row, index, done)
  162. rowDel(row, index, done) {
  163. this.$confirm("确定删除数据?", {
  164. confirmButtonText: "确定",
  165. cancelButtonText: "取消",
  166. type: "warning"
  167. }).then(() => {
  168. remove(row.id).then(res => {
  169. if (res.data.code == 200) {
  170. this.$message({
  171. type: "success",
  172. message: "删除成功!"
  173. });
  174. this.onLoad(this.page, this.search);
  175. }
  176. });
  177. });
  178. },
  179. //查看跳转页面
  180. beforeOpenPage(row, status) {
  181. this.detailData = {
  182. id: row.id,
  183. status: status
  184. };
  185. this.show = false;
  186. },
  187. editOpen(row, status) {
  188. this.detailData = {
  189. id: row.id,
  190. status: status
  191. };
  192. this.show = false;
  193. },
  194. //点击搜索按钮触发
  195. searchChange(params, done) {
  196. if (params.businesDate) {
  197. params.businesStartDate = params.businesDate[0];
  198. params.businesEndDate = params.businesDate[1];
  199. }
  200. if (params.requiredDeliveryDate) {
  201. params.requiredDeliveryStartDate = params.requiredDeliveryDate[0];
  202. params.requiredDeliveryEndDate = params.requiredDeliveryDate[1];
  203. }
  204. delete params.businesDate;
  205. delete params.requiredDeliveryDate;
  206. this.page.currentPage = 1;
  207. this.onLoad(this.page, params);
  208. done();
  209. },
  210. currentChange(val) {
  211. this.page.currentPage = val;
  212. },
  213. sizeChange(val) {
  214. this.page.currentPage = 1;
  215. this.page.pageSize = val;
  216. },
  217. onLoad(page, params) {
  218. if (this.search.businesDate && this.search.businesDate.length > 0) {
  219. params = {
  220. ...params,
  221. orderStartDate: this.search.businesDate[0],
  222. orderEndDate: this.search.businesDate[1]
  223. };
  224. delete params.businesDate;
  225. }
  226. this.loading = true;
  227. getList(page.currentPage, page.pageSize, params)
  228. .then(res => {
  229. this.dataList = res.data.data.records ? res.data.data.records : [];
  230. this.page.total = res.data.data.total;
  231. if (this.page.total) {
  232. this.option.height = window.innerHeight - 350;
  233. }
  234. })
  235. .finally(() => {
  236. this.loading = false;
  237. });
  238. },
  239. refreshChange() {
  240. this.onLoad(this.page, this.search);
  241. },
  242. newAdd(type) {
  243. this.detailData = {
  244. pageType: type
  245. };
  246. this.show = false;
  247. },
  248. goBack() {
  249. this.detailData = this.$options.data().detailData;
  250. this.show = true;
  251. },
  252. async saveColumn() {
  253. const inSave = await this.saveColumnData(
  254. this.getColumnName(2),
  255. this.option
  256. );
  257. if (inSave) {
  258. this.$message.success("保存成功");
  259. //关闭窗口
  260. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  261. }
  262. }
  263. },
  264. watch: {
  265. option: function() {
  266. this.search.businesDate = defaultDate();
  267. }
  268. }
  269. };
  270. </script>
  271. <style scoped>
  272. ::v-deep .select-component {
  273. display: flex;
  274. }
  275. .page-crad ::v-deep .basic-container__card {
  276. height: 94.2vh;
  277. }
  278. </style>