123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- <template>
- <el-dialog :title="$t('检验记录')" :visible.sync="visible" width="1200px" append-to-body>
- <el-table v-loading="loading" :data="checkList" @selection-change="handleSelectionChange" :height="clientHeight" border>
- <!-- <el-table-column :label="$t('创建人')" align="center" prop="createrCode" :show-overflow-tooltip="true"/>-->
- <el-table-column :label="$t('检验单位')" align="center" prop="checkUnit" />
- <el-table-column :label="$t('定期检验日期')" align="center" prop="warnDate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.warnDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('下次定期检验日期')" align="center" prop="nextWarnDate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.nextWarnDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column :label="$t('定期检验报告编号')" align="center" prop="reportNo" />
- <el-table-column v-if="[1,2].includes(this.devType)" :label="$t('年度检查日期')" align="center" prop="yearWarnDate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.yearWarnDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="[1,2].includes(this.devType)" :label="$t('年度检查结论')" align="center" prop="checkConclusion" />
- <el-table-column v-if="[1,2].includes(this.devType)" :label="$t('下次年度检查日期')" align="center" prop="yearNextWarnDate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.yearNextWarnDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="[1,2].includes(this.devType)" :label="$t('年度检查报告编号')" align="center" prop="yearReportNo" />
- <el-table-column v-if="this.devType == 4" :label="$t('本次外部检测日期')" align="center" prop="outWarnDate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.outWarnDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="this.devType == 4" :label="$t('下次外部检测日期')" align="center" prop="outNextWarnDate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.outNextWarnDate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <el-table-column v-if="this.devType == 4" :label="$t('外部检验结论')" align="center" prop="outCheckConclusion" />
- <el-table-column v-if="this.devType == 4" :label="$t('外部检验编号')" align="center" prop="outReportNo" />
- <el-table-column :label="$t('安全等级')" align="center" prop="safeClass" />
- <el-table-column :label="$t('录入时间')" align="center" prop="createdate" width="100">
- <template slot-scope="scope">
- <span>{{ parseTime(scope.row.createdate, '{y}-{m}-{d}') }}</span>
- </template>
- </el-table-column>
- <!-- <el-table-column :label="$t('操作')" align="center" fixed="right" width="120" class-name="small-padding fixed-width">-->
- <!-- <template slot-scope="scope">-->
- <!-- <el-button-->
- <!-- size="mini"-->
- <!-- type="text"-->
- <!-- icon="el-icon-edit"-->
- <!-- @click="handleUpdate(scope.row)"-->
- <!-- >{{ $t('修改') }}</el-button>-->
- <!-- <el-button-->
- <!-- size="mini"-->
- <!-- type="text"-->
- <!-- icon="el-icon-delete"-->
- <!-- @click="handleDelete(scope.row)"-->
- <!-- >{{ $t('删除') }}</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>
- </template>
- <script>
- import {addCheck, delCheck, exportCheck, getCheck, importTemplate, listCheck, updateCheck} from "@/api/sems/check";
- import {treeselect} from "@/api/system/dept";
- import {getToken} from "@/utils/auth";
- import Treeselect from "@riophae/vue-treeselect";
- import "@riophae/vue-treeselect/dist/vue-treeselect.css";
- export default {
- name: "Check",
- components: { Treeselect },
- data() {
- return {
- devType: null,
- // 遮罩层
- loading: true,
- visible: false,
- // 选中数组
- ids: [],
- // 非单个禁用
- single: true,
- // 非多个禁用
- multiple: true,
- // 显示搜索条件
- showSearch: false,
- // 总条数
- total: 0,
- // 特种设备检验记录表格数据
- checkList: [],
- // 弹出层标题
- title: "",
- // 部门树选项
- deptOptions: undefined,
- clientHeight:300,
- // 是否显示弹出层
- open: false,
- // 用户导入参数
- upload: {
- // 是否显示弹出层(用户导入)
- open: false,
- // 弹出层标题(用户导入)
- title: "",
- // 是否禁用上传
- isUploading: false,
- // 是否更新已经存在的用户数据
- updateSupport: 0,
- // 设置上传的请求头部
- headers: { Authorization: "Bearer " + getToken() },
- // 上传的地址
- url: process.env.VUE_APP_BASE_API + "/sems/check/importData"
- },
- // 查询参数
- queryParams: {
- pageNum: 1,
- pageSize: 20,
- createrCode: null,
- createdate: null,
- updaterCode: null,
- updatedate: null,
- checkUnit: null,
- warnDate: null,
- nextWarnDate: null,
- reportNo: null,
- yearWarnDate: null,
- checkConclusion: null,
- yearNextWarnDate: null,
- yearReportNo: null,
- outWarnDate: null,
- outNextWarnDate: null,
- outCheckConclusion: null,
- outReportNo: null,
- devId: null,
- devType: null,
- safeClass: null
- },
- // 表单参数
- form: {},
- // 表单校验
- rules: {
- }
- };
- },
- watch: {
- // 根据名称筛选部门树
- deptName(val) {
- this.$refs.tree.filter(val);
- }
- },
- created() {
- //设置表格高度对应屏幕高度
- this.$nextTick(() => {
- this.clientHeight = document.body.clientHeight -250
- })
- this.getTreeselect();
- },
- methods: {
- init (row, type) {
- this.visible = true
- this.queryParams.devId = row.id
- this.queryParams.devType = type
- this.devType = type
- console.log(this.devType)
- this.loading = true;
- this.$nextTick(() => {
- console.log(this.queryParams)
- listCheck(this.queryParams).then(response => {
- this.checkList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- })
- },
- /** 查询特种设备检验记录列表 */
- getList() {
- this.loading = true;
- listCheck(this.queryParams).then(response => {
- this.checkList = response.rows;
- this.total = response.total;
- this.loading = false;
- });
- },
- /** 查询部门下拉树结构 */
- getTreeselect() {
- treeselect().then(response => {
- this.deptOptions = response.data;
- });
- },
- // 取消按钮
- cancel() {
- this.open = false;
- this.reset();
- },
- // 表单重置
- reset() {
- this.form = {
- id: null,
- delFlag: null,
- createrCode: null,
- createdate: null,
- updaterCode: null,
- updatedate: null,
- checkUnit: null,
- warnDate: null,
- nextWarnDate: null,
- reportNo: null,
- yearWarnDate: null,
- checkConclusion: null,
- yearNextWarnDate: null,
- yearReportNo: null,
- outWarnDate: null,
- outNextWarnDate: null,
- outCheckConclusion: null,
- outReportNo: null,
- devId: null,
- devType: null,
- safeClass: 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 =this.$t('添加')+this.$t('特种设备') +this.$t('空格')+this.$t('检验记录');
- },
- /** 修改按钮操作 */
- handleUpdate(row) {
- this.reset();
- const id = row.id || this.ids
- getCheck(id).then(response => {
- this.form = response.data;
- this.open = true;
- this.title = this.$t('修改')+this.$t('特种设备') +this.$t('空格')+this.$t('检验记录');
- });
- },
- /** 提交按钮 */
- submitForm() {
- this.$refs["form"].validate(valid => {
- if (valid) {
- if (this.form.id != null) {
- updateCheck(this.form).then(response => {
- this.msgSuccess(this.$t('修改成功'));
- this.open = false;
- this.getList();
- });
- } else {
- addCheck(this.form).then(response => {
- this.msgSuccess(this.$t('新增成功'));
- this.open = false;
- this.getList();
- });
- }
- }
- });
- },
- /** 删除按钮操作 */
- handleDelete(row) {
- const ids = row.id || this.ids;
- this.$confirm(this.$t('是否确认删除?'), this.$t('警告'), {
- confirmButtonText: this.$t('确定'),
- cancelButtonText: this.$t('取消'),
- type: "warning"
- }).then(function() {
- return delCheck(ids);
- }).then(() => {
- this.getList();
- this.msgSuccess(this.$t('删除成功'));
- })
- },
- /** 导出按钮操作 */
- handleExport() {
- const queryParams = this.queryParams;
- this.$confirm(this.$t('是否确认导出所有特种设备检验记录数据项?'), this.$t('警告'), {
- confirmButtonText: this.$t('确定'),
- cancelButtonText: this.$t('取消'),
- type: "warning"
- }).then(function() {
- return exportCheck(queryParams);
- }).then(response => {
- this.download(response.msg);
- })
- },
- /** 导入按钮操作 */
- handleImport() {
- this.upload.title = this.$t('用户导入');
- this.upload.open = true;
- },
- /** 下载模板操作 */
- importTemplate() {
- importTemplate().then(response => {
- this.download(response.msg);
- });
- },
- // 文件上传中处理
- handleFileUploadProgress(event, file, fileList) {
- this.upload.isUploading = true;
- },
- // 文件上传成功处理
- handleFileSuccess(response, file, fileList) {
- this.upload.open = false;
- this.upload.isUploading = false;
- this.$refs.upload.clearFiles();
- this.$alert(response.msg, this.$t('导入结果'), { dangerouslyUseHTMLString: true });
- this.getList();
- },
- // 提交上传文件
- submitFileForm() {
- this.$refs.upload.submit();
- }
- }
- };
- </script>
|