index.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud
  5. :option="option"
  6. :search.sync="search"
  7. v-model="form"
  8. :table-loading="loading"
  9. :data="dataList"
  10. ref="crud"
  11. :key="key"
  12. @on-load="onLoad"
  13. @search-change="searchChange"
  14. @row-del="rowDel"
  15. @refresh-change="refreshChange"
  16. @resetColumn="resetColumnTwo('crud','option','optionList',270)"
  17. @saveColumn="saveColumnTwo('crud','option','optionList',270)"
  18. :page.sync="page">
  19. <template slot-scope="{type,size,row,index}" slot="menu">
  20. <el-button icon="el-icon-view" :size="size" :type="type" @click="check(row)">查看</el-button>
  21. <el-button icon="el-icon-delete" :size="size" :type="type" @click="$refs.crud.rowDel(row,index)">删除</el-button>
  22. </template>
  23. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  24. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>
  25. <!--<el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>-->
  26. </template>
  27. </avue-crud>
  28. </basic-container>
  29. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  30. </div>
  31. </template>
  32. <script>
  33. import {getList, remove} from "@/api/tirePartsMall/purchasingManagement/warehouseEntryOrder";
  34. import detailsPage from "./detailsPage.vue"
  35. import {dateFormat} from '@/util/date'
  36. export default {
  37. name: "index",
  38. components: {
  39. detailsPage
  40. },
  41. data() {
  42. return {
  43. detailsOpen: false,
  44. loading: false,
  45. search: {},
  46. form: {},
  47. dataList: [],
  48. detailData: {},
  49. page: {
  50. pageSize: 20,
  51. currentPage: 1,
  52. total: 0,
  53. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  54. },
  55. key: 0,
  56. option: {},
  57. optionList: {
  58. viewBtn: false,
  59. editBtn: false,
  60. delBtn: false,
  61. addBtn: false,
  62. index: true,
  63. span: 8,
  64. border: true,
  65. height: "auto",
  66. searchMenuPosition: "right",
  67. align: "center",
  68. size: "small",
  69. menuWidth: 140,
  70. searchSpan: 8,
  71. searchIcon: true,
  72. searchIndex: 2,
  73. highlightCurrentRow: true,
  74. dialogWidth: "70%",
  75. summaryText: "合计",
  76. showSummary: true,
  77. sumColumnList:[{
  78. name: "goodsTotalNum",
  79. type: "sum",
  80. decimals: 2
  81. }],
  82. column: [{
  83. label: "入库单号",
  84. prop: "ordNo",
  85. // billno
  86. search: true,
  87. overHidden: true,
  88. // width: 120,
  89. rules: [
  90. {
  91. required: true,
  92. message: " ",
  93. trigger: "blur"
  94. }
  95. ]
  96. }, {
  97. label: "来源单号",
  98. prop: "srcOrdNo",
  99. search: true,
  100. overHidden: true,
  101. // width: 120,
  102. rules: [
  103. {
  104. required: true,
  105. message: " ",
  106. trigger: "blur"
  107. }
  108. ]
  109. }, {
  110. label: "业务对象",
  111. prop: "customerId",
  112. search: true,
  113. overHidden: true,
  114. type: 'select',
  115. props: {
  116. label: 'cname',
  117. value: 'id'
  118. },
  119. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=GYS',
  120. }, {
  121. label: "仓库",
  122. prop: "storageName",
  123. search: true,
  124. overHidden: true,
  125. // width: 120,
  126. type: 'select',
  127. dicUrl: "/api/blade-sales-part/storageDesc/listAll",
  128. props: {
  129. label: 'cname',
  130. value: 'id'
  131. }
  132. }, {
  133. label: "商品数量",
  134. prop: "goodsTotalNum",
  135. search: false,
  136. overHidden: true,
  137. // width: 120,
  138. }, {
  139. label: "状态",
  140. prop: "statusName",
  141. search: true,
  142. overHidden: true,
  143. // width: 120,
  144. }, {
  145. label: "业务日期",
  146. prop: "createTime",
  147. search: true,
  148. overHidden: true,
  149. type: "datetime",
  150. value: dateFormat(new Date(), 'yyyy-MM-dd hh:mm:ss'),
  151. format: "yyyy-MM-dd HH:mm",
  152. valueFormat: "yyyy-MM-dd HH:mm:ss",
  153. // width: 200
  154. }, {
  155. label: "库管",
  156. prop: "remarks",
  157. search: true,
  158. overHidden: true,
  159. // width: 200
  160. },{
  161. label: "制单人",
  162. prop: "createUserName",
  163. searchProp: "createUser",
  164. overHidden: true,
  165. width: 100,
  166. filterable: true,
  167. remote: true,
  168. type: "select",
  169. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  170. props: {
  171. label: "account",
  172. value: "id",
  173. res: 'data.records'
  174. }
  175. }, {
  176. label: "制单日期",
  177. prop: "createTime",
  178. searchProp: "createTimeList",
  179. type: "date",
  180. overHidden: true,
  181. width: 100,
  182. searchRange: true,
  183. searchDefaultTime: ["00:00:00", "23:59:59"],
  184. format: "yyyy-MM-dd",
  185. valueFormat: "yyyy-MM-dd HH:mm:ss"
  186. }, {
  187. label: "更新人",
  188. prop: "updateUserName",
  189. searchProp: "updateUser",
  190. overHidden: true,
  191. width: 100,
  192. filterable: true,
  193. remote: true,
  194. type: "select",
  195. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  196. props: {
  197. label: "account",
  198. value: "id",
  199. res: 'data.records'
  200. }
  201. }, {
  202. label: "更新日期",
  203. prop: "updateTime",
  204. searchProp: "updateTimeList",
  205. type: "date",
  206. overHidden: true,
  207. width: 100,
  208. searchRange: true,
  209. searchDefaultTime: ["00:00:00", "23:59:59"],
  210. format: "yyyy-MM-dd",
  211. valueFormat: "yyyy-MM-dd HH:mm:ss"
  212. }]
  213. }
  214. }
  215. },
  216. async created() {
  217. this.option = await this.getColumnData(this.getColumnName(274), this.optionList);
  218. this.key++
  219. let i = 0;
  220. this.option.column.forEach(item => {
  221. if (item.search) i++
  222. })
  223. if (i % 3 !== 0) {
  224. const num = 3 - Number(i % 3)
  225. this.option.searchMenuSpan = num * 8;
  226. this.option.searchMenuPosition = "right";
  227. }
  228. },
  229. methods: {
  230. check(row) {
  231. this.form = row
  232. this.detailsOpen = true
  233. },
  234. backToList(type) {
  235. this.form = {}
  236. this.detailsOpen = false
  237. if (type === 0) {
  238. this.detailData = {}
  239. }
  240. this.onLoad(this.page, this.search)
  241. },
  242. //刷新
  243. refreshChange() {
  244. this.onLoad(this.page, this.search)
  245. },
  246. rowDel(form, index) {
  247. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  248. confirmButtonText: '确定',
  249. cancelButtonText: '取消',
  250. type: 'warning'
  251. }).then(() => {
  252. remove(form.id).then(res => {
  253. this.$message({
  254. type: 'success',
  255. message: '删除成功!'
  256. });
  257. this.dataList.splice(index, 1);
  258. this.onLoad(this.page)
  259. })
  260. }).catch(() => {
  261. });
  262. },
  263. searchChange(params, done) {
  264. done();
  265. this.onLoad(this.page, params)
  266. },
  267. onLoad(page, params = {}) {
  268. params = {
  269. ...params,
  270. current: page.currentPage,
  271. size: page.pageSize,
  272. bizTypeName: "SHGD",
  273. ...Object.assign(params, this.search)
  274. }
  275. this.loading = true
  276. getList(params).then(res => {
  277. this.dataList = res.data.data.records
  278. this.page.total = res.data.data.total
  279. this.loading = false
  280. }).finally(() => {
  281. this.loading = false
  282. })
  283. },
  284. //自定义列保存
  285. async saveColumnTwo(ref, option, optionBack, code) {
  286. /**
  287. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  288. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  289. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  290. */
  291. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  292. if (inSave) {
  293. this.$message.success("保存成功");
  294. //关闭窗口
  295. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  296. }
  297. },
  298. //自定义列重置
  299. async resetColumnTwo(ref, option, optionBack, code) {
  300. this[option] = this[optionBack];
  301. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  302. if (inSave) {
  303. this.$message.success("重置成功");
  304. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  305. }
  306. }
  307. }
  308. }
  309. </script>
  310. <style scoped>
  311. </style>