index.vue 7.8 KB

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