produceOrder.vue 9.4 KB

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