ProduceDialog.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <template>
  2. <ele-modal width="70vw" :visible.sync="visible" :close-on-click-modal="true" append-to-body
  3. custom-class="ele-dialog-form" title="选择工序">
  4. <el-form label-width="120px">
  5. <el-row>
  6. <el-col :span="6">
  7. <el-form-item label="工序编码" prop="code">
  8. <el-input v-model="searchData.code"></el-input>
  9. </el-form-item>
  10. </el-col>
  11. <el-col :span="6">
  12. <el-form-item label="工序名称" prop="name">
  13. <el-input v-model="searchData.name"></el-input>
  14. </el-form-item>
  15. </el-col>
  16. <el-col :span="6">
  17. <div class="ele-form-actions">
  18. <el-button type="primary" @click="search">搜索</el-button>
  19. <el-button @click="reset">重置</el-button>
  20. </div>
  21. </el-col>
  22. </el-row>
  23. </el-form>
  24. <ele-pro-table :columns="columns" :datasource="datasource" @cell-click="cellClick" ref="table" height="45vh"
  25. :initLoad="false" row-key="id">
  26. <!-- 表头工具栏 -->
  27. <template v-slot:action="{ row }">
  28. <el-radio class="radio" v-model="radio" :label="row.id"><i></i></el-radio>
  29. </template>
  30. </ele-pro-table>
  31. <div slot="footer">
  32. <el-button type="primary" @click="confirm">确定</el-button>
  33. <el-button @click="cancel">返回</el-button>
  34. </div>
  35. </ele-modal>
  36. </template>
  37. <script>
  38. import { getProduceList } from '@/api/factoryModel';
  39. import producetask from '@/api/technology/production';
  40. export default {
  41. data() {
  42. return {
  43. visible: false,
  44. isUpdate: false,
  45. selection: [],
  46. searchData: {
  47. code: '',
  48. name: ''
  49. },
  50. columns: [
  51. {
  52. prop: 'code',
  53. label: '工序编码',
  54. // sortable: 'custom',
  55. showOverflowTooltip: true,
  56. align: 'center',
  57. minWidth: 110
  58. },
  59. {
  60. prop: 'name',
  61. label: '工序名称',
  62. showOverflowTooltip: true,
  63. align: 'center',
  64. minWidth: 110
  65. },
  66. {
  67. align: 'center',
  68. prop: 'controlName',
  69. label: '工序控制码',
  70. showOverflowTooltip: true,
  71. minWidth: 110
  72. },
  73. {
  74. prop: 'workCenterName',
  75. label: '所属工作中心',
  76. align: 'center',
  77. showOverflowTooltip: true,
  78. minWidth: 110
  79. },
  80. {
  81. action: 'action',
  82. slot: 'action',
  83. align: 'center',
  84. label: '选择'
  85. }
  86. ],
  87. radio: null,
  88. };
  89. },
  90. methods: {
  91. open(item) {
  92. if(item) {
  93. this.current = {
  94. id: item.taskIds,
  95. name: item.taskNames,
  96. }
  97. }
  98. this.radio = item.taskIds
  99. this.visible = true;
  100. this.$nextTick(() => {
  101. this.$refs.table.reload();
  102. });
  103. },
  104. /* 表格数据源 */
  105. async datasource({ page, limit, where, order }) {
  106. const res = await producetask.list({
  107. ...where,
  108. ...this.searchData,
  109. pageNum: page,
  110. size: limit
  111. });
  112. return res;
  113. },
  114. cancel() {
  115. this.current = null
  116. this.radio = ''
  117. this.searchData = {};
  118. this.visible = false;
  119. },
  120. confirm() {
  121. if (!this.current) {
  122. return this.$message.warning('请选择工作中心')
  123. }
  124. this.$emit('changeProduct', this.current)
  125. this.cancel()
  126. },
  127. // 单击获取id
  128. cellClick(row) {
  129. this.current = row
  130. this.radio = row.id
  131. },
  132. search() {
  133. this.$refs.table.reload();
  134. },
  135. reset() {
  136. this.searchData = {};
  137. this.$refs.table.reload();
  138. }
  139. }
  140. };
  141. </script>