AdditionalOrder.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <ele-modal
  3. :visible.sync="visible"
  4. title="追加订单"
  5. width="75vw"
  6. append-to-body
  7. >
  8. <el-form ref="form" :model="form" label-width="90px">
  9. <el-row :gutter="15">
  10. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  11. <el-form-item label="销售订单号:">
  12. <el-input clearable :maxlength="20" v-model="form.code"/>
  13. </el-form-item>
  14. </el-col>
  15. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  16. <el-form-item label="订单类型:">
  17. <DictSelection dictName="订单类型" clearable v-model="form.orderType">
  18. </DictSelection>
  19. </el-form-item>
  20. </el-col>
  21. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  22. <el-form-item label="按单按库:">
  23. <DictSelection dictName="按单按库" clearable v-model="form.orderLibraryType">
  24. </DictSelection>
  25. </el-form-item>
  26. </el-col>
  27. <el-col v-bind="styleResponsive ? { lg: 6, md: 12 } : { span: 6 }">
  28. <el-form-item label-width="0px">
  29. <el-button
  30. type="primary"
  31. icon="el-icon-search"
  32. class="ele-btn-icon"
  33. @click="search"
  34. size="small"
  35. >
  36. 查询
  37. </el-button>
  38. <el-button @click="reset"
  39. icon="el-icon-refresh-left"
  40. size="small"
  41. type="primary"
  42. >重置</el-button>
  43. </el-form-item>
  44. </el-col>
  45. </el-row>
  46. </el-form>
  47. <ele-pro-table
  48. ref="table"
  49. :columns="columns"
  50. :datasource="datasource"
  51. :selection.sync="selection"
  52. cache-key="systemRoleTable"
  53. row-key="id"
  54. @done="setSelect"
  55. >
  56. <!-- <template v-slot:name='{row}'>
  57. <el-link :underline="false" @click="openDetails(row)">
  58. {{ row.name }}
  59. </el-link>
  60. </template> -->
  61. </ele-pro-table>
  62. <template v-slot:footer>
  63. <el-button @click="cancel">取消</el-button>
  64. <el-button type="primary" @click="save" :loading="loading">
  65. 确定
  66. </el-button>
  67. </template>
  68. </ele-modal>
  69. </template>
  70. <script>
  71. import { getPageList } from '@/api/saleOrder';
  72. import dictMixins from '@/mixins/dictMixins';
  73. export default {
  74. mixins: [dictMixins],
  75. props: {
  76. selectList:Array,
  77. productCode:String
  78. },
  79. data() {
  80. return {
  81. columns: [
  82. {
  83. width: 45,
  84. type: 'selection',
  85. columnKey: 'selection',
  86. align: 'center',
  87. reserveSelection: true
  88. },
  89. {
  90. columnKey: 'index',
  91. label: '序号',
  92. type: 'index',
  93. width: 55,
  94. align: 'center',
  95. showOverflowTooltip: true,
  96. fixed: 'left'
  97. },
  98. {
  99. prop: 'code',
  100. label: '销售订单号',
  101. align: 'center',
  102. showOverflowTooltip: true,
  103. minWidth: 110,
  104. slot: 'code'
  105. },
  106. {
  107. prop: 'lineNumber',
  108. label: '行号',
  109. align: 'center',
  110. showOverflowTooltip: true,
  111. minWidth: 110
  112. },
  113. {
  114. prop: 'contractNum',
  115. label: '合同数量',
  116. align: 'center',
  117. showOverflowTooltip: true,
  118. minWidth: 110
  119. },
  120. {
  121. prop: 'productSumWeight',
  122. label: '合同重量',
  123. align: 'center',
  124. showOverflowTooltip: true,
  125. minWidth: 110
  126. },
  127. {
  128. prop: 'orderLibraryType',
  129. label: '按单按库',
  130. align: 'center',
  131. showOverflowTooltip: true,
  132. minWidth: 110,
  133. formatter: (_row, _column, cellValue) => {
  134. return this.getDictValue('按单按库', _row.orderLibraryType);
  135. }
  136. },
  137. {
  138. prop: 'orderType',
  139. label: '订单类型',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 110,
  143. formatter: (_row, _column, cellValue) => {
  144. return this.getDictValue('订单类型', _row.orderType);
  145. }
  146. },
  147. {
  148. prop: 'orderSource',
  149. label: '订单来源',
  150. align: 'center',
  151. showOverflowTooltip: true,
  152. minWidth: 110,
  153. formatter: (_row, _column, cellValue) => {
  154. return this.getDictValue('订单来源', _row.orderSource);
  155. }
  156. },
  157. {
  158. prop: 'status',
  159. label: '生产状态',
  160. align: 'center',
  161. showOverflowTooltip: true,
  162. minWidth: 110,
  163. formatter: (_row, _column, cellValue) => {
  164. return this.getDictValue('生产状态', _row.status);
  165. }
  166. },
  167. {
  168. prop: 'releaseTime',
  169. label: '下达时间',
  170. align: 'center',
  171. showOverflowTooltip: true,
  172. minWidth: 110
  173. },
  174. {
  175. prop: 'deliveryTime',
  176. label: '交付日期',
  177. align: 'center',
  178. showOverflowTooltip: true,
  179. minWidth: 110
  180. },
  181. {
  182. prop: 'customerName',
  183. label: '客户名称',
  184. align: 'center',
  185. showOverflowTooltip: true,
  186. minWidth: 110
  187. },
  188. {
  189. prop: 'salesman',
  190. label: '业务员',
  191. align: 'center',
  192. showOverflowTooltip: true,
  193. minWidth: 110
  194. },
  195. {
  196. prop: 'deliveryRequirements',
  197. label: '交付要求',
  198. align: 'center',
  199. showOverflowTooltip: true,
  200. minWidth: 110,
  201. formatter: (_row, _column, cellValue) => {
  202. return this.getDictValue('交付要求', _row.deliveryRequirements);
  203. }
  204. }
  205. ],
  206. visible: false,
  207. loading:false,
  208. form:{},
  209. selection:[],
  210. tableList:[]
  211. };
  212. },
  213. computed: {
  214. // 是否开启响应式布局
  215. styleResponsive() {
  216. return this.$store.state.theme.styleResponsive;
  217. }
  218. },
  219. created () {
  220. this.requestDict('按单按库');
  221. this.requestDict('交付要求');
  222. this.requestDict('订单类型');
  223. this.requestDict('订单来源');
  224. this.requestDict('生产状态');
  225. },
  226. methods: {
  227. /* 表格数据源 */
  228. async datasource ({ page, limit, where, order }) {
  229. const params = {
  230. size: limit,
  231. pageNum: page,
  232. status:[1],
  233. productCode:this.productCode,
  234. ...this.form
  235. }
  236. const data = await getPageList(params)
  237. this.tableList = data.list
  238. return data
  239. },
  240. // 设置选中
  241. setSelect(){
  242. this.$nextTick(() => {
  243. this.$refs.table.clearSelection()
  244. this.tableList.forEach(row => {
  245. this.selectList.forEach(selected => {
  246. if (selected.id === row.id) {
  247. this.$refs.table.toggleRowSelection(row, true)
  248. }
  249. })
  250. })
  251. })
  252. },
  253. /* 搜索 */
  254. search() {
  255. this.$refs.table.reload({ page: 1, size:10 });
  256. },
  257. /* 重置 */
  258. reset() {
  259. this.form = {}
  260. this.search()
  261. },
  262. open () {
  263. this.visible = true;
  264. },
  265. cancel () {
  266. this.form = {}
  267. this.$refs.form.clearValidate();
  268. this.visible = false;
  269. },
  270. /* 保存编辑 */
  271. save() {
  272. this.$emit('choose',this.selection)
  273. this.cancel()
  274. },
  275. }
  276. };
  277. </script>
  278. <style lang="scss" scoped>
  279. .basic-details-title{
  280. margin:10px 0
  281. }
  282. .add-product{
  283. width:100%;
  284. display:flex;
  285. align-items:center;
  286. justify-content:flex-end;
  287. font-size:30px;
  288. color:#1890ff;
  289. margin:10px 0;
  290. cursor: pointer;
  291. }
  292. </style>