qualityItem.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <el-dialog
  3. :title="title"
  4. v-if="visible"
  5. :visible.sync="visible"
  6. :before-close="handleClose"
  7. :close-on-click-modal="false"
  8. :close-on-press-escape="false"
  9. append-to-body
  10. width="85%"
  11. >
  12. <el-card shadow="never">
  13. <!-- 数据表格 -->
  14. <user-search @search="reload" />
  15. <ele-pro-table
  16. ref="table"
  17. :columns="columns"
  18. :datasource="datasource"
  19. :selection.sync="selection"
  20. row-key="id"
  21. >
  22. <template v-slot:textType="{ row }">
  23. {{
  24. row.textType == 1
  25. ? '数值'
  26. : row.textType == 2
  27. ? '选择'
  28. : row.textType == 3
  29. ? '上下限'
  30. : row.textType == 4
  31. ? '规格'
  32. : row.textType == 5
  33. ? '时间'
  34. : row.textType == 6
  35. ? '范围'
  36. : ''
  37. }}
  38. </template>
  39. <template v-slot:type="{ row }">
  40. {{ getDictValue('质检标准类型', row.type) }}
  41. </template>
  42. <template v-slot:toolList="{ row }">
  43. <div style="display: inline-block;" v-for="(item,idx) in row.toolList" :key="idx">{{ item.name }} <span v-if="row.toolList && idx != row.toolList.length - 1">, </span></div>
  44. </template>
  45. </ele-pro-table>
  46. </el-card>
  47. <div class="btns">
  48. <el-button type="primary" size="small" @click="selected">选择</el-button>
  49. <el-button size="small" @click="handleClose">关闭</el-button>
  50. </div>
  51. </el-dialog>
  52. </template>
  53. <script>
  54. import { getList } from '@/api/inspectionProject';
  55. import UserSearch from '@/views/inspectionProject/components/user-search.vue';
  56. import dictMixins from '@/mixins/dictMixins';
  57. export default {
  58. components: {
  59. UserSearch
  60. },
  61. mixins: [dictMixins],
  62. data() {
  63. return {
  64. visible: false,
  65. title: '选择质检项',
  66. columns: [
  67. {
  68. columnKey: 'selection',
  69. type: 'selection',
  70. width: 45,
  71. align: 'center',
  72. reserveSelection: true
  73. },
  74. {
  75. prop: 'inspectionCode',
  76. label: '参数编码',
  77. showOverflowTooltip: true,
  78. align: 'center',
  79. minWidth: 110
  80. },
  81. {
  82. prop: 'inspectionName',
  83. label: '参数名称',
  84. showOverflowTooltip: true,
  85. align: 'center',
  86. minWidth: 110
  87. },
  88. {
  89. prop: 'textType',
  90. label: '参数类型',
  91. showOverflowTooltip: true,
  92. align: 'center',
  93. slot: 'textType',
  94. minWidth: 110
  95. },
  96. {
  97. prop: 'maxValue',
  98. label: '参数上限',
  99. align: 'center',
  100. showOverflowTooltip: true
  101. },
  102. {
  103. prop: 'minValue',
  104. label: '参数下限',
  105. align: 'center',
  106. showOverflowTooltip: true
  107. },
  108. {
  109. prop: 'defaultValue',
  110. label: '默认值',
  111. align: 'center',
  112. showOverflowTooltip: true
  113. },
  114. {
  115. label: '工艺要求',
  116. prop: 'inspectionStandard',
  117. formatter: (row, column, cellValue) => {
  118. return row.symbol + ' ' + cellValue + ' ' + row.unit;
  119. },
  120. minWidth: 150
  121. },
  122. {
  123. label: '标准类型',
  124. prop: 'type',
  125. slot: 'type'
  126. },
  127. {
  128. prop: 'qualityStandardName',
  129. label: '标准名称',
  130. align: 'center',
  131. minWidth: 110
  132. },
  133. {
  134. prop: 'toolList',
  135. slot: 'toolList',
  136. label: '设备名称',
  137. align: 'center',
  138. minWidth: 150
  139. },
  140. {
  141. label: '状态',
  142. prop: 'status',
  143. formatter: (row, column, cellValue) => {
  144. return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
  145. }
  146. },
  147. {
  148. label: '备注',
  149. prop: 'inspectionRemark'
  150. },
  151. ],
  152. // 表格选中数据
  153. selection: [],
  154. processData: [],
  155. categoryId: null
  156. };
  157. },
  158. watch: {},
  159. methods: {
  160. open(categoryId) {
  161. this.categoryId = categoryId;
  162. this.visible = true;
  163. },
  164. /* 表格数据源 */
  165. async datasource({ page, limit, where }) {
  166. const res = await getList({
  167. ...where,
  168. categoryLevelId: this.categoryId,
  169. pageNum: page,
  170. size: limit
  171. });
  172. return res;
  173. },
  174. /* 刷新表格 */
  175. reload(where) {
  176. this.$refs.table.reload({ page: 1, where: where });
  177. },
  178. handleClose() {
  179. this.visible = false;
  180. this.$refs.table.setSelectedRows([]);
  181. this.selection = [];
  182. },
  183. selected() {
  184. if (!this.selection.length) {
  185. this.$message.error('请至少选择一条数据');
  186. return;
  187. }
  188. let _arr = [];
  189. _arr = this.selection.map((m) => {
  190. return {
  191. inspectionItemId: m.id,
  192. status: 1,
  193. mode: null,
  194. version: null,
  195. categoryLevelId: this.categoryId,
  196. rootCategoryLevelId: '12'
  197. };
  198. });
  199. this.$emit('chooseProcess', _arr);
  200. this.handleClose();
  201. }
  202. }
  203. };
  204. </script>
  205. <style lang="scss" scoped>
  206. .btns {
  207. text-align: center;
  208. padding: 10px 0;
  209. }
  210. </style>