index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  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: 120,
  92. search: true,
  93. searchOrder:2
  94. },{
  95. label: '箱号',
  96. prop: 'code',
  97. width: 120,
  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: 120,
  115. search: true,
  116. searchOrder:1,
  117. }, {
  118. label: '来源单号',
  119. prop: 'orgSysNo',
  120. width: 120,
  121. search: true,
  122. searchOrder:1,
  123. }, {
  124. label: '箱数',
  125. prop: 'boxNumber',
  126. width: 100
  127. }, {
  128. label: '箱型箱量',
  129. prop: 'boxTypeNumber',
  130. overHidden: true,
  131. width: 170
  132. }, {
  133. label: '起始日期',
  134. prop: 'startDate',
  135. overHidden: true,
  136. width: 120
  137. }, {
  138. label: '付费对象',
  139. prop: 'purchaseCompanyId',
  140. width: 200,
  141. searchOrder:1,
  142. search: true,
  143. }, {
  144. label: '堆存地点',
  145. prop: 'address',
  146. width: 200
  147. }
  148. // , {
  149. // label: '状态',
  150. // prop: 'status',
  151. // width: 140,
  152. // overHidden: true,
  153. // filterable: true,
  154. // type: 'select',
  155. // dataType: 'number',
  156. // dicUrl: "/api/blade-system/dict-biz/dictionary?code=approval_status",
  157. // props: {
  158. // label: "dictValue",
  159. // value: "dictKey"
  160. // }
  161. // }
  162. , {
  163. label: '备注',
  164. prop: 'remarks',
  165. width: 500
  166. }, {
  167. label: '合同日期',
  168. prop: 'effectiveDateList',
  169. width: 100,
  170. search: true,
  171. hide:true,
  172. showColumn:false,
  173. overHidden: true,
  174. type: "date",
  175. searchOrder:1,
  176. searchRange: true,
  177. searchDefaultTime: ["00:00:00", "23:59:59"],
  178. format: "yyyy-MM-dd",
  179. valueFormat: "yyyy-MM-dd HH:mm:ss"
  180. }, {
  181. label: "制单人",
  182. prop: "createUserName",
  183. searchProp:"createUser",
  184. overHidden: true,
  185. width: 100,
  186. searchOrder:1,
  187. search: true,
  188. filterable: true,
  189. remote: true,
  190. type: "select",
  191. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  192. props: {
  193. label: "account",
  194. value: "id",
  195. res: 'data.records'
  196. }
  197. }, {
  198. label: "制单日期",
  199. prop: "createTime",
  200. searchProp:"createTimeList",
  201. type: "date",
  202. overHidden: true,
  203. width: 200,
  204. searchRange: true,
  205. searchDefaultTime: ["00:00:00", "23:59:59"],
  206. format: "yyyy-MM-dd",
  207. valueFormat: "yyyy-MM-dd HH:mm:ss"
  208. }, {
  209. label: "更新人",
  210. prop: "updateUserName",
  211. searchProp:"updateUser",
  212. overHidden: true,
  213. width: 100,
  214. search: true,
  215. searchOrder:1,
  216. filterable: true,
  217. remote: true,
  218. type: "select",
  219. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  220. props: {
  221. label: "account",
  222. value: "id",
  223. res: 'data.records'
  224. }
  225. }, {
  226. label: "更新日期",
  227. prop: "updateTime",
  228. searchProp:"updateTimeList",
  229. type: "date",
  230. overHidden: true,
  231. width: 200,
  232. searchRange: true,
  233. searchDefaultTime: ["00:00:00", "23:59:59"],
  234. format: "yyyy-MM-dd",
  235. valueFormat: "yyyy-MM-dd HH:mm:ss"
  236. }]
  237. }
  238. }
  239. },
  240. activated() {
  241. if (this.$route.query.check) {
  242. this.detailsOpen = false
  243. this.detailData = {
  244. id: this.$route.query.check.billId,
  245. check: this.$route.query.check,
  246. };
  247. this.form = {
  248. id:this.$route.query.check.billId
  249. }
  250. this.detailsOpen = true
  251. this.$router.$avueRouter.closeTag(window.location.hash.slice(1))
  252. }
  253. },
  254. async created() {
  255. this.option = await this.getColumnData(this.getColumnName(252), this.optionList);
  256. this.key++
  257. let i = 0;
  258. this.option.column.forEach(item => {
  259. if (item.search) i++
  260. })
  261. if (i % 3 !== 0) {
  262. const num = 3 - Number(i % 3)
  263. this.option.searchMenuSpan = num * 8;
  264. this.option.searchMenuPosition = "right";
  265. }
  266. },
  267. methods: {
  268. check(row){
  269. this.form = row
  270. this.detailsOpen = true
  271. },
  272. backToList(type) {
  273. this.form = {}
  274. this.detailsOpen = false
  275. if (type === 0){
  276. this.detailData = {}
  277. }
  278. this.onLoad(this.page,this.search)
  279. },
  280. //刷新
  281. refreshChange() {
  282. this.onLoad(this.page, this.search)
  283. },
  284. rowDel(form, index) {
  285. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  286. confirmButtonText: '确定',
  287. cancelButtonText: '取消',
  288. type: 'warning'
  289. }).then(() => {
  290. remove(form.id).then(res => {
  291. this.$message({
  292. type: 'success',
  293. message: '删除成功!'
  294. });
  295. })
  296. }).catch(() => {
  297. });
  298. },
  299. searchChange(params, done) {
  300. done();
  301. this.onLoad(this.page, params)
  302. },
  303. onLoad(page, params = {}) {
  304. params = {
  305. ...params,
  306. current: page.currentPage,
  307. size: page.pageSize,
  308. type: "DCF",
  309. ...Object.assign(params, this.search)
  310. }
  311. this.loading = true
  312. getList(params).then(res => {
  313. this.dataList = res.data.data.records
  314. this.page.total = res.data.data.total
  315. this.loading = false
  316. }).finally(() => {
  317. this.loading = false
  318. })
  319. },
  320. outExport() {
  321. let config = {params: {...this.search}}
  322. if (config.params) {
  323. for (const propName of Object.keys(config.params)) {
  324. const value = config.params[propName];
  325. if (value !== null && typeof (value) !== "undefined") {
  326. if (value instanceof Array) {
  327. for (const key of Object.keys(value)) {
  328. let params = propName + '[' + key + ']';
  329. config.params[params] = value[key]
  330. }
  331. delete config.params[propName]
  332. }
  333. }
  334. }
  335. }
  336. const routeData = this.$router.resolve({
  337. path: '/api/blade-box-tube/transfer/exportTradingBoxOut', //跳转目标窗口的地址
  338. query: {
  339. ...config.params, //括号内是要传递给新窗口的参数
  340. }
  341. })
  342. window.open(routeData.href.slice(1, routeData.href.length) + '&' + `${this.website.tokenHeader}=${getToken()}`);
  343. },
  344. //自定义列保存
  345. async saveColumnTwo(ref, option, optionBack, code) {
  346. /**
  347. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  348. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  349. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  350. */
  351. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  352. if (inSave) {
  353. this.$message.success("保存成功");
  354. //关闭窗口
  355. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  356. }
  357. },
  358. //自定义列重置
  359. async resetColumnTwo(ref, option, optionBack, code) {
  360. this[option] = this[optionBack];
  361. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  362. if (inSave) {
  363. this.$message.success("重置成功");
  364. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  365. }
  366. }
  367. }
  368. }
  369. </script>
  370. <style scoped>
  371. </style>