index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <basic-container>
  3. <avue-crud :option="option" :data="dataList" ref="crud" v-model="form" :page.sync="page" :search.sync="search"
  4. :table-loading="loading" :cell-style="cellStyle" @search-change="searchChange" @search-reset="searchReset"
  5. @selection-change="selectionChange" @current-change="currentChange" @size-change="sizeChange"
  6. @refresh-change="refreshChange" @saveColumn="saveColumn" @resetColumn="resetColumn"
  7. @search-criteria-switch="searchCriteriaSwitch" @on-load="onLoad">
  8. <template slot="corpIdCSearch">
  9. <crop-select v-model="search.corpIdC" corpType="GYS"></crop-select>
  10. </template>
  11. <template slot-scope="{ row }" slot="corpIdC">
  12. <span>
  13. {{row.corpNameC}}
  14. </span>
  15. </template>
  16. <template slot="corpIdXSearch">
  17. <crop-select v-model="search.corpIdX" corpType="KH"></crop-select>
  18. </template>
  19. <template slot-scope="{ row }" slot="corpIdX">
  20. <span>
  21. {{row.corpNameX}}
  22. </span>
  23. </template>
  24. <template slot="itemIdCSearch">
  25. <el-select v-model="search.itemIdC" placeholder="请选择" size="small">
  26. <el-option v-for="item in goodsoptions" :key="item.id" :label="item.cname" :value="item.id">
  27. </el-option>
  28. </el-select>
  29. </template>
  30. <template slot-scope="{ row }" slot="itemIdC">
  31. <span>
  32. {{row.itemNameC}}
  33. </span>
  34. </template>
  35. <template slot-scope="{ row }" slot="belongToCorpIdC">
  36. <span>
  37. {{row.belongToCorpNameC}}
  38. </span>
  39. </template>
  40. <template slot="belongToCorpIdCSearch">
  41. <crop-select v-model="search.belongToCorpIdC" corpType="GS"></crop-select>
  42. </template>
  43. <template slot="requiredArrivalDateCSearch">
  44. <el-date-picker v-model="search.requiredArrivalDateC" type="daterange" start-placeholder="开始日期"
  45. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  46. :default-time="['00:00:00', '23:59:59']">
  47. </el-date-picker>
  48. </template>
  49. <template slot="belongToCorpIdXSearch">
  50. <crop-select v-model="search.belongToCorpIdX" corpType="GS"></crop-select>
  51. </template>
  52. <template slot="plannedDeliveryDateXSearch">
  53. <el-date-picker v-model="search.plannedDeliveryDateX" type="daterange" start-placeholder="开始日期"
  54. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  55. :default-time="['00:00:00', '23:59:59']">
  56. </el-date-picker>
  57. </template>
  58. <template slot="salesNameSearch">
  59. <user-com v-model="search.salesName"></user-com>
  60. </template>
  61. </avue-crud>
  62. </basic-container>
  63. </template>
  64. <script>
  65. import option from "./config/mainList.json";
  66. import { getList, getGoods } from "@/api/basicData/rubberStock"
  67. import { roundNumbers } from "@/util/validate";
  68. export default {
  69. data() {
  70. return {
  71. loading: false,
  72. form: {},
  73. search: {},
  74. show: true,
  75. detailData: {},
  76. option: {},
  77. parentId: 0,
  78. dataList: [],
  79. page: {
  80. currentPage: 1,
  81. total: 0,
  82. pageSize: 10,
  83. pageSizes: [10, 50, 100, 200, 300, 400, 500, 1000]
  84. },
  85. query: {},
  86. goodsoptions: [],
  87. }
  88. },
  89. filters: {
  90. roundNumbers(val) {
  91. return roundNumbers(val);
  92. }
  93. },
  94. async created() {
  95. this.option = await this.getColumnData(this.getColumnName(187), option);
  96. getGoods(1, 10).then(res => {
  97. if (res.data.data.total > 0) {
  98. this.goodsoptions = res.data.data.records;
  99. if (Math.ceil(res.data.data.total / 10) > 1) {
  100. for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
  101. getGoods(i, 10).then(e => {
  102. this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
  103. });
  104. }
  105. }
  106. }
  107. });
  108. },
  109. mounted() {
  110. },
  111. methods: {
  112. //新单打开
  113. addReceipt(row) {
  114. },
  115. //编辑打开
  116. editOpen(row, status) {
  117. },
  118. rowDel(row, index, done) {
  119. if (row.id) {
  120. this.$confirm("确定将选择数据删除?", {
  121. confirmButtonText: "确定",
  122. cancelButtonText: "取消",
  123. type: "warning"
  124. }).then(() => {
  125. });
  126. }
  127. },
  128. //点击搜索按钮触发
  129. searchChange(params, done) {
  130. this.query = params;
  131. this.page.currentPage = 1;
  132. this.onLoad(this.page, params);
  133. done()
  134. },
  135. searchReset() {
  136. },
  137. selectionChange() {
  138. },
  139. currentChange(val) {
  140. this.page.currentPage = val;
  141. },
  142. sizeChange(val) {
  143. this.page.currentPage = 1;
  144. this.page.pageSize = val;
  145. },
  146. refreshChange() {
  147. this.onLoad(this.page);
  148. },
  149. onLoad(page, params = {}) {
  150. if (this.search.requiredArrivalDateC && this.search.requiredArrivalDateC.length > 0) {
  151. params = {
  152. ...params,
  153. requiredArrivalDateStartC: this.search.requiredArrivalDateC[0],
  154. requiredArrivalDateEndC: this.search.requiredArrivalDateC[1]
  155. };
  156. }
  157. if (this.search.plannedDeliveryDateX && this.search.plannedDeliveryDateX.length > 0) {
  158. params = {
  159. ...params,
  160. plannedDeliveryDateStartX: this.search.plannedDeliveryDateX[0],
  161. plannedDeliveryDateEndX: this.search.plannedDeliveryDateX[1]
  162. };
  163. }
  164. let data = this.deepClone(Object.assign(params));
  165. delete data.requiredArrivalDateC;
  166. delete data.plannedDeliveryDateX;
  167. // delete data.createTime;
  168. this.loading = true;
  169. getList(page.currentPage, page.pageSize, data)
  170. .then(res => {
  171. this.dataList = res.data.data.records ? res.data.data.records : [];
  172. this.page.total = res.data.data.total;
  173. })
  174. .finally(() => {
  175. this.loading = false;
  176. });
  177. },
  178. searchCriteriaSwitch(type) {
  179. if (type) {
  180. this.option.height = this.option.height - 138
  181. } else {
  182. this.option.height = this.option.height + 138
  183. }
  184. this.$refs.crud.getTableHeight()
  185. },
  186. cellStyle() {
  187. return "padding:0;height:40px;";
  188. },
  189. //列保存触发
  190. async saveColumn() {
  191. const inSave = await this.saveColumnData(
  192. this.getColumnName(187),
  193. this.option
  194. );
  195. if (inSave) {
  196. this.$message.success("保存成功");
  197. //关闭窗口
  198. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  199. }
  200. },
  201. async resetColumn() {
  202. const inSave = await this.delColumnData(
  203. this.getColumnName(187),
  204. option
  205. );
  206. if (inSave) {
  207. this.$message.success("重置成功");
  208. this.option = option;
  209. //关闭窗口
  210. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  211. }
  212. },
  213. }
  214. }
  215. </script>
  216. <style scoped>
  217. </style>