index.vue 12 KB

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