index.vue 11 KB

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