index.vue 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <order-search
  5. ref="searchRefs"
  6. @search="reload"
  7. :selection="selection"
  8. :activeName="activeName"
  9. >
  10. </order-search>
  11. <el-tabs v-model="activeName" type="card">
  12. <el-tab-pane label="待排产" name="first"></el-tab-pane>
  13. <el-tab-pane label="已排产" name="second"></el-tab-pane>
  14. </el-tabs>
  15. <!-- 数据表格 -->
  16. <ele-pro-table
  17. ref="table"
  18. :columns="columns"
  19. :initLoad="false"
  20. :datasource="datasource"
  21. :selection.sync="selection"
  22. cache-key="systemRoleTable1"
  23. row-key="id"
  24. >
  25. <template v-slot:code="{ row }">
  26. <el-link :underline="false" @click="openDetails(row)">
  27. {{ row.code }}
  28. </el-link>
  29. </template>
  30. <template v-slot:productSumWeight="{ row }">
  31. {{ row.productSumWeight }}
  32. </template>
  33. <!-- 操作列 -->
  34. <template v-slot:action="{ row }">
  35. <template v-if="row.orderSource != 1">
  36. <el-link
  37. type="primary"
  38. :underline="false"
  39. icon="el-icon-edit"
  40. @click="toUpdate(row)"
  41. >
  42. 修改
  43. </el-link>
  44. <el-popconfirm
  45. class="ele-action"
  46. title="确定要删除此销售订单吗?"
  47. @confirm="remove(row)"
  48. >
  49. <template v-slot:reference>
  50. <el-link type="danger" :underline="false" icon="el-icon-delete">
  51. 删除
  52. </el-link>
  53. </template>
  54. </el-popconfirm>
  55. </template>
  56. </template>
  57. </ele-pro-table>
  58. </el-card>
  59. <!-- 详情弹窗 -->
  60. <order-detail @refresh="reload" ref="detailDialog"> </order-detail>
  61. <!-- 创建订单 -->
  62. <create-order ref="createDialog" @refresh="reload"> </create-order>
  63. </div>
  64. </template>
  65. <script>
  66. import OrderSearch from './components/order-search.vue';
  67. import OrderDetail from './components/order-detail.vue';
  68. import CreateOrder from './components/create-order.vue';
  69. import { getPageList, deleteOrder } from '@/api/saleOrder';
  70. import dictMixins from '@/mixins/dictMixins';
  71. export default {
  72. name: 'saleOrder',
  73. mixins: [dictMixins],
  74. components: {
  75. OrderSearch,
  76. OrderDetail,
  77. CreateOrder
  78. },
  79. data () {
  80. return {
  81. // 加载状态
  82. loading: false,
  83. activeName: 'first',
  84. selection: []
  85. };
  86. },
  87. computed: {
  88. // 表格列配置
  89. columns () {
  90. const privateColumn = [];
  91. if (this.activeName == 'first') {
  92. privateColumn.push({
  93. columnKey: 'action',
  94. label: '操作',
  95. width: 150,
  96. align: 'center',
  97. resizable: false,
  98. slot: 'action',
  99. showOverflowTooltip: true,
  100. fixed: 'right'
  101. });
  102. }
  103. return [
  104. {
  105. width: 45,
  106. type: 'selection',
  107. columnKey: 'selection',
  108. align: 'center'
  109. },
  110. {
  111. columnKey: 'index',
  112. label: '序号',
  113. type: 'index',
  114. width: 55,
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. fixed: 'left'
  118. },
  119. {
  120. prop: 'code',
  121. label: '销售订单号',
  122. align: 'center',
  123. showOverflowTooltip: true,
  124. minWidth: 150,
  125. slot: 'code',
  126. },
  127. {
  128. prop: 'lineNumber',
  129. label: '行号',
  130. align: 'center',
  131. showOverflowTooltip: true
  132. },
  133. {
  134. prop: 'productCode',
  135. label: '产品编码',
  136. align: 'center',
  137. showOverflowTooltip: true,
  138. minWidth: 140,
  139. sortable: true
  140. },
  141. {
  142. prop: 'productName',
  143. label: '产品名称',
  144. align: 'center',
  145. minWidth: 120
  146. },
  147. {
  148. prop: 'produceRoutingName',
  149. label: '工艺路线',
  150. align: 'center',
  151. minWidth: 120
  152. },
  153. {
  154. prop: 'brandNo',
  155. label: '牌号',
  156. align: 'center'
  157. },
  158. {
  159. prop: 'model',
  160. label: '型号',
  161. align: 'center',
  162. minWidth: 120,
  163. sortable: true
  164. },
  165. {
  166. prop: 'specification',
  167. label: '规格',
  168. align: 'center',
  169. minWidth: 120,
  170. },
  171. {
  172. prop: 'productSumWeight',
  173. label: '合同重量',
  174. align: 'center',
  175. slot: 'productSumWeight'
  176. },
  177. {
  178. prop: 'contractNum',
  179. label: '合同数量(方)',
  180. minWidth: 120,
  181. align: 'center'
  182. },
  183. {
  184. prop: 'lackNum',
  185. label: '欠交数量(方)',
  186. minWidth: 120,
  187. align: 'center'
  188. },
  189. {
  190. prop: 'moCount',
  191. label: '模数',
  192. align: 'center'
  193. },
  194. {
  195. prop: 'blockCount',
  196. label: '块数',
  197. align: 'center'
  198. },
  199. {
  200. prop: 'orderLibraryType',
  201. label: '按单按库',
  202. align: 'center',
  203. showOverflowTooltip: true,
  204. formatter: (_row, _column, cellValue) => {
  205. return this.getDictValue('按单按库', _row.orderLibraryType);
  206. }
  207. },
  208. {
  209. prop: 'deliveryRequirements',
  210. label: '交付要求',
  211. align: 'center',
  212. showOverflowTooltip: true,
  213. formatter: (_row, _column, cellValue) => {
  214. return this.getDictValue('交付要求', _row.deliveryRequirements);
  215. }
  216. },
  217. {
  218. prop: 'orderType',
  219. label: '订单类型',
  220. align: 'center',
  221. showOverflowTooltip: true,
  222. formatter: (_row, _column, cellValue) => {
  223. return this.getDictValue('订单类型', _row.orderType);
  224. }
  225. },
  226. {
  227. prop: 'orderSource',
  228. label: '订单来源',
  229. align: 'center',
  230. showOverflowTooltip: true,
  231. formatter: (_row, _column, cellValue) => {
  232. return this.getDictValue('订单来源', _row.orderSource);
  233. }
  234. },
  235. {
  236. prop: 'status',
  237. label: '生产状态',
  238. align: 'center',
  239. showOverflowTooltip: true,
  240. formatter: (_row, _column, cellValue) => {
  241. return this.getDictValue('生产状态', _row.status);
  242. }
  243. },
  244. {
  245. prop: 'releaseTime',
  246. label: '下达时间',
  247. align: 'center',
  248. showOverflowTooltip: true
  249. },
  250. {
  251. prop: 'deliveryTime',
  252. label: '交付日期',
  253. align: 'center',
  254. showOverflowTooltip: true
  255. },
  256. {
  257. prop: 'customerName',
  258. label: '客户名称',
  259. align: 'center',
  260. showOverflowTooltip: true
  261. },
  262. {
  263. prop: 'serialNo',
  264. label: '客户代号',
  265. align: 'center',
  266. showOverflowTooltip: true
  267. },
  268. {
  269. prop: 'simpleName',
  270. label: '客户简称',
  271. align: 'center',
  272. showOverflowTooltip: true
  273. },
  274. {
  275. prop: 'salesman',
  276. label: '业务员',
  277. align: 'center',
  278. showOverflowTooltip: true
  279. },
  280. ...privateColumn
  281. ];
  282. }
  283. },
  284. created () {
  285. this.requestDict('按单按库');
  286. this.requestDict('交付要求');
  287. this.requestDict('订单类型');
  288. this.requestDict('订单来源');
  289. this.requestDict('生产状态');
  290. },
  291. methods: {
  292. /* 表格数据源 */
  293. async datasource ({ page, limit, where, order }) {
  294. if (this.activeName == 'first') {
  295. where.status = [1];
  296. } else {
  297. if (where.proStu) {
  298. where.status = [where.proStu];
  299. } else {
  300. where.status = [2, 3, 4, 5, 6, 7];
  301. }
  302. }
  303. const params = {
  304. size: limit,
  305. pageNum: page,
  306. ...where
  307. };
  308. const data = await getPageList(params);
  309. return data;
  310. },
  311. /* 刷新表格 */
  312. reload (where) {
  313. this.$nextTick(() =>
  314. this.$refs.table.reload({ page: 1, limit: 10, where })
  315. );
  316. },
  317. openDetails (row) {
  318. this.$refs.detailDialog.open(row);
  319. },
  320. toUpdate (row) {
  321. this.$refs.createDialog.open(row);
  322. },
  323. remove (row) {
  324. deleteOrder([row.id]).then((res) => {
  325. this.$message.success(res);
  326. this.reload();
  327. });
  328. }
  329. }
  330. };
  331. </script>
  332. <style lang="scss" scoped></style>