index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. const exportconstvalidateContacts = (rule, value, callback) => {
  127. if(!/^[\u0391-\uFFE5_a-zA-Z0-9]+$/.test(value)) {
  128. callback(new Error("只可输入中文/英文与数字"));
  129. } else {
  130. callback()
  131. }
  132. };
  133. return {
  134. tableButtonType:this.hasPermiDom(['laboratory:plan:query','laboratory:planjoin:edit','laboratory:distribution:list','laboratory:plan:query','laboratory:plan:edit','laboratory:plan:remove']),
  135. //页面状态
  136. pageType:0,
  137. // 遮罩层
  138. loading: false,
  139. dateRange: [],
  140. //启动条件
  141. deptOptions:[],
  142. // 查询参数
  143. param: {
  144. pageNum: 1,
  145. pageSize:20,
  146. searchValue: null,
  147. startCondition: null,
  148. },
  149. tableData: [],
  150. total: 0,
  151. pageData2:{},
  152. pageData3:{},
  153. //关联实验室
  154. dialogVisible:false,
  155. //关联记录
  156. dialogVisible2:false,
  157. typeList:[],
  158. levelList:[],
  159. dialogTable:[],
  160. checkedLabList:[],//需要选中的实验室
  161. joinSubOper:[],
  162. userId:localStorage.getItem('userId'),
  163. //新增预案
  164. addFormOpen:false,
  165. addForm:{},
  166. // 表单校验
  167. rules: {
  168. name: [
  169. { required: true, message: "请输入预案名称", trigger: "change" },
  170. { required: true, message: "请输入预案名称", validator: this.spaceJudgment, trigger: "change" },
  171. { required: true, validator: exportconstvalidateContacts, trigger: "blur" },
  172. ],
  173. },
  174. //关联页面传参数据
  175. associationData:{},
  176. addPlanData:{},
  177. };
  178. },
  179. methods: {
  180. // 操作按钮 1.关联 2.编辑 3.删除 4.新增
  181. tableClickButton(type,item){
  182. console.log('tableClickButton',type)
  183. let self = this;
  184. if(type == 1){
  185. this.$set(this,'associationData',JSON.parse(JSON.stringify(item)));
  186. this.$set(this,'pageType',4);
  187. }else if(type == 2){
  188. this.$set(this,'addPlanData',JSON.parse(JSON.stringify({id:item.id,name:item.name})));
  189. this.$set(this,'pageType',1);
  190. }else if(type == 3){
  191. this.$confirm('是否确认删除该预案?', "警告", {
  192. confirmButtonText: "确定",
  193. cancelButtonText: "取消",
  194. type: "warning"
  195. }).then(function() {
  196. delPlanData(item.id).then(response => {
  197. self.msgSuccess(response.msg)
  198. self.getListPlan();
  199. });
  200. }).then(() => {
  201. }).catch(() => {});
  202. }else if(type == 4){
  203. this.$set(this,'addFormOpen',true);
  204. this.$set(this,'addForm',{});
  205. }else if(type == 5){
  206. this.$set(this,'pageType',0);
  207. this.getListPlan();
  208. }else if(type == 6){
  209. this.$set(this,'pageType',1);
  210. }
  211. },
  212. //新增预案-关闭
  213. cancel(){
  214. this.$set(this,'addFormOpen',false);
  215. this.$set(this,'addForm',{});
  216. },
  217. //新增预案-提交
  218. submitForm(){
  219. let self = this;
  220. this.$refs["addForm"].validate(valid => {
  221. if (valid) {
  222. let obj = {
  223. name:this.addForm.name
  224. }
  225. addPlan(obj).then((response) => {
  226. this.msgSuccess(response.msg)
  227. this.$set(this,'addFormOpen',false);
  228. setTimeout(function(){
  229. self.tableClickButton(2,{id:response.data,name:self.addForm.name,});
  230. },500);
  231. // this.tableClickButton(2,{id:response.data,name:this.addForm.name,});
  232. // this.$set(this,'addPlanData',{
  233. //
  234. // });
  235. // self.$set(this,'addForm',{});
  236. // self.$set(this,'pageType',1);
  237. });
  238. }
  239. })
  240. },
  241. //查询
  242. onSearch() {
  243. this.getListPlan();
  244. },
  245. //重置
  246. resetForm() {
  247. this.$set(this.param,'searchValue',null);
  248. this.$set(this.param,'startCondition',null);
  249. this.onSearch();
  250. },
  251. //监听关联记录弹窗关闭
  252. handleClose(){
  253. this.pageType=0
  254. },
  255. /** 查询启动条件 */
  256. getDeptListTow() {
  257. optionSensor({}).then(response => {
  258. this.$set(this, 'deptOptions', response.data)
  259. });
  260. },
  261. /**获取分级*/
  262. getListClassifiedAll(){
  263. listClassifiedAll().then(response=>{
  264. if(response.code==200){
  265. this.levelList = response.data
  266. }
  267. })
  268. },
  269. /**获取分类*/
  270. getListClasstypeAll(){
  271. listClasstypeAll().then(response=>{
  272. if(response.code==200){
  273. this.typeList = response.data;
  274. }
  275. });
  276. },
  277. /** 查询风险预案列表 */
  278. getListPlan() {
  279. let _this=this;
  280. this.loading = true;
  281. selectRiskPlanLeveList(this.param).then(response => {
  282. this.$set(this,'tableData',response.rows)
  283. // this.tableData = response.rows;
  284. this.total = response.total;
  285. this.loading = false;
  286. // this.getList();
  287. });
  288. },
  289. },
  290. mounted(){
  291. this.getDeptListTow();
  292. this.getListClassifiedAll();
  293. this.getListClasstypeAll();
  294. this.getListPlan();
  295. },
  296. }
  297. </script>
  298. <style scoped lang="scss">
  299. /*#app .app-container{
  300. background: #fff;
  301. border-radius: 0px;
  302. overflow: hidden;
  303. padding: 10px;
  304. margin: 0;
  305. box-shadow:none;
  306. }*/
  307. .control{
  308. flex: 1;
  309. display: flex!important;
  310. flex-direction: column;
  311. overflow: hidden;
  312. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  313. .scrollbar-box{
  314. overflow: hidden;
  315. display: flex!important;
  316. flex-direction: column;
  317. height: 100%;
  318. width: 100%;
  319. padding:20px!important;
  320. box-sizing: border-box;
  321. /* box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  322. padding:20px!important;*/
  323. }
  324. .button-box{
  325. width:326px;
  326. display: flex;
  327. }
  328. .form-box{
  329. display:flex;
  330. .null-p{
  331. flex:1;
  332. }
  333. }
  334. }
  335. </style>