index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <!--控制记录-->
  2. <template>
  3. <div class="app-container control">
  4. <div class="scrollbar-box" v-if="pageType == 0">
  5. <el-form :model="param" ref="queryForm" :inline="true" label-width="80px">
  6. <el-form-item label="关键字" prop="name">
  7. <el-input
  8. maxlength="10"
  9. v-model="param.searchValue"
  10. placeholder="预案名称/创建人"
  11. clearable
  12. size="small"
  13. />
  14. </el-form-item>
  15. <el-form-item label="启动条件" prop="startCondition" label-width="100px">
  16. <el-select v-model="param.startCondition" placeholder="请选择启动条件" clearable size="small">
  17. <el-option
  18. v-for="dict in deptOptions"
  19. :key="dict.describe"
  20. :label="dict.describe"
  21. :value="dict.describe"
  22. ></el-option>
  23. </el-select>
  24. </el-form-item>
  25. <!--<el-form-item label="创建时间">-->
  26. <!--<el-date-picker-->
  27. <!--:clearable="false"-->
  28. <!--v-model="dateRange"-->
  29. <!--size="small"-->
  30. <!--style="width: 240px"-->
  31. <!--value-format="yyyy-MM-dd"-->
  32. <!--type="daterange"-->
  33. <!--range-separator="-"-->
  34. <!--start-placeholder="开始日期"-->
  35. <!--end-placeholder="结束日期"-->
  36. <!--&gt;</el-date-picker>-->
  37. <!--</el-form-item>-->
  38. <el-form-item style="float: right;" v-hasPermi="['laboratory:plan:add']">
  39. <p class="inquire-button-one" style="width:130px;" @click="tableClickButton(4)">定制预案</p>
  40. </el-form-item>
  41. <el-form-item>
  42. <p class="inquire-button-one" @click="onSearch">查询</p>
  43. <p class="reset-button-one" @click="resetForm">重置</p>
  44. </el-form-item>
  45. </el-form>
  46. <el-table v-loading="loading" border :data="tableData">
  47. <el-table-column label="预案名称" align="center" prop="name" :show-overflow-tooltip="true"/>
  48. <el-table-column label="启动条件" align="center" prop="startCondition" :show-overflow-tooltip="true" width="340"/>
  49. <el-table-column label="创建人" align="center" prop="createBy" width="180"/>
  50. <el-table-column label="创建时间" align="center" prop="createTime" width="200"/>
  51. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="340" v-if="tableButtonType">
  52. <template slot-scope="scope">
  53. <div class="button-box">
  54. <p class="table-min-button" style="margin-left:20px!important;" v-hasPermi="['laboratory:planjoin:edit']" @click="tableClickButton(1,scope.row)">关联实验室</p>
  55. <p class="table-min-button" style="margin-left:40px!important;" v-show="userId==scope.row.userId" v-hasPermiAnd="['laboratory:plan:query','laboratory:plan:edit']" @click="tableClickButton(2,scope.row)">编辑</p>
  56. <p class="table-min-button" style="margin-left:40px!important;color:#FE2B2B;" v-show="userId==scope.row.userId" v-hasPermi="['laboratory:plan:remove']" @click="tableClickButton(3,scope.row)">删除</p>
  57. </div>
  58. </template>
  59. </el-table-column>
  60. </el-table>
  61. <pagination :page-sizes="[20, 30, 40, 50]"
  62. v-show="total>0"
  63. :total="total"
  64. layout="total, prev, pager, next, sizes, jumper"
  65. :page.sync="param.pageNum"
  66. :limit.sync="param.pageSize"
  67. @pagination="getListPlan"
  68. />
  69. </div>
  70. <!--添加编辑-->
  71. <add-plan-page v-if="pageType == 1" :addPlanData="addPlanData"></add-plan-page>
  72. <!-- 查看 -->
  73. <detail-plan-page v-if="pageType == 2" :pageData2="pageData2"></detail-plan-page>
  74. <!--关联实验室-->
  75. <association-page v-if="pageType == 4" :associationData="associationData"></association-page>
  76. <!-- 关联记录 -->
  77. <el-dialog title='关联记录' @close="handleClose" :visible.sync="dialogVisible2" width="80%">
  78. <div class="scrollbar-box" style="padding:0;margin:0 auto;height:700px;overflow-y: scroll;display: flex;flex-direction: column;flex:1;">
  79. <relevance-record-page v-if="pageType == 3" :pageData3="pageData3" style="display: flex;flex-direction: column;flex:1;"></relevance-record-page>
  80. </div>
  81. </el-dialog>
  82. <!--新增预案-->
  83. <el-dialog title="定制预案" v-if="addFormOpen" :visible.sync="addFormOpen" width="500px" append-to-body>
  84. <el-form ref="addForm" :model="addForm" :rules="rules" label-width="80px">
  85. <el-form-item label="预案名称" prop="name">
  86. <el-input v-model="addForm.name" placeholder="请输入预案名称" maxLength="15"/>
  87. </el-form-item>
  88. </el-form>
  89. <div slot="footer" class="dialog-footer">
  90. <el-button @click="cancel">取 消</el-button>
  91. <el-button style="width:100px;" type="primary" @click="submitForm">配置规则</el-button>
  92. </div>
  93. </el-dialog>
  94. </div>
  95. </template>
  96. <script>
  97. import {
  98. updatePlan,
  99. listPlan,
  100. getUserRoleBySub,
  101. getLabRiskPlanRepeat,
  102. getLabRiskPlanJoinSub,
  103. riskPlanJoinSub,
  104. delPlan,
  105. getUserRoleBySubOperation
  106. } from "@/api/laboratory/plan";
  107. import addPlanPage from "./newAddPlan.vue";
  108. import detailPlanPage from "./detailPlan.vue";
  109. import associationPage from "./newAssociatedPage.vue";
  110. import relevanceRecordPage from "../distribution/index";
  111. import {listDepartments} from "@/api/system/dept";
  112. import {listClassifiedAll} from "@/api/laboratory/classified";
  113. import {listClasstypeAll} from "@/api/laboratory/classtype";
  114. import {authListSubject} from "@/api/laboratory/subject";
  115. import { selectRiskPlanLeveList, addPlan, delPlanData } from "@/api/evacuation3_2/index";
  116. import { optionSensor } from "@/api/laboratory/sensor";
  117. export default {
  118. components: {
  119. addPlanPage,
  120. detailPlanPage,
  121. relevanceRecordPage,
  122. associationPage
  123. },
  124. name: "Plan",
  125. data() {
  126. return {
  127. tableButtonType:this.hasPermiDom(['laboratory:plan:query','laboratory:planjoin:edit','laboratory:distribution:list','laboratory:plan:query','laboratory:plan:edit','laboratory:plan:remove']),
  128. //页面状态
  129. pageType:0,
  130. // 遮罩层
  131. loading: false,
  132. dateRange: [],
  133. //启动条件
  134. deptOptions:[],
  135. // 查询参数
  136. param: {
  137. pageNum: 1,
  138. pageSize:20,
  139. searchValue: null,
  140. startCondition: null,
  141. },
  142. tableData: [],
  143. total: 0,
  144. pageData2:{},
  145. pageData3:{},
  146. //关联实验室
  147. dialogVisible:false,
  148. //关联记录
  149. dialogVisible2:false,
  150. typeList:[],
  151. levelList:[],
  152. dialogTable:[],
  153. checkedLabList:[],//需要选中的实验室
  154. joinSubOper:[],
  155. userId:localStorage.getItem('userId'),
  156. //新增预案
  157. addFormOpen:false,
  158. addForm:{},
  159. // 表单校验
  160. rules: {
  161. name: [
  162. { required: true, message: "请输入预案名称", trigger: "change" },
  163. { required: true, message: "请输入预案名称", validator: this.spaceJudgment, trigger: "change" }
  164. ],
  165. },
  166. //关联页面传参数据
  167. associationData:{},
  168. addPlanData:{},
  169. };
  170. },
  171. methods: {
  172. // 操作按钮 1.关联 2.编辑 3.删除 4.新增
  173. tableClickButton(type,item){
  174. console.log('tableClickButton',type)
  175. let self = this;
  176. if(type == 1){
  177. this.$set(this,'associationData',JSON.parse(JSON.stringify(item)));
  178. this.$set(this,'pageType',4);
  179. }else if(type == 2){
  180. this.$set(this,'addPlanData',JSON.parse(JSON.stringify({id:item.id,name:item.name})));
  181. this.$set(this,'pageType',1);
  182. }else if(type == 3){
  183. this.$confirm('是否确认删除该预案?', "警告", {
  184. confirmButtonText: "确定",
  185. cancelButtonText: "取消",
  186. type: "warning"
  187. }).then(function() {
  188. delPlanData(item.id).then(response => {
  189. self.msgSuccess(response.msg)
  190. self.getListPlan();
  191. });
  192. }).then(() => {
  193. }).catch(() => {});
  194. }else if(type == 4){
  195. this.$set(this,'addFormOpen',true);
  196. this.$set(this,'addForm',{});
  197. }else if(type == 5){
  198. this.$set(this,'pageType',0);
  199. this.getListPlan();
  200. }else if(type == 6){
  201. this.$set(this,'pageType',1);
  202. }
  203. },
  204. //新增预案-关闭
  205. cancel(){
  206. this.$set(this,'addFormOpen',false);
  207. this.$set(this,'addForm',{});
  208. },
  209. //新增预案-提交
  210. submitForm(){
  211. let self = this;
  212. this.$refs["addForm"].validate(valid => {
  213. if (valid) {
  214. let obj = {
  215. name:this.addForm.name
  216. }
  217. addPlan(obj).then((response) => {
  218. this.msgSuccess(response.msg)
  219. this.$set(this,'addFormOpen',false);
  220. setTimeout(function(){
  221. self.tableClickButton(2,{id:response.data,name:self.addForm.name,});
  222. },500);
  223. // this.tableClickButton(2,{id:response.data,name:this.addForm.name,});
  224. // this.$set(this,'addPlanData',{
  225. //
  226. // });
  227. // self.$set(this,'addForm',{});
  228. // self.$set(this,'pageType',1);
  229. });
  230. }
  231. })
  232. },
  233. //查询
  234. onSearch() {
  235. this.getListPlan();
  236. },
  237. //重置
  238. resetForm() {
  239. this.$set(this.param,'searchValue',null);
  240. this.$set(this.param,'startCondition',null);
  241. this.onSearch();
  242. },
  243. //监听关联记录弹窗关闭
  244. handleClose(){
  245. this.pageType=0
  246. },
  247. /** 查询启动条件 */
  248. getDeptListTow() {
  249. optionSensor({}).then(response => {
  250. this.$set(this, 'deptOptions', response.data)
  251. });
  252. },
  253. /**获取分级*/
  254. getListClassifiedAll(){
  255. listClassifiedAll().then(response=>{
  256. if(response.code==200){
  257. this.levelList = response.data
  258. }
  259. })
  260. },
  261. /**获取分类*/
  262. getListClasstypeAll(){
  263. listClasstypeAll().then(response=>{
  264. if(response.code==200){
  265. this.typeList = response.data;
  266. }
  267. });
  268. },
  269. /** 查询风险预案列表 */
  270. getListPlan() {
  271. let _this=this;
  272. this.loading = true;
  273. selectRiskPlanLeveList(this.param).then(response => {
  274. this.$set(this,'tableData',response.rows)
  275. // this.tableData = response.rows;
  276. this.total = response.total;
  277. this.loading = false;
  278. // this.getList();
  279. });
  280. },
  281. },
  282. mounted(){
  283. this.getDeptListTow();
  284. this.getListClassifiedAll();
  285. this.getListClasstypeAll();
  286. this.getListPlan();
  287. },
  288. }
  289. </script>
  290. <style scoped lang="scss">
  291. /*#app .app-container{
  292. background: #fff;
  293. border-radius: 0px;
  294. overflow: hidden;
  295. padding: 10px;
  296. margin: 0;
  297. box-shadow:none;
  298. }*/
  299. .control{
  300. flex: 1;
  301. display: flex!important;
  302. flex-direction: column;
  303. overflow: hidden;
  304. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  305. .scrollbar-box{
  306. overflow: hidden;
  307. display: flex!important;
  308. flex-direction: column;
  309. height: 100%;
  310. width: 100%;
  311. padding:20px!important;
  312. box-sizing: border-box;
  313. /* box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  314. padding:20px!important;*/
  315. }
  316. .button-box{
  317. width:326px;
  318. display: flex;
  319. }
  320. .form-box{
  321. display:flex;
  322. .null-p{
  323. flex:1;
  324. }
  325. }
  326. }
  327. </style>