index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. <!--分级管控管理-->
  2. <template>
  3. <div class="app-container gradeManage">
  4. <div class="page-container gradeManage-page" v-if="pageType == 1">
  5. <div class="page-form-title-box">
  6. <el-form :model="queryParams" class="form-box" ref="queryForm"
  7. :inline="true" style="width:100%;">
  8. <el-form-item label="" prop="searchValue">
  9. <el-input
  10. maxLength="30"
  11. v-model="queryParams.searchValue"
  12. placeholder="请输入名称/学院"
  13. style="width: 200px"
  14. />
  15. </el-form-item>
  16. <el-form-item label="" prop="deptId">
  17. <el-select v-model="queryParams.deptId" placeholder="请选择学院" style="width: 200px">
  18. <el-option
  19. v-for="dict in deptIdOptionList"
  20. :key="dict.deptId"
  21. :label="dict.deptName"
  22. :value="dict.deptId"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="" prop="typeId">
  27. <el-select v-model="queryParams.typeId" placeholder="请选择安全分类" style="width: 200px">
  28. <el-option
  29. v-for="dict in typeOptionList"
  30. :key="dict.typeId"
  31. :label="dict.typeName"
  32. :value="dict.typeId"
  33. />
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item label="" prop="level">
  37. <el-select v-model="queryParams.level" placeholder="请选择安全分级" style="width: 200px">
  38. <el-option
  39. v-for="dict in levelOptionList"
  40. :key="dict.levelId"
  41. :label="dict.levelName"
  42. :value="dict.levelId"
  43. />
  44. </el-select>
  45. </el-form-item>
  46. <el-form-item label="" prop="state">
  47. <el-select v-model="queryParams.state" placeholder="请选择状态" style="width: 200px">
  48. <el-option
  49. v-for="dict in statusOptionList"
  50. :key="dict.value"
  51. :label="dict.label"
  52. :value="dict.value"
  53. />
  54. </el-select>
  55. </el-form-item>
  56. <el-form-item label="" prop="moldId">
  57. <el-select v-model="queryParams.moldId" placeholder="请选择类型" style="width: 200px">
  58. <el-option
  59. v-for="dict in moldIdOptionList"
  60. :key="dict.moldId"
  61. :label="dict.moldName"
  62. :value="dict.moldId"
  63. />
  64. </el-select>
  65. </el-form-item>
  66. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  67. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  68. <p class="page-add-common-style-button"
  69. style="float: right;"
  70. @click="clickPageType(2)"
  71. v-hasPermiRouter="['laboratory:gradeManage:add']"
  72. >新增</p>
  73. </el-form>
  74. </div>
  75. <div class="page-content-box">
  76. <el-table class="table-box" v-loading="loading" border :data="dataList" @selection-change="handleSelectionChange">
  77. <!--<el-table-column type="selection" width="55" align="center" />-->
  78. <el-table-column label="管控名称" align="left" prop="name" show-overflow-tooltip/>
  79. <el-table-column label="学院" align="left" prop="deptName" width="149" show-overflow-tooltip/>
  80. <el-table-column label="实验室类型" align="left" prop="moldName" width="149">
  81. <template slot-scope="scope">{{scope.row.moldName?scope.row.moldName:'--'}}</template>
  82. </el-table-column>
  83. <el-table-column label="安全分类" align="left" prop="typeName" width="130">
  84. <template slot-scope="scope">{{scope.row.typeName?scope.row.typeName:'--'}}</template>
  85. </el-table-column>
  86. <el-table-column label="安全分级" align="left" prop="levelName" width="130">
  87. <template slot-scope="scope">{{scope.row.levelName?scope.row.levelName:'--'}}</template>
  88. </el-table-column>
  89. <el-table-column label="管控规则数" align="left" prop="ruleNum" width="130"/>
  90. <el-table-column label="状态" align="left" prop="status" width="149">
  91. <template slot-scope="scope">
  92. <span :class="scope.row.status == 1?'tableTypeColorA':(scope.row.status == 0?'tableTypeColorB':'')">{{scope.row.status == 1?'开启':(scope.row.status == 0?'关闭':'')}}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="编辑人" align="left" prop="updateBy" width="149"/>
  96. <el-table-column label="编辑时间" align="left" prop="updateTime" width="179"/>
  97. <!--<el-table-column label="适配实验室数" align="left" prop="subNum" />-->
  98. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160px" v-if="tableButtonType">
  99. <template slot-scope="scope">
  100. <div class="table-button-box">
  101. <p class="table-button-null"></p>
  102. <p class="table-button-p"
  103. @click="clickPageType(3,scope.row)"
  104. v-hasPermiAnd="['laboratory:gradeManage:query','laboratory:gradeManage:edit']"
  105. >编辑</p>
  106. <p class="table-button-p"
  107. @click="handleDelete(scope.row)"
  108. v-hasPermi="['laboratory:gradeManage:remove']"
  109. >删除</p>
  110. <p class="table-button-null"></p>
  111. </div>
  112. </template>
  113. </el-table-column>
  114. </el-table>
  115. <pagination :page-sizes="[20, 30, 40, 50]"
  116. v-show="total>0"
  117. :total="total"
  118. :page.sync="queryParams.pageNum"
  119. :limit.sync="queryParams.pageSize"
  120. @pagination="getList"
  121. />
  122. </div>
  123. </div>
  124. <!-- 新增编辑 -->
  125. <add-page v-if="pageType == 2" :propsType="propsType" :propsId="propsId"></add-page>
  126. <!-- 添加或修改分级管控管理对话框 -->
  127. <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body :close-on-click-modal="false">
  128. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  129. <el-form-item label="备注" prop="remark">
  130. <el-input v-model="form.remark" placeholder="请输入备注" />
  131. </el-form-item>
  132. <el-form-item label="安全分级ID" prop="level">
  133. <el-input v-model="form.level" placeholder="请输入安全分级ID" />
  134. </el-form-item>
  135. <el-form-item label="安全分类ID" prop="typeId">
  136. <el-input v-model="form.typeId" placeholder="请输入安全分类ID" />
  137. </el-form-item>
  138. <el-form-item label="适配实验室多选逗号分隔" prop="subIds">
  139. <el-input v-model="form.subIds" placeholder="请输入适配实验室多选逗号分隔" />
  140. </el-form-item>
  141. </el-form>
  142. <div slot="footer" class="dialog-footer">
  143. <el-button type="primary" @click="submitForm">确 定</el-button>
  144. <el-button @click="cancel">取 消</el-button>
  145. </div>
  146. </el-dialog>
  147. </div>
  148. </template>
  149. <script>
  150. import {
  151. getGradeManage,
  152. delGradeManage, addGradeManage,
  153. updateGradeManage,
  154. } from "@/api/hierarchicalControl/indexDemo";
  155. import {
  156. getDeptDropList,
  157. laboratoryClassLevelGetList,
  158. laboratoryClassTypeGetList,
  159. laboratoryClassMoldGetList,
  160. } from '@/api/commonality/permission'
  161. import {
  162. laboratoryGradeManageList
  163. } from "@/api/hierarchicalControl/index";
  164. import addPage from "./addPage.vue"
  165. export default {
  166. name: "GradeManage",
  167. components: {
  168. addPage,
  169. },
  170. data() {
  171. return {
  172. tableButtonType:this.hasPermiDom(['laboratory:gradeManage:query','laboratory:gradeManage:edit','laboratory:gradeManage:remove']),
  173. //页面状态
  174. pageType:1,
  175. // 遮罩层
  176. loading: true,
  177. // 选中数组
  178. ids: [],
  179. // 非单个禁用
  180. single: true,
  181. // 非多个禁用
  182. multiple: true,
  183. // 显示搜索条件
  184. showSearch: true,
  185. // 总条数
  186. total: 0,
  187. // 分级管控管理表格数据
  188. dataList: [],
  189. // 弹出层标题
  190. title: "",
  191. // 是否显示弹出层
  192. open: false,
  193. // 查询参数
  194. queryParams: {
  195. pageNum: 1,
  196. pageSize:20,
  197. searchValue: null,
  198. status:null,
  199. typeId:null,
  200. level:null,
  201. },
  202. // 表单参数
  203. form: {},
  204. // 表单校验
  205. rules: {
  206. },
  207. // //分类数据
  208. typeList:[],
  209. // //分级数据
  210. levelList:[],
  211. propsType:false,
  212. propsId:{},
  213. //学院
  214. deptIdOptionList:[],
  215. //安全分类
  216. typeOptionList:[],
  217. //安全分级
  218. levelOptionList:[],
  219. //状态
  220. statusOptionList:[{label:"开启",value:"1"},{label:"关闭",value:"0"},],
  221. //类型
  222. moldIdOptionList:[],
  223. //高级搜索组件参数
  224. searchData:{
  225. buttonList:[
  226. {
  227. name:"新增",
  228. parameter:"add",
  229. type:"1", //按钮类型 1.按钮 2.导入 3.导出
  230. hasPermi:['laboratory:gradeManage:add'] // 权限字段
  231. },
  232. ],
  233. searchList:[
  234. {
  235. name:"关键字",//名称
  236. key:"searchValue",//键名 用于返回数据
  237. value:"",//内容
  238. placeholder:"请输入名称/学院",//输入提示
  239. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  240. type:"1",//类型 1.input 2.select 3.TimePicker
  241. universal:'10',//input 最大长度
  242. },
  243. {
  244. name:"学院",//名称
  245. key:"deptId",//键名 用于返回数据
  246. value:"",//内容
  247. placeholder:"请选择学院",//输入提示
  248. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  249. type:"2",//类型 1.input 2.select 3.TimePicker
  250. universal:[],//select列表数据
  251. },
  252. {
  253. name:"安全分类",//名称
  254. key:"typeId",//键名 用于返回数据
  255. value:"",//内容
  256. placeholder:"请选择安全分类",//输入提示
  257. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  258. type:"2",//类型 1.input 2.select 3.TimePicker
  259. universal:[],//select列表数据
  260. },
  261. {
  262. name:"安全分级",//名称
  263. key:"level",//键名 用于返回数据
  264. value:"",//内容
  265. placeholder:"请选择安全分级",//输入提示
  266. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  267. type:"2",//类型 1.input 2.select 3.TimePicker
  268. universal:[],//select列表数据
  269. },
  270. {
  271. name:"状态",//名称
  272. key:"status",//键名 用于返回数据
  273. value:"",//内容
  274. placeholder:"请选择状态",//输入提示
  275. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  276. type:"2",//类型 1.input 2.select 3.TimePicker
  277. universal:[
  278. {label:"开启",value:"1"},{label:"关闭",value:"0"},
  279. ],//select列表数据
  280. },
  281. {
  282. name:"类型",//名称
  283. key:"moldId",//键名 用于返回数据
  284. value:"",//内容
  285. placeholder:"请选择类型",//输入提示
  286. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  287. type:"2",//类型 1.input 2.select 3.TimePicker
  288. universal:[],//select列表数据
  289. },
  290. ]
  291. }
  292. };
  293. },
  294. created() {
  295. },
  296. mounted(){
  297. this.laboratoryClassLevelGetList();
  298. this.laboratoryClassTypeGetList();
  299. this.getDeptDropList();
  300. this.laboratoryClassMoldGetList();
  301. this.getList();
  302. },
  303. methods: {
  304. //获取实验室类型
  305. laboratoryClassMoldGetList(){
  306. laboratoryClassMoldGetList({}).then(response => {
  307. this.$set(this,'moldIdOptionList',response.data);
  308. });
  309. },
  310. //获取学院
  311. getDeptDropList(){
  312. getDeptDropList({level: 2, deptType: 1 }).then(response => {
  313. this.$set(this,'deptIdOptionList',response.data);
  314. });
  315. },
  316. //查询安全分级
  317. laboratoryClassLevelGetList(){
  318. laboratoryClassLevelGetList({}).then(response=>{
  319. this.$set(this,'levelOptionList',response.data);
  320. })
  321. },
  322. //查询安全分类
  323. laboratoryClassTypeGetList(){
  324. laboratoryClassTypeGetList({}).then(response=>{
  325. this.$set(this,'typeOptionList',response.data);
  326. });
  327. },
  328. //页面切换
  329. clickPageType(type,row){
  330. if(this.pageType != type){
  331. if(type == 1){
  332. this.getList();
  333. this.pageType = 1;
  334. }else if(type == 2){
  335. this.pageType = 2;
  336. this.propsType = false;
  337. }else if(type == 3){
  338. this.pageType = 2;
  339. this.propsType = true;
  340. this.propsId = row.id;
  341. }
  342. }
  343. },
  344. /** 查询分级管控管理列表 */
  345. getList() {
  346. this.loading = true;
  347. laboratoryGradeManageList(this.queryParams).then( response => {
  348. this.dataList = response.rows;
  349. this.total = response.total;
  350. this.loading = false;
  351. });
  352. },
  353. // 取消按钮
  354. cancel() {
  355. this.open = false;
  356. this.reset();
  357. },
  358. // 表单重置
  359. reset() {
  360. this.form = {
  361. id: null,
  362. deptId: null,
  363. deptName: null,
  364. userId: null,
  365. createBy: null,
  366. createTime: null,
  367. updateBy: null,
  368. updateTime: null,
  369. remark: null,
  370. level: null,
  371. typeId: null,
  372. subIds: null
  373. };
  374. this.resetForm("form");
  375. },
  376. /** 搜索按钮操作 */
  377. handleQuery() {
  378. this.$set(this.queryParams,'pageNum',1);
  379. this.getList();
  380. },
  381. /** 重置按钮操作 */
  382. resetQuery() {
  383. this.$set(this,'queryParams',{
  384. searchValue:'',
  385. deptId:null,
  386. typeId:null,
  387. level:null,
  388. status:null,
  389. moldId:null,
  390. })
  391. this.handleQuery();
  392. },
  393. // 多选框选中数据
  394. handleSelectionChange(selection) {
  395. this.ids = selection.map(item => item.id)
  396. this.single = selection.length!==1
  397. this.multiple = !selection.length
  398. },
  399. /** 新增按钮操作 */
  400. handleAdd() {
  401. this.reset();
  402. this.open = true;
  403. this.title = "添加分级管控管理";
  404. },
  405. /** 修改按钮操作 */
  406. handleUpdate(row) {
  407. this.reset();
  408. const id = row.id || this.ids
  409. getGradeManage(id).then( response => {
  410. this.form = response.data;
  411. this.open = true;
  412. this.title = "修改分级管控管理";
  413. });
  414. },
  415. /** 提交按钮 */
  416. submitForm() {
  417. this.$refs["form"].validate(valid => {
  418. if (valid) {
  419. if (this.form.id != null) {
  420. updateGradeManage(this.form).then( response => {
  421. this.msgSuccess("修改成功");
  422. this.open = false;
  423. this.getList();
  424. });
  425. } else {
  426. addGradeManage(this.form).then( response => {
  427. this.msgSuccess("新增成功");
  428. this.open = false;
  429. this.getList();
  430. });
  431. }
  432. }
  433. });
  434. },
  435. /** 删除按钮操作 */
  436. handleDelete(row) {
  437. const ids = row.id || this.ids;
  438. this.$confirm('是否确认删除?', "警告", {
  439. confirmButtonText: "确定",
  440. cancelButtonText: "取消",
  441. type: "warning"
  442. }).then(function() {
  443. return delGradeManage(ids);
  444. }).then(() => {
  445. this.getList();
  446. this.msgSuccess("删除成功");
  447. }).catch(() => {});
  448. },
  449. }
  450. };
  451. </script>
  452. <style lang="scss" scoped>
  453. .gradeManage{
  454. .gradeManage-page{
  455. .button-box{
  456. margin:0 auto;
  457. width:190px;
  458. display: flex;
  459. }
  460. .tableTypeColorA{
  461. color:#2AA408;
  462. }
  463. .tableTypeColorB{
  464. color:#FF3131;
  465. }
  466. }
  467. }
  468. </style>