index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  5. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  6. @expand-change="expandChange" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 360)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 360)" :page.sync="page">
  9. <template slot-scope="{type,size,row,index}" slot="menu">
  10. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  11. <el-button :size="size" :type="type" :disabled="row.issueStatus != 'I'"
  12. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  13. </template>
  14. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  15. <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新建放单</el-button>
  16. </template>
  17. <template slot="billNo" slot-scope="{ row, index }">
  18. <div style="color: #1e9fff;cursor: pointer;" @click.stop="editOpen(row)">
  19. {{ row.billNo }}
  20. </div>
  21. </template>
  22. </avue-crud>
  23. </basic-container>
  24. <detailsPage v-if="detailsOpen" @goBack="goBack" :onLoad="form" :detailData="detailData" @backToList="backToList">
  25. </detailsPage>
  26. </div>
  27. </template>
  28. <script>
  29. import { getList, remove } from "@/api/iosBasicData/release/releaseManagement";
  30. import detailsPage from "./detailsPage"
  31. import { getToken } from "@/util/auth";
  32. export default {
  33. name: "index",
  34. components: {
  35. detailsPage
  36. },
  37. data() {
  38. return {
  39. detailsOpen: false,
  40. loading: false,
  41. search: {},
  42. form: {},
  43. dataList: [],
  44. detailData: {},
  45. page: {
  46. pageSize: 20,
  47. currentPage: 1,
  48. total: 0,
  49. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  50. },
  51. key: 0,
  52. option: {},
  53. optionList: {
  54. viewBtn: false,
  55. editBtn: false,
  56. delBtn: false,
  57. addBtn: false,
  58. index: true,
  59. span: 8,
  60. border: true,
  61. height: "auto",
  62. searchMenuPosition: "right",
  63. align: "center",
  64. size: "small",
  65. menuWidth: 50,
  66. searchSpan: 8,
  67. searchIcon: true,
  68. searchIndex: 2,
  69. highlightCurrentRow: true,
  70. dialogWidth: "70%",
  71. summaryText: "合计",
  72. showSummary: true,
  73. sumColumnList: [{
  74. name: 'goodsTotalNum',
  75. type: 'sum',
  76. decimals: 0
  77. }],
  78. column: [
  79. // {
  80. // label: '*年度',
  81. // prop: "ordNo",
  82. // search: true,
  83. // overHidden: true,
  84. // type: "year",
  85. // },
  86. // {
  87. // label: '*月份',
  88. // prop: "customerName",
  89. // search: true,
  90. // overHidden: true,
  91. // type: "month",
  92. // },
  93. {
  94. label: '单据编号',
  95. prop: "billNo",
  96. search: true,
  97. overHidden: true,
  98. },
  99. {
  100. label: '客户简称',
  101. prop: "corpCnName",
  102. search: true,
  103. overHidden: true,
  104. filterable: true,
  105. type: 'select',
  106. props: {
  107. label: 'cnName',
  108. value: 'cnName',
  109. res: 'data.records'
  110. },
  111. dicUrl: '/api/blade-los/bcorps/listByType?current=1&size=10&cnName={{key}}',
  112. },
  113. {
  114. label: '单据日期',
  115. prop: "billDate",
  116. searchProp: "billDateList",
  117. type: "date",
  118. overHidden: true,
  119. search: true,
  120. width: 100,
  121. searchRange: true,
  122. searchDefaultTime: ["00:00:00", "23:59:59"],
  123. format: "yyyy-MM-dd",
  124. valueFormat: "yyyy-MM-dd HH:mm:ss"
  125. },
  126. {
  127. label: '单据状态',
  128. prop: "issueStatus",
  129. overHidden: true,
  130. type: "select",
  131. dicData: [{
  132. id: 'N',
  133. name: "新建",
  134. }, {
  135. id: 'S',
  136. name: "提交",
  137. }, {
  138. id: 'D',
  139. name: "跑单中",
  140. }, {
  141. id: 'O',
  142. name: "操作确认",
  143. }, {
  144. id: 'I',
  145. name: "调度确认",
  146. }, {
  147. id: 'T',
  148. name: "放单",
  149. }, {
  150. id: 'B',
  151. name: "退回",
  152. }],
  153. props: {
  154. label: "name",
  155. value: "id",
  156. },
  157. },
  158. {
  159. label: '提交时间',
  160. prop: "applyTime",
  161. searchProp: "applyTimeList",
  162. type: "date",
  163. overHidden: true,
  164. search: true,
  165. width: 100,
  166. searchRange: true,
  167. searchDefaultTime: ["00:00:00", "23:59:59"],
  168. format: "yyyy-MM-dd",
  169. valueFormat: "yyyy-MM-dd HH:mm:ss"
  170. },
  171. {
  172. label: '安排时间',
  173. prop: "requireTime",
  174. searchProp: "requireTimeList",
  175. type: "date",
  176. overHidden: true,
  177. search: true,
  178. width: 100,
  179. searchRange: true,
  180. searchDefaultTime: ["00:00:00", "23:59:59"],
  181. format: "yyyy-MM-dd",
  182. valueFormat: "yyyy-MM-dd HH:mm:ss"
  183. },
  184. {
  185. label: '制单人',
  186. prop: "createUserName",
  187. searchProp: "createUser",
  188. overHidden: true,
  189. width: 100,
  190. filterable: true,
  191. remote: true,
  192. type: "select",
  193. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  194. props: {
  195. label: "account",
  196. value: "id",
  197. res: 'data.records'
  198. }
  199. },
  200. // {
  201. // label: ' *审核状态',
  202. // prop: "status",
  203. // search: true,
  204. // overHidden: true,
  205. // },
  206. {
  207. label: '备注',
  208. prop: "remarks",
  209. overHidden: true,
  210. },
  211. {
  212. label: '提单份数',
  213. prop: "numberOfObl",
  214. overHidden: true,
  215. }
  216. ]
  217. }
  218. }
  219. },
  220. activated() {
  221. setTimeout(() => {
  222. }, 100);
  223. },
  224. async created() {
  225. this.option = await this.getColumnData(this.getColumnName(360), 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. this.getWorkDicts("sales_Status").then(res => {
  237. this.orderStatusList = res.data.data
  238. });
  239. },
  240. methods: {
  241. check(row) {
  242. this.form = row
  243. this.detailsOpen = true
  244. },
  245. backToList(type) {
  246. this.form = {}
  247. this.detailsOpen = false
  248. if (type === 0) {
  249. this.detailData = {}
  250. }
  251. if (this.$route.query.bsType) {
  252. this.$router.$avueRouter.closeTag(this.$route.fullPath);
  253. this.$router.push({
  254. path: "/tirePartsMall/salesService/returns/index"
  255. });
  256. }
  257. this.onLoad(this.page, this.search)
  258. this.$store.commit("XSTH_OUT_DETAIL");
  259. },
  260. editOpen(row, status) {
  261. this.form = row
  262. this.detailData = {
  263. id: row.id,
  264. status: status
  265. };
  266. this.$store.commit("XSTH_IN_DETAIL");
  267. this.detailsOpen = true;
  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({ ids: form.id }).then(res => {
  280. this.$message({
  281. type: 'success',
  282. message: '删除成功!'
  283. });
  284. this.dataList.splice(index, 1);
  285. this.onLoad(this.page)
  286. })
  287. }).catch(() => {
  288. });
  289. },
  290. searchChange(params, done) {
  291. this.page.currentPage = 1
  292. done();
  293. this.onLoad(this.page, params)
  294. },
  295. onLoad(page, params = {}) {
  296. params = {
  297. ...params,
  298. current: page.currentPage,
  299. size: page.pageSize,
  300. ...Object.assign(params, this.search),
  301. billType: 'R',
  302. }
  303. this.loading = true
  304. this.dataList.forEach(item => {
  305. this.$refs.crud.toggleRowExpansion(item, false);
  306. });
  307. getList(params).then(res => {
  308. if (res.data.data.records) {
  309. res.data.data.records.forEach(e => {
  310. e.itemLoading = true;
  311. });
  312. }
  313. this.dataList = res.data.data.records
  314. this.page.total = res.data.data.total
  315. this.$nextTick(() => {
  316. this.$refs.crud.doLayout()
  317. })
  318. this.loading = false
  319. }).finally(() => {
  320. this.loading = false
  321. })
  322. },
  323. //自定义列保存
  324. async saveColumnTwo(ref, option, optionBack, code) {
  325. /**
  326. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  327. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  328. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  329. */
  330. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  331. if (inSave) {
  332. this.$message.success("保存成功");
  333. //关闭窗口
  334. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  335. }
  336. },
  337. //自定义列重置
  338. async resetColumnTwo(ref, option, optionBack, code) {
  339. this[option] = this[optionBack];
  340. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  341. if (inSave) {
  342. this.$message.success("重置成功");
  343. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  344. }
  345. }
  346. }
  347. }
  348. </script>
  349. <style scoped>
  350. .itemTable ::v-deep .el-table {
  351. margin-left: 50px;
  352. width: 100%;
  353. }
  354. .bottomBox {
  355. padding: 3px 6px;
  356. border-radius: 12px;
  357. color: #fff;
  358. font-size: 10px;
  359. }
  360. </style>