index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="app-container electronicInformationBoard">
  3. <el-form class="form-box" :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
  4. <el-form-item label="关键字" prop="searchValue" label-width="54px">
  5. <el-input
  6. maxLength="20"
  7. v-model="queryParams.searchValue"
  8. placeholder="设备名称/设备编号/实验室"
  9. clearable
  10. size="small"
  11. style="width: 240px"
  12. />
  13. </el-form-item>
  14. <el-form-item label="部门" prop="type" label-width="56px">
  15. <el-select v-model="queryParams.deptId" placeholder="请选择学院">
  16. <el-option
  17. v-for="dict in deptOptions"
  18. :key="dict.deptId"
  19. :label="dict.deptName"
  20. :value="dict.deptId"
  21. ></el-option>
  22. </el-select>
  23. </el-form-item>
  24. <!--<el-form-item label="状态" prop="lightStatus">-->
  25. <!--<el-select v-model="queryParams.lightStatus" placeholder="请选择状态" clearable size="small" label-width="60px">-->
  26. <!--<el-option label="请选择字典生成" value="" />-->
  27. <!--</el-select>-->
  28. <!--</el-form-item>-->
  29. <el-form-item>
  30. <p class="inquire-button-one" @click="handleQuery" style="margin:0 20px;">查询</p>
  31. <p class="reset-button-one" @click="resetQuery">重置</p>
  32. </el-form-item>
  33. <el-form-item
  34. style="float: right;">
  35. <p class="inquire-button-one"
  36. v-hasPermi="['laboratory:cardInfo:add']"
  37. @click="addButton(1)"
  38. >+ 新增</p>
  39. </el-form-item>
  40. </el-form>
  41. <el-table v-loading="loading" border :data="dataList" style="margin-bottom:10px;">
  42. <el-table-column label="设备名称" align="center" prop="cardName" show-overflow-tooltip/>
  43. <el-table-column label="设备编号" align="center" prop="cardNum" show-overflow-tooltip width="210"/>
  44. <el-table-column label="部门" align="center" prop="deptName" show-overflow-tooltip width="200"/>
  45. <el-table-column label="位置" align="center" prop="location" show-overflow-tooltip width="200"/>
  46. <el-table-column label="设备状态" align="center" prop="operate" show-overflow-tooltip width="150">
  47. <template slot-scope="scope">
  48. <span>{{scope.row.operate==2?'在线':'离线'}}</span>
  49. </template>
  50. </el-table-column>
  51. <el-table-column label="创建人" align="center" prop="createBy" show-overflow-tooltip width="150"/>
  52. <el-table-column label="创建时间" align="center" prop="createTime" show-overflow-tooltip width="230"/>
  53. <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="150" v-if="tableButtonType">
  54. <template slot-scope="scope">
  55. <div class="table-button-box">
  56. <p class="table-button-null"></p>
  57. <p class="table-button-p" @click="addButton(2,scope.row)" v-hasPermi="['laboratory:cardInfo:edit']">编辑</p>
  58. <p class="table-button-p" @click="delButton(scope.row)" v-hasPermi="['laboratory:cardInfo:remove']">删除</p>
  59. <p class="table-button-null"></p>
  60. </div>
  61. </template>
  62. </el-table-column>
  63. </el-table>
  64. <pagination :page-sizes="[20, 30, 40, 50]"
  65. v-show="total>0"
  66. :total="total"
  67. :page.sync="queryParams.pageNum"
  68. :limit.sync="queryParams.pageSize"
  69. @pagination="getList"
  70. />
  71. <el-dialog :title="dialogTitle" :visible.sync="addDialogType" v-if="addDialogType"
  72. :close-on-click-modal="false"
  73. width="520px" append-to-body id="onDutyConfiguration-dialog-box">
  74. <el-form ref="form" :model="addForm" :rules="rules" label-width="100px">
  75. <el-form-item label="设备编号:" prop="cardNum">
  76. <el-input v-model="addForm.cardNum" placeholder="请输入设备编号" maxlength="50" style="width:360px;"/>
  77. </el-form-item>
  78. <el-form-item label="实验室:" prop="subjectId">
  79. <el-select
  80. style="width:360px;"
  81. v-model="addForm.subjectId"
  82. filterable
  83. remote
  84. clearable
  85. reserve-keyword
  86. placeholder="输入关键字检索选择"
  87. :remote-method="getSelectList"
  88. @change="selectChange"
  89. :loading="loading">
  90. <el-option
  91. v-for="item in selectList"
  92. :key="item.id"
  93. :label="item.name"
  94. :value="item.id">
  95. </el-option>
  96. </el-select>
  97. </el-form-item>
  98. <el-form-item label="安装位置:" prop="location">
  99. <el-input v-model="addForm.location" placeholder="请输入安装位置" maxlength="10" style="width:360px;"/>
  100. </el-form-item>
  101. <el-form-item label="关联门禁:" prop="isStart">
  102. <el-radio-group v-model="addForm.isStart" style="margin-top:4px;">
  103. <el-radio :label="1" style="margin-right:30px;">是</el-radio>
  104. <el-radio :label="2">否</el-radio>
  105. </el-radio-group>
  106. </el-form-item>
  107. </el-form>
  108. <div slot="footer" style="text-align: center;">
  109. <el-button @click="cancel" style="height:30px;line-height:30px;">取 消</el-button>
  110. <el-button type="primary" @click="submitForm">确 定</el-button>
  111. </div>
  112. </el-dialog>
  113. </div>
  114. </template>
  115. <script>
  116. import { XxpCardInfoList,XxpCardInfo,XxpCardInfoPut,XxpCardInfoDelete,getSubList } from "@/api/laboratory/electronicInformationBoard";
  117. // import { filterDept,getSubList } from "@/api/medicUniversity-3_1/index";
  118. import {listDepartments} from "@/api/system/dept";
  119. import {subjectList } from "@/api/laboratory/approval";
  120. export default {
  121. name: 'index',
  122. data(){
  123. return{
  124. tableButtonType:this.hasPermiDom(['laboratory:cardInfo:edit','laboratory:cardInfo:remove']),
  125. showSearch: true,
  126. loading: false,
  127. deptOptions:[],
  128. queryParams: {
  129. pageNum: 1,
  130. pageSize:20,
  131. searchValue:"",
  132. deptId:"",
  133. },
  134. dataList: [],
  135. total: 0,
  136. addDialogType:false,
  137. dialogType:null,
  138. dialogTitle:"",
  139. addForm:{},
  140. rules:{
  141. cardNum: [
  142. { required: true, message: "请输入设备编号", trigger: "change" },
  143. { required: true, message: "请输入预案名称", validator: this.spaceJudgment, trigger: "change" },
  144. ],
  145. subjectId: [
  146. { required: true, message: "请选择实验室", trigger: "change" },
  147. { required: true, message: "请选择实验室", validator: this.spaceJudgment, trigger: "change" },
  148. ],
  149. // location: [
  150. // { required: true, message: "请输入安装位置", trigger: "change" },
  151. // { required: true, message: "请输入安装位置", validator: this.spaceJudgment, trigger: "change" },
  152. // ],
  153. // isStart: [
  154. // { required: true, message: "请选择是否关联门禁", trigger: "change" },
  155. // { required: true, message: "请选择是否关联门禁", validator: this.spaceJudgment, trigger: "change" },
  156. // ],
  157. },
  158. selectList:[],
  159. selectListData:[],
  160. }
  161. },
  162. created(){
  163. this.getDeptListTow();
  164. // this.getSubList();
  165. // this.filterDept();
  166. this.getList();
  167. },
  168. mounted(){
  169. },
  170. methods:{
  171. delButton(row){
  172. let self = this;
  173. this.$confirm('是否确认删除?', "警告", {
  174. confirmButtonText: "确定",
  175. cancelButtonText: "取消",
  176. type: "warning"
  177. }).then(function() {
  178. XxpCardInfoDelete(row.id).then(response => {
  179. self.msgSuccess(response.msg);
  180. self.getList();
  181. });
  182. }).then(() => {
  183. }).catch(() => {});
  184. },
  185. //新增编辑按钮
  186. addButton(type,row){
  187. if(type == 1){
  188. this.$set(this,'dialogType','1');
  189. this.$set(this,'dialogTitle','新增电子信息牌');
  190. this.$set(this,'addForm',{
  191. cardNum:"",
  192. subjectId:"",
  193. subjectName:"",
  194. deptId:"",
  195. deptName:"",
  196. location:"",
  197. isStart:1,
  198. });
  199. this.$set(this,'selectList',[]);
  200. }else if(type == 2){
  201. this.$set(this,'dialogType','2');
  202. this.$set(this,'dialogTitle','编辑电子信息牌');
  203. this.$set(this,'addForm',{
  204. id:row.id,
  205. cardNum:row.cardNum,
  206. subjectId:row.subjectId,
  207. subjectName:row.subjectName,
  208. deptId:row.deptId,
  209. deptName:row.deptName,
  210. location:row.location,
  211. isStart:row.isStart,
  212. });
  213. this.getSelectList(row.subjectName);
  214. }
  215. this.$set(this,'addDialogType',true);
  216. },
  217. getSelectList(val){
  218. if(val){
  219. let obj = {}
  220. if(this.dialogType == 1){
  221. obj.name = val
  222. }else if(this.dialogType == 2){
  223. obj.name = val
  224. obj.id = this.addForm.subjectId
  225. }
  226. subjectList(obj).then(response => {
  227. this.$set(this,'selectList',response.data);
  228. })
  229. }else{
  230. this.$set(this,'selectList',[]);
  231. }
  232. },
  233. //实验室选中
  234. selectChange(id){
  235. let self = this;
  236. for(let i=0;i<self.selectList.length;i++){
  237. if(id == self.selectList[i].id){
  238. this.$set(this.addForm,'subjectName',self.selectList[i].name);
  239. this.$set(this.addForm,'deptId',self.selectList[i].deptId);
  240. this.$set(this.addForm,'deptName',self.selectList[i].deptName);
  241. }
  242. }
  243. },
  244. submitForm(){
  245. this.$refs["form"].validate((valid) => {
  246. if (valid) {
  247. if(this.addForm.id){
  248. //编辑
  249. XxpCardInfoPut(this.addForm).then(response => {
  250. //当前列表
  251. this.msgSuccess(response.msg);
  252. this.getList();
  253. this.addDialogType = false;
  254. });
  255. }else{
  256. //新增
  257. XxpCardInfo(this.addForm).then(response => {
  258. //当前列表
  259. this.msgSuccess(response.msg);
  260. this.getList();
  261. this.addDialogType = false;
  262. });
  263. }
  264. }
  265. })
  266. },
  267. cancel(){
  268. this.addDialogType = false;
  269. },
  270. /** 搜索按钮操作 */
  271. handleQuery() {
  272. this.queryParams.pageNum = 1;
  273. this.getList();
  274. },
  275. /** 重置按钮操作 */
  276. resetQuery() {
  277. this.$set(this.queryParams,'searchValue','')
  278. this.$set(this.queryParams,'deptId','')
  279. this.handleQuery();
  280. },
  281. getList() {
  282. this.loading = true;
  283. XxpCardInfoList(this.queryParams).then( response => {
  284. this.dataList = response.rows;
  285. this.total = response.total;
  286. this.loading = false;
  287. });
  288. },
  289. /** 查询学院列表 */
  290. getDeptListTow() {
  291. listDepartments().then(response => {
  292. // this.deptOptionsTwo = response.data;
  293. this.$set(this, 'deptOptions', response.data)
  294. });
  295. },
  296. }
  297. }
  298. </script>
  299. <style scoped lang="scss">
  300. .electronicInformationBoard{
  301. display: flex;
  302. flex-direction: column;
  303. font-weight:500;
  304. padding:20px 20px 10px!important;
  305. *{
  306. margin:0;
  307. padding:0;
  308. }
  309. .form-box{
  310. height:60px;
  311. }
  312. }
  313. </style>