newEquipmentDialog.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. <template>
  2. <el-dialog
  3. title="质检项"
  4. :visible.sync="visibleDialog"
  5. :before-close="handleClose"
  6. :close-on-click-modal="true"
  7. :close-on-press-escape="false"
  8. append-to-body
  9. width="80%"
  10. >
  11. <div class="layout">
  12. <ele-split-layout
  13. width="236px"
  14. allow-collapse
  15. :right-style="{ overflow: 'hidden' }"
  16. >
  17. <div>
  18. <div class="ele-border-lighter sys-organization-list">
  19. <AssetTree
  20. @handleNodeClick="handleNodeClick"
  21. @setRootId="setRootId"
  22. :id="rootId"
  23. ref="treeList"
  24. />
  25. </div>
  26. </div>
  27. <template v-slot:content>
  28. <user-search @search="reload" ref="searchRef"> </user-search>
  29. <!-- 数据表格 -->
  30. <ele-pro-table
  31. ref="table"
  32. :columns="columns"
  33. :datasource="datasource"
  34. :selection.sync="selection"
  35. height="calc(100vh - 385px)"
  36. full-height="calc(100vh - 116px)"
  37. tool-class="ele-toolbar-form"
  38. cache-key="newEquipmentDialog"
  39. row-key="id"
  40. >
  41. <!-- 表头工具栏 -->
  42. <template v-slot:toolbar> </template>
  43. <template v-slot:textType="{ row }">
  44. <div v-if="row.itemVO && row.itemVO.textType">
  45. {{
  46. row.itemVO.textType == 1
  47. ? '数值'
  48. : row.itemVO.textType == 2
  49. ? '选择'
  50. : row.itemVO.textType == 3
  51. ? '上下限'
  52. : row.itemVO.textType == 4
  53. ? '规格'
  54. : row.itemVO.textType == 5
  55. ? '时间'
  56. : row.itemVO.textType == 6
  57. ? '范围'
  58. : ''
  59. }}
  60. </div>
  61. </template>
  62. <template v-slot:type="{ row }">
  63. <span v-if="row.itemVO.type">
  64. {{ getDictValue('质检标准类型', row.itemVO.type) }}
  65. </span>
  66. </template>
  67. <template v-slot:toolList="{ row }">
  68. <div
  69. style="display: inline-block"
  70. v-for="(item, idx) in row.itemVO.toolList"
  71. :key="idx"
  72. >{{ item.name }}
  73. <span
  74. v-if="
  75. row.itemVO.toolList && idx != row.itemVO.toolList.length - 1
  76. "
  77. >,
  78. </span></div
  79. >
  80. </template>
  81. <template v-slot:action="{ row }">
  82. <el-popconfirm
  83. class="ele-action"
  84. title="确定要删除此质检项吗?"
  85. @confirm="remove(row)"
  86. >
  87. <template v-slot:reference>
  88. <el-link
  89. type="danger"
  90. :underline="false"
  91. icon="el-icon-delete"
  92. >
  93. 删除
  94. </el-link>
  95. </template>
  96. </el-popconfirm>
  97. </template>
  98. </ele-pro-table>
  99. </template>
  100. </ele-split-layout>
  101. </div>
  102. <div class="btns">
  103. <el-button type="primary" size="small" @click="selected">选择</el-button>
  104. <el-button size="small" @click="handleClose">关闭</el-button>
  105. </div>
  106. </el-dialog>
  107. </template>
  108. <script>
  109. import AssetTree from '@/components/AssetTree';
  110. import userSearch from '@/views/inspectionClassify/components/user-search';
  111. import { getList } from '@/api/inspectionClassify/index';
  112. import dictMixins from '@/mixins/dictMixins';
  113. export default {
  114. mixins: [dictMixins],
  115. components: {
  116. AssetTree,
  117. userSearch
  118. },
  119. props: {},
  120. data() {
  121. return {
  122. visibleDialog: true,
  123. rootId: '12',
  124. categoryLevelId: null,
  125. selection: [],
  126. columns: [
  127. {
  128. width: 45,
  129. type: 'selection',
  130. columnKey: 'selection',
  131. align: 'center',
  132. reserveSelection: true
  133. },
  134. {
  135. prop: 'itemVO.inspectionCode',
  136. label: '参数编码',
  137. align: 'center',
  138. minWidth: 110
  139. },
  140. {
  141. prop: 'itemVO.inspectionName',
  142. label: '参数名称',
  143. align: 'center',
  144. minWidth: 110
  145. },
  146. {
  147. prop: 'itemVO.textType',
  148. label: '参数类型',
  149. showOverflowTooltip: true,
  150. align: 'center',
  151. slot: 'textType',
  152. minWidth: 110
  153. },
  154. {
  155. prop: 'itemVO.maxValue',
  156. label: '参数上限',
  157. align: 'center',
  158. showOverflowTooltip: true
  159. },
  160. {
  161. prop: 'itemVO.minValue',
  162. label: '参数下限',
  163. align: 'center',
  164. showOverflowTooltip: true
  165. },
  166. {
  167. prop: 'itemVO.defaultValue',
  168. label: '默认值',
  169. align: 'center',
  170. showOverflowTooltip: true
  171. },
  172. {
  173. label: '工艺要求',
  174. prop: 'itemVO.inspectionStandard',
  175. formatter: (row, column, cellValue) => {
  176. return (
  177. row.itemVO.symbol + ' ' + cellValue + ' ' + row.itemVO.unit
  178. );
  179. },
  180. minWidth: 150
  181. },
  182. {
  183. label: '标准类型',
  184. prop: 'itemVO.type',
  185. slot: 'type'
  186. },
  187. {
  188. prop: 'itemVO.qualityStandardName',
  189. label: '标准名称',
  190. align: 'center',
  191. minWidth: 110
  192. },
  193. {
  194. label: '状态',
  195. prop: 'status',
  196. formatter: (row, column, cellValue) => {
  197. return cellValue == 1 ? '启用' : cellValue === 0 ? '停用' : '';
  198. }
  199. },
  200. {
  201. prop: 'itemVO.toolList',
  202. slot: 'toolList',
  203. label: '设备名称',
  204. align: 'center',
  205. minWidth: 150
  206. },
  207. {
  208. label: '备注',
  209. prop: 'inspectionRemark'
  210. }
  211. ]
  212. };
  213. },
  214. methods: {
  215. datasource({ page, limit, where }) {
  216. return getList({
  217. ...where,
  218. pageNum: page,
  219. size: limit,
  220. categoryLevelId: this.categoryLevelId || 12,
  221. rootCategoryLevelId: this.rootId
  222. });
  223. },
  224. handleNodeClick(info) {
  225. this.current = info;
  226. this.$nextTick(() => {
  227. this.categoryLevelId = info.id;
  228. this.rootCategoryLevelId = info.rootCategoryLevelId;
  229. this.reload();
  230. });
  231. },
  232. // 获取根节点id
  233. setRootId(id) {
  234. if (id) {
  235. this.rootId = id;
  236. }
  237. },
  238. /* 刷新表格 */
  239. reload(where) {
  240. this.$refs.table.reload({
  241. pageNum: 1,
  242. where: where,
  243. categoryLevelId: this.categoryLevelId,
  244. rootCategoryLevelId: this.rootId
  245. });
  246. },
  247. onDone() {
  248. this.$nextTick(() => {
  249. this.$refs.equiTable.setSelectedRowKeys(this.ids);
  250. });
  251. },
  252. handleClose() {
  253. this.$emit('closeDialog');
  254. },
  255. selected() {
  256. let _arr = [];
  257. if (!this.selection.length) {
  258. this.$message.error('请至少选择一条数据');
  259. return;
  260. }
  261. _arr = this.selection.map((m) => {
  262. return {
  263. ...m.itemVO
  264. };
  265. });
  266. this.$emit('chooseModal', _arr);
  267. this.handleClose();
  268. }
  269. }
  270. };
  271. </script>
  272. <style lang="scss" scoped>
  273. .layout {
  274. min-height: 50vh;
  275. max-height: 75vh;
  276. overflow-y: scroll;
  277. }
  278. .btns {
  279. text-align: center;
  280. padding: 10px 0;
  281. }
  282. </style>