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="button-box" style="display: flex">
  56. <p class="table-min-button" style="margin-left:0;" @click="addButton(2,scope.row)"
  57. v-hasPermi="['laboratory:cardInfo:edit']"
  58. >编辑</p>
  59. <p class="table-min-button" @click="delButton(scope.row)"
  60. v-hasPermi="['laboratory:cardInfo:remove']"
  61. >删除</p>
  62. </div>
  63. </template>
  64. </el-table-column>
  65. </el-table>
  66. <pagination :page-sizes="[20, 30, 40, 50]"
  67. v-show="total>0"
  68. :total="total"
  69. :page.sync="queryParams.pageNum"
  70. :limit.sync="queryParams.pageSize"
  71. @pagination="getList"
  72. />
  73. <el-dialog :title="dialogTitle" :visible.sync="addDialogType" v-if="addDialogType"
  74. width="520px" append-to-body id="onDutyConfiguration-dialog-box">
  75. <el-form ref="form" :model="addForm" :rules="rules" label-width="100px">
  76. <el-form-item label="设备编号:" prop="cardNum">
  77. <el-input v-model="addForm.cardNum" placeholder="请输入设备编号" maxlength="20" style="width:360px;"/>
  78. </el-form-item>
  79. <el-form-item label="实验室:" prop="subjectId">
  80. <el-select
  81. style="width:360px;"
  82. v-model="addForm.subjectId"
  83. filterable
  84. remote
  85. clearable
  86. reserve-keyword
  87. placeholder="输入关键字检索选择"
  88. :remote-method="getSelectList"
  89. @change="selectChange"
  90. :loading="loading">
  91. <el-option
  92. v-for="item in selectList"
  93. :key="item.id"
  94. :label="item.name"
  95. :value="item.id">
  96. </el-option>
  97. </el-select>
  98. </el-form-item>
  99. <el-form-item label="安装位置:" prop="location">
  100. <el-input v-model="addForm.location" placeholder="请输入安装位置" maxlength="10" style="width:360px;"/>
  101. </el-form-item>
  102. <el-form-item label="关联门禁:" prop="isStart">
  103. <el-radio-group v-model="addForm.isStart" style="margin-top:4px;">
  104. <el-radio :label="1" style="margin-right:30px;">是</el-radio>
  105. <el-radio :label="2">否</el-radio>
  106. </el-radio-group>
  107. </el-form-item>
  108. </el-form>
  109. <div slot="footer" style="text-align: center;">
  110. <el-button @click="cancel" style="height:30px;line-height:30px;">取 消</el-button>
  111. <el-button type="primary" @click="submitForm">确 定</el-button>
  112. </div>
  113. </el-dialog>
  114. </div>
  115. </template>
  116. <script>
  117. import { XxpCardInfoList,XxpCardInfo,XxpCardInfoPut,XxpCardInfoDelete,getSubList } from "@/api/laboratory/electronicInformationBoard";
  118. // import { filterDept,getSubList } from "@/api/medicUniversity-3_1/index";
  119. import {listDepartments} from "@/api/system/dept";
  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. },
  132. dataList: [],
  133. total: 0,
  134. addDialogType:false,
  135. dialogType:null,
  136. dialogTitle:"",
  137. addForm:{},
  138. rules:{
  139. cardNum: [
  140. { required: true, message: "请输入设备编号", trigger: "change" },
  141. { required: true, message: "请输入预案名称", validator: this.spaceJudgment, trigger: "change" },
  142. ],
  143. subjectId: [
  144. { required: true, message: "请选择实验室", trigger: "change" },
  145. { required: true, message: "请选择实验室", validator: this.spaceJudgment, trigger: "change" },
  146. ],
  147. // location: [
  148. // { required: true, message: "请输入安装位置", trigger: "change" },
  149. // { required: true, message: "请输入安装位置", validator: this.spaceJudgment, trigger: "change" },
  150. // ],
  151. // isStart: [
  152. // { required: true, message: "请选择是否关联门禁", trigger: "change" },
  153. // { required: true, message: "请选择是否关联门禁", validator: this.spaceJudgment, trigger: "change" },
  154. // ],
  155. },
  156. selectList:[],
  157. selectListData:[],
  158. }
  159. },
  160. created(){
  161. this.getDeptListTow();
  162. // this.getSubList();
  163. // this.filterDept();
  164. this.getList();
  165. },
  166. mounted(){
  167. },
  168. methods:{
  169. delButton(row){
  170. let self = this;
  171. this.$confirm('是否确认删除?', "警告", {
  172. confirmButtonText: "确定",
  173. cancelButtonText: "取消",
  174. type: "warning"
  175. }).then(function() {
  176. XxpCardInfoDelete(row.id).then(response => {
  177. self.msgSuccess(response.msg);
  178. self.getList();
  179. });
  180. }).then(() => {
  181. }).catch(() => {});
  182. },
  183. //新增编辑按钮
  184. addButton(type,row){
  185. if(type == 1){
  186. this.$set(this,'dialogType','1');
  187. this.$set(this,'dialogTitle','新增电子信息牌');
  188. this.$set(this,'addForm',{
  189. cardNum:"",
  190. subjectId:"",
  191. subjectName:"",
  192. deptId:"",
  193. deptName:"",
  194. location:"",
  195. isStart:1,
  196. });
  197. this.$set(this,'selectList',[]);
  198. }else if(type == 2){
  199. this.$set(this,'dialogType','2');
  200. this.$set(this,'dialogTitle','编辑电子信息牌');
  201. this.$set(this,'addForm',{
  202. id:row.id,
  203. cardNum:row.cardNum,
  204. subjectId:row.subjectId,
  205. subjectName:row.subjectName,
  206. deptId:row.deptId,
  207. deptName:row.deptName,
  208. location:row.location,
  209. isStart:row.isStart,
  210. });
  211. this.getSelectList(row.subjectName);
  212. }
  213. this.$set(this,'addDialogType',true);
  214. },
  215. getSelectList(val){
  216. if(val){
  217. let obj = {}
  218. if(this.dialogType == 1){
  219. obj.name = val
  220. }else if(this.dialogType == 2){
  221. obj.name = val
  222. obj.id = this.addForm.subjectId
  223. }
  224. getSubList(obj).then(response => {
  225. this.$set(this,'selectList',response.data);
  226. })
  227. }else{
  228. this.$set(this,'selectList',[]);
  229. }
  230. },
  231. //实验室选中
  232. selectChange(id){
  233. let self = this;
  234. for(let i=0;i<self.selectList.length;i++){
  235. if(id == self.selectList[i].id){
  236. this.$set(this.addForm,'subjectName',self.selectList[i].name);
  237. this.$set(this.addForm,'deptId',self.selectList[i].deptId);
  238. this.$set(this.addForm,'deptName',self.selectList[i].deptName);
  239. }
  240. }
  241. },
  242. submitForm(){
  243. this.$refs["form"].validate((valid) => {
  244. if (valid) {
  245. if(this.addForm.id){
  246. //编辑
  247. XxpCardInfoPut(this.addForm).then(response => {
  248. //当前列表
  249. this.msgSuccess(response.msg);
  250. this.getList();
  251. this.addDialogType = false;
  252. });
  253. }else{
  254. //新增
  255. XxpCardInfo(this.addForm).then(response => {
  256. //当前列表
  257. this.msgSuccess(response.msg);
  258. this.getList();
  259. this.addDialogType = false;
  260. });
  261. }
  262. }
  263. })
  264. },
  265. cancel(){
  266. this.addDialogType = false;
  267. },
  268. /** 搜索按钮操作 */
  269. handleQuery() {
  270. this.queryParams.pageNum = 1;
  271. this.getList();
  272. },
  273. /** 重置按钮操作 */
  274. resetQuery() {
  275. this.$set(this,'queryParams',{
  276. searchValue:"",
  277. deptId:''
  278. })
  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>