index.vue 10 KB

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