scheduling.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <!-- 任务处理中心 -->
  2. <template>
  3. <div class="production">
  4. <template v-if="!detailsVisible && !outsourceVisible">
  5. <el-header style="font-size: large;text-align: center">任务处理中心</el-header>
  6. <el-table
  7. :data="dataList"
  8. border
  9. v-loading="dataListLoading"
  10. style="width: 100%;">
  11. <el-table-column
  12. label="序号"
  13. type="index"
  14. width="50"
  15. align="center">
  16. </el-table-column>
  17. <el-table-column
  18. prop="orderCode"
  19. header-align="center"
  20. align="center"
  21. min-width="120"
  22. :show-tooltip-when-overflow="true"
  23. label="任务单编码">
  24. </el-table-column>
  25. <el-table-column
  26. prop="customerName"
  27. header-align="center"
  28. align="center"
  29. min-width="160"
  30. :show-tooltip-when-overflow="true"
  31. label="客户名称">
  32. </el-table-column>
  33. <el-table-column
  34. prop="contractNumber"
  35. header-align="center"
  36. align="center"
  37. min-width="140"
  38. :show-tooltip-when-overflow="true"
  39. label="合同编号">
  40. </el-table-column>
  41. <el-table-column
  42. prop="productNumber"
  43. header-align="center"
  44. align="center"
  45. min-width="120"
  46. :show-tooltip-when-overflow="true"
  47. label="生产编号">
  48. </el-table-column>
  49. <el-table-column
  50. prop="productName"
  51. header-align="center"
  52. align="center"
  53. min-width="160"
  54. :show-tooltip-when-overflow="true"
  55. label="物料名称">
  56. </el-table-column>
  57. <el-table-column
  58. prop="cnt"
  59. header-align="center"
  60. align="center"
  61. min-width="100"
  62. label="数量">
  63. </el-table-column>
  64. <el-table-column
  65. prop="isAppraise"
  66. header-align="center"
  67. align="center"
  68. :formatter="formatAppraise"
  69. label="是否鉴定">
  70. </el-table-column>
  71. <el-table-column
  72. prop="isFirst"
  73. header-align="center"
  74. align="center"
  75. :formatter="formatFirst"
  76. label="是否首件">
  77. </el-table-column>
  78. <el-table-column
  79. prop="deliveryDate"
  80. header-align="center"
  81. align="center"
  82. min-width="160"
  83. label="交期时间">
  84. </el-table-column>
  85. <el-table-column
  86. prop="batchNumber"
  87. header-align="center"
  88. align="center"
  89. min-width="140"
  90. :show-tooltip-when-overflow="true"
  91. label="批次号">
  92. </el-table-column>
  93. <el-table-column
  94. prop="notes"
  95. header-align="center"
  96. align="center"
  97. width="180"
  98. :show-tooltip-when-overflow="true"
  99. label="备注">
  100. </el-table-column>
  101. <el-table-column
  102. prop="inventoryCnt"
  103. header-align="center"
  104. align="center"
  105. min-width="140"
  106. label="仓库核对数量">
  107. </el-table-column>
  108. <el-table-column
  109. prop="prodState"
  110. header-align="center"
  111. align="center"
  112. width="120"
  113. :formatter="formatState"
  114. label="当前状态">
  115. </el-table-column>
  116. <el-table-column
  117. prop="state"
  118. header-align="center"
  119. align="center"
  120. :formatter="formatState2"
  121. label="处理状态">
  122. </el-table-column>
  123. <el-table-column
  124. fixed="right"
  125. header-align="center"
  126. align="center"
  127. width="280"
  128. label="操作">
  129. <template slot-scope="scope">
  130. <el-button type="text" size="small" @click="check(scope.row.id)">核料</el-button>
  131. <el-button type="text" size="small" @click="check(scope.row.id)">转采购</el-button>
  132. <el-button type="text" size="small" @click="check(scope.row.id)">转委外</el-button>
  133. <el-button type="text" size="small" @click="check(scope.row.id)">试制前检查</el-button>
  134. <el-button v-if="isAuth('prod:production:plan')" type="text" size="small" @click="detail(scope.row.id, true)">排产</el-button>
  135. <!-- <el-button v-if="isAuth('pur:commDetail:save') && Number(scope.row.outsourcing) === 0" type="text" size="small" @click="outsourceHandle(scope.row.id)">委外生产</el-button>-->
  136. </template>
  137. </el-table-column>
  138. </el-table>
  139. <el-pagination
  140. @size-change="sizeChangeHandle"
  141. @current-change="currentChangeHandle"
  142. :current-page="pageIndex"
  143. :page-sizes="[10, 20, 50, 100]"
  144. :page-size="pageSize"
  145. :total="totalPage"
  146. layout="total, sizes, prev, pager, next, jumper">
  147. </el-pagination>
  148. </template>
  149. <!-- 弹窗, 新增 / 修改 -->
  150. <detail v-if="detailsVisible" ref="details" @close="closeDialogEvent" @refreshDataList="getDataList" @onChose="onChose"/>
  151. <!-- 委外 -->
  152. <outsource v-if="outsourceVisible" ref="outsource" @refreshDataList="getDataList" @onChose="onChose"/>
  153. </div>
  154. </template>
  155. <script>
  156. import Detail from './scheduling-details'
  157. import Outsource from './scheduling-outsource'
  158. import { getSchedulingList, batchPlan } from '@/api/production'
  159. export default {
  160. name: 'scheduling',
  161. components: {Detail, Outsource},
  162. data () {
  163. return {
  164. detailsVisible: false,
  165. outsourceVisible: false,
  166. dataForm: {},
  167. dataList: [],
  168. pageIndex: 1,
  169. pageSize: 10,
  170. totalPage: 0,
  171. dataListLoading: false,
  172. dataListSelections: [],
  173. // 状态
  174. optionsProdState: [
  175. {
  176. code: '0',
  177. value: '待试制前检查'
  178. },
  179. {
  180. code: '1',
  181. value: '等待'
  182. },
  183. {
  184. code: '2',
  185. value: '待排产'
  186. },
  187. {
  188. code: '3',
  189. value: '生产中生产完成'
  190. },
  191. {
  192. code: '4',
  193. value: '生产完成'
  194. },
  195. {
  196. code: '5',
  197. value: '检验不合格完成'
  198. },
  199. {
  200. code: '6',
  201. value: '操作损坏完成'
  202. }
  203. ],
  204. // 处理状态
  205. optionsState: [
  206. {
  207. code: '1',
  208. value: '待核料'
  209. },
  210. {
  211. code: '2',
  212. value: '采购'
  213. },
  214. {
  215. code: '3',
  216. value: '委外'
  217. },
  218. {
  219. code: '4',
  220. value: '生产'
  221. }
  222. ],
  223. multipleSelection: []
  224. }
  225. },
  226. created () {
  227. this.getDataList()
  228. },
  229. methods: {
  230. onChose () {
  231. this.detailsVisible = false
  232. this.outsourceVisible = false
  233. },
  234. handleSelectionChange (val) {
  235. this.multipleSelection = val
  236. },
  237. // 批量排产
  238. batchPlan () {
  239. let ids = this.multipleSelection.map(item => item.id)
  240. // eslint-disable-next-line standard/object-curly-even-spacing
  241. batchPlan({ productionIds: ids}).then(({data}) => {
  242. if (data && data.code === '200') {
  243. this.$message({
  244. type: 'success',
  245. message: '批量排产成功!'
  246. })
  247. this.getDataList()
  248. } else {
  249. this.$message({
  250. type: 'error',
  251. message: data.msg
  252. })
  253. }
  254. })
  255. },
  256. // 查询
  257. queryPage () {
  258. this.pageIndex = 1
  259. this.getDataList()
  260. },
  261. // 获取数据列表
  262. getDataList () {
  263. this.dataListLoading = true
  264. let params = {
  265. 'current': this.pageIndex,
  266. 'size': this.pageSize,
  267. 'customerName': this.dataForm.customerName ? this.dataForm.customerName : null,
  268. 'orderCode': this.dataForm.orderCode ? this.dataForm.orderCode : null
  269. }
  270. getSchedulingList(params).then(({data}) => {
  271. if (data && data.code === '200') {
  272. this.dataList = data.data.records
  273. this.totalPage = Number(data.data.total)
  274. } else {
  275. this.dataList = []
  276. this.totalPage = 0
  277. }
  278. this.dataListLoading = false
  279. })
  280. },
  281. // 每页数
  282. sizeChangeHandle (val) {
  283. this.pageSize = val
  284. this.pageIndex = 1
  285. this.getDataList()
  286. },
  287. // 当前页
  288. currentChangeHandle (val) {
  289. this.pageIndex = val
  290. this.getDataList()
  291. },
  292. // 多选
  293. selectionChangeHandle (val) {
  294. this.dataListSelections = val
  295. },
  296. // 新增 / 修改
  297. detail (id, disable) {
  298. this.detailsVisible = true
  299. this.$nextTick(() => {
  300. this.$refs.details.init(id, disable)
  301. })
  302. },
  303. // 转换属性:是否
  304. formatAppraise (row) {
  305. if (!row.isAppraise) return ''
  306. return row.isAppraise === '1' ? '否' : '是'
  307. },
  308. // 转换属性:是否
  309. formatFirst (row) {
  310. if (!row.isFirst) return ''
  311. return row.isFirst === '1' ? '否' : '是'
  312. },
  313. // 转换属性“当前状态”
  314. formatState (row) {
  315. if (!row.prodState) return ''
  316. const item1 = this.optionsProdState.find((item) => item.code === row.prodState.toString())
  317. return item1 ? item1.value : ''
  318. },
  319. // 转换属性“处理状态”
  320. formatState2 (row) {
  321. if (!row.state) {
  322. return ''
  323. }
  324. const item1 = this.optionsState.find((item) => item.code === row.state.toString())
  325. return item1 ? item1.value : ''
  326. },
  327. closeDialogEvent () {
  328. this.detailsVisible = false
  329. },
  330. // 委外生产
  331. outsourceHandle (id) {
  332. this.outsourceVisible = true
  333. let ids = []
  334. ids.push(id)
  335. this.$nextTick(() => {
  336. this.$refs.outsource.init(id, ids)
  337. })
  338. },
  339. // 批量委外生产
  340. outsourceHandle2 () {
  341. let ids = this.multipleSelection.map(item => item.id)
  342. this.outsourceVisible = true
  343. this.$nextTick(() => {
  344. this.$refs.outsource.init(-1, ids)
  345. })
  346. }
  347. }
  348. }
  349. </script>
  350. <style scoped>
  351. </style>