index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <!-- 气瓶类型 -->
  2. <template>
  3. <div class="app-container cylinderSetting">
  4. <div class="page-container cylinderSettingPage">
  5. <div class="page-form-title-box">
  6. <el-form :model="queryParams" class="form-box" ref="queryForm"
  7. :inline="true" style="width:100%;">
  8. <el-form-item label="关键字" prop="searchValue" label-width="60px">
  9. <el-input
  10. maxLength="30"
  11. v-model="queryParams.searchValue"
  12. placeholder="气体名称"
  13. clearable
  14. style="width: 240px"
  15. />
  16. </el-form-item>
  17. <p class="page-inquire-common-style-button" @click="handleQuery">查询</p>
  18. <p class="page-reset-common-style-button" @click="resetQuery">重置</p>
  19. <p class="page-add-common-style-button"
  20. style="float: right;"
  21. v-hasPermi="['db:bottleType:add']"
  22. @click="tableButton(1)"
  23. >新增</p>
  24. </el-form>
  25. </div>
  26. <div class="page-content-box">
  27. <el-table class="table-box" v-loading="loading" border :data="dataList">
  28. <el-table-column label="气体名称" prop="gasName" show-overflow-tooltip/>
  29. <el-table-column label="级别" prop="level" width="300" show-overflow-tooltip>
  30. <template slot-scope="scope">
  31. {{forData(1,scope.row.level)}}
  32. </template>
  33. </el-table-column>
  34. <el-table-column label="规格" prop="size" width="150" show-overflow-tooltip>
  35. <template slot-scope="scope">
  36. {{forData(2,scope.row.size)}}
  37. </template>
  38. </el-table-column>
  39. <el-table-column label="成分" prop="gasComposition" width="300" show-overflow-tooltip/>
  40. <el-table-column label="编辑时间" prop="updateTime" width="249" show-overflow-tooltip>
  41. <template slot-scope="scope">
  42. <span>{{ parseTime(scope.row.updateTime,'{y}-{m}-{d} {h}:{i}') }}</span>
  43. </template>
  44. </el-table-column>
  45. <el-table-column label="操作" width="180" show-overflow-tooltip v-if="tableButtonType">
  46. <template slot-scope="scope">
  47. <div class="table-button-box">
  48. <p class="table-button-null"></p>
  49. <p class="table-button-p"
  50. @click="tableButton(2,scope.row)"
  51. v-hasPermiAnd="['db:bottleType:edit','db:bottleType:query']"
  52. >编辑</p>
  53. <p class="table-button-p"
  54. @click="tableButton(3,scope.row)"
  55. v-hasPermi="['db:bottleType:remove']"
  56. >删除</p>
  57. <p class="table-button-null"></p>
  58. </div>
  59. </template>
  60. </el-table-column>
  61. </el-table>
  62. <pagination :page-sizes="[20, 30, 40, 50]"
  63. v-show="total>0"
  64. :total="total"
  65. :page.sync="queryParams.pageNum"
  66. :limit.sync="queryParams.pageSize"
  67. @pagination="getList"
  68. />
  69. </div>
  70. </div>
  71. <el-dialog class="cylinderSetting-dialog-box"
  72. :title="dialogTitle" :visible.sync="dialogType" v-if="dialogType"
  73. :close-on-click-modal="false" width="500px" append-to-body>
  74. <el-form ref="dialogForm" :model="dialogForm" :rules="rules" label-width="120px">
  75. <el-form-item label="名称:" prop="gasName">
  76. <el-input
  77. maxLength="10"
  78. v-model="dialogForm.gasName"
  79. placeholder="请输入名称"
  80. style="width: 280px"
  81. />
  82. </el-form-item>
  83. <el-form-item label="级别:" prop="level">
  84. <el-select v-model="dialogForm.level"
  85. placeholder="请选择" style="width: 280px">
  86. <el-option
  87. v-for="dict in gasBottleLevel"
  88. :key="dict.dictValue"
  89. :label="dict.dictLabel"
  90. :value="dict.dictValue"
  91. />
  92. </el-select>
  93. </el-form-item>
  94. <el-form-item label="规格:" prop="size">
  95. <el-select v-model="dialogForm.size"
  96. placeholder="请选择" style="width: 280px">
  97. <el-option
  98. v-for="dict in gasBottleSpecification"
  99. :key="dict.dictValue"
  100. :label="dict.dictLabel"
  101. :value="dict.dictValue"
  102. />
  103. </el-select>
  104. </el-form-item>
  105. <el-form-item label="气体成分:" prop="gasComposition">
  106. <el-input
  107. maxLength="20"
  108. v-model="dialogForm.gasComposition"
  109. placeholder="请输入名称"
  110. style="width: 280px"
  111. />
  112. </el-form-item>
  113. </el-form>
  114. <div slot="footer" class="dialog-footer">
  115. <p class="dialog-footer-null-p"></p>
  116. <el-button @click="cancel">取 消</el-button>
  117. <el-button type="primary" @click="submit">确 定</el-button>
  118. <p class="dialog-footer-null-p"></p>
  119. </div>
  120. </el-dialog>
  121. </div>
  122. </template>
  123. <script>
  124. import vueQr from 'vue-qr'
  125. import { getLodop } from "@/utils/LodopFuncs";
  126. import { airbottleBottleTypeList,airbottleBottleTypeAdd,
  127. airbottleBottleTypeUpdate,airbottleBottleTypeFindById,
  128. airbottleBottleTypeDelete} from "@/api/gasBottleManage/index";
  129. //import { getDicts } from "@/api/commonality/noPermission";
  130. //import { systemUserSelect } from "@/api/commonality/permission";
  131. //import { getInfo } from "@/api/basicsModules/index";
  132. //import addPage from "./addPage.vue";
  133. export default {
  134. name: 'index',
  135. components: {
  136. vueQr
  137. },
  138. data () {
  139. return {
  140. tableButtonType:this.hasPermiDom(['db:bottleType:edit','db:bottleType:query','db:bottleType:remove',]),
  141. //页面遮罩
  142. loading:false,
  143. //气瓶级别
  144. gasBottleLevel:[],
  145. gasBottleSpecification:[],
  146. //查询条件
  147. queryParams:{
  148. pageNum:1,
  149. pageSize:20,
  150. searchValue:"",
  151. collegeId :null,
  152. },
  153. //时间数据
  154. dateRange:[],
  155. //列表数据
  156. dataList:[],
  157. //数据数量
  158. total:0,
  159. //弹窗开关
  160. dialogType:false,
  161. dialogTitle:"",
  162. dialogForm:{},
  163. //校验
  164. rules:{
  165. gasName:[
  166. { required: true, message: '请输入名称', trigger: 'blur' },
  167. { required: true, message: "请输入名称", validator: this.spaceJudgment, trigger: "blur" }
  168. ],
  169. // level:[
  170. // { required: true, message: '请选择级别', trigger: 'blur' },
  171. // ],
  172. // size:[
  173. // { required: true, message: '请选择规格', trigger: 'blur' },
  174. // ],
  175. // gasComposition:[
  176. // { required: true, message: '请输入气体成分', trigger: 'blur' },
  177. // { required: true, message: "请输入气体成分", validator: this.spaceJudgment, trigger: "blur" }
  178. // ],
  179. },
  180. }
  181. },
  182. created () {
  183. },
  184. mounted () {
  185. this.getList();
  186. this.getDicts("gasBottleLevel").then((response) => {
  187. this.$set(this,'gasBottleLevel',response.data);
  188. });
  189. this.getDicts("gasBottleSpecification").then((response) => {
  190. this.$set(this,'gasBottleSpecification',response.data);
  191. });
  192. },
  193. methods: {
  194. //弹窗相关
  195. cancel(){
  196. this.$set(this,'dialogType',false);
  197. },
  198. submit(){
  199. this.$refs["dialogForm"].validate(valid => {
  200. if (valid) {
  201. if(this.dialogForm.id){
  202. //编辑
  203. airbottleBottleTypeUpdate(this.dialogForm).then(response => {
  204. this.$set(this,'dialogType',false);
  205. this.msgSuccess(response.msg)
  206. this.getList();
  207. });
  208. } else {
  209. //新增
  210. airbottleBottleTypeAdd(this.dialogForm).then(response => {
  211. this.$set(this,'dialogType',false);
  212. this.msgSuccess(response.msg)
  213. this.getList();
  214. });
  215. }
  216. }
  217. })
  218. },
  219. //查询按钮
  220. handleQuery(){
  221. this.$set(this.queryParams,'pageNum',1);
  222. this.getList();
  223. },
  224. //重置按钮
  225. resetQuery(){
  226. this.$set(this,'dateRange',[])
  227. this.$set(this,'queryParams',{
  228. pageNum:1,
  229. pageSize:20,
  230. searchValue:"",
  231. collegeId :null,
  232. });
  233. this.getList();
  234. },
  235. //获取数据列表
  236. getList(){
  237. this.$set(this,'loading',true);
  238. let obj = JSON.parse(JSON.stringify(this.queryParams))
  239. airbottleBottleTypeList(obj).then(response => {
  240. this.$set(this,'loading',false);
  241. this.$set(this,'dataList',response.data.records);
  242. this.$set(this,'total',response.data.total);
  243. });
  244. },
  245. //操作按钮
  246. tableButton(type,row){
  247. let self = this;
  248. if(type == 1){
  249. //新增
  250. this.$set(this,'dialogTitle','新增');
  251. this.$set(this,'dialogForm',{
  252. gasName:"",
  253. level:"",
  254. size:"",
  255. gasComposition:"",
  256. });
  257. this.$set(this,'dialogType',true);
  258. }else if(type == 2){
  259. //编辑
  260. this.$set(this,'dialogTitle','编辑');
  261. this.$set(this,'dialogForm',{
  262. id:row.id,
  263. gasName:row.gasName,
  264. level:row.level+'',
  265. size:row.size+'',
  266. gasComposition:row.gasComposition,
  267. });
  268. this.$set(this,'dialogType',true);
  269. }else if(type == 3){
  270. //删除
  271. this.$confirm('是否确认删除?', "警告", {
  272. confirmButtonText: "确定",
  273. cancelButtonText: "取消",
  274. type: "warning"
  275. }).then(function() {
  276. }).then(() => {
  277. airbottleBottleTypeDelete({id:row.id}).then(response => {
  278. self.msgSuccess(response.msg)
  279. self.getList();
  280. });
  281. }).catch(() => {});
  282. }
  283. },
  284. forData(type,id){
  285. let self = this;
  286. let num = 0;
  287. if(type == 1){
  288. for(let i=0;i<self.gasBottleLevel.length;i++){
  289. if(id == self.gasBottleLevel[i].dictValue){
  290. num++
  291. return self.gasBottleLevel[i].dictLabel
  292. }
  293. }
  294. }else if (type){
  295. for(let i=0;i<self.gasBottleSpecification.length;i++){
  296. if(id == self.gasBottleSpecification[i].dictValue){
  297. num++
  298. return self.gasBottleSpecification[i].dictLabel
  299. }
  300. }
  301. }
  302. if(num == 0){
  303. return '其他'
  304. }
  305. },
  306. },
  307. }
  308. </script>
  309. <style scoped lang="scss">
  310. .cylinderSetting{
  311. display: flex;
  312. flex-direction: column;
  313. .cylinderSettingPage{
  314. }
  315. }
  316. </style>
  317. <style lang="scss">
  318. .cylinderSetting-dialog-box{
  319. .text-p{
  320. line-height:40px;
  321. font-size:16px;
  322. text-align: center;
  323. }
  324. .dialog-footer{
  325. display: flex;
  326. .dialog-footer-null-p{
  327. flex:1;
  328. }
  329. }
  330. }
  331. </style>