index.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="标准气体证书编号" prop="code">
  5. <el-input
  6. v-model="queryParams.code"
  7. placeholder="请输入标准气体证书编号"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="标准气体名称" prop="name">
  13. <el-input
  14. v-model="queryParams.name"
  15. placeholder="请输入标准气体名称"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item>
  21. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  22. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  23. </el-form-item>
  24. </el-form>
  25. <el-row :gutter="10" class="mb8">
  26. <el-col :span="1.5">
  27. <el-button
  28. type="primary"
  29. plain
  30. icon="el-icon-plus"
  31. size="mini"
  32. @click="handleAdd"
  33. v-hasPermi="['check:standardgases:add']"
  34. >新增</el-button>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-button
  38. type="success"
  39. plain
  40. icon="el-icon-edit"
  41. size="mini"
  42. :disabled="single"
  43. @click="handleUpdate"
  44. v-hasPermi="['check:standardgases:edit']"
  45. >修改</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="danger"
  50. plain
  51. icon="el-icon-delete"
  52. size="mini"
  53. :disabled="multiple"
  54. @click="handleDelete"
  55. v-hasPermi="['check:standardgases:remove']"
  56. >删除</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="warning"
  61. plain
  62. icon="el-icon-download"
  63. size="mini"
  64. @click="handleExport"
  65. v-hasPermi="['check:standardgases:export']"
  66. >导出</el-button>
  67. </el-col>
  68. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  69. </el-row>
  70. <el-table v-loading="loading" :data="standardgasesList" @selection-change="handleSelectionChange" :height="clientHeight" border>
  71. <el-table-column type="selection" width="55" align="center" />
  72. <el-table-column label="标准气体证书编号" align="center" prop="code" />
  73. <el-table-column label="标准气体名称" align="center" prop="name" />
  74. <el-table-column label="标准气体浓度" align="center" prop="concentration" />
  75. <el-table-column label="标准气体有效期" align="center" prop="lifespan" />
  76. <el-table-column label="生产厂家" align="center" prop="factory" />
  77. <el-table-column label="钢瓶编号" align="center" prop="cylinderCode" />
  78. <el-table-column label="备注" align="center" prop="remarks" />
  79. <el-table-column label="修改人" align="center" prop="updater" />
  80. <el-table-column label="修改时间" align="center" prop="updatedate" width="180">
  81. <template slot-scope="scope">
  82. <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  86. <template slot-scope="scope">
  87. <el-button
  88. size="mini"
  89. type="text"
  90. icon="el-icon-edit"
  91. @click="handleUpdate(scope.row)"
  92. v-hasPermi="['check:standardgases:edit']"
  93. >修改</el-button>
  94. <el-button
  95. size="mini"
  96. type="text"
  97. icon="el-icon-delete"
  98. @click="handleDelete(scope.row)"
  99. v-hasPermi="['check:standardgases:remove']"
  100. >删除</el-button>
  101. </template>
  102. </el-table-column>
  103. </el-table>
  104. <pagination
  105. v-show="total>0"
  106. :total="total"
  107. :page.sync="queryParams.pageNum"
  108. :limit.sync="queryParams.pageSize"
  109. @pagination="getList"
  110. />
  111. <!-- 添加或修改标准气体对话框 -->
  112. <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  113. <el-form ref="form" :model="form" :rules="rules" label-width="130px">
  114. <el-form-item label="标准气体证书编号" prop="code">
  115. <el-input v-model="form.code" placeholder="请输入标准气体证书编号" />
  116. </el-form-item>
  117. <el-form-item label="标准气体名称" prop="name">
  118. <el-input v-model="form.name" placeholder="请输入标准气体名称" />
  119. </el-form-item>
  120. <el-form-item label="标准气体浓度" prop="concentration">
  121. <el-input v-model="form.concentration" placeholder="请输入标准气体浓度" />
  122. </el-form-item>
  123. <el-form-item label="标准气体有效期" prop="lifespan">
  124. <el-input v-model="form.lifespan" placeholder="请输入标准气体有效期" />
  125. </el-form-item>
  126. <el-form-item label="生产厂家" prop="factory">
  127. <el-input v-model="form.factory" placeholder="请输入生产厂家" />
  128. </el-form-item>
  129. <el-form-item label="钢瓶编号" prop="cylinderCode">
  130. <el-input v-model="form.cylinderCode" placeholder="请输入钢瓶编号" />
  131. </el-form-item>
  132. <el-form-item label="描述" prop="remarks">
  133. <el-tooltip placement="top">
  134. <div slot="content">
  135. 注:请在描述中,注明该仪器的所属单位(本单位或第三方所属)。
  136. </div>
  137. <i class="el-icon-question"></i>
  138. </el-tooltip>
  139. <el-input v-model="form.remarks" placeholder="请输入描述" style="width: 97.7%"/>
  140. </el-form-item>
  141. </el-form>
  142. <div slot="footer" class="dialog-footer">
  143. <el-button type="primary" @click="submitForm">确 定</el-button>
  144. <el-button @click="cancel">取 消</el-button>
  145. </div>
  146. </el-dialog>
  147. </div>
  148. </template>
  149. <script>
  150. import { listStandardgases, getStandardgases, delStandardgases, addStandardgases, updateStandardgases } from "@/api/check/standardgases";
  151. export default {
  152. name: "Standardgases",
  153. data() {
  154. return {
  155. // 页面高度
  156. clientHeight:300,
  157. // 遮罩层
  158. loading: true,
  159. // 选中数组
  160. ids: [],
  161. // 非单个禁用
  162. single: true,
  163. // 非多个禁用
  164. multiple: true,
  165. // 显示搜索条件
  166. showSearch: false,
  167. // 总条数
  168. total: 0,
  169. // 标准气体表格数据
  170. standardgasesList: [],
  171. // 弹出层标题
  172. title: "",
  173. // 是否显示弹出层
  174. open: false,
  175. // 查询参数
  176. queryParams: {
  177. pageNum: 1,
  178. pageSize: 10,
  179. code: null,
  180. name: null,
  181. concentration: null,
  182. lifespan: null,
  183. factory: null,
  184. cylinderCode: null,
  185. remarks: null,
  186. deptId: null,
  187. createrCode: null,
  188. createdate: null,
  189. updaterCode: null,
  190. updatedate: null
  191. },
  192. // 表单参数
  193. form: {},
  194. // 表单校验
  195. rules: {
  196. }
  197. };
  198. },
  199. created() {
  200. this.getList();
  201. //设置表格高度对应屏幕高度
  202. this.$nextTick(() => {
  203. this.clientHeight = (document.body.clientHeight - 80) * 0.8
  204. });
  205. },
  206. methods: {
  207. /** 查询标准气体列表 */
  208. getList() {
  209. this.loading = true;
  210. listStandardgases(this.queryParams).then(response => {
  211. this.standardgasesList = response.rows;
  212. this.total = response.total;
  213. this.loading = false;
  214. });
  215. },
  216. // 取消按钮
  217. cancel() {
  218. this.open = false;
  219. this.reset();
  220. },
  221. // 表单重置
  222. reset() {
  223. this.form = {
  224. id: null,
  225. code: null,
  226. name: null,
  227. concentration: null,
  228. lifespan: null,
  229. factory: null,
  230. cylinderCode: null,
  231. remarks: null,
  232. deptId: null,
  233. delFlag: null,
  234. createrCode: null,
  235. createdate: null,
  236. updaterCode: null,
  237. updatedate: null
  238. };
  239. this.resetForm("form");
  240. },
  241. /** 搜索按钮操作 */
  242. handleQuery() {
  243. this.queryParams.pageNum = 1;
  244. this.getList();
  245. },
  246. /** 重置按钮操作 */
  247. resetQuery() {
  248. this.resetForm("queryForm");
  249. this.handleQuery();
  250. },
  251. // 多选框选中数据
  252. handleSelectionChange(selection) {
  253. this.ids = selection.map(item => item.id)
  254. this.single = selection.length!==1
  255. this.multiple = !selection.length
  256. },
  257. /** 新增按钮操作 */
  258. handleAdd() {
  259. this.reset();
  260. this.open = true;
  261. this.title = "添加标准气体";
  262. },
  263. /** 修改按钮操作 */
  264. handleUpdate(row) {
  265. this.reset();
  266. const id = row.id || this.ids
  267. getStandardgases(id).then(response => {
  268. this.form = response.data;
  269. this.open = true;
  270. this.title = "修改标准气体";
  271. });
  272. },
  273. /** 提交按钮 */
  274. submitForm() {
  275. this.$refs["form"].validate(valid => {
  276. if (valid) {
  277. if (this.form.id != null) {
  278. updateStandardgases(this.form).then(response => {
  279. this.$modal.msgSuccess("修改成功");
  280. this.open = false;
  281. this.getList();
  282. });
  283. } else {
  284. addStandardgases(this.form).then(response => {
  285. this.$modal.msgSuccess("新增成功");
  286. this.open = false;
  287. this.getList();
  288. });
  289. }
  290. }
  291. });
  292. },
  293. /** 删除按钮操作 */
  294. handleDelete(row) {
  295. const ids = row.id || this.ids;
  296. this.$modal.confirm('是否确认删除标准气体编号为"' + ids + '"的数据项?').then(function() {
  297. return delStandardgases(ids);
  298. }).then(() => {
  299. this.getList();
  300. this.$modal.msgSuccess("删除成功");
  301. }).catch(() => {});
  302. },
  303. /** 导出按钮操作 */
  304. handleExport() {
  305. this.download('check/standardgases/export', {
  306. ...this.queryParams
  307. }, `standardgases_${new Date().getTime()}.xlsx`)
  308. }
  309. }
  310. };
  311. </script>