produceOrder.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <el-dialog :title="title" v-if="visible" :visible.sync="visible" :before-close="handleClose"
  3. :close-on-click-modal="true" :close-on-press-escape="false" append-to-body width="90%">
  4. <el-card shadow="never">
  5. <productionPlanSearch @search="reload" ref="searchRef" :statusOpt="statusOpt" :planType="planType"
  6. :activeName="activeName" />
  7. <!-- 数据表格 -->
  8. <ele-pro-table ref="table" :columns="columns" :datasource="datasource" :selection.sync="selection" row-key="id">
  9. </ele-pro-table>
  10. </el-card>
  11. <div class="btns">
  12. <el-button type="primary" size="small" @click="selected">选择</el-button>
  13. <el-button size="small" @click="handleClose">关闭</el-button>
  14. </div>
  15. </el-dialog>
  16. </template>
  17. <script>
  18. import productionPlanSearch from '@/views/productionPlan/components/productionPlan-search.vue';
  19. import { getList } from '@/api/productionPlan/index.js';
  20. import dictMixins from '@/mixins/dictMixins';
  21. export default {
  22. components: { productionPlanSearch },
  23. mixins: [dictMixins],
  24. data() {
  25. return {
  26. visible: false,
  27. title: '生产计划',
  28. statusOpt: {
  29. first: [
  30. { label: '所有状态', value: '3,2' },
  31. { label: '待发布', value: '2' },
  32. { label: '发布失败', value: '3' },
  33. { label: '已发布', value: '4' }
  34. ],
  35. second: [
  36. { label: '所有状态', value: '7,4,5,6' },
  37. { label: '待生产', value: '4' },
  38. { label: '生产中', value: '5' },
  39. { label: '已完成', value: '6' },
  40. { label: '已延期', value: '7' }
  41. ],
  42. change: [{ label: '已变更', value: '9' }]
  43. },
  44. planType: [
  45. { label: '所有计划类型', value: null },
  46. { label: '内销计划', value: '1' },
  47. { label: '外销计划', value: '2' },
  48. { label: '预制计划', value: '3' }
  49. ],
  50. activeName: 'first',
  51. // 表格列配置
  52. columns: [
  53. {
  54. columnKey: 'selection',
  55. type: 'selection',
  56. width: 45,
  57. align: 'center',
  58. selectable: (row, index) => {
  59. return !this.tableData.some(
  60. (it) => it.id == row.id || it.salesOrderId == row.id
  61. );
  62. },
  63. reserveSelection: true,
  64. fixed: 'left'
  65. },
  66. {
  67. slot: 'batchNo',
  68. prop: 'batchNo',
  69. label: '批次号',
  70. align: 'center',
  71. minWidth: 140,
  72. sortable: true
  73. },
  74. {
  75. slot: 'code',
  76. prop: 'code',
  77. action: 'code',
  78. label: '计划编号',
  79. align: 'center',
  80. minWidth: 160,
  81. sortable: true
  82. },
  83. {
  84. prop: 'salesCode',
  85. action: 'salesCode',
  86. label: '销售订单号',
  87. align: 'center',
  88. minWidth: 160
  89. },
  90. {
  91. prop: 'productCode',
  92. label: '编码',
  93. align: 'center',
  94. minWidth: 140
  95. },
  96. {
  97. prop: 'productName',
  98. label: '名称',
  99. align: 'center',
  100. minWidth: 140
  101. },
  102. {
  103. prop: 'brandNo',
  104. label: '牌号',
  105. align: 'center',
  106. showOverflowTooltip: true
  107. },
  108. {
  109. prop: 'specification',
  110. label: '规格',
  111. align: 'center',
  112. minWidth: 150,
  113. showOverflowTooltip: true
  114. },
  115. {
  116. prop: 'model',
  117. label: '型号',
  118. align: 'center',
  119. showOverflowTooltip: true
  120. },
  121. {
  122. prop: 'priority',
  123. label: '优先级',
  124. align: 'center',
  125. minWidth: 120,
  126. slot: 'priority',
  127. sortable: 'custom'
  128. },
  129. {
  130. prop: 'produceRoutingName',
  131. label: '工艺路线',
  132. align: 'center',
  133. width: 140,
  134. showOverflowTooltip: true
  135. },
  136. {
  137. prop: 'productNum',
  138. label: '计划数量',
  139. align: 'center',
  140. slot: 'productNum'
  141. },
  142. {
  143. prop: 'productWeight',
  144. label: '计划重量',
  145. align: 'center',
  146. slot: 'productWeight'
  147. },
  148. {
  149. prop: 'requiredFormingNum',
  150. label: '要求生产数量',
  151. align: 'center',
  152. slot: 'requiredFormingNum'
  153. },
  154. {
  155. prop: 'newSumOrderWeight',
  156. label: '要求生产重量',
  157. align: 'center',
  158. slot: 'newSumOrderWeight'
  159. },
  160. {
  161. prop: 'scheduleStatusName',
  162. label: '进度状态',
  163. align: 'center',
  164. minWidth: 100
  165. },
  166. {
  167. prop: '',
  168. label: '已排产数量',
  169. align: 'center',
  170. showOverflowTooltip: true
  171. },
  172. {
  173. prop: '',
  174. label: '未排产数量',
  175. align: 'center',
  176. showOverflowTooltip: true
  177. },
  178. {
  179. prop: '',
  180. label: '已生产数量',
  181. align: 'center',
  182. showOverflowTooltip: true
  183. },
  184. {
  185. prop: '',
  186. label: '未生产数量',
  187. align: 'center',
  188. showOverflowTooltip: true
  189. },
  190. {
  191. prop: 'factoryName',
  192. label: '所属工厂',
  193. align: 'center'
  194. },
  195. {
  196. prop: '',
  197. label: '合格品数',
  198. align: 'center'
  199. },
  200. {
  201. prop: '',
  202. label: '不合格品数',
  203. align: 'center'
  204. },
  205. {
  206. prop: '',
  207. label: '合格率',
  208. align: 'center'
  209. },
  210. {
  211. prop: 'moCount',
  212. label: '模数',
  213. align: 'center',
  214. show: this.clientEnvironmentId == '4'
  215. },
  216. {
  217. prop: 'blockCount',
  218. label: '块数',
  219. align: 'center',
  220. show: this.clientEnvironmentId == '4'
  221. },
  222. {
  223. prop: 'noWordCount',
  224. label: '未排程块数',
  225. align: 'center',
  226. show: this.clientEnvironmentId == '4',
  227. minWidth: 110
  228. },
  229. {
  230. prop: 'reqMoldTime',
  231. label: '计划完成日期',
  232. align: 'center',
  233. width: 110,
  234. showOverflowTooltip: true
  235. },
  236. {
  237. prop: 'startTime',
  238. label: '计划开始日期',
  239. align: 'center',
  240. width: 110,
  241. showOverflowTooltip: true
  242. },
  243. {
  244. prop: 'endTime',
  245. label: '计划结束日期',
  246. align: 'center',
  247. width: 110,
  248. showOverflowTooltip: true
  249. },
  250. {
  251. prop: 'orderType',
  252. label: '计划类型',
  253. align: 'center',
  254. formatter: (row) => {
  255. const obj = this.planType.find((i) => i.value == row.planType);
  256. return obj && obj.label;
  257. }
  258. },
  259. {
  260. prop: 'version',
  261. label: '版本',
  262. align: 'center',
  263. minWidth: 80
  264. },
  265. {
  266. prop: 'createTime',
  267. label: '创建时间',
  268. align: 'center',
  269. width: 110,
  270. showOverflowTooltip: true
  271. },
  272. ],
  273. // 表格选中数据
  274. selection: [],
  275. tableData: [],
  276. current: null,
  277. planType: [
  278. { label: '所有计划类型', value: null },
  279. { label: '内销计划', value: '1' },
  280. { label: '外销计划', value: '2' },
  281. { label: '预制计划', value: '3' }
  282. ],
  283. };
  284. },
  285. computed: {
  286. clientEnvironmentId() {
  287. return this.$store.state.user.info.clientEnvironmentId;
  288. },
  289. },
  290. created() {
  291. },
  292. methods: {
  293. open(item) {
  294. if (item) {
  295. this.tableData = item;
  296. }
  297. this.visible = true;
  298. },
  299. /* 表格数据源 */
  300. async datasource({ page, limit, where }) {
  301. const data = await getList({
  302. ...where,
  303. pageNum: page,
  304. size: limit
  305. });
  306. return data;
  307. },
  308. /* 刷新表格 */
  309. reload(where) {
  310. this.$refs.table.reload({ page: 1, where: where });
  311. },
  312. handleClose() {
  313. this.visible = false;
  314. this.$refs.table.setSelectedRows([]);
  315. this.selection = [];
  316. },
  317. selected() {
  318. if (!this.selection.length) {
  319. this.$message.error('请至少选择一条数据');
  320. return;
  321. }
  322. this.$emit('chooseOrder', this.selection);
  323. this.handleClose();
  324. }
  325. }
  326. };
  327. </script>
  328. <style lang="scss" scoped>
  329. .btns {
  330. text-align: center;
  331. padding: 10px 0;
  332. }
  333. </style>