index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  1. <template>
  2. <div class="ele-body">
  3. <el-card shadow="never" v-loading="loading">
  4. <order-search @search="reload" ref="searchRef"> </order-search>
  5. <!-- <el-tabs v-model="activeName" type="card">
  6. <el-tab-pane label="未完成工单" name="first"></el-tab-pane>
  7. <el-tab-pane label="已完成工单" name="second"></el-tab-pane>
  8. </el-tabs> -->
  9. <!-- 数据表格 -->
  10. <ele-pro-table
  11. ref="table"
  12. :columns="columns"
  13. :datasource="datasource"
  14. cache-key="workOrderTable"
  15. >
  16. <template v-slot:code="{ row }">
  17. <!-- <el-link type="primary" :underline="false" @click="goDetail(row)"> -->
  18. {{ row.code }}
  19. <!-- </el-link> -->
  20. </template>
  21. <template v-slot:status="{ row }">
  22. <span :class="{ 'ele-text-danger': row.status == 3 }">
  23. {{ statusFormatter(row.status) }}
  24. </span>
  25. </template>
  26. <!-- 操作列 -->
  27. <template v-slot:action="{ row }">
  28. <el-link
  29. type="primary"
  30. :underline="false"
  31. icon="el-icon-truck"
  32. @click="toRelease(row)"
  33. v-if="row.status == 8"
  34. >
  35. 下达
  36. </el-link>
  37. </template>
  38. </ele-pro-table>
  39. </el-card>
  40. <el-dialog :visible.sync="visible" title="选择班组" width="400px">
  41. <el-select v-model="releasParams.teamId">
  42. <el-option
  43. v-for="item in teamList"
  44. :value="item.id"
  45. :key="item.id"
  46. :label="item.name"
  47. ></el-option>
  48. </el-select>
  49. <div class="footer" slot="footer">
  50. <el-button @click="visible = false">取消</el-button>
  51. <el-button type="primary" @click="confirm">确定</el-button>
  52. </div>
  53. </el-dialog>
  54. </div>
  55. </template>
  56. <script>
  57. import { getList, releaseWorkOrder } from '@/api/workOrder/index.js';
  58. import { teamPage } from '@/api/mainData/index.js';
  59. import OrderSearch from './components/order-search.vue';
  60. export default {
  61. components: {
  62. OrderSearch
  63. },
  64. data () {
  65. return {
  66. visible: false,
  67. loading: false,
  68. releasParams: {
  69. teamId: '',
  70. id: ''
  71. },
  72. teamList: [],
  73. statusOpt: [
  74. { label: '待生产', value: 4 },
  75. { label: '生产中', value: 5 },
  76. { label: '待下达', value: 8 }
  77. ],
  78. current: null,
  79. };
  80. },
  81. computed: {
  82. // 表格列配置
  83. columns () {
  84. return [
  85. {
  86. columnKey: 'index',
  87. label: '序号',
  88. type: 'index',
  89. width: 55,
  90. align: 'center',
  91. showOverflowTooltip: true,
  92. fixed: 'left'
  93. },
  94. {
  95. slot: 'code',
  96. label: '生产订单号',
  97. align: 'center',
  98. minWidth: 110
  99. },
  100. {
  101. prop: 'productionPlanCode',
  102. label: '计划编号',
  103. align: 'center'
  104. },
  105. {
  106. prop: 'produceRoutingName',
  107. label: '工艺路线',
  108. align: 'center'
  109. },
  110. {
  111. prop: 'productCode',
  112. label: '物料编号',
  113. align: 'center'
  114. },
  115. {
  116. prop: 'productName',
  117. label: '产品名称',
  118. align: 'center'
  119. },
  120. {
  121. prop: 'brandNo',
  122. label: '牌号',
  123. align: 'center'
  124. },
  125. {
  126. prop: 'model',
  127. label: '型号',
  128. align: 'center'
  129. },
  130. {
  131. prop: 'formingNum',
  132. label: '要求生产数量',
  133. align: 'center',
  134. showOverflowTooltip: true,
  135. minWidth: 110
  136. },
  137. {
  138. prop: 'formingWeight',
  139. label: '要求生产重量',
  140. align: 'center',
  141. showOverflowTooltip: true,
  142. minWidth: 110
  143. },
  144. {
  145. prop: 'planStartTime',
  146. label: '计划开始时间',
  147. align: 'center',
  148. showOverflowTooltip: true,
  149. minWidth: 110
  150. },
  151. {
  152. prop: 'planCompleteTime',
  153. label: '计划结束时间',
  154. align: 'center',
  155. showOverflowTooltip: true,
  156. minWidth: 110
  157. },
  158. {
  159. prop: 'createTime',
  160. label: '创建时间',
  161. align: 'center',
  162. showOverflowTooltip: true,
  163. minWidth: 110
  164. },
  165. {
  166. slot: 'status',
  167. label: '状态',
  168. align: 'center',
  169. formatter: (row) => {
  170. const obj = this.statusOpt.find((i) => i.value == row.status);
  171. return obj && obj.label;
  172. }
  173. },
  174. {
  175. prop: 'serialNo',
  176. label: '客户代号',
  177. align: 'center',
  178. showOverflowTooltip: true
  179. },
  180. {
  181. prop: 'simpleName',
  182. label: '客户简称',
  183. align: 'center',
  184. showOverflowTooltip: true
  185. },
  186. {
  187. columnKey: 'action',
  188. label: '操作',
  189. width: 90,
  190. align: 'center',
  191. resizable: false,
  192. fixed: 'right',
  193. slot: 'action',
  194. showOverflowTooltip: true
  195. }
  196. ];
  197. }
  198. },
  199. created () {
  200. },
  201. methods: {
  202. statusFormatter (status) {
  203. const obj = this.statusOpt.find((i) => i.value == status);
  204. return obj && obj.label;
  205. },
  206. /* 表格数据源 */
  207. datasource ({ page, limit, where }) {
  208. if (where.status) {
  209. where.statusList = [];
  210. where.statusList.push(where.status);
  211. }
  212. return getList({
  213. pageNum: page,
  214. size: limit,
  215. ...where
  216. });
  217. },
  218. async _teamPage () {
  219. const res = await teamPage({ page: 1, size: -1, produceVersionId: this.current.produceVersionId });
  220. this.teamList = res.list;
  221. },
  222. // 下达
  223. toRelease (row) {
  224. this.current = row
  225. this.visible = true;
  226. this._teamPage();
  227. },
  228. // 下达
  229. confirm () {
  230. if (!this.releasParams.teamId) {
  231. return this.$message.error('请选择班组');
  232. }
  233. const loading = this.$loading({ text: '加载中...' });
  234. releaseWorkOrder({id: this.current.id, teamId: this.releasParams.teamId})
  235. .then((res) => {
  236. if (res) {
  237. this.$message.success('成功');
  238. this.reload();
  239. this.visible = false;
  240. }
  241. })
  242. .finally(() => {
  243. loading.close();
  244. });
  245. },
  246. /* 刷新表格 */
  247. reload (where) {
  248. this.$nextTick(() => {
  249. this.$refs.table.reload({ page: 1, where });
  250. });
  251. }
  252. }
  253. };
  254. </script>
  255. <style lang="scss" scoped></style>