ProduceDialogAll.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <ele-modal
  3. width="70vw"
  4. :visible.sync="visible"
  5. :close-on-click-modal="false"
  6. append-to-body
  7. custom-class="ele-dialog-form"
  8. title="选择工序"
  9. :maxable="true"
  10. >
  11. <el-form label-width="120px">
  12. <el-row>
  13. <el-col :span="6">
  14. <el-form-item label="工序编码" prop="code">
  15. <el-input v-model="searchData.code"></el-input>
  16. </el-form-item>
  17. </el-col>
  18. <el-col :span="6">
  19. <el-form-item label="工序名称" prop="name">
  20. <el-input v-model="searchData.name"></el-input>
  21. </el-form-item>
  22. </el-col>
  23. <el-col :span="6">
  24. <el-form-item label="工作中心" prop="name">
  25. <el-select
  26. v-model="searchData.workCenterId"
  27. placeholder="请选择"
  28. filterable
  29. clearable
  30. >
  31. <el-option
  32. v-for="item in workCenterList"
  33. :key="item.id"
  34. :label="item.name"
  35. :value="item.id"
  36. >
  37. </el-option>
  38. </el-select>
  39. </el-form-item>
  40. </el-col>
  41. <el-col :span="6">
  42. <div class="ele-form-actions">
  43. <el-button type="primary" @click="search">搜索</el-button>
  44. <el-button @click="reset">重置</el-button>
  45. </div>
  46. </el-col>
  47. </el-row>
  48. </el-form>
  49. <ele-pro-table
  50. :columns="columns"
  51. :datasource="datasource"
  52. ref="table"
  53. height="45vh"
  54. :initLoad="false"
  55. row-key="id"
  56. :selection.sync="selection"
  57. >
  58. </ele-pro-table>
  59. <div slot="footer">
  60. <el-button type="primary" @click="confirm">确定</el-button>
  61. <el-button @click="cancel">返回</el-button>
  62. </div>
  63. </ele-modal>
  64. </template>
  65. <script>
  66. import producetask from '@/api/technology/production';
  67. import work from '@/api/technology/work';
  68. export default {
  69. props: {
  70. disabledListId: {
  71. type: Array,
  72. default: () => []
  73. }
  74. },
  75. data() {
  76. return {
  77. visible: false,
  78. selection: [],
  79. searchData: {
  80. code: '',
  81. name: '',
  82. workCenterId: ''
  83. },
  84. columns: [
  85. {
  86. width: 45,
  87. type: 'selection',
  88. columnKey: 'selection',
  89. align: 'center',
  90. fixed: 'left',
  91. selectable: (row, index) => {
  92. return !this.disabledListId.includes(row.id);
  93. }
  94. },
  95. {
  96. prop: 'code',
  97. label: '工序编码',
  98. showOverflowTooltip: true,
  99. align: 'center',
  100. minWidth: 110
  101. },
  102. {
  103. prop: 'name',
  104. label: '工序名称',
  105. showOverflowTooltip: true,
  106. align: 'center',
  107. minWidth: 110
  108. },
  109. {
  110. align: 'center',
  111. prop: 'controlName',
  112. label: '工序控制码',
  113. showOverflowTooltip: true,
  114. minWidth: 110
  115. },
  116. {
  117. prop: 'workCenterName',
  118. label: '所属工作中心',
  119. align: 'center',
  120. showOverflowTooltip: true,
  121. minWidth: 110
  122. }
  123. ],
  124. workCenterList: []
  125. };
  126. },
  127. methods: {
  128. open() {
  129. this.visible = true;
  130. this.getListWorkCenter();
  131. this.$nextTick(() => {
  132. this.$refs.table.reload();
  133. });
  134. },
  135. /* 表格数据源 */
  136. async datasource({ page, limit, where, order }) {
  137. const res = await producetask.list({
  138. ...where,
  139. ...this.searchData,
  140. pageNum: page,
  141. size: limit
  142. });
  143. return res;
  144. },
  145. cancel() {
  146. this.searchData = {};
  147. this.visible = false;
  148. },
  149. confirm() {
  150. if (!this.selection.length) {
  151. return this.$message.warning('请选择工序');
  152. }
  153. this.$emit('changeProduct', this.selection);
  154. this.cancel();
  155. },
  156. search() {
  157. this.$refs.table.reload();
  158. },
  159. reset() {
  160. this.searchData = {};
  161. this.$refs.table.reload();
  162. },
  163. async getListWorkCenter() {
  164. await work.list({ pageNum: 1, size: -1 }).then((res) => {
  165. this.workCenterList = res.list;
  166. });
  167. }
  168. }
  169. };
  170. </script>