index.vue 11 KB

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