123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317 |
- <template>
- <div class="app-container">
- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
- <el-form-item label="标准气体证书编号" prop="code">
- <el-input
- v-model="queryParams.code"
- placeholder="请输入标准气体证书编号"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item label="标准气体名称" prop="name">
- <el-input
- v-model="queryParams.name"
- placeholder="请输入标准气体名称"
- clearable
- @keyup.enter.native="handleQuery"
- />
- </el-form-item>
- <el-form-item>
- <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
- </el-form-item>
- </el-form>
- <el-row :gutter="10" class="mb8">
- <el-col :span="1.5">
- <el-button
- type="primary"
- plain
- icon="el-icon-plus"
- size="mini"
- @click="handleAdd"
- v-hasPermi="['check:standardgases:add']"
- >新增</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="success"
- plain
- icon="el-icon-edit"
- size="mini"
- :disabled="single"
- @click="handleUpdate"
- v-hasPermi="['check:standardgases:edit']"
- >修改</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="danger"
- plain
- icon="el-icon-delete"
- size="mini"
- :disabled="multiple"
- @click="handleDelete"
- v-hasPermi="['check:standardgases:remove']"
- >删除</el-button>
- </el-col>
- <el-col :span="1.5">
- <el-button
- type="warning"
- plain
- icon="el-icon-download"
- size="mini"
- @click="handleExport"
- v-hasPermi="['check:standardgases:export']"
- >导出</el-button>
- </el-col>
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
- </el-row>
- <el-table v-loading="loading" :data="standardgasesList" @selection-change="handleSelectionChange" :height="clientHeight" border>
- <el-table-column type="selection" width="55" align="center" />
- <el-table-column label="标准气体证书编号" align="center" prop="code" />
- <el-table-column label="标准气体名称" align="center" prop="name" />
- <el-table-column label="标准气体浓度" align="center" prop="concentration" />
- <el-table-column label="标准气体有效期" align="center" prop="lifespan" />
- <el-table-column label="生产厂家" align="center" prop="factory" />
- <el-table-column label="钢瓶编号" align="center" prop="cylinderCode" />
- <el-table-column label="备注" align="center" prop="remarks" />
- <el-table-column label="修改人" align="center" prop="updater" />
- <el-table-column label="修改时间" align="center" prop="updatedate" width="180">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.updatedate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
- <template slot-scope="scope">
- <el-button
- size="mini"
- type="text"
- icon="el-icon-edit"
- @click="handleUpdate(scope.row)"
- v-hasPermi="['check:standardgases:edit']"
- >修改</el-button>
- <el-button
- size="mini"
- type="text"
- icon="el-icon-delete"
- @click="handleDelete(scope.row)"
- v-hasPermi="['check:standardgases:remove']"
- >删除</el-button>
- </template>
- </el-table-column>
- </el-table>
- <pagination
- v-show="total>0"
- :total="total"
- :page.sync="queryParams.pageNum"
- :limit.sync="queryParams.pageSize"
- @pagination="getList"
- />
- <!-- 添加或修改标准气体对话框 -->
- <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
- <el-form ref="form" :model="form" :rules="rules" label-width="130px">
- <el-form-item label="标准气体证书编号" prop="code">
- <el-input v-model="form.code" placeholder="请输入标准气体证书编号" />
- </el-form-item>
- <el-form-item label="标准气体名称" prop="name">
- <el-input v-model="form.name" placeholder="请输入标准气体名称" />
- </el-form-item>
- <el-form-item label="标准气体浓度" prop="concentration">
- <el-input v-model="form.concentration" placeholder="请输入标准气体浓度" />
- </el-form-item>
- <el-form-item label="标准气体有效期" prop="lifespan">
- <el-input v-model="form.lifespan" placeholder="请输入标准气体有效期" />
- </el-form-item>
- <el-form-item label="生产厂家" prop="factory">
- <el-input v-model="form.factory" placeholder="请输入生产厂家" />
- </el-form-item>
- <el-form-item label="钢瓶编号" prop="cylinderCode">
- <el-input v-model="form.cylinderCode" placeholder="请输入钢瓶编号" />
- </el-form-item>
- <el-form-item label="描述" prop="remarks">
- <el-tooltip placement="top">
- <div slot="content">
- 注:请在描述中,注明该仪器的所属单位(本单位或第三方所属)。
- </div>
- <i class="el-icon-question"></i>
- </el-tooltip>
- <el-input v-model="form.remarks" placeholder="请输入描述" style="width: 97.7%"/>
- </el-form-item>
- </el-form>
- <div slot="footer" class="dialog-footer">
- <el-button type="primary" @click="submitForm">确 定</el-button>
- <el-button @click="cancel">取 消</el-button>
- </div>
- </el-dialog>
- </div>
- </template>
- <script>
- import { listStandardgases, getStandardgases, delStandardgases, addStandardgases, updateStandardgases } from "@/api/check/standardgases";
- export default {
- name: "Standardgases",
- data() {
- return {
- // 页面高度
- clientHeight:300,
- // 遮罩层
- loading: true,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: false,
- // 总条数
- total: 0,
- // 标准气体表格数据
- standardgasesList: [],
- // 弹出层标题
- title: "",
- // 是否显示弹出层
- open: false,
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 10,
- code: null,
- name: null,
- concentration: null,
- lifespan: null,
- factory: null,
- cylinderCode: null,
- remarks: null,
- deptId: null,
- createrCode: null,
- createdate: null,
- updaterCode: null,
- updatedate: null
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- }
- };
- },
- created() {
- this.getList();
- //设置表格高度对应屏幕高度
- this.$nextTick(() => {
- this.clientHeight = (document.body.clientHeight - 80) * 0.8
- });
- },
- methods: {
- /** 查询标准气体列表 */
- getList() {
- this.loading = true;
- listStandardgases(this.queryParams).then(response => {
- this.standardgasesList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- code: null,
- name: null,
- concentration: null,
- lifespan: null,
- factory: null,
- cylinderCode: null,
- remarks: null,
- deptId: null,
- delFlag: null,
- createrCode: null,
- createdate: null,
- updaterCode: null,
- updatedate: null
- };
- this.resetForm("form");
- },
- /** 搜索按钮操作 */
- handleQuery() {
- this.queryParams.pageNum = 1;
- this.getList();
- },
- /** 重置按钮操作 */
- resetQuery() {
- this.resetForm("queryForm");
- this.handleQuery();
- },
- // 多选框选中数据
- handleSelectionChange(selection) {
- this.ids = selection.map(item => item.id)
- this.single = selection.length!==1
- this.multiple = !selection.length
- },
- /** 新增按钮操作 */
- handleAdd() {
- this.reset();
- this.open = true;
- this.title = "添加标准气体";
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getStandardgases(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = "修改标准气体";
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateStandardgases(this.form).then(response => {
- this.$modal.msgSuccess("修改成功");
- this.open = false;
- this.getList();
- });
- } else {
- addStandardgases(this.form).then(response => {
- this.$modal.msgSuccess("新增成功");
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$modal.confirm('是否确认删除标准气体编号为"' + ids + '"的数据项?').then(function() {
- return delStandardgases(ids);
- }).then(() => {
- this.getList();
- this.$modal.msgSuccess("删除成功");
- }).catch(() => {});
- },
- /** 导出按钮操作 */
- handleExport() {
- this.download('check/standardgases/export', {
- ...this.queryParams
- }, `standardgases_${new Date().getTime()}.xlsx`)
- }
- }
- };
- </script>
|