index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <!--危险源管理-->
  2. <template>
  3. <div class="app-container hazard">
  4. <div class="hazard-min" v-if="pageType==1">
  5. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="90px" class="form-box">
  6. <el-form-item label="危险源名称" prop="name" style="margin-left:20px;">
  7. <el-input
  8. v-model="queryParams.name"
  9. placeholder="请输入危险源名称"
  10. clearable
  11. size="small"
  12. />
  13. </el-form-item>
  14. <el-form-item style="float: right;">
  15. <el-col :span="1.5">
  16. <p class="add-button-one-90"
  17. @click="addLaboratoryButton"
  18. v-hasPermi="['laboratory:hazard:add']"
  19. ><i class="el-icon-plus"></i>添加</p>
  20. </el-col>
  21. </el-form-item>
  22. <el-form-item>
  23. <p class="inquire-button-one" @click="handleQuery">查询</p>
  24. <p class="reset-button-one" @click="resetQuery">重置</p>
  25. </el-form-item>
  26. </el-form>
  27. <!--<div class="for-max-box">-->
  28. <!--<div class="for-big-box" v-for="(item,index) in hazardList" :key="index">-->
  29. <!--&lt;!&ndash;<p class="class-name-p color_ff" :class="item.type==1?'lv1Back':(item.type==2?'lv2Back':(item.type==3?'lv3Back':(item.type==4?'lv4Back':'')))">危险化学品</p>&ndash;&gt;-->
  30. <!--<p class="name-box color_66">{{item.name}}</p>-->
  31. <!--<div class="progress-box">-->
  32. <!--<p class="color_99">实验室危险源占比 {{item.labScale}}%</p>-->
  33. <!--<el-progress :text-inside="true" :stroke-width="20" color="#F7CB6B" :percentage="item.labScale" style="margin-right:74px;"></el-progress>-->
  34. <!--</div>-->
  35. <!--<div class="progress-box">-->
  36. <!--<p class="color_99">发生事故占比 {{item.faultScale}}%</p>-->
  37. <!--<el-progress :text-inside="true" :stroke-width="20" color="#FF4C76" :percentage="item.faultScale" style="margin-right:74px;"></el-progress>-->
  38. <!--</div>-->
  39. <!--<div class="progress-box">-->
  40. <!--<p class="color_99">关联风险占比 {{item.planScale}}%</p>-->
  41. <!--<el-progress :text-inside="true" :stroke-width="20" color="#52a1fe" :percentage="item.planScale" style="margin-right:74px;"></el-progress>-->
  42. <!--</div>-->
  43. <!--<div class="button-null-left"></div>-->
  44. <!--<div class="button-box">-->
  45. <!--<p class="table-button-warning-90" style="margin-right:20px;" @click="addLaboratoryButton(item)"><i class="el-icon-edit-outline"></i>编辑</p>-->
  46. <!--<p class="table-button-grey-90" @click="handleDelete(item)"><i class="el-icon-delete"></i>删除</p>-->
  47. <!--</div>-->
  48. <!--</div>-->
  49. <!--<img v-if="!hazardList[0]" src="@/assets/ZDimages/null-data-1.png" style="display: block;width:200px;margin:100px auto;">-->
  50. <!--</div>-->
  51. <el-table v-loading="loading" border :data="hazardList" @selection-change="handleSelectionChange">
  52. <!--<el-table-column type="selection" width="55" align="center" />-->
  53. <!-- <el-table-column label="消息类型" align="left" prop="messType" /> -->
  54. <el-table-column label="名称" align="left" prop="name" />
  55. <el-table-column label="编号" align="left" prop="code" />
  56. <el-table-column label="实验室危险源占比" align="left" prop="labScale">
  57. <template slot-scope="scope">
  58. <div class="progress-box">
  59. <el-progress :text-inside="true" :stroke-width="20" color="#52a1fe" :percentage="scope.row.labScale" style="margin-right:74px;"></el-progress>
  60. </div>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="查看次数" align="left" prop="scanCount" width="100" />
  64. <el-table-column label="二维码" align="left" width="100">
  65. <template slot-scope="scope">
  66. <div @click="dialogQrCodeOn(scope.row.qrCodeUrl)">
  67. <vue-qr style="height:23px;width:23px;cursor:pointer;" :text="scope.row.qrCodeUrl" :size="200"></vue-qr>
  68. </div>
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="操作" align="left" class-name="small-padding fixed-width" width="160" v-if="tableButtonType">
  72. <template slot-scope="scope">
  73. <div class="button-box">
  74. <p class="table-min-button"
  75. @click="addLaboratoryButton(scope.row)"
  76. v-hasPermiAnd="['laboratory:hazard:query','laboratory:hazard:edit']"
  77. >编辑</p>
  78. <p class="table-min-button"
  79. @click="handleDelete(scope.row)"
  80. v-hasPermi="['laboratory:hazard:remove']"
  81. >删除</p>
  82. </div>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. <pagination :page-sizes="[20, 30, 40, 50]"
  87. v-show="total>0"
  88. :total="total"
  89. layout="total, prev, pager, next, sizes, jumper"
  90. :page.sync="queryParams.pageNum"
  91. :limit.sync="queryParams.pageSize"
  92. @pagination="getList"
  93. />
  94. </div>
  95. <add-laboratory v-if="pageType==2" :hazardId="hazardId"></add-laboratory>
  96. <!-- 二维码展示 -->
  97. <el-dialog title="二维码" class="qr-codeUrl-dialog" :visible.sync="dialogQrCodeType" width="300px" append-to-body>
  98. <vue-qr style="display: block;height:200px;width:200px;cursor:pointer;margin:0 auto;" :text="dialogQrCodeUrl" :size="200"></vue-qr>
  99. </el-dialog>
  100. </div>
  101. </template>
  102. <script>
  103. import { listHazard, getHazard, delHazard, addHazard, updateHazard } from "@/api/laboratory/hazard";
  104. import addLaboratory from "./addLaboratory.vue";
  105. import { done } from 'element-ui'
  106. import vueQr from 'vue-qr'
  107. export default {
  108. components: {
  109. addLaboratory,
  110. vueQr
  111. },
  112. name: "Hazard",
  113. data() {
  114. return {
  115. tableButtonType:this.hasPermiDom(['laboratory:hazard:query','laboratory:hazard:edit','laboratory:hazard:remove']),
  116. // 遮罩层
  117. loading: true,
  118. // 选中数组
  119. ids: [],
  120. // 子表选中数据
  121. checkedLabHazardSubjectRelation: [],
  122. // 非单个禁用
  123. single: true,
  124. // 非多个禁用
  125. multiple: true,
  126. // 显示搜索条件
  127. showSearch: true,
  128. // 总条数
  129. total: 0,
  130. // 危险源表格数据
  131. hazardList: [],
  132. // 危险源和实验室关联表格数据
  133. labHazardSubjectRelationList: [],
  134. // 弹出层标题
  135. title: "",
  136. // 是否显示弹出层
  137. open: false,
  138. // 查询参数
  139. queryParams: {
  140. pageNum: 1,
  141. pageSize:20,
  142. chName: null,
  143. enName: null,
  144. casNo: null,
  145. dangerCode: null,
  146. flammability: null,
  147. ignitionPoint: null,
  148. combustionProducts: null,
  149. stability: null,
  150. taboo: null,
  151. skinContactAid: null,
  152. eyeContactAid: null,
  153. inhalationAid: null,
  154. ingestionAid: null,
  155. engineeringProtection: null,
  156. personalProtection: null,
  157. storage: null,
  158. leakageTreatment: null,
  159. deptId: null,
  160. deptName: null,
  161. userId: null,
  162. },
  163. // 表单参数
  164. form: {},
  165. // 表单校验
  166. rules: {
  167. },
  168. //新增危险源
  169. pageType:1,
  170. hazardId: null,
  171. //二维码展示数据
  172. dialogQrCodeType:false,
  173. dialogQrCodeUrl:"",
  174. };
  175. },
  176. created() {
  177. this.getList();
  178. },
  179. methods: {
  180. dialogQrCodeOn(url){
  181. this.dialogQrCodeUrl = url;
  182. this.dialogQrCodeType = true;
  183. },
  184. //新建危险源
  185. addLaboratoryButton(row){
  186. console.log(row.hazardId)
  187. this.hazardId = row.hazardId
  188. this.pageType = 2;
  189. },
  190. offLaboratoryButton(){
  191. this.pageType = 1;
  192. },
  193. /** 查询危险源列表 */
  194. getList() {
  195. this.loading = true;
  196. listHazard(this.queryParams).then(response => {
  197. this.hazardList = response.rows;
  198. this.total = response.total;
  199. this.loading = false;
  200. });
  201. },
  202. // 取消按钮
  203. cancel() {
  204. this.open = false;
  205. this.reset();
  206. },
  207. clickPageTypeOne(){
  208. this.pageType = 1;
  209. this.getList();
  210. },
  211. // 表单重置
  212. reset() {
  213. this.form = {
  214. id: null,
  215. chName: null,
  216. enName: null,
  217. casNo: null,
  218. dangerCode: null,
  219. flammability: null,
  220. ignitionPoint: null,
  221. combustionProducts: null,
  222. stability: null,
  223. taboo: null,
  224. skinContactAid: null,
  225. eyeContactAid: null,
  226. inhalationAid: null,
  227. ingestionAid: null,
  228. engineeringProtection: null,
  229. personalProtection: null,
  230. storage: null,
  231. leakageTreatment: null,
  232. deptId: null,
  233. deptName: null,
  234. createTime: null,
  235. userId: null,
  236. createBy: null,
  237. updateTime: null,
  238. updateBy: null,
  239. remark: null
  240. };
  241. this.labHazardSubjectRelationList = [];
  242. this.resetForm("form");
  243. },
  244. /** 搜索按钮操作 */
  245. handleQuery() {
  246. this.queryParams.pageNum = 1;
  247. this.getList();
  248. },
  249. /** 重置按钮操作 */
  250. resetQuery() {
  251. // this.resetForm("queryForm");
  252. this.$set(this,'queryParams',{
  253. pageNum: 1,
  254. pageSize:20,
  255. name:"",
  256. });
  257. this.handleQuery();
  258. },
  259. // 多选框选中数据
  260. handleSelectionChange(selection) {
  261. this.ids = selection.map(item => item.hazardId)
  262. this.single = selection.length!==1
  263. this.multiple = !selection.length
  264. },
  265. /** 新增按钮操作 */
  266. handleAdd() {
  267. this.reset();
  268. this.open = true;
  269. this.title = "添加危险源";
  270. },
  271. /** 删除按钮操作 */
  272. handleDelete(row) {
  273. const ids = row.hazardId || this.ids;
  274. this.$confirm('是否确认删除危险源?', "警告", {
  275. confirmButtonText: "确定",
  276. cancelButtonText: "取消",
  277. type: "warning"
  278. }).then(function() {
  279. return delHazard(ids);
  280. }).then(() => {
  281. this.getList();
  282. this.msgSuccess("删除成功");
  283. }).catch(() => {});
  284. },
  285. /** 导出按钮操作 */
  286. handleExport() {
  287. this.download('laboratory/hazard/export', {
  288. ...this.queryParams
  289. }, `laboratory_hazard.xlsx`)
  290. },
  291. }
  292. };
  293. </script>
  294. <style scoped lang="scss">
  295. .hazard {
  296. display: flex!important;
  297. flex-direction: column;
  298. box-shadow: 0 0 8px 2px rgba(0, 0, 0, 0.1);
  299. /*padding:11px 20px 20px!important;*/
  300. .hazard-min{
  301. flex:1;
  302. overflow: hidden;
  303. display: flex!important;
  304. flex-direction: column;
  305. padding:11px 20px 20px!important;
  306. }
  307. .form-box{
  308. margin-top:12px;
  309. //display: flex;
  310. .null-p{
  311. flex:1;
  312. }
  313. }
  314. .button-box{
  315. display: flex;
  316. height:30px;
  317. width:190px;
  318. /*margin-top:40px;*/
  319. /*margin-right:40px;*/
  320. margin:0 auto;
  321. }
  322. }
  323. </style>