6 changed files with 2893 additions and 6 deletions
File diff suppressed because it is too large
@ -0,0 +1,952 @@ |
|||||
|
<template> |
||||
|
<div class="g-main"> |
||||
|
<div v-show="true"> |
||||
|
<div class="m-search" ref="ref_search"> |
||||
|
<el-form |
||||
|
:inline="true" |
||||
|
ref="ref_searchform" |
||||
|
label-width="100px" |
||||
|
> |
||||
|
<div> |
||||
|
<el-form-item |
||||
|
v-for="item in searchParams" |
||||
|
:key="'serach' + item.keyName" |
||||
|
:label="item.field" |
||||
|
:prop="item.keyName" |
||||
|
> |
||||
|
<template v-if="item.type == 'input'"> |
||||
|
<el-input |
||||
|
v-model="item.value" |
||||
|
size="small" |
||||
|
class="u-item-width-normal" |
||||
|
clearable |
||||
|
:placeholder="item.placeholder || '请输入'" |
||||
|
> |
||||
|
</el-input> |
||||
|
</template> |
||||
|
<template v-else-if="item.type == 'select'"> |
||||
|
<el-select |
||||
|
v-model="item.value" |
||||
|
:placeholder="item.placeholder || '请选择'" |
||||
|
size="small" |
||||
|
clearable |
||||
|
class="u-item-width-normal" |
||||
|
:multiple="item.multiple || false" |
||||
|
> |
||||
|
<el-option |
||||
|
v-for="item in item.optionList" |
||||
|
:key=" |
||||
|
'serach' + item.keyName + item.value |
||||
|
" |
||||
|
:label="item.label" |
||||
|
:value="item.value" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
</template> |
||||
|
<template v-else-if="item.type == 'cascader'"> |
||||
|
<el-cascader |
||||
|
v-model="item.value" |
||||
|
:placeholder="item.placeholder || '请选择'" |
||||
|
:options="item.optionList" |
||||
|
:props="item.optionProps" |
||||
|
:show-all-levels="false" |
||||
|
size="small" |
||||
|
clearable |
||||
|
class="u-item-width-normal" |
||||
|
@change=" |
||||
|
(e) => handleChangeCascader(e, item) |
||||
|
" |
||||
|
> |
||||
|
</el-cascader> |
||||
|
</template> |
||||
|
<template v-if="item.type == 'date-range'"> |
||||
|
<el-date-picker |
||||
|
v-model="item.supValues[0]" |
||||
|
type="date" |
||||
|
placeholder="开始时间" |
||||
|
style="width: 150px" |
||||
|
value-format="yyyy-MM-dd" |
||||
|
clearable |
||||
|
> |
||||
|
</el-date-picker> |
||||
|
<span |
||||
|
style=" |
||||
|
display: inline-block; |
||||
|
margin: 0 10px; |
||||
|
" |
||||
|
>至</span |
||||
|
> |
||||
|
<el-date-picker |
||||
|
v-model="item.supValues[1]" |
||||
|
type="date" |
||||
|
placeholder="结束时间" |
||||
|
style="width: 150px" |
||||
|
value-format="yyyy-MM-dd" |
||||
|
clearable |
||||
|
> |
||||
|
</el-date-picker> |
||||
|
</template> |
||||
|
<template v-if="item.type == 'date'"> |
||||
|
<el-date-picker |
||||
|
v-model="item.value" |
||||
|
type="date" |
||||
|
size="small" |
||||
|
placeholder="" |
||||
|
value-format="yyyy-MM-dd" |
||||
|
class="u-item-width-normal" |
||||
|
clearable |
||||
|
> |
||||
|
</el-date-picker> |
||||
|
</template> |
||||
|
</el-form-item> |
||||
|
|
||||
|
<div class="u-search-btn"> |
||||
|
<el-button |
||||
|
size="small" |
||||
|
class="diy-button--white" |
||||
|
@click="resetSearch" |
||||
|
>重置</el-button |
||||
|
><el-button |
||||
|
size="small" |
||||
|
class="diy-button--blue" |
||||
|
@click="handleSearch" |
||||
|
>查询</el-button |
||||
|
> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-form> |
||||
|
</div> |
||||
|
|
||||
|
<div |
||||
|
class="m-table" |
||||
|
:style="{ height: maxTableHeight + 130 + 'px' }" |
||||
|
> |
||||
|
<div class="u-table-btn1"> |
||||
|
<el-button |
||||
|
class="diy-button--blue" |
||||
|
v-if="addUrl" |
||||
|
size="small" |
||||
|
@click="handleAdd" |
||||
|
>新增</el-button |
||||
|
> |
||||
|
|
||||
|
<el-button |
||||
|
v-if="mubanUrl" |
||||
|
class="diy-button--white" |
||||
|
size="small" |
||||
|
@click="handleExportModule('room')" |
||||
|
>下载模板</el-button |
||||
|
> |
||||
|
|
||||
|
<el-upload |
||||
|
:headers="$getElUploadHeaders()" |
||||
|
v-if="importUrl" |
||||
|
ref="upload" |
||||
|
class="upload-btn" |
||||
|
action="uploadUlr" |
||||
|
:limit="1" |
||||
|
:accept="'.xls,.xlsx'" |
||||
|
:with-credentials="true" |
||||
|
:show-file-list="false" |
||||
|
:auto-upload="true" |
||||
|
:before-upload="beforeExcelUpload" |
||||
|
:http-request="uploadHttpRequest" |
||||
|
style="margin-left: 10px" |
||||
|
> |
||||
|
<el-button size="small" class="diy-button--white" |
||||
|
>导入</el-button |
||||
|
> |
||||
|
</el-upload> |
||||
|
|
||||
|
<el-button |
||||
|
v-if="exportUrl" |
||||
|
@click="handleExport" |
||||
|
class="diy-button--white" |
||||
|
size="small" |
||||
|
style="margin-left: 10px" |
||||
|
>导出</el-button |
||||
|
> |
||||
|
|
||||
|
<el-button |
||||
|
v-if="qrCodeExportUrl" |
||||
|
@click="handleExportQrcode" |
||||
|
class="diy-button--white" |
||||
|
size="small" |
||||
|
>导出员工登记码</el-button |
||||
|
> |
||||
|
|
||||
|
<el-button |
||||
|
v-if="delMultipleUrl" |
||||
|
size="small" |
||||
|
@click="handleDeleteMultiple" |
||||
|
class="diy-button--white" |
||||
|
>批量删除</el-button |
||||
|
> |
||||
|
|
||||
|
<slot |
||||
|
name="listBtn" |
||||
|
v-bind:multipleSelection="multipleSelection" |
||||
|
></slot> |
||||
|
</div> |
||||
|
|
||||
|
<div class="m-table-item"> |
||||
|
<el-table |
||||
|
ref="ref_table" |
||||
|
:data="tableData" |
||||
|
border |
||||
|
class="resi-table" |
||||
|
style="width: 100%" |
||||
|
:height="maxTableHeight" |
||||
|
@selection-change="handleSelectionChange" |
||||
|
> |
||||
|
<template |
||||
|
v-for="(item, index) in tableParams" |
||||
|
:prop="item.keyName" |
||||
|
> |
||||
|
<el-table-column |
||||
|
v-if="item.type == 'selection'" |
||||
|
:key="'table-selection' + index" |
||||
|
type="selection" |
||||
|
align="center" |
||||
|
width="50" |
||||
|
/> |
||||
|
|
||||
|
<el-table-column |
||||
|
v-if="item.type == 'no'" |
||||
|
:key="'table-no' + item.keyName" |
||||
|
:label="item.field" |
||||
|
fixed="left" |
||||
|
type="index" |
||||
|
align="center" |
||||
|
width="50" |
||||
|
/> |
||||
|
|
||||
|
<el-table-column |
||||
|
v-else-if="item.type == 'text'" |
||||
|
:key="'table' + item.keyName" |
||||
|
:prop="item.keyName" |
||||
|
:label="item.field" |
||||
|
align="center" |
||||
|
:width="item.width || ''" |
||||
|
:show-overflow-tooltip="true" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
v-else-if="item.type == 'array'" |
||||
|
:key="'table-array' + item.keyName" |
||||
|
:prop="item.keyName" |
||||
|
:label="item.field" |
||||
|
align="center" |
||||
|
:width="item.width || ''" |
||||
|
:show-overflow-tooltip="true" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
{{ |
||||
|
scope.row[item.keyName].join( |
||||
|
item.arrayDiv || "," |
||||
|
) |
||||
|
}} |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</template> |
||||
|
|
||||
|
<el-table-column |
||||
|
v-if="operateCol" |
||||
|
fixed="right" |
||||
|
label="操作" |
||||
|
align="center" |
||||
|
width="200" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<slot |
||||
|
name="listBtnbefore" |
||||
|
v-bind:item="scope.row" |
||||
|
></slot> |
||||
|
<el-button |
||||
|
v-if="infoUrl && infoAuth(scope.row)" |
||||
|
@click="handleWatch(scope.row)" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
class=".div-table-button--detail" |
||||
|
>查看</el-button |
||||
|
> |
||||
|
<el-button |
||||
|
v-if="editUrl && editAuth(scope.row)" |
||||
|
@click="handleEdit(scope.row)" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
class="div-table-button--edit" |
||||
|
>{{ editBtnName(scope.row) }}</el-button |
||||
|
> |
||||
|
<el-popconfirm |
||||
|
v-if="delUrl && delAuth(scope.row)" |
||||
|
title="删除之后无法回复,确认删除?" |
||||
|
@onConfirm=" |
||||
|
handleDelete(scope.row, scope.$index) |
||||
|
" |
||||
|
@confirm=" |
||||
|
handleDelete(scope.row, scope.$index) |
||||
|
" |
||||
|
> |
||||
|
<el-button |
||||
|
slot="reference" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
style="margin-left: 10px" |
||||
|
class="div-table-button--delete" |
||||
|
>删除</el-button |
||||
|
> |
||||
|
</el-popconfirm> |
||||
|
|
||||
|
<slot |
||||
|
name="listBtnSup" |
||||
|
v-bind:item="scope.row" |
||||
|
></slot> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
|
||||
|
<div> |
||||
|
<el-pagination |
||||
|
@size-change="handleSizeChange" |
||||
|
@current-change="handleCurrentChange" |
||||
|
:current-page.sync="pageNo" |
||||
|
:page-sizes="[20, 50, 100, 200]" |
||||
|
:page-size="parseInt(pageSize)" |
||||
|
layout="sizes, prev, pager, next, total" |
||||
|
:total="total" |
||||
|
> |
||||
|
</el-pagination> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 修改弹出框 --> |
||||
|
<el-dialog |
||||
|
v-if="formShow" |
||||
|
:visible.sync="formShow" |
||||
|
:close-on-click-modal="false" |
||||
|
:close-on-press-escape="false" |
||||
|
:title="formTitle" |
||||
|
:width="editParamsDiv ? '990px' : '670px'" |
||||
|
top="5vh" |
||||
|
class="m-dialog" |
||||
|
@closed="handleClose" |
||||
|
> |
||||
|
<edit-form |
||||
|
v-if="formShow" |
||||
|
ref="editForm" |
||||
|
:idName="idName" |
||||
|
:formId="formId" |
||||
|
:formType="formType" |
||||
|
:infoUrl="infoUrl" |
||||
|
:addUrl="addUrl" |
||||
|
:editUrl="editUrl" |
||||
|
:editParams="editParams" |
||||
|
:editParamsDiv="editParamsDiv" |
||||
|
:editElseRules="editElseRules" |
||||
|
:editFixedParams="editFixedParams" |
||||
|
:formBtnFixed="formBtnFixed" |
||||
|
:editConfig="editConfig" |
||||
|
@close="handleClose" |
||||
|
@afterEdit="handleEditSuccess" |
||||
|
> |
||||
|
<template v-slot:bottomSup="{ id, formType, info }"> |
||||
|
<slot |
||||
|
name="editBottomSup" |
||||
|
v-bind:id="id" |
||||
|
v-bind:formType="formType" |
||||
|
v-bind:info="info" |
||||
|
></slot> |
||||
|
</template> |
||||
|
<template v-slot:operateSup="{ id, formType, info }"> |
||||
|
<slot |
||||
|
name="editOperateSup" |
||||
|
v-bind:id="id" |
||||
|
v-bind:formType="formType" |
||||
|
v-bind:info="info" |
||||
|
></slot> |
||||
|
</template> |
||||
|
</edit-form> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
import { mapGetters } from "vuex"; |
||||
|
import axios from "axios"; |
||||
|
import editForm from "./cpts/edit"; |
||||
|
import nextTick from "dai-js/tools/nextTick"; |
||||
|
|
||||
|
export default { |
||||
|
components: { editForm }, |
||||
|
|
||||
|
props: { |
||||
|
searchParams: { |
||||
|
type: Array, |
||||
|
default: () => [], |
||||
|
}, |
||||
|
searchUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
|
||||
|
tableParams: { |
||||
|
type: Array, |
||||
|
default: () => [], |
||||
|
}, |
||||
|
|
||||
|
tableUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
|
||||
|
addUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
editUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
delUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
delMultipleUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
infoUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
exportUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
qrCodeExportUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
importUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
mubanUrl: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
|
||||
|
infoAuth: { |
||||
|
type: Function, |
||||
|
default: () => true, |
||||
|
}, |
||||
|
editAuth: { |
||||
|
type: Function, |
||||
|
default: () => true, |
||||
|
}, |
||||
|
editBtnName: { |
||||
|
type: Function, |
||||
|
default: () => "修改", |
||||
|
}, |
||||
|
delAuth: { |
||||
|
type: Function, |
||||
|
default: () => true, |
||||
|
}, |
||||
|
|
||||
|
editParams: { |
||||
|
type: Array, |
||||
|
default: () => [], |
||||
|
}, |
||||
|
editElseRules: { |
||||
|
type: Object, |
||||
|
default: () => ({}), |
||||
|
}, |
||||
|
editConfig: { |
||||
|
type: Object, |
||||
|
default: () => ({}), |
||||
|
}, |
||||
|
editFixedParams: { |
||||
|
type: Object, |
||||
|
default: () => ({}), |
||||
|
}, |
||||
|
editParamsDiv: { |
||||
|
type: Number, |
||||
|
default: 0, |
||||
|
}, |
||||
|
|
||||
|
idName: { |
||||
|
type: String, |
||||
|
default: "id", |
||||
|
}, |
||||
|
|
||||
|
formBtnFixed: { |
||||
|
type: Boolean, |
||||
|
default: true, |
||||
|
}, |
||||
|
|
||||
|
operateCol: { |
||||
|
type: Boolean, |
||||
|
default: true, |
||||
|
}, |
||||
|
|
||||
|
cookTableData: { |
||||
|
type: Function, |
||||
|
default: (val) => val, |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
tableData: [], |
||||
|
|
||||
|
pageNo: 1, |
||||
|
pageSize: window.localStorage.getItem("pageSize") || 20, |
||||
|
total: 1, |
||||
|
|
||||
|
formId: "", |
||||
|
formShow: false, |
||||
|
formTitle: "详情", |
||||
|
formType: "", // 列表list 新增add 修改edit 详情info |
||||
|
|
||||
|
ref_search_height: 100, |
||||
|
|
||||
|
multipleSelection: [], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
computed: { |
||||
|
maxTableHeight() { |
||||
|
const { ref_search_height } = this; |
||||
|
return this.$store.state.inIframe |
||||
|
? this.clientHeight - |
||||
|
ref_search_height - |
||||
|
265 + |
||||
|
this.iframeHeight |
||||
|
: this.clientHeight - ref_search_height - 265; |
||||
|
}, |
||||
|
...mapGetters(["clientHeight", "iframeHeight"]), |
||||
|
}, |
||||
|
|
||||
|
watch: {}, |
||||
|
|
||||
|
async mounted() { |
||||
|
console.log(this.$store.state); |
||||
|
this.user = this.$store.state.user; |
||||
|
|
||||
|
this.agencyId = this.user.agencyId; |
||||
|
|
||||
|
this.iniSearchData(); |
||||
|
|
||||
|
this.getTableData(); |
||||
|
|
||||
|
await nextTick(100); |
||||
|
this.computeSearchHeight(); |
||||
|
}, |
||||
|
|
||||
|
activated() { |
||||
|
console.log("-------------activated"); |
||||
|
this.$refs["ref_table"].doLayout(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
handleSelectionChange(val) { |
||||
|
console.log(val); |
||||
|
this.multipleSelection = val; |
||||
|
}, |
||||
|
|
||||
|
computeSearchHeight() { |
||||
|
this.ref_search_height = this.$refs["ref_search"].clientHeight; |
||||
|
console.log(this.$refs["ref_search"]); |
||||
|
console.log(this.ref_search_height); |
||||
|
}, |
||||
|
|
||||
|
iniSearchData() { |
||||
|
const { searchParams } = this; |
||||
|
searchParams.forEach((item, index) => { |
||||
|
if (item.type == "select" || item.type == "cascader") { |
||||
|
if (item.optionUrl) { |
||||
|
this.getFmOptions( |
||||
|
index, |
||||
|
item.optionUrl, |
||||
|
item.optionUrlParams || {}, |
||||
|
item.optionCook || null |
||||
|
); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async getFmOptions(index, url, params, cookFn) { |
||||
|
const { data, code, msg } = await requestPost(url, { |
||||
|
...params, |
||||
|
}); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.searchParams[index].optionList = |
||||
|
typeof cookFn == "function" ? cookFn(data) : data || []; |
||||
|
} else { |
||||
|
this.$message.error("请求检索基础数据失败!"); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleChangeCascader(vals, item) { |
||||
|
if (typeof item.handleChangeFn == "function") { |
||||
|
item.handleChangeFn(vals, item); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleSearch(val) { |
||||
|
this.pageNo = 1; |
||||
|
|
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
|
||||
|
beforeExcelUpload(file) { |
||||
|
console.log("file", file); |
||||
|
const isType = file.type === "application/vnd.ms-excel"; |
||||
|
const isTypeComputer = |
||||
|
file.type === |
||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; |
||||
|
const fileType = isType || isTypeComputer; |
||||
|
const isLt1M = file.size / 1024 / 1024 < 10; |
||||
|
if (!fileType) { |
||||
|
this.$message.error("上传文件只能是xls/xlsx格式!"); |
||||
|
} |
||||
|
|
||||
|
if (!isLt1M) { |
||||
|
this.$message.error("上传文件大小不能超过 10MB!"); |
||||
|
} |
||||
|
return fileType && isLt1M; |
||||
|
}, |
||||
|
|
||||
|
async uploadHttpRequest(file) { |
||||
|
let { importUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
this.$message({ |
||||
|
showClose: true, |
||||
|
message: "导入中,请到系统管理-导入记录中查看进度", |
||||
|
duration: 0, |
||||
|
}); |
||||
|
|
||||
|
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
||||
|
formData.append("file", file.file); //添加文件对象 |
||||
|
await this.$http |
||||
|
.post(url, formData) |
||||
|
.then((res) => { |
||||
|
console.log("res-up", res); |
||||
|
if (res.data.code == 0 && res.data.msg == "success") { |
||||
|
// this.$message.success('导入成功') |
||||
|
this.getTableData(); |
||||
|
this.$refs.upload.clearFiles(); |
||||
|
} else this.$message.error(res.data.msg); |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("失败", err); |
||||
|
file.onError(); //上传失败的文件会从文件列表中删除 |
||||
|
// this.$message.error('导入失败') |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async handleExportModule() { |
||||
|
let { mubanUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
await this.$http({ |
||||
|
method: "POST", |
||||
|
url, |
||||
|
responseType: "blob", |
||||
|
data: {}, |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
// this.download(res.data, title + '.xls') |
||||
|
if (res.headers["content-disposition"]) { |
||||
|
let fileName = window.decodeURI( |
||||
|
res.headers["content-disposition"] |
||||
|
.split(";")[1] |
||||
|
.split("=")[1] |
||||
|
); |
||||
|
console.log("filename", fileName); |
||||
|
let blob = new Blob([res.data], { |
||||
|
type: "application/vnd.ms-excel", |
||||
|
}); |
||||
|
var url = window.URL.createObjectURL(blob); |
||||
|
var aLink = document.createElement("a"); |
||||
|
aLink.style.display = "none"; |
||||
|
aLink.href = url; |
||||
|
aLink.setAttribute("download", fileName); |
||||
|
document.body.appendChild(aLink); |
||||
|
aLink.click(); |
||||
|
document.body.removeChild(aLink); //下载完成移除元素 |
||||
|
window.URL.revokeObjectURL(url); //释放掉blob对象 |
||||
|
} else this.$message.error("下载失败"); |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("err", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async handleExport() { |
||||
|
const { exportUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
const { pageSize, pageNo } = this; |
||||
|
|
||||
|
axios({ |
||||
|
url: window.SITE_CONFIG["apiURL"] + url, |
||||
|
method: "post", |
||||
|
data: { |
||||
|
pageSize, |
||||
|
pageNo, |
||||
|
...this.computeFmData(), |
||||
|
}, |
||||
|
responseType: "blob", |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
let fileName = window.decodeURI( |
||||
|
res.headers["content-disposition"] |
||||
|
.split(";")[1] |
||||
|
.split("=")[1] |
||||
|
); |
||||
|
console.log("filename", fileName); |
||||
|
let blob = new Blob([res.data], { |
||||
|
type: "application/vnd.ms-excel", |
||||
|
}); |
||||
|
var url = window.URL.createObjectURL(blob); |
||||
|
var aLink = document.createElement("a"); |
||||
|
aLink.style.display = "none"; |
||||
|
aLink.href = url; |
||||
|
aLink.setAttribute("download", fileName); |
||||
|
document.body.appendChild(aLink); |
||||
|
aLink.click(); |
||||
|
document.body.removeChild(aLink); //下载完成移除元素 |
||||
|
window.URL.revokeObjectURL(url); //释放掉blob对象 |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("获取导出情失败", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
async handleExportQrcode() { |
||||
|
const { qrCodeExportUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
const { pageSize, pageNo } = this; |
||||
|
|
||||
|
axios({ |
||||
|
url: window.SITE_CONFIG["apiURL"] + url, |
||||
|
method: "post", |
||||
|
data: { |
||||
|
pageSize, |
||||
|
pageNo, |
||||
|
...this.computeFmData(), |
||||
|
}, |
||||
|
responseType: "blob", |
||||
|
}) |
||||
|
.then((res) => { |
||||
|
let fileName = window.decodeURI( |
||||
|
res.headers["content-disposition"] |
||||
|
.split(";")[1] |
||||
|
.split("=")[1] |
||||
|
); |
||||
|
console.log("filename", fileName); |
||||
|
let blob = new Blob([res.data], { |
||||
|
type: "application/vnd.ms-excel", |
||||
|
}); |
||||
|
var url = window.URL.createObjectURL(blob); |
||||
|
var aLink = document.createElement("a"); |
||||
|
aLink.style.display = "none"; |
||||
|
aLink.href = url; |
||||
|
aLink.setAttribute("download", fileName); |
||||
|
document.body.appendChild(aLink); |
||||
|
aLink.click(); |
||||
|
document.body.removeChild(aLink); //下载完成移除元素 |
||||
|
window.URL.revokeObjectURL(url); //释放掉blob对象 |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("获取导出情失败", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
handleAdd() { |
||||
|
this.formType = "add"; |
||||
|
this.formTitle = "新增"; |
||||
|
this.formShow = true; |
||||
|
}, |
||||
|
|
||||
|
handleWatch(row) { |
||||
|
const { idName } = this; |
||||
|
this.formType = "watch"; |
||||
|
this.formId = row[idName]; |
||||
|
this.formTitle = "查看"; |
||||
|
this.formShow = true; |
||||
|
}, |
||||
|
|
||||
|
handleEdit(row) { |
||||
|
const { idName } = this; |
||||
|
this.formType = "edit"; |
||||
|
this.formId = row[idName]; |
||||
|
this.formTitle = "修改"; |
||||
|
this.formShow = true; |
||||
|
}, |
||||
|
|
||||
|
handleClose() { |
||||
|
this.formShow = false; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
|
||||
|
handleEditSuccess() { |
||||
|
this.handleClose(); |
||||
|
// this.getTableData(); |
||||
|
}, |
||||
|
|
||||
|
async handleDeleteMultiple() { |
||||
|
let { delMultipleUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
const { multipleSelection, idName } = this; |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, [ |
||||
|
...multipleSelection.map((item) => item[idName]), |
||||
|
]); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.$message.success("批量删除成功!"); |
||||
|
this.getTableData(); |
||||
|
} else { |
||||
|
this.$message.error("操作失败!"); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async handleDelete(rowData, rowIndex) { |
||||
|
console.log(rowData, rowIndex); |
||||
|
let { delUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
const { tableData, idName } = this; |
||||
|
const idValue = tableData[rowIndex][idName]; |
||||
|
let param = { |
||||
|
[idName]: idValue, |
||||
|
}; |
||||
|
if (url.endsWith("/")) { |
||||
|
url += idValue; |
||||
|
} |
||||
|
if (url.endsWith("批量")) { |
||||
|
url = url.slice(0, -2); |
||||
|
param = [idValue]; |
||||
|
} |
||||
|
|
||||
|
const { data, code, msg } = await requestPost(url, param); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.$message.success("删除成功!"); |
||||
|
this.getTableData(); |
||||
|
} else { |
||||
|
this.$message.error("操作失败!"); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
computeFmData() { |
||||
|
let fmData = {}; |
||||
|
this.searchParams.forEach((item) => { |
||||
|
fmData[item.keyName] = item.value; |
||||
|
if (item.supValues) { |
||||
|
item.supValues.forEach((value, index) => { |
||||
|
fmData[item.supKeys[index]] = value; |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
return fmData; |
||||
|
}, |
||||
|
|
||||
|
refresh() { |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
|
||||
|
async getTableData() { |
||||
|
const { tableUrl: url } = this; |
||||
|
if (!url) return; |
||||
|
|
||||
|
const { pageSize, pageNo } = this; |
||||
|
const { data, code, msg } = await requestPost(url, { |
||||
|
pageSize, |
||||
|
pageNo, |
||||
|
...this.computeFmData(), |
||||
|
}); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.total = data.total || 0; |
||||
|
this.tableData = data.list ? this.cookTableData(data.list) : []; |
||||
|
} else { |
||||
|
this.$message.error(msg); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleSizeChange(val) { |
||||
|
this.pageSize = val; |
||||
|
window.localStorage.setItem("pageSize", val); |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
handleCurrentChange(val) { |
||||
|
this.pageNo = val; |
||||
|
this.getTableData(); |
||||
|
}, |
||||
|
|
||||
|
resetSearch() { |
||||
|
console.log("----------------resetSearch", this.searchParams); |
||||
|
this.searchParams.forEach((item) => { |
||||
|
if (typeof item.value == "string") { |
||||
|
item.value = ""; |
||||
|
} else if (Array.isArray(item.value)) { |
||||
|
item.value = []; |
||||
|
} |
||||
|
if (item.supValues) { |
||||
|
item.supValues = item.supValues.map((value, index) => { |
||||
|
if (typeof value == "string") { |
||||
|
return ""; |
||||
|
} else if (Array.isArray(value)) { |
||||
|
return []; |
||||
|
} |
||||
|
return value; |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import "@/assets/scss/buttonstyle.scss"; |
||||
|
@import "@/assets/scss/modules/management/list-main.scss"; |
||||
|
|
||||
|
.m-dialog { |
||||
|
/deep/ .el-dialog__body { |
||||
|
position: relative; |
||||
|
max-height: 83vh; |
||||
|
box-sizing: border-box; |
||||
|
padding: 0 0 20px !important; |
||||
|
.dialog-h-content { |
||||
|
max-height: calc(83vh - 80px); |
||||
|
box-sizing: border-box; |
||||
|
padding: 50px 80px; |
||||
|
overflow: auto; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.resi-btns { |
||||
|
margin-top: 20px; |
||||
|
text-align: center; |
||||
|
text-align: right; |
||||
|
margin-right: 16px; |
||||
|
} |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,594 @@ |
|||||
|
<template> |
||||
|
<div class="m-record"> |
||||
|
<h3>检查记录</h3> |
||||
|
<div> |
||||
|
<div class="u-table-btn1 mt10" v-if="formType == 'edit'"> |
||||
|
<el-button |
||||
|
size="small" |
||||
|
class="diy-button--blue" |
||||
|
:disabled="btnDisabled || disabled" |
||||
|
@click="handleAdd" |
||||
|
>新增</el-button |
||||
|
> |
||||
|
</div> |
||||
|
|
||||
|
<div class="m-table-item"> |
||||
|
<el-table |
||||
|
:data="tableData" |
||||
|
class="resi-table" |
||||
|
row-key="id" |
||||
|
border |
||||
|
style="width: 100%" |
||||
|
> |
||||
|
<el-table-column |
||||
|
label="序号" |
||||
|
type="index" |
||||
|
align="center" |
||||
|
width="50" |
||||
|
> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
prop="inspectTime" |
||||
|
label="检查时间" |
||||
|
align="center" |
||||
|
width="200px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-date-picker |
||||
|
v-if="scope.row.isEdit" |
||||
|
v-model="scope.row.inspectTime" |
||||
|
type="date" |
||||
|
class="input-width" |
||||
|
value-format="yyyy-MM-dd" |
||||
|
placeholder="选择日期" |
||||
|
> |
||||
|
</el-date-picker> |
||||
|
<div v-else class="div-content"> |
||||
|
{{ scope.row.inspectTime }} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
prop="inspectStaffId" |
||||
|
label="检查人员" |
||||
|
align="center" |
||||
|
width="200px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-select |
||||
|
v-if="scope.row.isEdit" |
||||
|
v-model="scope.row.inspectStaffId" |
||||
|
placeholder="请选择" |
||||
|
class="input-width" |
||||
|
@change="handleChangeStaff(scope.row)" |
||||
|
clearable |
||||
|
> |
||||
|
<el-option |
||||
|
v-for="subItem in optionStaff" |
||||
|
:key="subItem.value" |
||||
|
:label="subItem.label" |
||||
|
:value="subItem.value" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
<div v-else class="div-content"> |
||||
|
{{ scope.row.inspectStaffName }} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
prop="inspectStaffMobile" |
||||
|
label="联系电话" |
||||
|
align="center" |
||||
|
width="200px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-input |
||||
|
v-if="scope.row.isEdit" |
||||
|
type="number" |
||||
|
v-model="scope.row.inspectStaffMobile" |
||||
|
placeholder="请输入" |
||||
|
class="input-width" |
||||
|
clearable |
||||
|
disabled |
||||
|
></el-input> |
||||
|
<div v-else class="div-content"> |
||||
|
{{ scope.row.inspectStaffMobile }} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
prop="inspectResult" |
||||
|
label="检查结果" |
||||
|
align="center" |
||||
|
width="200px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-select |
||||
|
v-if="scope.row.isEdit" |
||||
|
v-model="scope.row.inspectResult" |
||||
|
placeholder="请选择" |
||||
|
class="input-width" |
||||
|
size="small" |
||||
|
clearable |
||||
|
> |
||||
|
<el-option |
||||
|
v-for="subItem in optionResult" |
||||
|
:key="subItem.value" |
||||
|
:label="subItem.label" |
||||
|
:value="subItem.value" |
||||
|
> |
||||
|
</el-option> |
||||
|
</el-select> |
||||
|
<div v-else class="div-content"> |
||||
|
{{ |
||||
|
scope.row.inspectResult == 1 |
||||
|
? "正常" |
||||
|
: "异常" |
||||
|
}} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<!-- <el-table-column |
||||
|
prop="detailed" |
||||
|
label="隐患明细" |
||||
|
align="center" |
||||
|
width="200px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-input |
||||
|
v-if="scope.row.isEdit" |
||||
|
type="text" |
||||
|
v-model="scope.row.detailed" |
||||
|
placeholder="请输入" |
||||
|
class="input-width" |
||||
|
maxlength="500" |
||||
|
clearable |
||||
|
></el-input> |
||||
|
<div v-else class="div-content"> |
||||
|
{{ scope.row.detailed }} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> --> |
||||
|
|
||||
|
<el-table-column |
||||
|
prop="imgList" |
||||
|
label="图片列表" |
||||
|
align="center" |
||||
|
width="150px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<div v-if="scope.row.isEdit"> |
||||
|
<el-upload |
||||
|
:headers="$getElUploadHeaders()" |
||||
|
class="avatar-uploader" |
||||
|
:action="uploadUrl" |
||||
|
:data="{ customerId: customerId }" |
||||
|
:show-file-list="true" |
||||
|
:limit="3" |
||||
|
:file-list="scope.row.imgShowList" |
||||
|
:on-success=" |
||||
|
(res) => |
||||
|
handleImgSuccess(res, scope.row) |
||||
|
" |
||||
|
:on-remove=" |
||||
|
(res) => handleImgRemove(res, scope.row) |
||||
|
" |
||||
|
list-type="picture" |
||||
|
:before-upload="beforeImgUpload" |
||||
|
> |
||||
|
<i |
||||
|
class="el-icon-plus avatar-uploader-icon" |
||||
|
></i> |
||||
|
最多三张图片 |
||||
|
</el-upload> |
||||
|
</div> |
||||
|
|
||||
|
<div v-else class="div-content"> |
||||
|
<el-image |
||||
|
v-if="scope.row.imgList.length > 0" |
||||
|
style="width: 100px; height: 50px" |
||||
|
:src="scope.row.imgList[0]" |
||||
|
fit="cover" |
||||
|
:preview-src-list="scope.row.imgList" |
||||
|
></el-image> |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
prop="nextInspectTime" |
||||
|
label="拟复查时间" |
||||
|
align="center" |
||||
|
width="200px" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<el-date-picker |
||||
|
v-if="scope.row.isEdit" |
||||
|
v-model="scope.row.nextInspectTime" |
||||
|
type="date" |
||||
|
class="input-width" |
||||
|
value-format="yyyy-MM-dd" |
||||
|
placeholder="选择日期" |
||||
|
> |
||||
|
</el-date-picker> |
||||
|
<div v-else class="div-content"> |
||||
|
{{ scope.row.nextInspectTime }} |
||||
|
</div> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
|
||||
|
<el-table-column |
||||
|
v-if="!disabled" |
||||
|
fixed="right" |
||||
|
label="操作" |
||||
|
align="center" |
||||
|
width="120" |
||||
|
> |
||||
|
<template slot-scope="scope"> |
||||
|
<template v-if="scope.row.isEdit"> |
||||
|
<el-button |
||||
|
@click="handleEdit(scope.row)" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
class="btn-color-edit" |
||||
|
>保存</el-button |
||||
|
> |
||||
|
<el-button |
||||
|
@click="handleChange(scope.row, 'cancle')" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
class="btn-color-edit" |
||||
|
>取消</el-button |
||||
|
> |
||||
|
</template> |
||||
|
<template v-else> |
||||
|
<el-button |
||||
|
v-if="formType == 'edit'" |
||||
|
@click="handleChange(scope.row, 'edit')" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
:disabled="disabled" |
||||
|
class="btn-color-edit" |
||||
|
>修改</el-button |
||||
|
> |
||||
|
<el-popconfirm |
||||
|
v-if="formType == 'edit'" |
||||
|
title="删除之后无法恢复,确认删除?" |
||||
|
@onConfirm="del(scope.row)" |
||||
|
@confirm="del(scope.row)" |
||||
|
> |
||||
|
<el-button |
||||
|
slot="reference" |
||||
|
type="text" |
||||
|
size="small" |
||||
|
class="btn-color-del" |
||||
|
style="margin-left: 10px" |
||||
|
>删除</el-button |
||||
|
> |
||||
|
</el-popconfirm> |
||||
|
</template> |
||||
|
</template> |
||||
|
</el-table-column> |
||||
|
</el-table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { requestPost } from "@/js/dai/request"; |
||||
|
|
||||
|
export default { |
||||
|
props: { |
||||
|
id: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
info: { |
||||
|
type: Object, |
||||
|
default: () => ({}), |
||||
|
}, |
||||
|
disabled: { |
||||
|
type: Boolean, |
||||
|
default: false, |
||||
|
}, |
||||
|
formType: { |
||||
|
type: String, |
||||
|
default: "", |
||||
|
}, |
||||
|
source: { |
||||
|
//展示来源:manage 管理平台 visiual 可视化平台 |
||||
|
type: String, |
||||
|
default: "manage", |
||||
|
}, |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
uploadUrl: |
||||
|
window.SITE_CONFIG["apiURL"] + "/oss/file/uploadqrcodeV2", |
||||
|
customerId: localStorage.getItem("customerId"), |
||||
|
|
||||
|
btnDisabled: false, |
||||
|
btnType: "cancle", |
||||
|
isEdit: false, |
||||
|
tableData: [], |
||||
|
tempRow: {}, |
||||
|
|
||||
|
optionResult: [ |
||||
|
{ |
||||
|
label: "合格", |
||||
|
value: "0", |
||||
|
}, |
||||
|
{ |
||||
|
label: "不合格", |
||||
|
value: "1", |
||||
|
}, |
||||
|
], |
||||
|
optionStaff: [ |
||||
|
// { |
||||
|
// label: "人名", |
||||
|
// value: "inspectStaffId", |
||||
|
// }, |
||||
|
], |
||||
|
}; |
||||
|
}, |
||||
|
|
||||
|
computed: { |
||||
|
allowOperate() { |
||||
|
const { |
||||
|
info: { agencyId }, |
||||
|
} = this; |
||||
|
return agencyId && agencyId == this.$store.state.user.agencyId; |
||||
|
}, |
||||
|
}, |
||||
|
watch: { |
||||
|
id: { |
||||
|
handler(val) { |
||||
|
console.log("val------points", val); |
||||
|
if (val.length > 0) { |
||||
|
this.btnDisabled = false; |
||||
|
this.getList(); |
||||
|
} else this.btnDisabled = true; |
||||
|
}, |
||||
|
immediate: true, |
||||
|
}, |
||||
|
}, |
||||
|
|
||||
|
created() { |
||||
|
this.getOptionStaff(); |
||||
|
}, |
||||
|
|
||||
|
methods: { |
||||
|
beforeImgUpload(file) { |
||||
|
console.log(file); |
||||
|
const isLt1M = file.size / 1024 / 1024 < 10; |
||||
|
const srcType = file.type; |
||||
|
const format = file.name.split(".").pop(); |
||||
|
|
||||
|
if (!isLt1M) { |
||||
|
this.$message.error("上传文件大小不能超过 10MB!"); |
||||
|
return false; |
||||
|
} |
||||
|
if (srcType.indexOf("image") == -1) { |
||||
|
this.$message.error("仅限图片格式"); |
||||
|
return false; |
||||
|
} |
||||
|
return true; |
||||
|
}, |
||||
|
|
||||
|
handleImgSuccess(res, row) { |
||||
|
console.log("handleImgSuccess", res); |
||||
|
if (res.code === 0 && res.msg === "success") { |
||||
|
row.imgList.push(res.data.url); |
||||
|
this.computeImgShowList(row); |
||||
|
} else { |
||||
|
this.$message.error(res.msg); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
computeImgShowList(row) { |
||||
|
row.imgShowList = row.imgList.map((url) => { |
||||
|
return { name: "", url }; |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
handleImgRemove(file, row) { |
||||
|
console.log("handleImgRemove", file); |
||||
|
let url = file.url || file.response.data.url; |
||||
|
if (url) { |
||||
|
row.imgList = row.imgList.filter((item) => item !== url); |
||||
|
this.computeImgShowList(row); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
getRowClass({ rowIndex, columnIndex }) { |
||||
|
if (rowIndex === 0) { |
||||
|
return "background: #2195fe; color: #fff;"; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
handleChange(row, type) { |
||||
|
console.log("type----", type); |
||||
|
if (type == "cancle") { |
||||
|
row = { ...this.tempRow }; |
||||
|
row.isEdit = false; |
||||
|
if (this.btnType == "add") this.tableData.pop(); |
||||
|
this.getList(); |
||||
|
console.log("row----", row); |
||||
|
} else { |
||||
|
this.tempRow = { ...row }; |
||||
|
row.isEdit = true; |
||||
|
} |
||||
|
this.btnType = type; |
||||
|
this.isEdit = !this.isEdit; |
||||
|
}, |
||||
|
|
||||
|
handleChangeStaff(row) { |
||||
|
const { inspectStaffId } = row; |
||||
|
const { optionStaff } = this; |
||||
|
let item = optionStaff.find((item) => item.value == inspectStaffId); |
||||
|
if (item) { |
||||
|
row.inspectStaffName = item.name; |
||||
|
row.inspectStaffMobile = item.mobile; |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async getOptionStaff() { |
||||
|
let url = `/data/aggregator/org/staff-select-list/${this.$store.state.user.agencyId}`; |
||||
|
const { data, code, msg } = await requestPost(url, {}); |
||||
|
|
||||
|
if (code === 0) { |
||||
|
this.optionStaff = data || []; |
||||
|
} else { |
||||
|
this.$message.error("请求工作人员数据失败!"); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
async handleEdit(row) { |
||||
|
if (this.btnType == "add") this.save(row); |
||||
|
else this.edit(row); |
||||
|
}, |
||||
|
|
||||
|
handleAdd() { |
||||
|
this.btnType = "add"; |
||||
|
this.isEdit = true; |
||||
|
|
||||
|
const item = { |
||||
|
isEdit: true, |
||||
|
id: this.id, |
||||
|
inspectTime: "", |
||||
|
inspectStaffId: "", |
||||
|
inspectStaffName: "", |
||||
|
inspectStaffMobile: "", |
||||
|
inspectResult: "", |
||||
|
imgList: [], |
||||
|
nextInspectTime: "", |
||||
|
}; |
||||
|
this.computeImgShowList(item); |
||||
|
this.tableData.push(item); |
||||
|
}, |
||||
|
|
||||
|
async save(row) { |
||||
|
const params = { |
||||
|
equipmentId: this.id, |
||||
|
...row, |
||||
|
}; |
||||
|
await this.$http |
||||
|
.post( |
||||
|
"/actual/base/monitoringEquipmentInspectRecord/save", |
||||
|
params |
||||
|
) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg); |
||||
|
} else { |
||||
|
this.$message.success("保存成功"); |
||||
|
row.isEdit = false; |
||||
|
this.isEdit = false; |
||||
|
this.btnType = "cancle"; |
||||
|
this.getList(); |
||||
|
} |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("err", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async edit(row) { |
||||
|
const params = { |
||||
|
...row, |
||||
|
}; |
||||
|
|
||||
|
await this.$http |
||||
|
.post( |
||||
|
"/actual/base/monitoringEquipmentInspectRecord/update", |
||||
|
params |
||||
|
) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg); |
||||
|
} else { |
||||
|
this.$message.success("保存成功"); |
||||
|
row.isEdit = false; |
||||
|
this.isEdit = false; |
||||
|
this.getList(); |
||||
|
} |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("err", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async del(row) { |
||||
|
await this.$http |
||||
|
.post(`/actual/base/monitoringEquipmentInspectRecord/delete`, [ |
||||
|
row.patrolId, |
||||
|
]) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg); |
||||
|
} else { |
||||
|
this.$message.success("删除成功"); |
||||
|
this.getList(); |
||||
|
} |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("err", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
async getList() { |
||||
|
const { id } = this; |
||||
|
|
||||
|
const params = { |
||||
|
equipmentId: id, |
||||
|
pageNo: 1, |
||||
|
pageSize: 10000, |
||||
|
}; |
||||
|
|
||||
|
await this.$http |
||||
|
.post(`/actual/base/monitoringEquipmentInspectRecord/page`, { |
||||
|
...params, |
||||
|
}) |
||||
|
.then(({ data: res }) => { |
||||
|
if (res.code !== 0) { |
||||
|
return this.$message.error(res.msg); |
||||
|
} else { |
||||
|
this.tableData = res.data.list.map((item) => { |
||||
|
this.computeImgShowList(item); |
||||
|
return { |
||||
|
...item, |
||||
|
isEdit: false, |
||||
|
}; |
||||
|
}); |
||||
|
} |
||||
|
}) |
||||
|
.catch((err) => { |
||||
|
console.log("err", err); |
||||
|
return this.$message.error("网络错误"); |
||||
|
}); |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped> |
||||
|
@import "@/assets/scss/buttonstyle.scss"; |
||||
|
@import "@/assets/scss/modules/management/list-main.scss"; |
||||
|
|
||||
|
.mt10 { |
||||
|
margin-bottom: 10px; |
||||
|
} |
||||
|
.input-width { |
||||
|
width: 170px; |
||||
|
} |
||||
|
</style> |
||||
@ -0,0 +1,208 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
<base-page |
||||
|
:searchParams="searchParams" |
||||
|
:tableParams="tableParams" |
||||
|
:tableUrl="tableUrl" |
||||
|
:addUrl="addUrl" |
||||
|
:editUrl="editUrl" |
||||
|
:delUrl="delUrl" |
||||
|
:infoUrl="infoUrl" |
||||
|
:editAuth="editAuth" |
||||
|
:delAuth="delAuth" |
||||
|
:exportUrl="exportUrl" |
||||
|
:qrCodeExportUrl="qrCodeExportUrl" |
||||
|
:importUrl="importUrl" |
||||
|
:mubanUrl="mubanUrl" |
||||
|
:editParams="editParams" |
||||
|
:editElseRules="editElseRules" |
||||
|
:editFixedParams="editFixedParams" |
||||
|
:editParamsDiv="5" |
||||
|
:editBtnName="(item) => (!item.latitude ? '待完善' : '修改')" |
||||
|
:formBtnFixed="false" |
||||
|
idName="id" |
||||
|
> |
||||
|
<template v-slot:editBottomSup="{ id, formType, info }"> |
||||
|
<record |
||||
|
v-if="formType != 'add' && id" |
||||
|
:formType="formType" |
||||
|
:id="id" |
||||
|
:info="info" |
||||
|
></record> |
||||
|
</template> |
||||
|
</base-page> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import basePage from "@/views/modules/cpts/base2/index"; |
||||
|
import record from "./cpts/record"; |
||||
|
|
||||
|
export default { |
||||
|
components: { basePage, record }, |
||||
|
props: {}, |
||||
|
|
||||
|
data() { |
||||
|
return { |
||||
|
searchParams: [ |
||||
|
{ field: "设备名称", keyName: "equipmentName", type: "input" }, |
||||
|
{ field: "设备编号", keyName: "equipmentNum", type: "input" }, |
||||
|
{ field: "负责人", keyName: "principalName", type: "input" }, |
||||
|
{ field: "所处位置", keyName: "location", type: "input" }, |
||||
|
{ |
||||
|
field: "检查时间", |
||||
|
keyName: "latestInspectTime", |
||||
|
type: "date", |
||||
|
}, |
||||
|
{ |
||||
|
field: "检查结果", |
||||
|
keyName: "latestInspectResult", |
||||
|
type: "select", |
||||
|
optionUrl: "", |
||||
|
optionUrlParams: {}, |
||||
|
optionList: [ |
||||
|
{ |
||||
|
value: "0", |
||||
|
label: "异常", |
||||
|
}, |
||||
|
{ |
||||
|
value: "1", |
||||
|
label: "正常", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
|
||||
|
tableParams: [ |
||||
|
{ field: "序号", keyName: "", type: "no" }, |
||||
|
{ field: "设备名称", keyName: "equipmentName", type: "text" }, |
||||
|
{ field: "设备编号", keyName: "equipmentNum", type: "text" }, |
||||
|
{ field: "所处位置", keyName: "location", type: "text" }, |
||||
|
{ |
||||
|
field: "负责人", |
||||
|
keyName: "principalName", |
||||
|
type: "text", |
||||
|
}, |
||||
|
{ field: "联系电话", keyName: "contactNum", type: "text" }, |
||||
|
{ |
||||
|
field: "最新检查时间", |
||||
|
keyName: "latestInspectTime", |
||||
|
type: "text", |
||||
|
}, |
||||
|
{ |
||||
|
field: "最新结果", |
||||
|
keyName: "latestInspectResult", |
||||
|
type: "text", |
||||
|
}, |
||||
|
], |
||||
|
tableUrl: "/actual/base/monitoringEquipment/page", |
||||
|
mubanUrl: "/actual/base/monitoringEquipment/downloadTemplate", |
||||
|
importUrl: "/actual/base/monitoringEquipment/import", |
||||
|
exportUrl: "/actual/base/monitoringEquipment/export", |
||||
|
qrCodeExportUrl: "", |
||||
|
|
||||
|
addUrl: "/actual/base/monitoringEquipment/save", |
||||
|
editUrl: "/actual/base/monitoringEquipment/update", |
||||
|
infoUrl: "/actual/base/monitoringEquipment/detail/", |
||||
|
delUrl: "/actual/base/monitoringEquipment/delete", |
||||
|
|
||||
|
editAuth(item) { |
||||
|
return item.agencyId == this.$store.state.user.agencyId; |
||||
|
}, |
||||
|
delAuth(item) { |
||||
|
return item.agencyId == this.$store.state.user.agencyId; |
||||
|
}, |
||||
|
|
||||
|
editParams: [ |
||||
|
[ |
||||
|
{ |
||||
|
field: "设备名称", |
||||
|
keyName: "equipmentName", |
||||
|
type: "input", |
||||
|
maxlength: 50, |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: "设备名称不能为空", |
||||
|
trigger: "blur", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
{ |
||||
|
field: "设备编号", |
||||
|
keyName: "equipmentNum", |
||||
|
type: "input", |
||||
|
maxlength: 50, |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: "设备编号不能为空", |
||||
|
trigger: "blur", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
{ |
||||
|
field: "负责人", |
||||
|
keyName: "principalName", |
||||
|
type: "input", |
||||
|
|
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: "负责人不能为空", |
||||
|
trigger: "blur", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
{ |
||||
|
field: "联系电话", |
||||
|
keyName: "contactNum", |
||||
|
maxlength: 50, |
||||
|
type: "input", |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: "联系电话不能为空", |
||||
|
trigger: "blur", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
{ |
||||
|
field: "所处位置", |
||||
|
keyName: "location", |
||||
|
type: "address", |
||||
|
maxlength: 50, |
||||
|
supKeys: ["longitude", "latitude"], |
||||
|
supValues: ["", ""], |
||||
|
rules: [ |
||||
|
{ |
||||
|
required: true, |
||||
|
message: "所处位置不能为空", |
||||
|
trigger: "blur", |
||||
|
}, |
||||
|
], |
||||
|
}, |
||||
|
], |
||||
|
], |
||||
|
editFixedParams: { |
||||
|
agencyId: this.$store.state.user.agencyId, |
||||
|
}, |
||||
|
editElseRules: { |
||||
|
longitude: { |
||||
|
type: "number", |
||||
|
required: true, |
||||
|
message: "请拖动地图选择坐标点", |
||||
|
}, |
||||
|
}, |
||||
|
}; |
||||
|
}, |
||||
|
computed: {}, |
||||
|
watch: {}, |
||||
|
|
||||
|
async mounted() {}, |
||||
|
|
||||
|
methods: {}, |
||||
|
}; |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss" scoped></style> |
||||
Loading…
Reference in new issue