index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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',252)"
  17. @saveColumn="saveColumnTwo('crud','option','optionList',252)"
  18. :page.sync="page">
  19. <template slot="purchaseCompanyIdSearch">
  20. <crop-select v-model="search.purchaseCompanyId" corpType="GS"/>
  21. </template>
  22. <template slot="purchaseCompanyId" slot-scope="{row}">
  23. {{ row.purchaseCompanyName }}
  24. </template>
  25. <template slot-scope="{type,size,row,$index}" slot="menu">
  26. <el-button icon="el-icon-view" :size="size" :type="type" @click="check(row)">查看</el-button>
  27. <el-button icon="el-icon-delete" :size="size" v-if="row.status == 0" :type="type" @click="$refs.crud.rowDel(row,$index)">删除
  28. </el-button>
  29. </template>
  30. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  31. <!-- <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">创建单据</el-button>-->
  32. <!-- <el-button class="el-icon-document-copy" type="success" size="small">复制单据</el-button>-->
  33. <el-button class="el-icon-download" type="warning" size="small" @click="outExport">导出</el-button>
  34. </template>
  35. </avue-crud>
  36. </basic-container>
  37. <detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>
  38. </div>
  39. </template>
  40. <script>
  41. import {getList, remove} from "@/api/boxManagement/stockpilingManage/index.js";
  42. import detailsPage from "./detailsPage"
  43. import {getToken} from "@/util/auth";
  44. export default {
  45. name: "index",
  46. components: {
  47. detailsPage
  48. },
  49. data() {
  50. return {
  51. detailsOpen: false,
  52. loading: false,
  53. search: {},
  54. form: {},
  55. dataList: [],
  56. detailData: {},
  57. page: {
  58. pageSize: 20,
  59. currentPage: 1,
  60. total: 0,
  61. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  62. },
  63. key:0,
  64. option: {},
  65. optionList: {
  66. viewBtn: false,
  67. editBtn: false,
  68. delBtn: false,
  69. addBtn: false,
  70. index: true,
  71. span: 8,
  72. border: true,
  73. height:"auto",
  74. searchMenuPosition: "right",
  75. align: "center",
  76. menuWidth:140,
  77. searchSpan: 8,
  78. searchIcon: true,
  79. searchIndex: 2,
  80. highlightCurrentRow: true,
  81. dialogWidth: "70%",
  82. showSummary: true,
  83. sumColumnList: [{
  84. name: 'boxNumber',
  85. type: 'sum',
  86. decimals:0
  87. }],
  88. column: [{
  89. label: '系统号',
  90. prop: 'sysNo',
  91. width: 220,
  92. search: true,
  93. searchOrder:2
  94. },{
  95. label: '箱号',
  96. prop: 'code',
  97. width: 100,
  98. searchOrder:1,
  99. overHidden: true,
  100. filterable: true,
  101. remote: true,
  102. type: "select",
  103. search: true,
  104. allowCreate: true,
  105. dicUrl: "/api/blade-box-tube/archives/list?size=10&current=1&code={{key}}",
  106. props: {
  107. label: "code",
  108. value: "code",
  109. res:"data.records"
  110. }
  111. }, {
  112. label: '合同号',
  113. prop: 'contractNo',
  114. width: 170,
  115. search: true,
  116. searchOrder:1,
  117. }, {
  118. label: '箱数',
  119. prop: 'boxNumber',
  120. width: 170
  121. }, {
  122. label: '箱型箱量',
  123. prop: 'boxTypeNumber',
  124. overHidden: true,
  125. width: 170
  126. }, {
  127. label: '付费对象',
  128. prop: 'purchaseCompanyId',
  129. width: 200,
  130. searchOrder:1,
  131. search: true,
  132. }, {
  133. label: '堆存地点',
  134. prop: 'address',
  135. width: 200
  136. }
  137. // , {
  138. // label: '状态',
  139. // prop: 'status',
  140. // width: 140,
  141. // overHidden: true,
  142. // filterable: true,
  143. // type: 'select',
  144. // dataType: 'number',
  145. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=approval_status",
  146. // props: {
  147. // label: "dictValue",
  148. // value: "dictKey"
  149. // }
  150. // }
  151. , {
  152. label: '备注',
  153. prop: 'remarks',
  154. width: 500
  155. }, {
  156. label: '合同日期',
  157. prop: 'effectiveDateList',
  158. width: 100,
  159. search: true,
  160. hide:true,
  161. showColumn:false,
  162. overHidden: true,
  163. type: "date",
  164. searchOrder:1,
  165. searchRange: true,
  166. searchDefaultTime: ["00:00:00", "23:59:59"],
  167. format: "yyyy-MM-dd",
  168. valueFormat: "yyyy-MM-dd HH:mm:ss"
  169. }, {
  170. label: "制单人",
  171. prop: "createUserName",
  172. searchProp:"createUser",
  173. overHidden: true,
  174. width: 100,
  175. searchOrder:1,
  176. search: true,
  177. filterable: true,
  178. remote: true,
  179. type: "select",
  180. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  181. props: {
  182. label: "account",
  183. value: "id",
  184. res: 'data.records'
  185. }
  186. }, {
  187. label: "制单日期",
  188. prop: "createTime",
  189. searchProp:"createTimeList",
  190. type: "date",
  191. overHidden: true,
  192. width: 200,
  193. searchRange: true,
  194. searchDefaultTime: ["00:00:00", "23:59:59"],
  195. format: "yyyy-MM-dd",
  196. valueFormat: "yyyy-MM-dd HH:mm:ss"
  197. }, {
  198. label: "更新人",
  199. prop: "updateUserName",
  200. searchProp:"updateUser",
  201. overHidden: true,
  202. width: 100,
  203. search: true,
  204. searchOrder:1,
  205. filterable: true,
  206. remote: true,
  207. type: "select",
  208. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  209. props: {
  210. label: "account",
  211. value: "id",
  212. res: 'data.records'
  213. }
  214. }, {
  215. label: "更新日期",
  216. prop: "updateTime",
  217. searchProp:"updateTimeList",
  218. type: "date",
  219. overHidden: true,
  220. width: 200,
  221. searchRange: true,
  222. searchDefaultTime: ["00:00:00", "23:59:59"],
  223. format: "yyyy-MM-dd",
  224. valueFormat: "yyyy-MM-dd HH:mm:ss"
  225. }]
  226. }
  227. }
  228. },
  229. activated() {
  230. if (this.$route.query.check) {
  231. this.detailsOpen = false
  232. this.detailData = {
  233. id: this.$route.query.check.billId,
  234. check: this.$route.query.check,
  235. };
  236. this.form = {
  237. id:this.$route.query.check.billId
  238. }
  239. this.detailsOpen = true
  240. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  241. }
  242. },
  243. async created() {
  244. this.option = await this.getColumnData(this.getColumnName(252), this.optionList);
  245. this.key++
  246. let i = 0;
  247. this.option.column.forEach(item => {
  248. if (item.search) i++
  249. })
  250. if (i % 3 !== 0) {
  251. const num = 3 - Number(i % 3)
  252. this.option.searchMenuSpan = num * 8;
  253. this.option.searchMenuPosition = "right";
  254. }
  255. },
  256. methods: {
  257. check(row){
  258. this.form = row
  259. this.detailsOpen = true
  260. },
  261. backToList(type) {
  262. this.form = {}
  263. this.detailsOpen = false
  264. if (type === 0){
  265. this.detailData = {}
  266. }
  267. this.onLoad(this.page,this.search)
  268. },
  269. //刷新
  270. refreshChange() {
  271. this.onLoad(this.page, this.search)
  272. },
  273. rowDel(form, index) {
  274. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  275. confirmButtonText: '确定',
  276. cancelButtonText: '取消',
  277. type: 'warning'
  278. }).then(() => {
  279. remove(form.id).then(res => {
  280. this.$message({
  281. type: 'success',
  282. message: '删除成功!'
  283. });
  284. })
  285. }).catch(() => {
  286. });
  287. },
  288. searchChange(params, done) {
  289. done();
  290. this.onLoad(this.page, params)
  291. },
  292. onLoad(page, params = {}) {
  293. params = {
  294. ...params,
  295. current: page.currentPage,
  296. size: page.pageSize,
  297. type: "DCF",
  298. ...Object.assign(params, this.search)
  299. }
  300. this.loading = true
  301. getList(params).then(res => {
  302. this.dataList = res.data.data.records
  303. this.page.total = res.data.data.total
  304. this.loading = false
  305. }).finally(() => {
  306. this.loading = false
  307. })
  308. },
  309. outExport() {
  310. let config = {params: {...this.search}}
  311. if (config.params) {
  312. for (const propName of Object.keys(config.params)) {
  313. const value = config.params[propName];
  314. if (value !== null && typeof (value) !== "undefined") {
  315. if (value instanceof Array) {
  316. for (const key of Object.keys(value)) {
  317. let params = propName + '[' + key + ']';
  318. config.params[params] = value[key]
  319. }
  320. delete config.params[propName]
  321. }
  322. }
  323. }
  324. }
  325. const routeData = this.$router.resolve({
  326. path: '/api/blade-box-tube/transfer/exportTradingBoxOut', //跳转目标窗口的地址
  327. query: {
  328. ...config.params, //括号内是要传递给新窗口的参数
  329. }
  330. })
  331. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  332. },
  333. //自定义列保存
  334. async saveColumnTwo(ref, option, optionBack, code) {
  335. /**
  336. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  337. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  338. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  339. */
  340. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  341. if (inSave) {
  342. this.$message.success("保存成功");
  343. //关闭窗口
  344. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  345. }
  346. },
  347. //自定义列重置
  348. async resetColumnTwo(ref, option, optionBack, code) {
  349. this[option] = this[optionBack];
  350. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  351. if (inSave) {
  352. this.$message.success("重置成功");
  353. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  354. }
  355. }
  356. }
  357. }
  358. </script>
  359. <style scoped>
  360. </style>