objEquipmentDialog.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <el-dialog
  3. title="问题对象"
  4. :visible.sync="equipmentdialog"
  5. :before-close="handleClose"
  6. :close-on-click-modal="true"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="60%"
  10. >
  11. <el-row>
  12. <el-col :span="6">
  13. <el-form
  14. label-width="90px"
  15. style="padding: 10px"
  16. class="ele-form-search"
  17. @keyup.enter.native="search"
  18. @submit.native.prevent
  19. >
  20. <el-row>
  21. <el-col :span="24">
  22. <el-form-item label="批号:">
  23. <el-input
  24. v-model="where.batchNo"
  25. placeholder="请输入"
  26. ></el-input>
  27. </el-form-item>
  28. </el-col>
  29. <el-col :span="24">
  30. <el-form-item label="编号:">
  31. <el-input v-model="where.code" placeholder="请输入"></el-input>
  32. </el-form-item>
  33. </el-col>
  34. <el-col :span="24">
  35. <el-form-item label="名称:">
  36. <el-input v-model="where.name" placeholder="请输入"></el-input>
  37. </el-form-item>
  38. </el-col>
  39. <el-col :span="24">
  40. <el-form-item label="产品编码:">
  41. <el-input
  42. v-model="where.productCode"
  43. placeholder="请输入"
  44. ></el-input>
  45. </el-form-item>
  46. </el-col>
  47. <el-col :span="24">
  48. <el-form-item label="产品名称:">
  49. <el-input
  50. v-model="where.productName"
  51. placeholder="请输入"
  52. ></el-input>
  53. </el-form-item>
  54. </el-col>
  55. <el-col :span="24">
  56. <el-form-item label="牌号:">
  57. <el-input
  58. v-model="where.brandNo"
  59. placeholder="请输入"
  60. ></el-input>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="24">
  64. <el-form-item label="型号:">
  65. <el-input v-model="where.model" placeholder="请输入"></el-input>
  66. </el-form-item>
  67. </el-col>
  68. <el-col :span="24">
  69. <el-form-item label="规格:">
  70. <el-input v-model="where.specification" placeholder="请输入"></el-input>
  71. </el-form-item>
  72. </el-col>
  73. <el-col :span="24">
  74. <div class="ele-form-actions" style="display:flex;justify-content: end;margin-top: 15px;" >
  75. <el-button
  76. type="primary"
  77. icon="el-icon-search"
  78. class="ele-btn-icon"
  79. @click="search"
  80. >
  81. 查询
  82. </el-button>
  83. <el-button
  84. @click="reset"
  85. icon="el-icon-refresh-left"
  86. type="primary"
  87. >重置</el-button
  88. >
  89. </div>
  90. </el-col>
  91. </el-row> </el-form
  92. ></el-col>
  93. <el-col :span="18"
  94. ><div>
  95. <div class="switch">
  96. <div class="switch_left">
  97. <ul>
  98. <li
  99. v-for="item in tabOptions"
  100. :key="item.key"
  101. :class="{ active: activeComp == item.key }"
  102. @click="activeComp = item.key"
  103. >
  104. {{ item.name }}
  105. </li>
  106. </ul>
  107. </div>
  108. </div>
  109. </div>
  110. <productionPlan
  111. v-if="activeComp == 'productionPlan'"
  112. ref="productionPlan"
  113. />
  114. <workOrder v-if="activeComp == 'workOrder'" ref="workOrder" />
  115. <produceOrder v-if="activeComp == 'produceOrder'" ref="produceOrder" />
  116. <div>
  117. <ele-pro-table
  118. ref="table"
  119. :columns="objColumns"
  120. :datasource="tableList"
  121. :selection.sync="selection"
  122. row-key="id"
  123. height="20vh"
  124. :needPage="false"
  125. >
  126. <template v-slot:toolbar>
  127. <el-button type="primary" size="small" @click="add"
  128. >添加</el-button
  129. >
  130. <el-button size="small" @click="del">移除</el-button></template
  131. >
  132. </ele-pro-table>
  133. </div></el-col
  134. >
  135. </el-row>
  136. <template v-slot:footer>
  137. <el-button type="primary" size="small" @click="selected">确认</el-button>
  138. <el-button size="small" @click="handleClose">关闭</el-button>
  139. </template>
  140. </el-dialog>
  141. </template>
  142. <script>
  143. // 默认表单数据
  144. const defaultWhere = {
  145. code: '',
  146. name: '',
  147. productCode: '',
  148. productName: '',
  149. brandNo: '',
  150. model: '',
  151. batchNo:"",
  152. specification:''
  153. };
  154. import { objColumns } from './data.js';
  155. import dictMixins from '@/mixins/dictMixins';
  156. import productionPlan from './productionPlan';
  157. import workOrder from './workOrder';
  158. import produceOrder from './produceOrder';
  159. export default {
  160. components: { productionPlan, workOrder, produceOrder },
  161. mixins: [dictMixins],
  162. data() {
  163. return {
  164. activeComp: 'productionPlan',
  165. where: {...defaultWhere},
  166. tabOptions: [
  167. { key: 'productionPlan', name: '生产计划' },
  168. { key: 'workOrder', name: '生产订单' },
  169. { key: 'produceOrder', name: '生产工单' }
  170. ],
  171. objColumns: objColumns,
  172. equipmentdialog: false,
  173. tableList: [],
  174. selection: []
  175. };
  176. },
  177. watch: {},
  178. methods: {
  179. open(data) {
  180. this.tableList = (data && JSON.parse(JSON.stringify(data))) || [];
  181. this.equipmentdialog = true;
  182. },
  183. reload() {
  184. this.$refs.equiTable.reload();
  185. },
  186. handleClose() {
  187. this.equipmentdialog = false;
  188. },
  189. reset() {
  190. this.reload();
  191. },
  192. add() {
  193. const planStatus = [
  194. { label: '待发布', value: '2' },
  195. { label: '发布失败', value: '3' },
  196. { label: '待生产', value: '4' },
  197. { label: '生产中', value: '5' },
  198. { label: '已完成', value: '6' },
  199. { label: '已延期', value: '7' },
  200. { label: '待下达', value: '8' }
  201. ];
  202. if (this.$refs[this.activeComp].getValue().length == 0) {
  203. return;
  204. }
  205. let ids = this.tableList.map((item) => item.id);
  206. let getValue = this.$refs[this.activeComp]
  207. .getValue()
  208. .filter((item) => !ids.includes(item.id)); //去重
  209. getValue.forEach((element) => {
  210. element.status = planStatus.find(
  211. (item) => item.value == element.status
  212. ).label;
  213. });
  214. this.tableList.push(...getValue);
  215. },
  216. del() {
  217. let ids = this.selection.map((item) => item.id);
  218. this.tableList = this.tableList.filter((item) => !ids.includes(item.id));
  219. },
  220. // 选择
  221. selected() {
  222. this.$emit('choose', JSON.parse(JSON.stringify(this.tableList)));
  223. this.handleClose();
  224. },
  225. /* 搜索 */
  226. search() {
  227. this.$refs[this.activeComp].reload(this.where)
  228. },
  229. /* 重置 */
  230. reset() {
  231. this.where = { ...defaultWhere };
  232. this.search();
  233. }
  234. }
  235. };
  236. </script>
  237. <style lang="scss" scoped>
  238. :deep(.el-row) {
  239. margin-bottom: 20px;
  240. &:last-child {
  241. margin-bottom: 0;
  242. }
  243. }
  244. </style>