index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <productionPlan-search
  5. @search="reload"
  6. ref="searchRef"
  7. :statusOpt="statusOpt"
  8. :planType="planType"
  9. :activeName="activeName"
  10. >
  11. </productionPlan-search>
  12. <el-tabs v-model="activeName" type="card" @tab-click="handleTabChange">
  13. <el-tab-pane label="未发布" name="first"></el-tab-pane>
  14. <el-tab-pane label="已发布" name="second"></el-tab-pane>
  15. </el-tabs>
  16. <!-- 数据表格 -->
  17. <ele-pro-table
  18. ref="table"
  19. :key="activeName"
  20. :columns="columns"
  21. :datasource="datasource"
  22. :cache-key="`${activeName}ProductionPlanTable`"
  23. >
  24. <!-- 操作列 -->
  25. <template v-slot:action="{ row }">
  26. <el-link
  27. type="primary"
  28. :underline="false"
  29. icon="el-icon-truck"
  30. @click="handleOrderPublish(row)"
  31. >
  32. 发布工单
  33. </el-link>
  34. <el-link type="primary" :underline="false" icon="el-icon-truck">
  35. 重新发布
  36. </el-link>
  37. <el-link type="primary" :underline="false" icon="el-icon-edit">
  38. 修改计划
  39. </el-link>
  40. <el-link type="primary" :underline="false" icon="el-icon-edit">
  41. 删除
  42. </el-link>
  43. </template>
  44. </ele-pro-table>
  45. </el-card>
  46. </div>
  47. </template>
  48. <script>
  49. import { getList } from '@/api/productionPlan/index.js';
  50. import productionPlanSearch from './components/productionPlan-search.vue';
  51. export default {
  52. components: {
  53. productionPlanSearch
  54. },
  55. data () {
  56. return {
  57. activeName: 'first',
  58. // 加载状态
  59. loading: false,
  60. pageType: 'add',
  61. dialogTitle: '',
  62. isBindPlan: false,
  63. statusOpt: {
  64. first: [
  65. { label: '所有状态', value: '1,2' },
  66. { label: '待发布', value: '1' },
  67. { label: '发布状态', value: '2' }
  68. ],
  69. second: [
  70. { label: '所有状态', value: '0,3,4,5,6' },
  71. { label: '待排产', value: '0' },
  72. { label: '待生产', value: '3' },
  73. { label: '生产中', value: '4' },
  74. { label: '已完成', value: '5' },
  75. { label: '已延期', value: '6' }
  76. ]
  77. },
  78. planType: [
  79. { label: '所有计划类型', value: '0,1' },
  80. { label: '内销计划', value: '0' },
  81. { label: '外销计划', value: '1' }
  82. ]
  83. };
  84. },
  85. computed: {
  86. // 表格列配置
  87. columns () {
  88. const opt = {
  89. first: [
  90. {
  91. prop: 'deliveryTime',
  92. label: '预测交货日期',
  93. align: 'center',
  94. showOverflowTooltip: true,
  95. minWidth: 110
  96. }
  97. ],
  98. second: [
  99. // {
  100. // prop: 'formingTime',
  101. // label: '实际成型日期',
  102. // align: 'center',
  103. // showOverflowTooltip: true,
  104. // minWidth: 110
  105. // },
  106. {
  107. prop: 'releaseTime',
  108. label: '工单发布日期',
  109. align: 'center',
  110. showOverflowTooltip: true,
  111. minWidth: 110
  112. },
  113. {
  114. prop: 'deliveryTime',
  115. label: '预测交货日期',
  116. align: 'center',
  117. showOverflowTooltip: true,
  118. minWidth: 110
  119. },
  120. {
  121. prop: 'formingTime',
  122. label: '实际交货日期',
  123. align: 'center',
  124. showOverflowTooltip: true,
  125. minWidth: 110
  126. }
  127. ]
  128. };
  129. return [
  130. {
  131. columnKey: 'index',
  132. label: '序号',
  133. type: 'index',
  134. width: 55,
  135. align: 'center',
  136. showOverflowTooltip: true,
  137. fixed: 'left'
  138. },
  139. {
  140. slot: 'code',
  141. prop: 'code',
  142. action: 'code',
  143. label: '计划编号',
  144. align: 'center',
  145. showOverflowTooltip: true,
  146. minWidth: 110
  147. },
  148. {
  149. prop: 'productCode',
  150. label: '产品编号',
  151. align: 'center',
  152. showOverflowTooltip: true,
  153. minWidth: 110
  154. },
  155. {
  156. prop: 'brandNo',
  157. label: '牌号',
  158. align: 'center',
  159. showOverflowTooltip: true,
  160. minWidth: 110
  161. },
  162. {
  163. prop: 'model',
  164. label: '型号',
  165. align: 'center',
  166. showOverflowTooltip: true,
  167. minWidth: 110
  168. },
  169. {
  170. prop: 'productNum',
  171. label: '计划数量',
  172. align: 'center',
  173. showOverflowTooltip: true,
  174. minWidth: 110
  175. },
  176. {
  177. prop: 'productWeight',
  178. label: '计划重量',
  179. align: 'center',
  180. showOverflowTooltip: true,
  181. minWidth: 110
  182. },
  183. {
  184. prop: 'requiredFormingNum',
  185. label: '要求成型数量',
  186. align: 'center',
  187. showOverflowTooltip: true,
  188. minWidth: 110
  189. },
  190. // {
  191. // prop: '',
  192. // label: '已成型数量',
  193. // align: 'center',
  194. // showOverflowTooltip: true,
  195. // minWidth: 110
  196. // },
  197. {
  198. prop: 'requiredFormingTime',
  199. label: '要求成型日期',
  200. align: 'center',
  201. showOverflowTooltip: true,
  202. minWidth: 110
  203. },
  204. {
  205. prop: 'planFormingTime',
  206. label: '预测成型日期',
  207. align: 'center',
  208. showOverflowTooltip: true,
  209. minWidth: 110
  210. },
  211. ...opt[this.activeName],
  212. {
  213. prop: 'orderType',
  214. label: '计划类型',
  215. align: 'center',
  216. showOverflowTooltip: true,
  217. formatter: (row) => {
  218. const obj = this.planType.find((i) => i.value == row.orderType);
  219. return obj && obj.label;
  220. }
  221. },
  222. {
  223. prop: 'createTime',
  224. label: '创建时间',
  225. align: 'center',
  226. showOverflowTooltip: true,
  227. minWidth: 110
  228. },
  229. {
  230. prop: 'planStatus',
  231. label: '状态',
  232. align: 'center',
  233. minWidth: 110,
  234. formatter: (row) => {
  235. const obj = this.statusOpt[this.activeName].find(
  236. (i) => i.value == row.orderType
  237. );
  238. return obj && obj.label;
  239. }
  240. },
  241. ...(this.activeName === 'second'
  242. ? [
  243. {
  244. prop: 'releaseTime',
  245. label: '发布时间',
  246. align: 'center',
  247. showOverflowTooltip: true,
  248. minWidth: 110
  249. }
  250. ]
  251. : []),
  252. ...(this.activeName === 'first'
  253. ? [
  254. {
  255. columnKey: 'action',
  256. label: '操作',
  257. width: 350,
  258. align: 'center',
  259. resizable: false,
  260. fixed: 'right',
  261. slot: 'action',
  262. showOverflowTooltip: true
  263. }
  264. ]
  265. : [])
  266. ];
  267. }
  268. },
  269. methods: {
  270. /* 表格数据源 */
  271. datasource ({ page, limit, where }) {
  272. return getList({
  273. pageNum: page,
  274. size: limit,
  275. ...where
  276. });
  277. },
  278. // 发布工单
  279. handleOrderPublish (row) {
  280. this.$router.push({
  281. path: '/productionPlan/workOrderPublish'
  282. });
  283. },
  284. handleTabChange () {
  285. this.$refs.searchRef.reset();
  286. },
  287. /* 刷新表格 */
  288. reload (where) {
  289. this.$refs.table.reload({ page: 1, where });
  290. },
  291. goDetail (row) {
  292. row.title = '工单详情';
  293. row.tabLabel = '工单信息';
  294. this.$router.push({
  295. path: '/productionPlan/detail'
  296. });
  297. }
  298. }
  299. };
  300. </script>
  301. <style lang="scss" scoped></style>