index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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" @selection-change="selectionChange" @on-load="onLoad" @search-change="searchChange"
  6. @row-del="rowDel" @refresh-change="refreshChange"
  7. @resetColumn="resetColumnTwo('crud', 'option', 'optionList', 271)"
  8. @saveColumn="saveColumnTwo('crud', 'option', 'optionList', 271)" :page.sync="page">
  9. <template slot-scope="{type,size,row,index}" slot="menu" >
  10. <!--<el-button icon="el-icon-view" :size="size" :type="type" @click="check(row)">查看</el-button>-->
  11. <el-button type="text" size="small" @click="rowCell(row, index)">{{ row.$cellEdit ? '保存' : '修改' }}
  12. </el-button>
  13. <el-button icon="el-icon-delete" :disabled="row.statusName === '已派工'" :size="size" :type="type"
  14. @click="$refs.crud.rowDel(row, index)">删除
  15. </el-button>
  16. </template>
  17. <template slot="corpNameSearch">
  18. <crop-select v-model="search.corpId" corpType="KH" :refresh="false"></crop-select>
  19. </template>
  20. <template slot-scope="{type,size,row,$index}" slot="menuLeft">
  21. <!-- <el-button icon="el-icon-plus" type="primary" :size="size" @click="detailsOpen = true">新增</el-button>-->
  22. <!-- <el-button type="warning" icon="el-icon-download" size="small" @click="outExport">导出</el-button>-->
  23. <el-button type="success" icon="el-icon-finished" size="small" @click="dispatching"
  24. :disabled="selectionList.length <= 0">派工
  25. </el-button>
  26. </template>
  27. </avue-crud>
  28. </basic-container>
  29. <!--<detailsPage v-if="detailsOpen" :onLoad="form" :detailData="detailData" @backToList="backToList"></detailsPage>-->
  30. </div>
  31. </template>
  32. <script>
  33. import { getList, remove, outboundWorkOrder } from "@/api/tirePartsMall/salesManagement/outboundTask";
  34. import da from "element-ui/src/locale/lang/da";
  35. // import detailsPage from "./detailsPage"
  36. export default {
  37. name: "index",
  38. components: {
  39. // detailsPage
  40. },
  41. data() {
  42. return {
  43. detailsOpen: false,
  44. loading: false,
  45. search: {},
  46. form: {},
  47. dataList: [],
  48. selectionList: [],
  49. detailData: {},
  50. page: {
  51. pageSize: 20,
  52. currentPage: 1,
  53. total: 0,
  54. pageSizes: [10, 20, 30, 40, 50, 100, 200, 300, 400, 500]
  55. },
  56. key: 0,
  57. option: {},
  58. optionList: {
  59. selection: true,
  60. viewBtn: false,
  61. editBtn: false,
  62. celBtn: true,
  63. delBtn: false,
  64. addBtn: false,
  65. menu: true,
  66. index: true,
  67. span: 8,
  68. border: true,
  69. height: "auto",
  70. searchMenuPosition: "right",
  71. align: "center",
  72. size: "small",
  73. menuWidth: 80,
  74. searchSpan: 8,
  75. searchIcon: true,
  76. searchIndex: 2,
  77. highlightCurrentRow: true,
  78. dialogWidth: "70%",
  79. summaryText: "合计",
  80. // showSummary: true,
  81. // sumColumnList: [],
  82. column: [{
  83. label: '销售单号',
  84. prop: "ordNo",
  85. search: true,
  86. width: 140,
  87. overHidden: true,
  88. }, {
  89. label: '业务对象',
  90. prop: "customerName",
  91. search: true,
  92. width: 140,
  93. type: 'select',
  94. overHidden: true,
  95. props: {
  96. label: 'cname',
  97. value: 'id'
  98. },
  99. dicUrl: '/api/blade-sales-part/corpsDesc/listAll?corpType=KH',
  100. }
  101. // , {
  102. // label: "商品种类",
  103. // prop: "corpId",
  104. // width: 100,
  105. // overHidden: true,
  106. // }
  107. , {
  108. label: '业务来源',
  109. prop: "bsType",
  110. width: 100,
  111. overHidden: true,
  112. },
  113. {
  114. label: '来源公司',
  115. prop: "sourceCompanyId",
  116. search: true,
  117. width: 100,
  118. overHidden: true,
  119. type: 'select',
  120. type: 'select',
  121. props: {
  122. label: 'fullName',
  123. value: 'id'
  124. },
  125. dicUrl: '/api/blade-system/dept/top-list'
  126. },
  127. {
  128. label: '发货仓库',
  129. prop: "storageName",
  130. width: 100,
  131. search: true,
  132. overHidden: true,
  133. cell:false,
  134. type: 'select',
  135. props: {
  136. label: 'cname',
  137. value: 'id'
  138. },
  139. dicUrl: '/api/blade-sales-part/storageDesc/listAll',
  140. },
  141. // {
  142. // label: '发货库管',
  143. // prop: "bsType",
  144. // width: 100,
  145. // overHidden: true,
  146. // },
  147. {
  148. label: '收货地址',
  149. prop: "recAddress",
  150. width: 200,
  151. overHidden: true,
  152. },
  153. {
  154. label: '销售数量',
  155. prop: "goodsTotalNum",
  156. width: 100,
  157. overHidden: true,
  158. },
  159. {
  160. label: '发货数量',
  161. prop: "goodsTotalShipNum",
  162. width: 100,
  163. overHidden: true,
  164. },
  165. {
  166. label: '联系人',
  167. prop: "contacts",
  168. width: 100,
  169. overHidden: true,
  170. }, {
  171. label: '电话',
  172. prop: "phone",
  173. width: 100,
  174. overHidden: true,
  175. }, {
  176. label: '状态',
  177. prop: "statusName",
  178. width: 100,
  179. search: true,
  180. type: 'select',
  181. overHidden: true,
  182. dicData: [{
  183. label: '待处理',
  184. value: '待处理'
  185. }, {
  186. label: '已派工',
  187. value: '已派工'
  188. }]
  189. }, {
  190. label: '备注',
  191. prop: "remarks",
  192. width: 200,
  193. overHidden: true,
  194. }, {
  195. label: '业务日期',
  196. prop: "createTime",
  197. searchProp: "createTimeList",
  198. type: "date",
  199. overHidden: true,
  200. search: true,
  201. width: 100,
  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. async created() {
  211. this.option = await this.getColumnData(this.getColumnName(271), this.optionList);
  212. this.key++
  213. let i = 0;
  214. this.option.column.forEach(item => {
  215. if (item.search) i++
  216. })
  217. if (i % 3 !== 0) {
  218. const num = 3 - Number(i % 3)
  219. this.option.searchMenuSpan = num * 8;
  220. this.option.searchMenuPosition = "right";
  221. }
  222. this.option.selectable = (row, index) => {
  223. return row.statusName === "待处理";
  224. }
  225. },
  226. methods: {
  227. selectionChange(list) {
  228. this.selectionList = list
  229. },
  230. dispatching() {
  231. this.$confirm('是否确认派工?', '提示', {
  232. confirmButtonText: '确定',
  233. cancelButtonText: '取消',
  234. type: 'warning'
  235. }).then(() => {
  236. let data = []
  237. for (let item of this.selectionList) {
  238. data.push(item.id)
  239. }
  240. this.loading = true; // Show the loading spinner
  241. outboundWorkOrder(data.join(',')).then(res => {
  242. this.$message({
  243. type: 'success',
  244. message: '生成成功!'
  245. });
  246. this.onLoad(this.page)
  247. }).finally(() => {
  248. this.loading = false; // Hide the loading spinner
  249. });
  250. })
  251. },
  252. check(row) {
  253. this.form = row
  254. this.detailsOpen = true
  255. },
  256. backToList(type) {
  257. this.form = {}
  258. this.detailsOpen = false
  259. if (type === 0) {
  260. this.detailData = {}
  261. }
  262. this.onLoad(this.page, this.search)
  263. },
  264. //刷新
  265. refreshChange() {
  266. this.onLoad(this.page, this.search)
  267. },
  268. rowCell(row,index){
  269. this.findObject(this.optionList.column, "storageName").cell = true
  270. this.$refs.crud.rowCell(row, index)
  271. },
  272. rowDel(form, index) {
  273. this.$confirm('此操作将永久删除该行, 是否继续?', '提示', {
  274. confirmButtonText: '确定',
  275. cancelButtonText: '取消',
  276. type: 'warning'
  277. }).then(() => {
  278. remove(form.id).then(res => {
  279. this.$message({
  280. type: 'success',
  281. message: '删除成功!'
  282. });
  283. this.dataList.splice(index, 1);
  284. this.onLoad(this.page)
  285. })
  286. }).catch(() => {
  287. });
  288. },
  289. searchChange(params, done) {
  290. console.log(params);
  291. done();
  292. this.onLoad(this.page, params)
  293. },
  294. onLoad(page, params = {}) {
  295. params = {
  296. ...params,
  297. current: page.currentPage,
  298. size: page.pageSize,
  299. bizTypeName: "FHRW",
  300. ...Object.assign(params, this.search)
  301. }
  302. this.loading = true
  303. getList(params).then(res => {
  304. this.dataList = res.data.data.records
  305. this.page.total = res.data.data.total
  306. this.loading = false
  307. }).finally(() => {
  308. this.loading = false
  309. })
  310. },
  311. //自定义列保存
  312. async saveColumnTwo(ref, option, optionBack, code) {
  313. /**
  314. * 已定义全局方法,直接使用,saveColumnData保存列数据方法,参数传值(表格名称,当前表格的option数据)
  315. * 已定义全局方法,直接使用,getColumnName方法用来获取枚举值,参数根据自己定义的code值获取中文名
  316. * 一定要执行异步操作,要等接口成功返回,才能执行下一行代码
  317. */
  318. const inSave = await this.saveColumnData(this.getColumnName(code), this[option]);
  319. if (inSave) {
  320. this.$message.success("保存成功");
  321. //关闭窗口
  322. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  323. }
  324. },
  325. //自定义列重置
  326. async resetColumnTwo(ref, option, optionBack, code) {
  327. console.log(this[option]);
  328. console.log(this[optionBack]);
  329. // this[option] = this[optionBack];
  330. const inSave = await this.delColumnData(this.getColumnName(code), this[optionBack]);
  331. if (inSave) {
  332. this.$message.success("重置成功");
  333. this.$refs[ref].$refs.dialogColumn.columnBox = false;
  334. }
  335. }
  336. }
  337. }
  338. </script>
  339. <style scoped></style>