index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457
  1. <template>
  2. <div>
  3. <basic-container v-show="!detailsOpen">
  4. <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  5. <el-tab-pane label="申请明细" name="first">
  6. <avue-crud :option="option" :search.sync="search" v-model="form" :table-loading="loading" :data="dataList"
  7. ref="crud" :key="key" @on-load="onLoad" @search-change="searchChange" @row-del="rowDel"
  8. @selection-change="selectionChange" @expand-change="expandChange" @refresh-change="refreshChange"
  9. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 362)"
  10. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 362)" :page.sync="page">
  11. <!-- <template slot-scope="{type,size,row,index}" slot="menu">
  12. <el-button :size="size" :type="type" :disabled="row.issueStatus != 'D'"
  13. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  14. </template> -->
  15. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  16. <el-button type="success" plain :size="size" @click="applicationDetail">生成调度</el-button>
  17. </template>
  18. <!-- <template slot="billNo" slot-scope="{ row, index }">
  19. <div style="color: #1e9fff;cursor: pointer;" @click.stop="editOpen(row)">
  20. {{ row.billNo }}
  21. </div>
  22. </template> -->
  23. </avue-crud>
  24. </el-tab-pane>
  25. <el-tab-pane label="调度单据" name="second">
  26. <avue-crud :option="option" :search.sync="search2" v-model="form2" :table-loading="loading" :data="dataList2"
  27. ref="crud2" :key="key" @on-load="onLoad2" @search-change="searchChange2" @row-del="rowDel"
  28. @refresh-change="refreshChange2" @resetColumn="resetColumnTwo('crud2', 'option', 'optionList', 362)"
  29. @saveColumn="saveColumnTwo('crud2', 'option', 'optionList', 362)" :page.sync="page2">
  30. <template slot-scope="{type,size,row,index}" slot="menu">
  31. <!-- <el-button :size="size" :type="type" @click="check(row)">查看</el-button> -->
  32. <el-button :size="size" :type="type" :disabled="row.issueStatus != 'D'"
  33. @click="$refs.crud.rowDel(row, index)">删除</el-button>
  34. </template>
  35. <!-- <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  36. <el-button type="success" plain :size="size" @click="detailsOpen = true">申请明细</el-button>
  37. </template> -->
  38. <template slot="billNo" slot-scope="{ row, index }">
  39. <div style="color: #1e9fff;cursor: pointer;" @click.stop="editOpen(row)">
  40. {{ row.billNo }}
  41. </div>
  42. </template>
  43. </avue-crud>
  44. </el-tab-pane>
  45. </el-tabs>
  46. </basic-container>
  47. <detailsPage v-if="detailsOpen" @goBack="goBack" :onLoad="form" :detailData="detailData" @backToList="backToList"
  48. :dispatchList="dispatchList">
  49. </detailsPage>
  50. </div>
  51. </template>
  52. <script>
  53. import { getList, remove, getList2 } from "@/api/iosBasicData/release/schedulingManagement";
  54. import detailsPage from "./detailsPage"
  55. import { getToken } from "@/util/auth";
  56. import { application } from "../../../../api/iosBasicData/release/jobApplication";
  57. export default {
  58. name: "index",
  59. components: {
  60. detailsPage
  61. },
  62. data() {
  63. return {
  64. dispatchList: [],
  65. selectionList: [],
  66. activeName: 'first',
  67. detailsOpen: false,
  68. loading: false,
  69. search: {},
  70. form: {},
  71. dataList: [],
  72. detailData: {},
  73. page: {
  74. pageSize: 20,
  75. currentPage: 1,
  76. total: 0,
  77. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  78. },
  79. search2: {},
  80. form2: {},
  81. dataList2: [],
  82. page2: {
  83. pageSize: 20,
  84. currentPage: 1,
  85. total: 0,
  86. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  87. },
  88. key: 0,
  89. option: {},
  90. optionList: {
  91. viewBtn: false,
  92. editBtn: false,
  93. delBtn: false,
  94. addBtn: false,
  95. index: true,
  96. span: 8,
  97. border: true,
  98. height: "auto",
  99. searchMenuPosition: "right",
  100. align: "center",
  101. size: "small",
  102. menuWidth: 50,
  103. searchSpan: 8,
  104. searchIcon: true,
  105. searchIndex: 2,
  106. highlightCurrentRow: true,
  107. dialogWidth: "70%",
  108. showSummary: true,
  109. tip: false,
  110. selection: true,
  111. column: [
  112. // {
  113. // label: '*年度',
  114. // prop: "ordNo",
  115. // search: true,
  116. // overHidden: true,
  117. // type: "year",
  118. // },
  119. // {
  120. // label: '*月份',
  121. // prop: "customerName",
  122. // search: true,
  123. // overHidden: true,
  124. // type: "month",
  125. // },
  126. {
  127. label: '单据编号',
  128. prop: "billNo",
  129. search: true,
  130. overHidden: true,
  131. },
  132. {
  133. label: 'MBL NO',
  134. prop: 'mblno',
  135. search: true,
  136. overHidden: true,
  137. },
  138. {
  139. label: '客户简称',
  140. prop: "corpCnName",
  141. search: true,
  142. overHidden: true,
  143. filterable: true,
  144. type: 'select',
  145. props: {
  146. label: 'cnName',
  147. value: 'cnName',
  148. res: 'data.records'
  149. },
  150. dicUrl: '/api/blade-los/bcorps/listByType?current=1&size=10&shortName={{key}}',
  151. },
  152. {
  153. label: '单据日期',
  154. prop: "billDate",
  155. searchProp: "billDateList",
  156. type: "date",
  157. overHidden: true,
  158. search: true,
  159. width: 100,
  160. searchRange: true,
  161. searchDefaultTime: ["00:00:00", "23:59:59"],
  162. format: "yyyy-MM-dd",
  163. valueFormat: "yyyy-MM-dd HH:mm:ss"
  164. },
  165. {
  166. label: '单据状态',
  167. prop: "issueStatus",
  168. overHidden: true,
  169. type: "select",
  170. dicData: [{
  171. id: 'N',
  172. name: "新建",
  173. }, {
  174. id: 'S',
  175. name: "提交",
  176. }, {
  177. id: 'D',
  178. name: "跑单中",
  179. }, {
  180. id: 'O',
  181. name: "操作确认",
  182. }, {
  183. id: 'I',
  184. name: "调度确认",
  185. }, {
  186. id: 'T',
  187. name: "放单",
  188. }, {
  189. id: 'B',
  190. name: "退回",
  191. }],
  192. props: {
  193. label: "name",
  194. value: "id",
  195. },
  196. },
  197. {
  198. label: '提交时间',
  199. prop: "applyTime",
  200. searchProp: "applyTimeList",
  201. type: "date",
  202. overHidden: true,
  203. search: true,
  204. width: 100,
  205. searchRange: true,
  206. searchDefaultTime: ["00:00:00", "23:59:59"],
  207. format: "yyyy-MM-dd",
  208. valueFormat: "yyyy-MM-dd HH:mm:ss"
  209. },
  210. {
  211. label: '安排时间',
  212. prop: "requireTime",
  213. searchProp: "requireTimeList",
  214. type: "date",
  215. overHidden: true,
  216. search: true,
  217. width: 100,
  218. searchRange: true,
  219. searchDefaultTime: ["00:00:00", "23:59:59"],
  220. format: "yyyy-MM-dd",
  221. valueFormat: "yyyy-MM-dd HH:mm:ss"
  222. },
  223. {
  224. label: '制单人',
  225. prop: "createUserName",
  226. searchProp: "createUser",
  227. overHidden: true,
  228. width: 100,
  229. filterable: true,
  230. remote: true,
  231. type: "select",
  232. dicUrl: "/api/blade-user/page?size=20&current=1&account={{key}}",
  233. props: {
  234. label: "account",
  235. value: "id",
  236. res: 'data.records'
  237. }
  238. },
  239. // {
  240. // label: ' *审核状态',
  241. // prop: "status",
  242. // search: true,
  243. // overHidden: true,
  244. // },
  245. {
  246. label: '备注',
  247. prop: "remarks",
  248. overHidden: true,
  249. },
  250. {
  251. label: '提单份数',
  252. prop: "numberOfObl",
  253. overHidden: true,
  254. }
  255. ]
  256. }
  257. }
  258. },
  259. activated() {
  260. setTimeout(() => {
  261. }, 100);
  262. },
  263. async created() {
  264. this.option = await this.getColumnData(this.getColumnName(362), this.optionList);
  265. this.key++
  266. let i = 0;
  267. this.option.column.forEach(item => {
  268. if (item.search) i++
  269. })
  270. if (i % 3 !== 0) {
  271. const num = 3 - Number(i % 3)
  272. this.option.searchMenuSpan = num * 8;
  273. this.option.searchMenuPosition = "right";
  274. }
  275. this.getWorkDicts("sales_Status").then(res => {
  276. this.orderStatusList = res.data.data
  277. });
  278. },
  279. methods: {
  280. selectionChange(list) {
  281. this.selectionList = list
  282. },
  283. handleClick(tab, event) {
  284. if (tab == 'first') {
  285. this.onLoad(this.page, this.search)
  286. } else {
  287. this.onLoad2(this.page2, this.search2)
  288. }
  289. },
  290. check(row) {
  291. this.form = row
  292. this.detailsOpen = true
  293. },
  294. backToList(type) {
  295. this.form = {}
  296. this.detailsOpen = false
  297. if (type === 0) {
  298. this.detailData = {}
  299. }
  300. this.onLoad(this.page, this.search)
  301. },
  302. editOpen(row, status) {
  303. this.form = row
  304. this.detailData = {
  305. id: row.id,
  306. status: status
  307. };
  308. this.detailsOpen = true;
  309. },
  310. //刷新
  311. refreshChange() {
  312. this.onLoad(this.page, this.search)
  313. },
  314. rowDel(form, index) {
  315. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  316. confirmButtonText: '确定',
  317. cancelButtonText: '取消',
  318. type: 'warning'
  319. }).then(() => {
  320. remove({ id: form.id }).then(res => {
  321. this.$message({
  322. type: 'success',
  323. message: '删除成功!'
  324. });
  325. this.dataList2.splice(index, 1);
  326. this.onLoad2(this.page2)
  327. })
  328. }).catch(() => {
  329. });
  330. },
  331. searchChange(params, done) {
  332. this.page.currentPage = 1
  333. done();
  334. this.onLoad(this.page, params)
  335. },
  336. onLoad(page, params = {}) {
  337. params = {
  338. issueStatus: 'O',
  339. ...params,
  340. current: page.currentPage,
  341. size: page.pageSize,
  342. ...Object.assign(params, this.search)
  343. }
  344. this.loading = true
  345. getList2(params).then(res => {
  346. if (res.data.data.records) {
  347. res.data.data.records.forEach(e => {
  348. e.itemLoading = true;
  349. });
  350. }
  351. this.dataList = res.data.data.records
  352. this.page.total = res.data.data.total
  353. this.$nextTick(() => {
  354. this.$refs.crud.doLayout()
  355. })
  356. this.loading = false
  357. }).finally(() => {
  358. this.loading = false
  359. })
  360. },
  361. //刷新
  362. refreshChange2() {
  363. this.onLoad2(this.page2, this.search)
  364. },
  365. searchChange2(params, done) {
  366. this.page2.currentPage = 1
  367. done();
  368. this.onLoad2(this.page2, params)
  369. },
  370. onLoad2(page, params = {}) {
  371. params = {
  372. ...params,
  373. current: page.currentPage,
  374. size: page.pageSize,
  375. ...Object.assign(params, this.search2),
  376. billType: 'D',
  377. }
  378. this.loading = true
  379. getList(params).then(res => {
  380. if (res.data.data.records) {
  381. res.data.data.records.forEach(e => {
  382. e.itemLoading = true;
  383. });
  384. }
  385. this.dataList2 = res.data.data.records
  386. this.page2.total = res.data.data.total
  387. this.$nextTick(() => {
  388. this.$refs.crud.doLayout()
  389. })
  390. this.loading = false
  391. }).finally(() => {
  392. this.loading = false
  393. })
  394. },
  395. //申请明细
  396. applicationDetail() {
  397. if (this.selectionList.length == 0) {
  398. this.$message({
  399. type: 'error',
  400. message: '请选择单据!'
  401. });
  402. } else {
  403. this.$confirm('确定生成调度?', '提示', {
  404. confirmButtonText: '确定',
  405. cancelButtonText: '取消',
  406. type: 'warning'
  407. }).then(() => {
  408. let ids = []
  409. this.dispatchList = this.selectionList
  410. this.detailsOpen = true
  411. })
  412. }
  413. },
  414. //自定义列保存
  415. async saveColumnTwo(ref, option, optionBack, code) {
  416. /**
  417. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  418. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  419. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  420. */
  421. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  422. if (inSave) {
  423. this.$message.success("保存成功");
  424. //关闭窗口
  425. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  426. }
  427. },
  428. //自定义列重置
  429. async resetColumnTwo(ref, option, optionBack, code) {
  430. this[option] = this[optionBack];
  431. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  432. if (inSave) {
  433. this.$message.success("重置成功");
  434. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  435. }
  436. }
  437. }
  438. }
  439. </script>
  440. <style scoped>
  441. .itemTable ::v-deep .el-table {
  442. margin-left: 50px;
  443. width: 100%;
  444. }
  445. .bottomBox {
  446. padding: 3px 6px;
  447. border-radius: 12px;
  448. color: #fff;
  449. font-size: 10px;
  450. }
  451. </style>