processRoute.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <template>
  2. <ele-modal
  3. title="选择工艺路线"
  4. custom-class="ele-dialog-form long-dialog-form"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. top="5vh"
  9. :close-on-press-escape="false"
  10. append-to-body
  11. width="70%"
  12. :maxable="true"
  13. >
  14. <el-card shadow="never">
  15. <route-search @search="reload"></route-search>
  16. <ele-pro-table
  17. ref="table"
  18. :columns="columns"
  19. :datasource="datasource"
  20. row-key="id"
  21. height="calc(100vh - 460px)"
  22. class="dict-table"
  23. @cell-click="cellClick"
  24. >
  25. <template v-slot:action="{ row }">
  26. <el-radio class="radio" v-model="radio" :label="row.id"
  27. ><i></i
  28. ></el-radio>
  29. </template>
  30. </ele-pro-table>
  31. </el-card>
  32. <div slot="footer">
  33. <el-button type="primary" size="small" @click="selected">选择</el-button>
  34. <el-button size="small" @click="handleClose">关闭</el-button>
  35. </div>
  36. </ele-modal>
  37. </template>
  38. <script>
  39. import { routeList } from '@/api/aps';
  40. import { reviewStatus } from '@/enum/dict';
  41. import routeSearch from './routeSearch.vue'
  42. export default {
  43. components: {
  44. routeSearch
  45. },
  46. props: {},
  47. data() {
  48. return {
  49. visible: false,
  50. columns: [
  51. {
  52. action: 'action',
  53. slot: 'action',
  54. align: 'center',
  55. label: '选择'
  56. },
  57. {
  58. columnKey: 'index',
  59. label: '序号',
  60. type: 'index',
  61. width: 55,
  62. align: 'center',
  63. showOverflowTooltip: true,
  64. fixed: 'left'
  65. },
  66. {
  67. prop: 'code',
  68. label: '工艺路线编码',
  69. showOverflowTooltip: true,
  70. align: 'center',
  71. minWidth: 110,
  72. slot: 'code'
  73. },
  74. {
  75. prop: 'name',
  76. label: '工艺路线名称',
  77. showOverflowTooltip: true,
  78. align: 'center',
  79. minWidth: 110
  80. },
  81. {
  82. prop: 'version',
  83. label: '工艺路线版本',
  84. align: 'center',
  85. showOverflowTooltip: true,
  86. minWidth: 110
  87. },
  88. {
  89. prop: 'status',
  90. label: '状态',
  91. align: 'center',
  92. slot: 'status',
  93. showOverflowTooltip: true,
  94. minWidth: 110,
  95. // filters: [
  96. // { text: '草稿', value: -1 },
  97. // { text: '失效', value: 0 },
  98. // { text: '生效', value: 1 }
  99. // ],
  100. filterMultiple: false,
  101. columnKey: 'status',
  102. formatter:(row)=>{
  103. if(row.status == -1){
  104. return '草稿'
  105. }else if(row.status == 0){
  106. return '失效'
  107. }else{
  108. return '生效'
  109. }
  110. }
  111. },
  112. {
  113. prop: 'approvalStatus',
  114. label: '审核状态',
  115. align: 'center',
  116. showOverflowTooltip: true,
  117. minWidth: 100,
  118. formatter: (_row, _column, cellValue) => {
  119. return reviewStatus[_row.approvalStatus];
  120. }
  121. },
  122. {
  123. prop: 'factoriesName',
  124. label: '所属工厂',
  125. align: 'center',
  126. showOverflowTooltip: true
  127. },
  128. {
  129. align: 'center',
  130. prop: 'createTime',
  131. label: '创建时间',
  132. showOverflowTooltip: true,
  133. minWidth: 110
  134. },
  135. ],
  136. radio: null
  137. };
  138. },
  139. watch: {},
  140. methods: {
  141. open(item) {
  142. if (item) {
  143. this.radio = item.id;
  144. }
  145. this.visible = true;
  146. },
  147. /* 表格数据源 */
  148. datasource({ page, limit, where, order }) {
  149. return routeList({
  150. pageNum: page,
  151. size: limit,
  152. ...where
  153. });
  154. },
  155. /* 刷新表格 */
  156. reload(where) {
  157. this.$refs.table.reload({ page: 1, where });
  158. },
  159. handleNodeClick(data, node) {
  160. this.curNodeData = data;
  161. this.reload({ categoryId: data.id });
  162. },
  163. // 单击获取id
  164. cellClick(row) {
  165. this.current = row;
  166. this.radio = row.id;
  167. },
  168. handleClose() {
  169. this.visible = false;
  170. this.current = null;
  171. this.radio = '';
  172. },
  173. selected() {
  174. if (!this.current) {
  175. return this.$message.warning('请选择工艺路线');
  176. }
  177. this.$emit('changeParent', this.current);
  178. this.handleClose();
  179. }
  180. }
  181. };
  182. </script>
  183. <style lang="scss" scoped></style>