index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="实验室id" prop="subjectId">
  5. <el-input
  6. v-model="queryParams.subjectId"
  7. placeholder="请输入实验室id"
  8. clearable
  9. size="small"
  10. />
  11. </el-form-item>
  12. <el-form-item label="安全准日配置id" prop="groupconfigureId">
  13. <el-input
  14. v-model="queryParams.groupconfigureId"
  15. placeholder="请输入安全准日配置id"
  16. clearable
  17. size="small"
  18. />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  22. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  23. </el-form-item>
  24. </el-form>
  25. <el-row :gutter="10" class="mb8">
  26. <el-col :span="1.5">
  27. <el-button
  28. type="primary"
  29. plain
  30. icon="el-icon-plus"
  31. size="mini"
  32. @click="handleAdd"
  33. v-hasPermi="['laboratory:securityconfigure:add']"
  34. >新增</el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button
  38. type="success"
  39. plain
  40. icon="el-icon-edit"
  41. size="mini"
  42. :disabled="single"
  43. @click="handleUpdate"
  44. v-hasPermi="['laboratory:securityconfigure:edit']"
  45. >修改</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="danger"
  50. plain
  51. icon="el-icon-delete"
  52. size="mini"
  53. :disabled="multiple"
  54. @click="handleDelete"
  55. v-hasPermi="['laboratory:securityconfigure:remove']"
  56. >删除</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="warning"
  61. plain
  62. icon="el-icon-download"
  63. size="mini"
  64. @click="handleExport"
  65. v-hasPermi="['laboratory:securityconfigure:export']"
  66. >导出</el-button>
  67. </el-col>
  68. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  69. </el-row>
  70. <el-table v-loading="loading" border :data="securityconfigureList" @selection-change="handleSelectionChange">
  71. <el-table-column type="selection" width="55" align="center" />
  72. <el-table-column label="主键id" align="left" prop="id" />
  73. <el-table-column label="实验室id" align="left" prop="subjectId" />
  74. <el-table-column label="安全准日配置id" align="left" prop="groupconfigureId" />
  75. <el-table-column label="备注" align="left" prop="remark" />
  76. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" v-if="tableButtonType">
  77. <template slot-scope="scope">
  78. <div class="table-button-box">
  79. <p class="table-button-null"></p>
  80. <p class="table-button-p"
  81. @click="handleUpdate(scope.row)"
  82. v-hasPermi="['laboratory:securityconfigure:edit']">修改</p>
  83. <p class="table-button-p"
  84. @click="handleDelete(scope.row)"
  85. v-hasPermi="['laboratory:securityconfigure:remove']">删除</p>
  86. <p class="table-button-null"></p>
  87. </div>
  88. </template>
  89. </el-table-column>
  90. </el-table>
  91. <pagination
  92. v-show="total>0"
  93. :total="total"
  94. layout="total, prev, pager, next, sizes, jumper"
  95. :page.sync="queryParams.pageNum"
  96. :limit.sync="queryParams.pageSize"
  97. @pagination="getList"
  98. />
  99. <!-- 添加或修改实验室和安全准入配置中间关联对话框 -->
  100. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  101. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  102. <el-form-item label="实验室id" prop="subjectId">
  103. <el-input v-model="form.subjectId" placeholder="请输入实验室id" />
  104. </el-form-item>
  105. <el-form-item label="安全准日配置id" prop="groupconfigureId">
  106. <el-input v-model="form.groupconfigureId" placeholder="请输入安全准日配置id" />
  107. </el-form-item>
  108. <el-form-item label="备注" prop="remark">
  109. <el-input v-model="form.remark" placeholder="请输入备注" />
  110. </el-form-item>
  111. </el-form>
  112. <div slot="footer" class="dialog-footer">
  113. <el-button @click="cancel">取 消</el-button>
  114. <el-button type="primary" @click="submitForm">确 定</el-button>
  115. </div>
  116. </el-dialog>
  117. </div>
  118. </template>
  119. <script>
  120. import { listSecurityconfigure, getSecurityconfigure, delSecurityconfigure, addSecurityconfigure, updateSecurityconfigure } from "@/api/laboratory/securityconfigure";
  121. export default {
  122. name: "Securityconfigure",
  123. data() {
  124. return {
  125. tableButtonType:this.hasPermiDom(['laboratory:securityconfigure:edit','laboratory:securityconfigure:remove']),
  126. // 遮罩层
  127. loading: true,
  128. // 选中数组
  129. ids: [],
  130. // 非单个禁用
  131. single: true,
  132. // 非多个禁用
  133. multiple: true,
  134. // 显示搜索条件
  135. showSearch: true,
  136. // 总条数
  137. total: 0,
  138. // 实验室和安全准入配置中间关联表格数据
  139. securityconfigureList: [],
  140. // 弹出层标题
  141. title: "",
  142. // 是否显示弹出层
  143. open: false,
  144. // 查询参数
  145. queryParams: {
  146. pageNum: 1,
  147. pageSize:20,
  148. subjectId: null,
  149. groupconfigureId: null,
  150. },
  151. // 表单参数
  152. form: {},
  153. // 表单校验
  154. rules: {
  155. }
  156. };
  157. },
  158. created() {
  159. this.getList();
  160. },
  161. methods: {
  162. /** 查询实验室和安全准入配置中间关联列表 */
  163. getList() {
  164. this.loading = true;
  165. listSecurityconfigure(this.queryParams).then( response => {
  166. this.securityconfigureList = response.rows;
  167. this.total = response.total;
  168. this.loading = false;
  169. });
  170. },
  171. // 取消按钮
  172. cancel() {
  173. this.open = false;
  174. this.reset();
  175. },
  176. // 表单重置
  177. reset() {
  178. this.form = {
  179. id: null,
  180. subjectId: null,
  181. groupconfigureId: null,
  182. remark: null
  183. };
  184. this.resetForm("form");
  185. },
  186. /** 搜索按钮操作 */
  187. handleQuery() {
  188. this.queryParams.pageNum = 1;
  189. this.getList();
  190. },
  191. /** 重置按钮操作 */
  192. resetQuery() {
  193. this.resetForm("queryForm");
  194. this.handleQuery();
  195. },
  196. // 多选框选中数据
  197. handleSelectionChange(selection) {
  198. this.ids = selection.map(item => item.id)
  199. this.single = selection.length!==1
  200. this.multiple = !selection.length
  201. },
  202. /** 新增按钮操作 */
  203. handleAdd() {
  204. this.reset();
  205. this.open = true;
  206. this.title = "添加实验室和安全准入配置中间关联";
  207. },
  208. /** 修改按钮操作 */
  209. handleUpdate(row) {
  210. this.reset();
  211. const id = row.id || this.ids
  212. getSecurityconfigure(id).then( response => {
  213. this.form = response.data;
  214. this.open = true;
  215. this.title = "修改实验室和安全准入配置中间关联";
  216. });
  217. },
  218. /** 提交按钮 */
  219. submitForm() {
  220. this.$refs["form"].validate(valid => {
  221. if (valid) {
  222. if (this.form.id != null) {
  223. updateSecurityconfigure(this.form).then( response => {
  224. this.msgSuccess("修改成功");
  225. this.open = false;
  226. this.getList();
  227. });
  228. } else {
  229. addSecurityconfigure(this.form).then( response => {
  230. this.msgSuccess("新增成功");
  231. this.open = false;
  232. this.getList();
  233. });
  234. }
  235. }
  236. });
  237. },
  238. /** 删除按钮操作 */
  239. handleDelete(row) {
  240. const ids = row.id || this.ids;
  241. this.$confirm('是否确认删除实验室和安全准入配置中间关联?', "警告", {
  242. confirmButtonText: "确定",
  243. cancelButtonText: "取消",
  244. type: "warning"
  245. }).then(function() {
  246. return delSecurityconfigure(ids);
  247. }).then(() => {
  248. this.getList();
  249. this.msgSuccess("删除成功");
  250. }).catch(() => {});
  251. },
  252. /** 导出按钮操作 */
  253. handleExport() {
  254. this.download('laboratory/securityconfigure/export', {
  255. ...this.queryParams
  256. }, `laboratory_securityconfigure.xlsx`)
  257. }
  258. }
  259. };
  260. </script>