index.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  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="businesDateSearch">
  50. <el-date-picker v-model="search.businesDate" type="daterange" start-placeholder="开始日期"
  51. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  52. :default-time="['00:00:00', '23:59:59']">
  53. </el-date-picker>
  54. </template>
  55. <template slot="belongToCorpIdXSearch">
  56. <crop-select v-model="search.belongToCorpIdX" corpType="GS"></crop-select>
  57. </template>
  58. <template slot="plannedDeliveryDateXSearch">
  59. <el-date-picker v-model="search.plannedDeliveryDateX" type="daterange" start-placeholder="开始日期"
  60. end-placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
  61. :default-time="['00:00:00', '23:59:59']">
  62. </el-date-picker>
  63. </template>
  64. <template slot-scope="{ row }" slot="belongToCorpIdX">
  65. <span>
  66. {{row.belongToCorpNameX}}
  67. </span>
  68. </template>
  69. <template slot="salesNameSearch">
  70. <user-com v-model="search.salesName"></user-com>
  71. </template>
  72. </avue-crud>
  73. </basic-container>
  74. </template>
  75. <script>
  76. import option from "./config/mainList.json";
  77. import { getList, getGoods } from "@/api/basicData/rubberStock"
  78. import { roundNumbers } from "@/util/validate";
  79. export default {
  80. data() {
  81. return {
  82. loading: false,
  83. form: {},
  84. search: {
  85. rubberDistinguish:"1"
  86. },
  87. show: true,
  88. detailData: {},
  89. option: {},
  90. parentId: 0,
  91. dataList: [],
  92. page: {
  93. currentPage: 1,
  94. total: 0,
  95. pageSize: 10,
  96. pageSizes: [10, 50, 100, 200, 300, 400, 500, 1000]
  97. },
  98. query: {},
  99. goodsoptions: [],
  100. }
  101. },
  102. filters: {
  103. roundNumbers(val) {
  104. return roundNumbers(val);
  105. }
  106. },
  107. async created() {
  108. this.option = await this.getColumnData(this.getColumnName(187), option);
  109. this.getWorkDicts("rubber_distinguish").then(res => {
  110. this.findObject(this.option.column, "rubberDistinguish").dicData =
  111. res.data.data;
  112. })
  113. getGoods(1, 10).then(res => {
  114. if (res.data.data.total > 0) {
  115. this.goodsoptions = res.data.data.records;
  116. if (Math.ceil(res.data.data.total / 10) > 1) {
  117. for (let i = 2; i <= Math.ceil(res.data.data.total / 10); i++) {
  118. getGoods(i, 10).then(e => {
  119. this.goodsoptions = this.goodsoptions.concat(e.data.data.records);
  120. });
  121. }
  122. }
  123. }
  124. });
  125. },
  126. mounted() {
  127. },
  128. methods: {
  129. //新单打开
  130. addReceipt(row) {
  131. },
  132. //编辑打开
  133. editOpen(row, status) {
  134. },
  135. rowDel(row, index, done) {
  136. if (row.id) {
  137. this.$confirm("确定将选择数据删除?", {
  138. confirmButtonText: "确定",
  139. cancelButtonText: "取消",
  140. type: "warning"
  141. }).then(() => {
  142. });
  143. }
  144. },
  145. //点击搜索按钮触发
  146. searchChange(params, done) {
  147. this.query = params;
  148. this.page.currentPage = 1;
  149. this.onLoad(this.page, params);
  150. done()
  151. },
  152. searchReset() {
  153. this.search.rubberDistinguish = "1"
  154. this.onLoad(this.page, this.search);
  155. },
  156. selectionChange() {
  157. },
  158. currentChange(val) {
  159. this.page.currentPage = val;
  160. },
  161. sizeChange(val) {
  162. this.page.currentPage = 1;
  163. this.page.pageSize = val;
  164. },
  165. refreshChange() {
  166. this.onLoad(this.page);
  167. },
  168. onLoad(page, params = {}) {
  169. if (this.search.requiredArrivalDateC && this.search.requiredArrivalDateC.length > 0) {
  170. params = {
  171. ...params,
  172. requiredArrivalDateStartC: this.search.requiredArrivalDateC[0],
  173. requiredArrivalDateEndC: this.search.requiredArrivalDateC[1]
  174. };
  175. }
  176. if (this.search.businesDate && this.search.businesDate.length > 0) {
  177. params = {
  178. ...params,
  179. businesDateStartC: this.search.businesDate[0],
  180. businesDateEndC: this.search.businesDate[1]
  181. };
  182. }
  183. if (this.search.plannedDeliveryDateX && this.search.plannedDeliveryDateX.length > 0) {
  184. params = {
  185. ...params,
  186. plannedDeliveryDateStartX: this.search.plannedDeliveryDateX[0],
  187. plannedDeliveryDateEndX: this.search.plannedDeliveryDateX[1]
  188. };
  189. }
  190. if (this.search.rubberDistinguish){
  191. params.rubberDistinguish = this.search.rubberDistinguish
  192. }
  193. let data = this.deepClone(Object.assign(params));
  194. delete data.requiredArrivalDateC;
  195. delete data.plannedDeliveryDateX;
  196. delete data.businesDate;
  197. // delete data.createTime;
  198. this.loading = true;
  199. getList(page.currentPage, page.pageSize, data)
  200. .then(res => {
  201. this.dataList = res.data.data.records ? res.data.data.records : [];
  202. this.page.total = res.data.data.total;
  203. })
  204. .finally(() => {
  205. this.loading = false;
  206. });
  207. },
  208. searchCriteriaSwitch(type) {
  209. if (type) {
  210. this.option.height = this.option.height - 138
  211. } else {
  212. this.option.height = this.option.height + 138
  213. }
  214. this.$refs.crud.getTableHeight()
  215. },
  216. cellStyle() {
  217. return "padding:0;height:40px;";
  218. },
  219. //列保存触发
  220. async saveColumn() {
  221. const inSave = await this.saveColumnData(
  222. this.getColumnName(187),
  223. this.option
  224. );
  225. if (inSave) {
  226. this.$message.success("保存成功");
  227. //关闭窗口
  228. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  229. }
  230. },
  231. async resetColumn() {
  232. const inSave = await this.delColumnData(
  233. this.getColumnName(187),
  234. option
  235. );
  236. if (inSave) {
  237. this.$message.success("重置成功");
  238. this.option = option;
  239. //关闭窗口
  240. this.$refs.crud.$refs.dialogColumn.columnBox = false;
  241. }
  242. },
  243. }
  244. }
  245. </script>
  246. <style scoped>
  247. </style>