user-list.vue 5.6 KB

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