index.vue 7.7 KB

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