index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  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. export default {
  120. name: 'index',
  121. data(){
  122. return{
  123. tableButtonType:this.hasPermiDom(['laboratory:cardInfo:edit','laboratory:cardInfo:remove']),
  124. showSearch: true,
  125. loading: false,
  126. deptOptions:[],
  127. queryParams: {
  128. pageNum: 1,
  129. pageSize:20,
  130. searchValue:"",
  131. deptId:"",
  132. },
  133. dataList: [],
  134. total: 0,
  135. addDialogType:false,
  136. dialogType:null,
  137. dialogTitle:"",
  138. addForm:{},
  139. rules:{
  140. cardNum: [
  141. { required: true, message: "请输入设备编号", trigger: "change" },
  142. { required: true, message: "请输入预案名称", validator: this.spaceJudgment, trigger: "change" },
  143. ],
  144. subjectId: [
  145. { required: true, message: "请选择实验室", trigger: "change" },
  146. { required: true, message: "请选择实验室", validator: this.spaceJudgment, trigger: "change" },
  147. ],
  148. // location: [
  149. // { required: true, message: "请输入安装位置", trigger: "change" },
  150. // { required: true, message: "请输入安装位置", validator: this.spaceJudgment, trigger: "change" },
  151. // ],
  152. // isStart: [
  153. // { required: true, message: "请选择是否关联门禁", trigger: "change" },
  154. // { required: true, message: "请选择是否关联门禁", validator: this.spaceJudgment, trigger: "change" },
  155. // ],
  156. },
  157. selectList:[],
  158. selectListData:[],
  159. }
  160. },
  161. created(){
  162. this.getDeptListTow();
  163. // this.getSubList();
  164. // this.filterDept();
  165. this.getList();
  166. },
  167. mounted(){
  168. },
  169. methods:{
  170. delButton(row){
  171. let self = this;
  172. this.$confirm('是否确认删除?', "警告", {
  173. confirmButtonText: "确定",
  174. cancelButtonText: "取消",
  175. type: "warning"
  176. }).then(function() {
  177. XxpCardInfoDelete(row.id).then(response => {
  178. self.msgSuccess(response.msg);
  179. self.getList();
  180. });
  181. }).then(() => {
  182. }).catch(() => {});
  183. },
  184. //新增编辑按钮
  185. addButton(type,row){
  186. if(type == 1){
  187. this.$set(this,'dialogType','1');
  188. this.$set(this,'dialogTitle','新增电子信息牌');
  189. this.$set(this,'addForm',{
  190. cardNum:"",
  191. subjectId:"",
  192. subjectName:"",
  193. deptId:"",
  194. deptName:"",
  195. location:"",
  196. isStart:1,
  197. });
  198. this.$set(this,'selectList',[]);
  199. }else if(type == 2){
  200. this.$set(this,'dialogType','2');
  201. this.$set(this,'dialogTitle','编辑电子信息牌');
  202. this.$set(this,'addForm',{
  203. id:row.id,
  204. cardNum:row.cardNum,
  205. subjectId:row.subjectId,
  206. subjectName:row.subjectName,
  207. deptId:row.deptId,
  208. deptName:row.deptName,
  209. location:row.location,
  210. isStart:row.isStart,
  211. });
  212. this.getSelectList(row.subjectName);
  213. }
  214. this.$set(this,'addDialogType',true);
  215. },
  216. getSelectList(val){
  217. if(val){
  218. let obj = {}
  219. if(this.dialogType == 1){
  220. obj.name = val
  221. }else if(this.dialogType == 2){
  222. obj.name = val
  223. obj.id = this.addForm.subjectId
  224. }
  225. getSubList(obj).then(response => {
  226. this.$set(this,'selectList',response.data);
  227. })
  228. }else{
  229. this.$set(this,'selectList',[]);
  230. }
  231. },
  232. //实验室选中
  233. selectChange(id){
  234. let self = this;
  235. for(let i=0;i<self.selectList.length;i++){
  236. if(id == self.selectList[i].id){
  237. this.$set(this.addForm,'subjectName',self.selectList[i].name);
  238. this.$set(this.addForm,'deptId',self.selectList[i].deptId);
  239. this.$set(this.addForm,'deptName',self.selectList[i].deptName);
  240. }
  241. }
  242. },
  243. submitForm(){
  244. this.$refs["form"].validate((valid) => {
  245. if (valid) {
  246. if(this.addForm.id){
  247. //编辑
  248. XxpCardInfoPut(this.addForm).then(response => {
  249. //当前列表
  250. this.msgSuccess(response.msg);
  251. this.getList();
  252. this.addDialogType = false;
  253. });
  254. }else{
  255. //新增
  256. XxpCardInfo(this.addForm).then(response => {
  257. //当前列表
  258. this.msgSuccess(response.msg);
  259. this.getList();
  260. this.addDialogType = false;
  261. });
  262. }
  263. }
  264. })
  265. },
  266. cancel(){
  267. this.addDialogType = false;
  268. },
  269. /** 搜索按钮操作 */
  270. handleQuery() {
  271. this.queryParams.pageNum = 1;
  272. this.getList();
  273. },
  274. /** 重置按钮操作 */
  275. resetQuery() {
  276. this.$set(this.queryParams,'searchValue','')
  277. this.$set(this.queryParams,'deptId','')
  278. this.handleQuery();
  279. },
  280. getList() {
  281. this.loading = true;
  282. XxpCardInfoList(this.queryParams).then( response => {
  283. this.dataList = response.rows;
  284. this.total = response.total;
  285. this.loading = false;
  286. });
  287. },
  288. /** 查询学院列表 */
  289. getDeptListTow() {
  290. listDepartments().then(response => {
  291. // this.deptOptionsTwo = response.data;
  292. this.$set(this, 'deptOptions', response.data)
  293. });
  294. },
  295. }
  296. }
  297. </script>
  298. <style scoped lang="scss">
  299. .electronicInformationBoard{
  300. display: flex;
  301. flex-direction: column;
  302. font-weight:500;
  303. padding:20px 20px 10px!important;
  304. *{
  305. margin:0;
  306. padding:0;
  307. }
  308. .form-box{
  309. height:60px;
  310. }
  311. }
  312. </style>