user-list.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div>
  3. <user-search @search="reload" ref="searchRef"> </user-search>
  4. <!-- 数据表格 -->
  5. <ele-pro-table
  6. ref="table"
  7. :columns="columns"
  8. :datasource="datasource"
  9. height="calc(100vh - 365px)"
  10. full-height="calc(100vh - 116px)"
  11. tool-class="ele-toolbar-form"
  12. cache-key="systemOrgUserTable"
  13. >
  14. <!-- 表头工具栏 -->
  15. <template v-slot:toolbar>
  16. <el-button
  17. size="small"
  18. type="primary"
  19. icon="el-icon-plus"
  20. class="ele-btn-icon"
  21. @click="openAdd()"
  22. >
  23. 添加质检项
  24. </el-button>
  25. </template>
  26. <!-- 编码列 -->
  27. <template v-slot:name="{ row }">
  28. {{ row.qualityStandard && row.qualityStandard.name }}
  29. </template>
  30. <template v-slot:code="{ row }">
  31. <el-link
  32. type="primary"
  33. :underline="false"
  34. @click="openDetail(row.qualityStandard)"
  35. >
  36. {{ row.qualityStandard && row.qualityStandard.code }}
  37. </el-link>
  38. </template>
  39. <template v-slot:type="{ row }">
  40. {{
  41. getDictValue(
  42. '质检标准类型',
  43. row.qualityStandard && row.qualityStandard.type
  44. )
  45. }}
  46. </template>
  47. <template v-slot:standardCode="{ row }">
  48. {{ row.qualityStandard && row.qualityStandard.standardCode }}
  49. </template>
  50. <template v-slot:status="{ row }">
  51. {{
  52. row.qualityStandard && row.qualityStandard.status == 1
  53. ? '启用'
  54. : '停用'
  55. }}
  56. </template>
  57. <template v-slot:mode="{ row }">
  58. {{ getDictValue('质检方式', row.mode) }}
  59. </template>
  60. <template v-slot:version="{ row }">
  61. {{ row.qualityStandard && row.qualityStandard.version }}
  62. </template>
  63. <template v-slot:action="{ row }">
  64. <el-link
  65. type="primary"
  66. :underline="false"
  67. icon="el-icon-edit"
  68. @click="openEdit(row)"
  69. >
  70. 添加
  71. </el-link>
  72. <el-popconfirm
  73. class="ele-action"
  74. title="确定要删除此干燥区吗?"
  75. @confirm="remove(row)"
  76. >
  77. <template v-slot:reference>
  78. <el-link type="danger" :underline="false" icon="el-icon-delete">
  79. 删除
  80. </el-link>
  81. </template>
  82. </el-popconfirm>
  83. </template>
  84. </ele-pro-table>
  85. <!-- <Add @chooseProcess="chooseProcess" ref="addRef" /> -->
  86. <edit ref="edit" @done="done"></edit>
  87. <Detail ref="detailRef"></Detail>
  88. <qualityItem ref="qualityItemRef"></qualityItem>
  89. </div>
  90. </template>
  91. <script>
  92. import userSearch from './user-search.vue';
  93. import {
  94. getList,
  95. removeItem,
  96. saveBatch
  97. } from '@/api/inspectionClassify/index';
  98. import dictMixins from '@/mixins/dictMixins';
  99. // import Add from './add.vue';
  100. import Edit from './edit.vue';
  101. import Detail from '@/views/inspectionStandard/components/edit.vue';
  102. import qualityItem from './qualityItem.vue'
  103. export default {
  104. mixins: [dictMixins],
  105. components: { userSearch, Edit, Detail , qualityItem},
  106. props: {
  107. // 类别id
  108. rootId: [Number, String]
  109. },
  110. data() {
  111. return {
  112. // 当前编辑数据
  113. current: null,
  114. // 表格列配置
  115. columns: [
  116. {
  117. columnKey: 'index',
  118. type: 'index',
  119. label: '序号',
  120. width: 55,
  121. align: 'center'
  122. },
  123. {
  124. prop: 'code',
  125. label: '标准编码',
  126. showOverflowTooltip: true,
  127. minWidth: 110,
  128. slot: 'code'
  129. },
  130. {
  131. prop: 'name',
  132. label: '标准名称',
  133. showOverflowTooltip: true,
  134. minWidth: 110,
  135. slot: 'name'
  136. },
  137. {
  138. label: '标准类型',
  139. prop: 'type',
  140. slot: 'type'
  141. },
  142. {
  143. label: '标准代码',
  144. prop: 'standardCode'
  145. },
  146. {
  147. prop: 'status',
  148. label: '状态',
  149. align: 'center',
  150. minWidth: 110,
  151. slot: 'status'
  152. },
  153. {
  154. prop: 'version',
  155. label: '版本号',
  156. align: 'center',
  157. minWidth: 110,
  158. slot: 'version'
  159. },
  160. {
  161. label: '操作',
  162. prop: 'action',
  163. slot: 'action',
  164. action: 'action'
  165. }
  166. ]
  167. };
  168. },
  169. created() {
  170. this.requestDict('质检方式');
  171. this.requestDict('质检标准类型');
  172. },
  173. methods: {
  174. /* 表格数据源 */
  175. datasource({ page, limit, where }) {
  176. return getList({
  177. ...where,
  178. pageNum: page,
  179. size: limit,
  180. categoryLevelId: this.categoryLevelId || 12,
  181. rootCategoryLevelId: this.rootId
  182. });
  183. },
  184. /* 刷新表格 */
  185. reload(where) {
  186. this.$refs.table.reload({
  187. pageNum: 1,
  188. where: where,
  189. categoryLevelId: this.categoryLevelId,
  190. rootCategoryLevelId: this.rootId
  191. });
  192. },
  193. /* 打开编辑弹窗 */
  194. openAdd() {
  195. // this.$refs.addRef.open(this.categoryLevelId || 12);
  196. this.$refs.qualityItemRef.open()
  197. },
  198. openEdit(row) {
  199. this.$refs.edit.open(row);
  200. },
  201. openDetail(row) {
  202. console.log(row);
  203. this.$refs.detailRef.open('detail', row);
  204. },
  205. chooseProcess(data) {
  206. saveBatch(data).then((res) => {
  207. console.log(res);
  208. if (res.code == 0) {
  209. this.$message.success(res.message);
  210. this.reload();
  211. }
  212. });
  213. },
  214. /* 删除 */
  215. remove(row) {
  216. const loading = this.$loading({ lock: true });
  217. removeItem([row.id])
  218. .then((msg) => {
  219. loading.close();
  220. this.$message.success(msg);
  221. this.reload();
  222. })
  223. .catch((e) => {
  224. loading.close();
  225. });
  226. },
  227. done() {
  228. this.$refs.searchRef.search();
  229. },
  230. clickSearch(info) {
  231. this.categoryLevelId = info.id;
  232. this.rootCategoryLevelId = info.rootCategoryLevelId;
  233. this.reload();
  234. }
  235. }
  236. };
  237. </script>