index.vue 11 KB

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