|
@@ -45,7 +45,8 @@
|
|
|
size="mini"
|
|
|
@click="handleAdd"
|
|
|
v-hasPermi="['gas:otherEngine:add']"
|
|
|
- >新增</el-button>
|
|
|
+ >新增
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
|
|
|
<el-col :span="1.5">
|
|
@@ -57,40 +58,42 @@
|
|
|
:disabled="multiple"
|
|
|
@click="handleDelete"
|
|
|
v-hasPermi="['gas:otherEngine:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</el-col>
|
|
|
-<!-- <el-col :span="1.5">-->
|
|
|
-<!-- <el-button-->
|
|
|
-<!-- type="warning"-->
|
|
|
-<!-- plain-->
|
|
|
-<!-- icon="el-icon-download"-->
|
|
|
-<!-- size="mini"-->
|
|
|
-<!-- :loading="exportLoading"-->
|
|
|
-<!-- @click="handleExport"-->
|
|
|
-<!-- v-hasPermi="['gas:otherEngine:export']"-->
|
|
|
-<!-- >导出</el-button>-->
|
|
|
-<!-- </el-col>-->
|
|
|
+ <!-- <el-col :span="1.5">-->
|
|
|
+ <!-- <el-button-->
|
|
|
+ <!-- type="warning"-->
|
|
|
+ <!-- plain-->
|
|
|
+ <!-- icon="el-icon-download"-->
|
|
|
+ <!-- size="mini"-->
|
|
|
+ <!-- :loading="exportLoading"-->
|
|
|
+ <!-- @click="handleExport"-->
|
|
|
+ <!-- v-hasPermi="['gas:otherEngine:export']"-->
|
|
|
+ <!-- >导出</el-button>-->
|
|
|
+ <!-- </el-col>-->
|
|
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="otherEngineList" @selection-change="handleSelectionChange">
|
|
|
- <el-table-column type="selection" width="55" align="center" />
|
|
|
+ <el-table-column type="selection" width="55" align="center"/>
|
|
|
<el-table-column label="工程类型" align="center" prop="engineType">
|
|
|
<template slot-scope="scope">
|
|
|
<dict-tag :options="dict.type.engine_type" :value="scope.row.engineType"/>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column label="工程名" align="center" prop="name" />
|
|
|
- <el-table-column label="工程地址" align="center" prop="address" />
|
|
|
- <el-table-column label="创建时间" align="center" prop="time" />
|
|
|
- <el-table-column label="修改时间" align="center" prop="updateTime" />
|
|
|
- <el-table-column label="照片" align="center" prop="photo" >
|
|
|
+ <el-table-column label="工程名" align="center" prop="name"/>
|
|
|
+ <el-table-column label="工程地址" align="center" prop="address"/>
|
|
|
+ <el-table-column label="创建时间" align="center" prop="time"/>
|
|
|
+ <el-table-column label="修改时间" align="center" prop="updateTime"/>
|
|
|
+ <el-table-column label="照片" align="center" prop="photo">
|
|
|
<template slot-scope="scope">
|
|
|
<el-image
|
|
|
v-if="scope.row.photo.length> 0 && (scope.row.photo[0].substring(scope.row.photo[0].lastIndexOf('.')+1)!='mp4')"
|
|
|
style="width: 100px; height: 100px"
|
|
|
:src="scope.row.photo[0]"
|
|
|
- :preview-src-list="scope.row.photo">
|
|
|
+ :preview-src-list="scope.row.photo"
|
|
|
+ >
|
|
|
</el-image>
|
|
|
<video
|
|
|
v-else
|
|
@@ -109,19 +112,29 @@
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template slot-scope="scope">
|
|
|
<el-button
|
|
|
+ v-show="scope.row.status == '001'"
|
|
|
+ size="mini"
|
|
|
+ type="text"
|
|
|
+ icon="el-icon-download"
|
|
|
+ @click="imgDownload(scope.row)"
|
|
|
+ >导出图片
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-edit"
|
|
|
@click="handleUpdate(scope.row)"
|
|
|
v-hasPermi="['gas:otherEngine:edit']"
|
|
|
- >修改</el-button>
|
|
|
+ >修改
|
|
|
+ </el-button>
|
|
|
<el-button
|
|
|
size="mini"
|
|
|
type="text"
|
|
|
icon="el-icon-delete"
|
|
|
@click="handleDelete(scope.row)"
|
|
|
v-hasPermi="['gas:otherEngine:remove']"
|
|
|
- >删除</el-button>
|
|
|
+ >删除
|
|
|
+ </el-button>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
@@ -137,7 +150,7 @@
|
|
|
<!-- 添加或修改其他工程对话框 -->
|
|
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
|
|
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
|
|
|
- <el-form-item label="工程类型" prop="engineType" >
|
|
|
+ <el-form-item label="工程类型" prop="engineType">
|
|
|
<el-select v-model="form.engineType" placeholder="请选择工程类型">
|
|
|
<el-option
|
|
|
v-for="dict in dict.type.engine_type"
|
|
@@ -148,16 +161,16 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="工程名" prop="name">
|
|
|
- <el-input v-model="form.name" placeholder="请输入工程名" />
|
|
|
+ <el-input v-model="form.name" placeholder="请输入工程名"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="工程地址" prop="address">
|
|
|
- <el-input v-model="form.address" placeholder="请输入工程地址" />
|
|
|
+ <el-input v-model="form.address" placeholder="请输入工程地址"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="照片">
|
|
|
<imageUpload v-model="form.photo"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="备注" prop="remark">
|
|
|
- <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
|
|
|
+ <el-input v-model="form.remark" type="textarea" placeholder="请输入内容"/>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="是否完工" prop="status">
|
|
|
<el-radio-group v-model="form.status">
|
|
@@ -165,7 +178,8 @@
|
|
|
v-for="dict in dict.type.engine_status"
|
|
|
:key="dict.value"
|
|
|
:label="dict.value"
|
|
|
- >{{dict.label}}</el-radio>
|
|
|
+ >{{ dict.label }}
|
|
|
+ </el-radio>
|
|
|
</el-radio-group>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
@@ -178,11 +192,20 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listOtherEngine, getOtherEngine, delOtherEngine, addOtherEngine, updateOtherEngine } from "@/api/gas/otherEngine";
|
|
|
+import {
|
|
|
+ listOtherEngine,
|
|
|
+ getOtherEngine,
|
|
|
+ delOtherEngine,
|
|
|
+ addOtherEngine,
|
|
|
+ updateOtherEngine
|
|
|
+} from '@/api/gas/otherEngine'
|
|
|
+import JSZip from 'jszip'
|
|
|
+import FileSaver from 'file-saver'
|
|
|
+import axios from 'axios'
|
|
|
|
|
|
export default {
|
|
|
- name: "OtherEngine",
|
|
|
- dicts: ['engine_status','engine_type'],
|
|
|
+ name: 'OtherEngine',
|
|
|
+ dicts: ['engine_status', 'engine_type'],
|
|
|
data() {
|
|
|
return {
|
|
|
// 按钮loading
|
|
@@ -204,7 +227,7 @@ export default {
|
|
|
// 其他工程表格数据
|
|
|
otherEngineList: [],
|
|
|
// 弹出层标题
|
|
|
- title: "",
|
|
|
+ title: '',
|
|
|
// 是否显示弹出层
|
|
|
open: false,
|
|
|
// 查询参数
|
|
@@ -213,45 +236,103 @@ export default {
|
|
|
pageSize: 10,
|
|
|
name: undefined,
|
|
|
status: undefined,
|
|
|
- engineType: undefined,
|
|
|
+ engineType: undefined
|
|
|
},
|
|
|
// 表单参数
|
|
|
form: {},
|
|
|
// 表单校验
|
|
|
rules: {
|
|
|
engineType: [
|
|
|
- { required: true, message: "请选择工程类型", trigger: "blur" }
|
|
|
+ { required: true, message: '请选择工程类型', trigger: 'blur' }
|
|
|
],
|
|
|
name: [
|
|
|
- { required: true, message: "工程名不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: '工程名不能为空', trigger: 'blur' }
|
|
|
],
|
|
|
address: [
|
|
|
- { required: true, message: "工程地址不能为空", trigger: "blur" }
|
|
|
+ { required: true, message: '工程地址不能为空', trigger: 'blur' }
|
|
|
],
|
|
|
status: [
|
|
|
- { required: true, message: "是否完工不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
+ { required: true, message: '是否完工不能为空', trigger: 'blur' }
|
|
|
+ ]
|
|
|
}
|
|
|
- };
|
|
|
+ }
|
|
|
},
|
|
|
created() {
|
|
|
- this.getList();
|
|
|
+ this.getList()
|
|
|
},
|
|
|
methods: {
|
|
|
+
|
|
|
+// 获取文件blob
|
|
|
+ getFile(url) {
|
|
|
+ return new Promise((resolve, reject) => {
|
|
|
+ url = url.split("myhuaweicloud.com")[1]
|
|
|
+ axios(url,{
|
|
|
+ method: 'get',
|
|
|
+ // responseType: 'blob'
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ resolve(res.data)
|
|
|
+ })
|
|
|
+ .catch(err => {
|
|
|
+ reject(err.toString())
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 图片批量处理成压缩包后下载
|
|
|
+ batchPictureZip(data,fileName) {
|
|
|
+ const zip = new JSZip()
|
|
|
+ const promises = []
|
|
|
+ const cache = {}
|
|
|
+ this.$message('正在下载,请耐心等待...')
|
|
|
+ for (const item of data) {
|
|
|
+ const promise = this.getFile(item.url).then(data => {
|
|
|
+ // 下载文件, 并存成ArrayBuffer对象
|
|
|
+ zip.file(item.fileName, data, { binary: true }) // 逐个添加文件
|
|
|
+ cache[item.fileName] = data
|
|
|
+ })
|
|
|
+ promises.push(promise)
|
|
|
+ }
|
|
|
+ Promise.all(promises)
|
|
|
+ .then(() => {
|
|
|
+ zip.generateAsync({ type: 'blob' }).then((content) => {
|
|
|
+ // 生成二进制流
|
|
|
+ FileSaver.saveAs(content, fileName) // 利用file-saver保存文件 自定义文件名
|
|
|
+ this.$message.success('下载成功')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ .catch(res => {
|
|
|
+ this.$message.error('下载失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 下载附件
|
|
|
+ imgDownload(data) {
|
|
|
+ console.log(data)
|
|
|
+ let ls = []
|
|
|
+ for (let i = 0; i < data.photo.length; i++) {
|
|
|
+ let a = {
|
|
|
+ fileName: data.photo[i].split("/file/")[1],
|
|
|
+ url: data.photo[i]
|
|
|
+ }
|
|
|
+ ls.push(a)
|
|
|
+ }
|
|
|
+ this.batchPictureZip(ls,data.name)
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
/** 查询其他工程列表 */
|
|
|
getList() {
|
|
|
- this.loading = true;
|
|
|
+ this.loading = true
|
|
|
listOtherEngine(this.queryParams).then(response => {
|
|
|
- this.otherEngineList = response.rows;
|
|
|
- console.log(response.rows);
|
|
|
- this.total = response.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ this.otherEngineList = response.rows
|
|
|
+ console.log(response.rows)
|
|
|
+ this.total = response.total
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
// 取消按钮
|
|
|
cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
+ this.open = false
|
|
|
+ this.reset()
|
|
|
},
|
|
|
// 表单重置
|
|
|
reset() {
|
|
@@ -261,98 +342,98 @@ export default {
|
|
|
address: undefined,
|
|
|
remark: undefined,
|
|
|
photo: undefined,
|
|
|
- status: "0",
|
|
|
+ status: '0',
|
|
|
delFlag: undefined,
|
|
|
createBy: undefined,
|
|
|
createTime: undefined,
|
|
|
updateBy: undefined,
|
|
|
updateTime: undefined
|
|
|
- };
|
|
|
- this.resetForm("form");
|
|
|
+ }
|
|
|
+ this.resetForm('form')
|
|
|
},
|
|
|
/** 搜索按钮操作 */
|
|
|
handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
- this.getList();
|
|
|
+ this.queryParams.pageNum = 1
|
|
|
+ this.getList()
|
|
|
},
|
|
|
/** 重置按钮操作 */
|
|
|
resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
+ this.resetForm('queryForm')
|
|
|
+ this.handleQuery()
|
|
|
},
|
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(selection) {
|
|
|
this.ids = selection.map(item => item.id)
|
|
|
- this.single = selection.length!==1
|
|
|
+ this.single = selection.length !== 1
|
|
|
this.multiple = !selection.length
|
|
|
},
|
|
|
/** 新增按钮操作 */
|
|
|
handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "添加其他工程";
|
|
|
+ this.reset()
|
|
|
+ this.open = true
|
|
|
+ this.title = '添加其他工程'
|
|
|
},
|
|
|
/** 修改按钮操作 */
|
|
|
handleUpdate(row) {
|
|
|
- this.loading = true;
|
|
|
- this.reset();
|
|
|
+ this.loading = true
|
|
|
+ this.reset()
|
|
|
const id = row.id || this.ids
|
|
|
getOtherEngine(id).then(response => {
|
|
|
- this.loading = false;
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改其他工程";
|
|
|
- });
|
|
|
+ this.loading = false
|
|
|
+ this.form = response.data
|
|
|
+ this.open = true
|
|
|
+ this.title = '修改其他工程'
|
|
|
+ })
|
|
|
},
|
|
|
/** 提交按钮 */
|
|
|
submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
+ this.$refs['form'].validate(valid => {
|
|
|
if (valid) {
|
|
|
- this.buttonLoading = true;
|
|
|
+ this.buttonLoading = true
|
|
|
if (this.form.id != null) {
|
|
|
- if (typeof this.form.photo==='string'){
|
|
|
+ if (typeof this.form.photo === 'string') {
|
|
|
this.form.photo = this.form.photo.split(',')
|
|
|
}
|
|
|
updateOtherEngine(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
+ this.$modal.msgSuccess('修改成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
}).finally(() => {
|
|
|
- this.buttonLoading = false;
|
|
|
- });
|
|
|
+ this.buttonLoading = false
|
|
|
+ })
|
|
|
} else {
|
|
|
- if (this.form.photo!=null){
|
|
|
+ if (this.form.photo != null) {
|
|
|
this.form.photo = this.form.photo.split(',')
|
|
|
}
|
|
|
addOtherEngine(this.form).then(response => {
|
|
|
- this.$modal.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
+ this.$modal.msgSuccess('新增成功')
|
|
|
+ this.open = false
|
|
|
+ this.getList()
|
|
|
}).finally(() => {
|
|
|
- this.buttonLoading = false;
|
|
|
- });
|
|
|
+ this.buttonLoading = false
|
|
|
+ })
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ })
|
|
|
},
|
|
|
/** 删除按钮操作 */
|
|
|
handleDelete(row) {
|
|
|
- const ids = row.id || this.ids;
|
|
|
+ const ids = row.id || this.ids
|
|
|
this.$modal.confirm('是否确认删除其他工程编号为"' + ids + '"的数据项?').then(() => {
|
|
|
- this.loading = true;
|
|
|
- return delOtherEngine(ids);
|
|
|
+ this.loading = true
|
|
|
+ return delOtherEngine(ids)
|
|
|
}).then(() => {
|
|
|
- this.loading = false;
|
|
|
- this.getList();
|
|
|
- this.$modal.msgSuccess("删除成功");
|
|
|
+ this.loading = false
|
|
|
+ this.getList()
|
|
|
+ this.$modal.msgSuccess('删除成功')
|
|
|
}).finally(() => {
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ this.loading = false
|
|
|
+ })
|
|
|
},
|
|
|
/** 导出按钮操作 */
|
|
|
handleExport() {
|
|
|
- this.$download.excel('/gas/otherEngine/export', this.queryParams);
|
|
|
+ this.$download.excel('/gas/otherEngine/export', this.queryParams)
|
|
|
}
|
|
|
}
|
|
|
-};
|
|
|
+}
|
|
|
</script>
|