86 changed files with 9283 additions and 7832 deletions
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
File diff suppressed because it is too large
@ -1,472 +1,490 @@ |
|||
<template> |
|||
<div class="g-main"> |
|||
<div class="m-table"> |
|||
<div class="u-table-btn1"> |
|||
|
|||
<el-upload :headers="$getElUploadHeaders()" |
|||
ref="upload" |
|||
class="upload-btn" |
|||
action="uploadUlr" |
|||
:limit="1" |
|||
:accept="'.xls,.xlsx'" |
|||
:with-credentials="true" |
|||
:show-file-list="false" |
|||
:auto-upload="true" |
|||
:on-progress="handleProgress" |
|||
:on-success="handleExcelSuccess" |
|||
:before-upload="beforeExcelUpload" |
|||
:http-request="uploadHttpRequest"> |
|||
<el-button size="small" |
|||
class="diy-button--white" |
|||
:loading="importLoading">表格导入</el-button> |
|||
</el-upload> |
|||
<el-button class="diy-button--white" |
|||
size="small" |
|||
style="margin-left:10px" |
|||
@click="handleExportModule()">下载模板</el-button> |
|||
|
|||
</div> |
|||
<el-table ref="ref_table" |
|||
:data="dataList" |
|||
border |
|||
:height="tableHeight" |
|||
class="m-table-item" |
|||
v-loading="dataListLoading" |
|||
style="width: 100%"> |
|||
<el-table-column label="序号" |
|||
header-align="center" |
|||
align="center" |
|||
type="index" |
|||
width="100"></el-table-column> |
|||
|
|||
<el-table-column prop="deptName" |
|||
header-align="center" |
|||
align="center" |
|||
label="表格信息" |
|||
min-width="100"> |
|||
</el-table-column> |
|||
<el-table-column prop="dataName" |
|||
header-align="center" |
|||
align="center" |
|||
label="平台对应信息" |
|||
min-width="110"> |
|||
<template slot-scope="scope"> |
|||
|
|||
<el-select class="item_width_sel" |
|||
v-model="scope.row.itemGroupId" |
|||
size="small" |
|||
placeholder="请选择"> |
|||
<el-option v-for="item in groupList" |
|||
@click.native="handleSelGroup(scope.$index,item)" |
|||
:key="item.id" |
|||
:label="item.label" |
|||
:value="item.id"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
<el-select class="item_width_sel" |
|||
v-model="scope.row.itemId" |
|||
size="small" |
|||
style="margin-left:10px" |
|||
placeholder="请选择"> |
|||
<el-option v-for="item in scope.row.itemList" |
|||
:key="item.itemId" |
|||
:label="item.label" |
|||
:value="item.itemId"> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
</template> |
|||
</el-table-column> |
|||
|
|||
</el-table> |
|||
<div> |
|||
<el-pagination @size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="pageSize" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total"> |
|||
</el-pagination> |
|||
</div> |
|||
|
|||
<div ref="divEditBtn" |
|||
class="m-edit-btn"> |
|||
|
|||
<el-button type="primary" |
|||
size="small" |
|||
class="diy-button--blue" |
|||
@click="handleComfirm">保 存</el-button> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<!-- 修改弹出框 --> |
|||
<el-dialog :visible.sync="formShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="'数据更新配置'" |
|||
width="850px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="diaClose"> |
|||
<div class="div_form"> |
|||
<el-form ref="ref_form" |
|||
:inline="true" |
|||
:model="formData"> |
|||
|
|||
<el-form-item label="适用范围" |
|||
label-width="150px" |
|||
style="display: block"> |
|||
|
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
</div> |
|||
|
|||
<div class="div-btn"> |
|||
<el-button size="small" |
|||
@click="diaClose">取 消</el-button> |
|||
<el-button size="small" |
|||
type="primary" |
|||
@click="editDiaOK">确 定</el-button> |
|||
</div> |
|||
</el-dialog> |
|||
|
|||
</div> |
|||
<div class="g-main"> |
|||
<div class="m-table"> |
|||
<div class="u-table-btn1"> |
|||
<el-upload |
|||
:headers="$getElUploadHeaders()" |
|||
ref="upload" |
|||
class="upload-btn" |
|||
action="uploadUlr" |
|||
:limit="1" |
|||
:accept="'.xls,.xlsx'" |
|||
:with-credentials="true" |
|||
:show-file-list="false" |
|||
:auto-upload="true" |
|||
:on-progress="handleProgress" |
|||
:on-success="handleExcelSuccess" |
|||
:before-upload="beforeExcelUpload" |
|||
:http-request="uploadHttpRequest" |
|||
> |
|||
<el-button |
|||
size="small" |
|||
class="diy-button--white" |
|||
:loading="importLoading" |
|||
>表格导入</el-button |
|||
> |
|||
</el-upload> |
|||
|
|||
<el-button |
|||
class="diy-button--white" |
|||
size="small" |
|||
style="margin-left: 10px" |
|||
@click="handleExportModule()" |
|||
>下载模板</el-button |
|||
> |
|||
</div> |
|||
|
|||
<div v-if="dataList.length > 0"> |
|||
<el-table |
|||
ref="ref_table" |
|||
:data="dataList" |
|||
border |
|||
:height="tableHeight" |
|||
class="m-table-item" |
|||
v-loading="dataListLoading" |
|||
style="width: 100%" |
|||
> |
|||
<el-table-column |
|||
label="序号" |
|||
header-align="center" |
|||
align="center" |
|||
type="index" |
|||
width="100" |
|||
></el-table-column> |
|||
|
|||
<el-table-column |
|||
prop="srcField" |
|||
header-align="center" |
|||
align="center" |
|||
label="表格信息" |
|||
min-width="100" |
|||
> |
|||
</el-table-column> |
|||
<el-table-column |
|||
prop="field" |
|||
header-align="center" |
|||
align="center" |
|||
label="平台对应信息" |
|||
min-width="110" |
|||
> |
|||
<template slot-scope="scope"> |
|||
<span v-if="scope.row.exist">{{ |
|||
scope.row.field |
|||
}}</span> |
|||
|
|||
<div v-else> |
|||
<el-select |
|||
class="item_width_sel" |
|||
v-model="scope.row.itemGroupId" |
|||
size="small" |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in groupList" |
|||
@click.native=" |
|||
handleSelGroup(scope.$index, item) |
|||
" |
|||
:key="item.id" |
|||
:label="item.label" |
|||
:value="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
|
|||
<el-select |
|||
class="item_width_sel" |
|||
v-model="scope.row.field" |
|||
size="small" |
|||
style="margin-left: 10px" |
|||
placeholder="请选择" |
|||
> |
|||
<el-option |
|||
v-for="item in scope.row.itemList" |
|||
:key="item.itemId" |
|||
:label="item.label" |
|||
:value="item.label" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</div> |
|||
</template> |
|||
</el-table-column> |
|||
</el-table> |
|||
|
|||
<div ref="divEditBtn" class="m-edit-btn"> |
|||
<el-button |
|||
type="primary" |
|||
size="small" |
|||
class="diy-button--blue" |
|||
@click="handleComfirm" |
|||
>保 存</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
|
|||
<div class="m-hint" v-else>请先导入表格</div> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from "vuex"; |
|||
|
|||
import { requestPost } from '@/js/dai/request' |
|||
|
|||
import { mapGetters } from 'vuex' |
|||
export default { |
|||
|
|||
data () { |
|||
return { |
|||
customerId: '', // 客户id,父组件传 |
|||
customerName: '', // 客户名称,父组件传 |
|||
|
|||
tableParams: { |
|||
customerId: '' |
|||
}, |
|||
// tableHeight: 500, |
|||
search: '', |
|||
dataList: [], |
|||
|
|||
dataListLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
|
|||
|
|||
formShow: false, |
|||
formData: {}, |
|||
|
|||
scopeList: [], |
|||
dataSyncConfigId: '', |
|||
importLoading: false, |
|||
|
|||
groupList: [], |
|||
sHeight: 0, |
|||
} |
|||
}, |
|||
|
|||
computed: { |
|||
tableHeight () { |
|||
const h = this.clientHeight - this.sHeight + this.iframeHeigh |
|||
const _h = this.clientHeight - this.sHeight |
|||
return this.$store.state.inIframe ? h : _h |
|||
}, |
|||
|
|||
...mapGetters(['clientHeight', 'iframeHeight']) |
|||
}, |
|||
components: { |
|||
|
|||
}, |
|||
created () { |
|||
|
|||
}, |
|||
async mounted () { |
|||
await this.loadData() |
|||
await this.loadPersonGroup() |
|||
|
|||
this.sHeight = this.$refs.divEditBtn.offsetHeight + 300 |
|||
}, |
|||
methods: { |
|||
|
|||
|
|||
diaClose () { |
|||
this.formShow = false |
|||
}, |
|||
|
|||
async loadPersonGroup () { |
|||
const url = '/oper/customize/icformitemgroup/list' |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' |
|||
let params = { |
|||
formCode: 'resi_base_info', |
|||
policyFlag: '1' |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.groupList = data |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
|
|||
}, |
|||
|
|||
//选择人员信息第一列下拉框 |
|||
async handleSelGroup (index, item, isSet) { |
|||
const url = '/oper/customize/icformitem/getItemListV2' |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' |
|||
let params = { |
|||
policyFlag: '1', |
|||
groupId: item.id, |
|||
|
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
|
|||
let oneData = this.dataList[index] |
|||
oneData.itemList = data |
|||
this.$set(this.dataList, index, oneData) |
|||
} else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
|
|||
// 加载列表数据 |
|||
async loadData () { |
|||
this.dataListLoading = true |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/epmetuser/dataSyncConfig/list' |
|||
const url = '/epmetuser/dataSyncConfig/list' |
|||
|
|||
this.tableParams = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, this.tableParams) |
|||
this.dataListLoading = false |
|||
if (code === 0) { |
|||
this.total = data.total |
|||
this.dataList = data.list |
|||
this.dataList.forEach(element => { |
|||
|
|||
element.stateShow = element.switchStatus === 'open' ? true : false |
|||
|
|||
}) |
|||
} else { |
|||
// this.$message.error(msg ) |
|||
} |
|||
}, |
|||
|
|||
handleChangeScope (value) { |
|||
// console.log('value', value) |
|||
|
|||
this.orgIdArray = value |
|||
this.scopeList = [] |
|||
let selArray = this.$refs["myCascader"].getCheckedNodes() |
|||
|
|||
// console.log('selArray', selArray) |
|||
|
|||
selArray.forEach((element, index) => { |
|||
|
|||
let obj = { |
|||
orgId: element.data.agencyId, |
|||
orgType: element.data.level, |
|||
orgIdPath: element.path.join(':'), |
|||
|
|||
} |
|||
this.scopeList.push(obj) |
|||
}); |
|||
|
|||
console.log('this.scopeList', this.scopeList) |
|||
|
|||
}, |
|||
|
|||
handleComfirm () { |
|||
console.log(this.dataList) |
|||
}, |
|||
|
|||
async editDiaOK () { |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/epmetuser/dataSyncConfig/scopeSave' |
|||
const url = '/epmetuser/dataSyncConfig/scopeSave' |
|||
|
|||
let params = { |
|||
dataSyncConfigId: this.dataSyncConfigId, |
|||
scopeList: this.scopeList |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
|
|||
if (code === 0) { |
|||
this.formShow = false |
|||
this.loadData() |
|||
} else { |
|||
// this.$message.error(msg ) |
|||
} |
|||
}, |
|||
|
|||
async handleExportModule () { |
|||
let url = "/heart/iccommunityselforganization/import-template-download"; |
|||
|
|||
let params = {}; |
|||
await this.$http({ |
|||
method: "POST", |
|||
url, |
|||
responseType: "blob", |
|||
data: params, |
|||
}) |
|||
.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("网络错误"); |
|||
}); |
|||
}, |
|||
// 上传大图标成功 |
|||
handleExcelSuccess (res, file) { |
|||
if (res.code === 0 && res.msg === "success") { |
|||
console.log("resss---ppp", res); |
|||
} else { |
|||
this.$message.error(res.msg); |
|||
} |
|||
}, |
|||
handleProgress (event, file, fileList) { |
|||
console.log("percentage", file.percentage); |
|||
}, |
|||
|
|||
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) { |
|||
this.importLoading = true; |
|||
this.importBtnTitle = "正在上传中..."; |
|||
this.$message({ |
|||
showClose: true, |
|||
message: "导入中,请到系统管理-导入记录中查看进度", |
|||
duration: 0, |
|||
}); |
|||
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|||
formData.append("file", file.file); //添加文件对象 |
|||
await this.$http |
|||
.post( |
|||
"/heart/iccommunityselforganization/importcommunityselforganization", |
|||
formData |
|||
) |
|||
.then((res) => { |
|||
console.log("res-up", res); |
|||
if (res.data.code == 0 && res.data.msg == "success") { |
|||
// this.$message.success('导入成功') |
|||
this.getTableData(); |
|||
} else this.$message.error(res.data.msg); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
// this.$message.error('导入失败') |
|||
}); |
|||
// axios({ |
|||
// url: |
|||
// window.SITE_CONFIG["apiURL"] + |
|||
// "/heart/iccommunityselforganization/importcommunityselforganization", |
|||
// method: "post", |
|||
// data: formData, |
|||
// // responseType: "blob", |
|||
// }) |
|||
// .then((res) => { |
|||
// this.importLoading = false; |
|||
// this.importBtnTitle = "导入"; |
|||
// console.log("resresresresresresres", res); |
|||
|
|||
// this.getTableData(); |
|||
// if (res.data.code == 0) { |
|||
// return this.$message.success(res.data.data || "导入成功"); |
|||
// } else { |
|||
// return this.$message.error(res.data.msg); |
|||
// } |
|||
// }) |
|||
// .catch((err) => { |
|||
// console.log("失败", err); |
|||
// }); |
|||
this.importLoading = false; |
|||
this.importBtnTitle = "导入"; |
|||
this.$refs.upload.clearFiles(); |
|||
}, |
|||
|
|||
handleSizeChange (val) { |
|||
this.pageSize = val |
|||
this.pageNo = 1 |
|||
this.loadData() |
|||
}, |
|||
handleCurrentChange (val) { |
|||
this.pageNo = val |
|||
this.loadData() |
|||
}, |
|||
|
|||
// 取消 |
|||
diaCancel () { |
|||
this.$emit('cancleBack') |
|||
}, |
|||
|
|||
|
|||
} |
|||
} |
|||
data() { |
|||
return { |
|||
customerId: "", // 客户id,父组件传 |
|||
customerName: "", // 客户名称,父组件传 |
|||
|
|||
tableParams: { |
|||
customerId: "", |
|||
}, |
|||
// tableHeight: 500, |
|||
search: "", |
|||
dataList: [], |
|||
|
|||
dataListLoading: false, |
|||
total: 0, |
|||
pageSize: 20, |
|||
pageNo: 0, |
|||
|
|||
formShow: false, |
|||
formData: {}, |
|||
|
|||
scopeList: [], |
|||
dataSyncConfigId: "", |
|||
importLoading: false, |
|||
|
|||
groupList: [], |
|||
sHeight: 0, |
|||
|
|||
importCode: "", |
|||
importOption: { exist: {}, notExist: {} }, |
|||
|
|||
fileData: null, |
|||
}; |
|||
}, |
|||
|
|||
computed: { |
|||
tableHeight() { |
|||
const h = this.clientHeight - this.sHeight + this.iframeHeigh; |
|||
const _h = this.clientHeight - this.sHeight; |
|||
return this.$store.state.inIframe ? h : _h; |
|||
}, |
|||
|
|||
...mapGetters(["clientHeight", "iframeHeight"]), |
|||
}, |
|||
components: {}, |
|||
created() {}, |
|||
async mounted() { |
|||
// await this.loadData(); |
|||
await this.loadPersonGroup(); |
|||
|
|||
this.sHeight = this.$refs.divEditBtn.offsetHeight + 300; |
|||
}, |
|||
methods: { |
|||
diaClose() { |
|||
this.formShow = false; |
|||
}, |
|||
|
|||
async loadPersonGroup() { |
|||
const url = "/oper/customize/icformitemgroup/list"; |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' |
|||
let params = { |
|||
formCode: "resi_base_info", |
|||
policyFlag: "1", |
|||
}; |
|||
|
|||
const { data, code, msg } = await requestPost(url, params); |
|||
|
|||
if (code === 0) { |
|||
this.groupList = data; |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
//选择人员信息第一列下拉框 |
|||
async handleSelGroup(index, item, isSet) { |
|||
const url = "/oper/customize/icformitem/getItemListV2"; |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/gov/org/isServiceProject/service/serviceScopeTree' |
|||
let params = { |
|||
policyFlag: "1", |
|||
groupId: item.id, |
|||
}; |
|||
|
|||
const { data, code, msg } = await requestPost(url, params); |
|||
|
|||
if (code === 0) { |
|||
let oneData = this.dataList[index]; |
|||
oneData.itemList = data; |
|||
this.$set(this.dataList, index, oneData); |
|||
} else { |
|||
this.$message.error(msg); |
|||
} |
|||
}, |
|||
|
|||
// 加载列表数据 |
|||
async loadData() { |
|||
this.dataListLoading = true; |
|||
// const url = 'http://yapi.elinkservice.cn/mock/245/epmetuser/dataSyncConfig/list' |
|||
const url = "/epmetuser/dataSyncConfig/list"; |
|||
|
|||
this.tableParams = { |
|||
pageSize: this.pageSize, |
|||
pageNo: this.pageNo, |
|||
}; |
|||
|
|||
const { data, code, msg } = await requestPost( |
|||
url, |
|||
this.tableParams |
|||
); |
|||
this.dataListLoading = false; |
|||
if (code === 0) { |
|||
this.total = data.total; |
|||
this.dataList = data.list; |
|||
this.dataList.forEach((element) => { |
|||
element.stateShow = |
|||
element.switchStatus === "open" ? true : false; |
|||
}); |
|||
} else { |
|||
// this.$message.error(msg ) |
|||
} |
|||
}, |
|||
|
|||
handleChangeScope(value) { |
|||
// console.log('value', value) |
|||
|
|||
this.orgIdArray = value; |
|||
this.scopeList = []; |
|||
let selArray = this.$refs["myCascader"].getCheckedNodes(); |
|||
|
|||
// console.log('selArray', selArray) |
|||
|
|||
selArray.forEach((element, index) => { |
|||
let obj = { |
|||
orgId: element.data.agencyId, |
|||
orgType: element.data.level, |
|||
orgIdPath: element.path.join(":"), |
|||
}; |
|||
this.scopeList.push(obj); |
|||
}); |
|||
|
|||
console.log("this.scopeList", this.scopeList); |
|||
}, |
|||
|
|||
async handleExportModule() { |
|||
let url = "/epmetuser/icresiuser/import/download-template"; |
|||
|
|||
let params = {}; |
|||
await this.$http({ |
|||
method: "POST", |
|||
url, |
|||
responseType: "blob", |
|||
data: params, |
|||
}) |
|||
.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("网络错误"); |
|||
}); |
|||
}, |
|||
// 上传大图标成功 |
|||
handleExcelSuccess(res, file) { |
|||
if (res.code === 0 && res.msg === "success") { |
|||
console.log("resss---ppp", res); |
|||
} else { |
|||
this.$message.error(res.msg); |
|||
} |
|||
}, |
|||
handleProgress(event, file, fileList) { |
|||
console.log("percentage", file.percentage); |
|||
}, |
|||
|
|||
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) { |
|||
this.importLoading = true; |
|||
this.importBtnTitle = "正在上传中..."; |
|||
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|||
formData.append("file", file.file); //添加文件对象 |
|||
formData.append("code", ""); //添加文件对象 |
|||
await this.$http |
|||
.post("/actual/base/residentBaseInfo/importExcel", formData) |
|||
.then((res) => { |
|||
console.log("res-up", res); |
|||
if (res.data.code == 0 && res.data.msg == "success") { |
|||
console.log(res.data.data); |
|||
const data = res.data.data; |
|||
|
|||
this.dataList = [ |
|||
...Object.keys(data.option.exist).map((k) => { |
|||
return { |
|||
index: k, |
|||
srcField: data.option.exist[k], |
|||
exist: true, |
|||
field: data.option.exist[k], |
|||
}; |
|||
}), |
|||
...Object.keys(data.option.notExist).map((k) => { |
|||
return { |
|||
index: k, |
|||
srcField: data.option.notExist[k], |
|||
exist: false, |
|||
field: "", |
|||
}; |
|||
}), |
|||
]; |
|||
this.importOption = data.option; |
|||
this.importCode = data.code; |
|||
this.fileData = file; |
|||
} else this.$message.error(res.data.msg); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
// this.$message.error('导入失败') |
|||
}); |
|||
this.importLoading = false; |
|||
this.importBtnTitle = "导入"; |
|||
this.$refs.upload.clearFiles(); |
|||
}, |
|||
|
|||
async handleComfirm() { |
|||
this.importLoading = true; |
|||
this.importBtnTitle = "正在上传中..."; |
|||
const { importOption, importCode, dataList } = this; |
|||
dataList.forEach((item) => { |
|||
if (!item.exist) { |
|||
importOption.notExist[item.index] = item.field; |
|||
} |
|||
}); |
|||
await this.$http |
|||
.post("/actual/base/residentBaseInfo/import/header", { |
|||
code: importCode, |
|||
option: { |
|||
exist: importOption.exist, |
|||
notExist: importOption.notExist, |
|||
}, |
|||
}) |
|||
.then((res) => { |
|||
console.log("res-up", res); |
|||
if (res.data.code == 0 && res.data.msg == "success") { |
|||
this.upload2(this.fileData, this.importCode); |
|||
} else this.$message.error(res.data.msg); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
// this.$message.error('导入失败') |
|||
}); |
|||
this.importLoading = false; |
|||
this.importBtnTitle = "导入"; |
|||
}, |
|||
|
|||
async upload2(file, code) { |
|||
this.importLoading = true; |
|||
this.importBtnTitle = "正在上次中..."; |
|||
const formData = new FormData(); //FormData对象,添加参数只能通过append('key', value)的形式添加 |
|||
formData.append("file", file.file); //添加文件对象 |
|||
formData.append("code", code); //添加文件对象 |
|||
await this.$http |
|||
.post("/actual/base/residentBaseInfo/importExcel", formData) |
|||
.then((res) => { |
|||
console.log("res-up", res); |
|||
if (res.data.code == 0 && res.data.msg == "success") { |
|||
this.afterSuccess(); |
|||
} else this.$message.error(res.data.msg); |
|||
}) |
|||
.catch((err) => { |
|||
console.log("失败", err); |
|||
file.onError(); //上传失败的文件会从文件列表中删除 |
|||
// this.$message.error('导入失败') |
|||
}); |
|||
this.importLoading = false; |
|||
this.importBtnTitle = "导入"; |
|||
this.$refs.upload.clearFiles(); |
|||
}, |
|||
|
|||
afterSuccess() { |
|||
this.$message({ |
|||
showClose: true, |
|||
message: "导入成功,请到系统管理-导入记录中查看进度", |
|||
duration: 0, |
|||
}); |
|||
|
|||
this.dataList = []; |
|||
this.importOption = {}; |
|||
this.importCode = ""; |
|||
this.fileData = null; |
|||
}, |
|||
|
|||
// 取消 |
|||
diaCancel() { |
|||
this.$emit("cancleBack"); |
|||
}, |
|||
}, |
|||
}; |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
|
|||
.m-edit-btn { |
|||
display: flex; |
|||
margin-top: 20px; |
|||
margin-right: 16px; |
|||
justify-content: flex-end; |
|||
text-align: center; |
|||
display: flex; |
|||
margin-top: 20px; |
|||
margin-right: 16px; |
|||
justify-content: flex-end; |
|||
text-align: center; |
|||
} |
|||
|
|||
.item_width_sel { |
|||
width: 200px; |
|||
width: 200px; |
|||
} |
|||
|
|||
.m-hint { |
|||
font-size: 50px; |
|||
line-height: 300px; |
|||
text-align: center; |
|||
color: #aaaaaa; |
|||
} |
|||
</style> |
|||
|
|||
@ -0,0 +1,590 @@ |
|||
<template> |
|||
<div> |
|||
<el-form |
|||
ref="label_form" |
|||
:inline="true" |
|||
:model="formData" |
|||
class="div_form" |
|||
:rules="rules" |
|||
> |
|||
<el-form-item |
|||
label="标签名称" |
|||
label-width="100px" |
|||
prop="tagName" |
|||
> |
|||
<el-input v-model="formData.tagName" placeholder="请输入内容" clearable ></el-input> |
|||
|
|||
</el-form-item> |
|||
|
|||
</el-form> |
|||
<p style="margin-left: 15px;"> <b style="color:#F56C6C">*</b> 匹配数据</p> |
|||
<el-table |
|||
border |
|||
:data="tableData" |
|||
style="width: 100%" |
|||
height="200" |
|||
> |
|||
<el-table-column label="选择数据源" align="center" width="120"> |
|||
<template slot-scope="scope"> |
|||
<el-select |
|||
v-model="scope.row.dataSource" |
|||
placeholder="请选择" |
|||
@change="handleChangeSource(scope.row,scope.$index)" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="item in dataSourceOpction" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
:key="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<!-- || scope.$index == scope._self._data.tableData.length-1 --> |
|||
|
|||
<el-table-column label="字段类别" align="center" width="120"> |
|||
<template slot-scope="scope" v-if="scope.row.dataSource=='resi'"> |
|||
<el-select |
|||
v-model="scope.row.itemGroupId" |
|||
placeholder="请选择" |
|||
clearable |
|||
@change="handleChangeFieldsType(scope.row,scope.$index)" |
|||
> |
|||
<el-option |
|||
v-for="item in scope.row.itemGroupIdOpction" |
|||
:label="item.label" |
|||
:value="item.id" |
|||
:key="item.id" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</template> |
|||
<!-- <template v-else> |
|||
<el-select |
|||
:placeholder="scope.row.dataSource=='house'?'房屋信息':'统计信息'" |
|||
:disabled="true" |
|||
> |
|||
</el-select> |
|||
</template> --> |
|||
</el-table-column> |
|||
<el-table-column label="字段名称" align="center" width="120"> |
|||
<template slot-scope="scope"> |
|||
<el-select |
|||
v-model="scope.row.itemId" |
|||
placeholder="请选择" |
|||
@change="handleChangeFieldsName(scope.row,scope.$index)" |
|||
@clear="handleClearItemId(scope.row,scope.$index)" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="item in scope.row.itemIdOpction" |
|||
:label="item.label" |
|||
:value="scope.row.dataSource=='resi'?item.itemId:item.colKey" |
|||
:key="scope.row.dataSource=='resi'?item.itemId:item.colKey" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="比较符" align="center" width="120"> |
|||
<template slot-scope="scope"> |
|||
<el-select |
|||
v-model="scope.row.queryType" |
|||
placeholder="请选择" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="item in queryTypeOpction" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
:key="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="对应值" align="center" width="155"> |
|||
<template slot-scope="scope" > |
|||
<template v-for="item in scope.row.correspondingOpction" > |
|||
<el-select |
|||
v-if="item.itemType == 'select'||item.itemType == 'radio'||item.itemType =='checkbox'" |
|||
v-model="scope.row.colVal" |
|||
placeholder="请选择" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="items in item.options" |
|||
:label="items.label" |
|||
:value="items.value" |
|||
:key="items.label" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
<el-input |
|||
v-else-if="item.itemType === 'input'||item.itemType === 'textarea'" |
|||
v-model="scope.row.colVal" |
|||
placeholder="请输入" |
|||
clearable |
|||
> |
|||
</el-input> |
|||
<el-input-number v-else-if="item.itemType==='inputNum'" |
|||
class="item_width_2" |
|||
v-model="scope.row.colVal" |
|||
:min="0" |
|||
size="mini" |
|||
label="请输入"></el-input-number> |
|||
<el-date-picker v-else-if="item.itemType==='datepicker'||item.itemType==='date'" |
|||
v-model="scope.row.colVal" |
|||
class="item_width_2" |
|||
type="datetime" |
|||
value-format="yyyy-MM-dd HH:mm:ss" |
|||
value="yyyy-MM-dd HH:mm:ss" |
|||
placeholder="开始时间"> |
|||
</el-date-picker> |
|||
<el-input v-else |
|||
class="item_width_2" |
|||
size="mini" |
|||
placeholder="请输入" |
|||
v-model="personItem.colVal"> |
|||
</el-input> |
|||
</template> |
|||
|
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column label="条件关系" align="center" width="120"> |
|||
<template slot-scope="scope" v-if="scope.$index!=tableData.length-1"> |
|||
<el-select |
|||
v-model="scope.row.nextLogicalRel" |
|||
placeholder="请选择" |
|||
clearable |
|||
> |
|||
<el-option |
|||
v-for="item in nextLogicalRelOpction" |
|||
:label="item.label" |
|||
:value="item.value" |
|||
:key="item.value" |
|||
> |
|||
</el-option> |
|||
</el-select> |
|||
</template> |
|||
</el-table-column> |
|||
<el-table-column fixed="right" label="操作" align="center" width="120"> |
|||
<template slot-scope="scope"> |
|||
<img src="@/assets/img/icon-del.png" |
|||
v-show="scope.$index!=tableData.length-1" |
|||
@click="handleClickDelete(scope.$index)" |
|||
class="imgBtn" |
|||
> |
|||
|
|||
<img src="@/assets/img/icon-add.png" |
|||
@click="handleClickAddRow" |
|||
v-show="scope.$index==tableData.length-1" |
|||
class="imgBtn"> |
|||
<!-- <el-button |
|||
|
|||
size="small" |
|||
type="text" |
|||
|
|||
>增加</el-button |
|||
> |
|||
<el-button |
|||
|
|||
size="small" |
|||
type="text" |
|||
@click="handleClickDelete(scope.$index)" |
|||
>删除</el-button |
|||
> --> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
</el-table> |
|||
<div class="div_btn"> |
|||
<el-button size="small" @click="handleCancle">取 消</el-button> |
|||
<el-button |
|||
size="small" |
|||
type="primary" |
|||
@click="handleComfirm" |
|||
>确 定</el-button |
|||
> |
|||
</div> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost,requestGet } from "@/js/dai/request"; |
|||
export default { |
|||
data() { |
|||
return { |
|||
formData:{ |
|||
tagName:"", |
|||
}, |
|||
FormType:"", |
|||
rules:{ |
|||
tagName:[{ required: true, message: '请输入标签名称', trigger: 'change' }] |
|||
}, |
|||
tableData:[{ |
|||
dataSource:"",//数据源 |
|||
itemGroupId:"",//字段类别 |
|||
itemId:"",//字段名称 |
|||
queryType:"",//比较符 |
|||
colVal:"",//对应值 |
|||
nextLogicalRel:"",//条件关系, |
|||
tableName:"",//数据库表名 |
|||
colKey:"", |
|||
itemIdOpction:[], |
|||
itemGroupIdOpction:[], |
|||
correspondingOpction:[] |
|||
}], |
|||
formType:'', |
|||
dataSourceOpction:[{label:'人员信息',value:'resi'},{label:'房屋信息',value:'house'},{label:'统计信息',value:'stat'}], |
|||
queryTypeOpction:[{}], |
|||
nextLogicalRelOpction:[{label:'并且',value:'and'},{label:'或者',value:'or'}], |
|||
}; |
|||
}, |
|||
created() {}, |
|||
methods: { |
|||
async initForm(type,row) { |
|||
console.log(type); |
|||
this.FormType = type |
|||
await this.getFormEdit(row.tagId) |
|||
this.tagId = row.tagId |
|||
console.log( this.tableData); |
|||
this.formType = type |
|||
for(let i in this.tableData){ |
|||
this.handleChangeSource(this.tableData[i],[i],type) |
|||
this.handleChangeFieldsType(this.tableData[i],[i],type) |
|||
setTimeout(() => { |
|||
this.handleChangeFieldsName(this.tableData[i],[i],type) |
|||
}, 300); |
|||
} |
|||
this.formData.tagName = row.tagName |
|||
}, |
|||
|
|||
// 选择数据源 |
|||
async handleChangeSource(row,index,type){ |
|||
console.log(row); |
|||
if(row.dataSource == 'resi'){ |
|||
let url = "/oper/customize/icformitemgroup/list" |
|||
let params={ |
|||
formCode: "resi_base_info", |
|||
policyFlag: "1" |
|||
} |
|||
let {data,code,msg} = await requestPost(url,params) |
|||
if(code == 0){ |
|||
this.$set(this.tableData[index],'itemGroupIdOpction',data) |
|||
console.log(this.tableData[index].itemGroupIdOpction); |
|||
}else { |
|||
this.$message.error(msg) |
|||
} |
|||
this.hadeleClearForm(this.tableData[index],index) |
|||
if(!type){ |
|||
this.tableData[index].itemGroupId = "" |
|||
this.tableData[index].itemId = "" |
|||
this.tableData[index].colKey = "" |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
this.tableData[index].itemIdOpction = [] |
|||
} |
|||
}else if( row.dataSource == 'house') { |
|||
let url = "/governance/policy/item-list/house" |
|||
let params={} |
|||
let {data,code,msg} = await requestPost(url,params) |
|||
if(code == 0){ |
|||
this.tableData[index].itemIdOpction = data |
|||
|
|||
}else{ |
|||
this.$message.error(msg) |
|||
} |
|||
this.hadeleClearForm(this.tableData[index],index) |
|||
if(!type){ |
|||
this.tableData[index].itemGroupId = "" |
|||
this.tableData[index].itemId = "" |
|||
this.tableData[index].colKey = "" |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
} |
|||
} else if(row.dataSource == "stat"){ |
|||
let url = "/governance/policy/item-list/stat" |
|||
let params={} |
|||
let {data,code,msg} = await requestPost(url,params) |
|||
if(code == 0){ |
|||
this.tableData[index].itemIdOpction = data |
|||
|
|||
}else{ |
|||
this.$message.error(msg) |
|||
} |
|||
this.hadeleClearForm(this.tableData[index],index) |
|||
if(!type){ |
|||
this.tableData[index].itemGroupId = "" |
|||
this.tableData[index].itemId = "" |
|||
this.tableData[index].colKey = "" |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
} |
|||
}else{ |
|||
this.hadeleClearForm(this.tableData[index],index) |
|||
this.tableData[index].itemGroupId = "" |
|||
this.tableData[index].itemId = "" |
|||
this.tableData[index].colKey = "" |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
this.tableData[index].itemIdOpction = [] |
|||
} |
|||
|
|||
this.getCompareList() |
|||
|
|||
}, |
|||
|
|||
// 字段类别修改 |
|||
async handleChangeFieldsType(row,index,type){ |
|||
console.log(row,index,'字段类别row'); |
|||
if(row.dataSource != "resi") return |
|||
const url = "/oper/customize/icformitem/getItemListV2" |
|||
let params={ |
|||
groupId: row.itemGroupId, |
|||
policyFlag: "1" |
|||
} |
|||
this.hadeleClearForm(this.tableData[index],index) |
|||
if(!type){ |
|||
this.tableData[index].itemId = "" |
|||
this.tableData[index].colKey = "" |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
this.tableData[index].itemIdOpction = [] |
|||
} |
|||
let {data,code,msg} = await requestPost(url,params) |
|||
if(code == 0){ |
|||
this.$set(this.tableData[index],'itemIdOpction',data) |
|||
console.log(this.tableData[index].itemIdOpction ,'see'); |
|||
}else { |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
// 字段名称修改 |
|||
async handleChangeFieldsName(row,index,type){ |
|||
console.log(row,'字段名称row'); |
|||
var arr = [] |
|||
// 人的信息中colKey的字段是columnName要做一下判断 |
|||
if(row.dataSource == 'house' || row.dataSource == 'stat'){ |
|||
arr = row.itemIdOpction.filter(item=>item.colKey == row.itemId) |
|||
this.tableData[index].tableName = arr[0].tableName |
|||
this.tableData[index].colKey = arr[0].colKey |
|||
if(!type){ |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
} |
|||
// this.tableData[index].colVal = '' |
|||
// this.tableData[index].queryType = '' |
|||
}else if(row.dataSource == 'resi'&&row.itemId!=""){ |
|||
arr = row.itemIdOpction.filter(item=>item.itemId == row.itemId) |
|||
this.tableData[index].tableName = arr[0].tableName |
|||
this.tableData[index].colKey = arr[0].columnName |
|||
if(!type){ |
|||
this.tableData[index].colVal = "" |
|||
this.tableData[index].nextLogicalRel = "" |
|||
this.tableData[index].queryType = "" |
|||
} |
|||
// this.tableData[index].colVal = '' |
|||
// this.tableData[index].queryType = '' |
|||
} |
|||
console.log(arr,'arr是筛选出来的'); |
|||
if(row.itemId=="")return |
|||
// 列表对应值的option有的是通过接口获取的就需要再通过optionSourceType判断下 |
|||
console.log(arr[0].optionSourceType); |
|||
if(arr[0].optionSourceType== "remote"){ |
|||
let url = "" |
|||
let params = {} |
|||
if(row.dataSource == 'house'){ |
|||
url = arr[0].optionSourceUrl |
|||
params = JSON.parse(arr[0].optionSourceParam) |
|||
}else{ |
|||
url = arr[0].optionSourceValue |
|||
} |
|||
|
|||
const { data, code, msg } = await requestPost(url, params) |
|||
if(code == 0 ){ |
|||
arr[0].options = data |
|||
this.$set( this.tableData[index],'correspondingOpction',arr) |
|||
}else{ |
|||
this.$message.error(msg) |
|||
} |
|||
}else{ |
|||
this.$set( this.tableData[index],'correspondingOpction',arr) |
|||
} |
|||
|
|||
console.log( this.tableData); |
|||
|
|||
}, |
|||
async getCompareList(){ |
|||
const url = "/sys/dict/data/dictlist" |
|||
let params = { |
|||
dictType: "sql_query_type" |
|||
} |
|||
let {data,code,msg} = await requestPost(url,params) |
|||
if(code == 0){ |
|||
this.queryTypeOpction = data |
|||
}else if(code>=8000){ |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
// 选中标签其他清空 |
|||
hadeleClearForm(row,index){ |
|||
let obj = {} |
|||
obj = { |
|||
dataSource:row.dataSource?row.dataSource:'', |
|||
itemId:row.itemId?row.itemId:'', |
|||
queryType:row.queryType?row.queryType:'', |
|||
colVal:row.colVal?row.colVal:'', |
|||
colKey:row.colKey?row.colKey:'', |
|||
nextLogicalRel:row.nextLogicalRel?row.nextLogicalRel:'', |
|||
tableName:row.tableName?row.tableName:'', |
|||
itemGroupId:row.itemGroupId?row.itemGroupId:'', |
|||
itemIdOpction:row.itemIdOpction?row.itemIdOpction:[], |
|||
itemGroupIdOpction:row.itemGroupIdOpction?row.itemGroupIdOpction:[] |
|||
} |
|||
this.$set(this.tableData,index,obj) |
|||
}, |
|||
async getFormEdit(id){ |
|||
const url = `/governance/resiSearchTag/listResiSearchRulesByTagId?tagId=${id}` |
|||
let {code,msg,data} = await requestGet(url) |
|||
if(code == 0){ |
|||
console.log(data,'获取到的详情信息'); |
|||
this.tableData = data |
|||
}else if(code>=8000){ |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
async handleComfirm(){ |
|||
this.$refs.label_form.validate((flag)=>{ |
|||
if(flag){ |
|||
let messageObj = {} |
|||
messageObj = this.validateRule(this.tableData) |
|||
console.log(messageObj); |
|||
if(messageObj){ |
|||
this.$message.error(messageObj) |
|||
return |
|||
} |
|||
for(let i in this.tableData){ |
|||
for(let j in this.tableData[i]){ |
|||
if(typeof this.tableData[i][j] != "string"&&typeof this.tableData[i][j] != "number"){ |
|||
this.$delete(this.tableData[i],j) |
|||
} |
|||
} |
|||
} |
|||
this.addSubmit() |
|||
}else{ |
|||
return false |
|||
} |
|||
}) |
|||
|
|||
}, |
|||
async addSubmit(){ |
|||
let url = "" |
|||
let params = { |
|||
} |
|||
if(this.FormType == "edit"){ |
|||
url = "/governance/resiSearchTag/updateResiSearchTag" |
|||
params = { |
|||
tagName:this.formData.tagName, |
|||
rules: this.tableData, |
|||
tagId:this.tagId |
|||
} |
|||
}else { |
|||
url = "/governance/resiSearchTag/addResiSearchTag" |
|||
params = { |
|||
tagName:this.formData.tagName, |
|||
rules: this.tableData, |
|||
} |
|||
} |
|||
|
|||
let {data,msg,code} = await requestPost(url,params) |
|||
if(code==0){ |
|||
this.$message.success('新增成功') |
|||
this.$emit('dialogOk') |
|||
}else if(code>=8000){ |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
handleCancle(){ |
|||
this.$emit('dialogCancle') |
|||
}, |
|||
validateRule(tabList){ |
|||
console.log(tabList); |
|||
let message = "" |
|||
tabList.forEach((item,index)=>{ |
|||
if (item.itemGroupId === '' && item.dataSource=='resi'|| |
|||
item.itemId === '' || |
|||
item.queryType === '' || |
|||
item.colKey === '' |
|||
) { |
|||
|
|||
message = `匹配规则${item.dataSource=='resi'?'人员':item.dataSource=='house'?'房屋':item.dataSource=='stat'?'统计':''}信息不完整,请填写完整 !` |
|||
return message |
|||
} |
|||
if ((index != this.tableData.length - 1) && item.nextLogicalRel === '') { |
|||
message = `匹配规则${item.dataSource=='resi'?'人员':item.dataSource=='house'?'房屋':item.dataSource=='stat'?'统计':''}信息不完整,请填写完整 !` |
|||
console.log(item); |
|||
return message |
|||
} |
|||
if ((item.queryType !== 'is_null' && item.queryType !== 'is_not_null') && item.colVal === '') { |
|||
message = `匹配规则${item.dataSource=='resi'?'人员':item.dataSource=='house'?'房屋':item.dataSource=='stat'?'统计':''}信息不完整,请填写完整 !` |
|||
|
|||
return message |
|||
} |
|||
|
|||
}) |
|||
return message |
|||
}, |
|||
handleClickAddRow(){ |
|||
if(this.tableData == undefined){ |
|||
this.tableData = [] |
|||
} |
|||
let obj = {} |
|||
obj.dataSource=""; |
|||
obj.itemGroupId=""; |
|||
obj.itemId=""; |
|||
obj.queryType=""; |
|||
obj.colVal=""; |
|||
obj.nextLogicalRel="" |
|||
obj.itemIdOpction = [] |
|||
this.tableData.push(obj) |
|||
|
|||
}, |
|||
// 删除一行 |
|||
handleClickDelete(index){ |
|||
this.tableData.splice(index,1) |
|||
}, |
|||
handleClearItemId(row,index){ |
|||
this.tableData[index].colVal = '' |
|||
this.tableData[index].queryType = '' |
|||
}, |
|||
}, |
|||
props:{}, |
|||
computed:{}, |
|||
watch: {}, |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
.imgBtn { |
|||
width: 25px; |
|||
height: 25px; |
|||
margin-top: 3px; |
|||
cursor: pointer; |
|||
} |
|||
.div_btn{ |
|||
display: flex; |
|||
justify-content: right; |
|||
margin-right: 16px; |
|||
margin-top: 10px; |
|||
} |
|||
</style> |
|||
@ -0,0 +1,236 @@ |
|||
<template> |
|||
<div class="g-main"> |
|||
<div class="m-search"> |
|||
<el-form :inline="true" |
|||
:model="formData" |
|||
ref="ref_searchform" |
|||
:label-width="'120px'"> |
|||
<el-form-item label="标签名称" |
|||
prop="tagName"> |
|||
<el-input v-model="formData.tagName" |
|||
size="small" |
|||
class="u-item-width-normal" |
|||
clearable |
|||
placeholder="请输入"> |
|||
</el-input> |
|||
|
|||
</el-form-item> |
|||
<el-row type="flex" > |
|||
<el-col :span="24" align="right"> |
|||
<el-button style="margin-left:30px" |
|||
size="small" |
|||
type="primary " |
|||
@click="handleSearchFrom">查询</el-button> |
|||
</el-col> |
|||
</el-row> |
|||
|
|||
|
|||
</el-form> |
|||
</div> |
|||
<div class="m-table"> |
|||
<div class="div_btn"> |
|||
<el-button |
|||
style="height:32px;" |
|||
size="small" |
|||
@click="handleAdd({},'add')" |
|||
type="primary" |
|||
icon="el-icon-plus" |
|||
> |
|||
新增</el-button |
|||
> |
|||
</div> |
|||
<el-table |
|||
ref="config_table" |
|||
border |
|||
:data="tableData" |
|||
v-loading="tableLoading" |
|||
style="width: 100%" |
|||
:height="tableHeight" |
|||
> |
|||
<el-table-column |
|||
label="标签名称" |
|||
prop="tagName" |
|||
fixed="left" |
|||
align="center" |
|||
key="tagName" |
|||
/> |
|||
<el-table-column fixed="right" label="操作" align="center" width="200"> |
|||
<template slot-scope="scope"> |
|||
<el-button |
|||
style="margin-right: 10px" |
|||
@click="handleAdd(scope.row,'edit')" |
|||
size="small" |
|||
type="text" |
|||
>修改</el-button |
|||
> |
|||
<!-- 按钮权限--> |
|||
<template > |
|||
|
|||
<el-popconfirm |
|||
title="删除之后无法回复,确认删除?" |
|||
@onConfirm="handleDel(scope.row)" |
|||
> |
|||
<el-button |
|||
size="small" |
|||
type="text" |
|||
slot="reference" |
|||
>删除</el-button |
|||
> |
|||
</el-popconfirm> |
|||
</template> |
|||
</template> |
|||
</el-table-column> |
|||
|
|||
</el-table> |
|||
|
|||
<div class="div-flex"> |
|||
<div class="m-page"> |
|||
<el-pagination |
|||
@size-change="handleSizeChange" |
|||
@current-change="handleCurrentChange" |
|||
:current-page.sync="pageNo" |
|||
:page-sizes="[20, 50, 100, 200]" |
|||
:page-size="pageSize" |
|||
layout="sizes, prev, pager, next, total" |
|||
:total="total" |
|||
> |
|||
</el-pagination> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<el-dialog :visible.sync="formShow" |
|||
:close-on-click-modal="false" |
|||
:close-on-press-escape="false" |
|||
:title="formTitle" |
|||
destroy-on-close |
|||
width="900px" |
|||
top="5vh" |
|||
class="dialog-h" |
|||
@closed="diaClose" |
|||
|
|||
> |
|||
<add-form |
|||
v-if="formShow" |
|||
ref="Config_form" |
|||
:row-obj="rowObj" |
|||
@dialogCancle="addFormCancle" |
|||
@dialogOk="addFormOk"></add-form> |
|||
</el-dialog> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import { requestPost } from "@/js/dai/request"; |
|||
import { mapGetters } from "vuex"; |
|||
import addForm from "./addForm.vue" |
|||
import nextTick from "dai-js/tools/nextTick"; |
|||
export default { |
|||
name:"labelConfig", |
|||
data(){ |
|||
return{ |
|||
formData:{ |
|||
tagName:"" |
|||
}, |
|||
tableData:[], |
|||
pageNo:1, |
|||
pageSize:20, |
|||
tableLoading:true, |
|||
total:0, |
|||
searchH:100, |
|||
formShow:false, |
|||
formTitle:"", |
|||
rowObj:{} |
|||
} |
|||
|
|||
}, |
|||
created(){ |
|||
}, |
|||
components:{addForm}, |
|||
methods:{ |
|||
async getlabelConfigList(){ |
|||
const url = "/governance/resiSearchTag/listResiSearchTags" |
|||
let params = { |
|||
pageNo:this.pageNo, |
|||
pageSize:this.pageSize, |
|||
tagName:this.formData.tagName |
|||
} |
|||
let {data,msg,code} = await requestPost(url,params) |
|||
this.tableLoading = false |
|||
if(code == 0 ){ |
|||
this.tableData = data.list |
|||
this.total = data.total |
|||
}else{ |
|||
this.$message.error(msg) |
|||
} |
|||
}, |
|||
addFormCancle () { |
|||
this.formShow = false |
|||
}, |
|||
addFormOk () { |
|||
this.formShow = false |
|||
this.getlabelConfigList() |
|||
}, |
|||
handleAdd (row,type) { |
|||
if(type=="add"){ |
|||
this.formTitle = '新增标签' |
|||
this.formShow = true |
|||
// this.$nextTick(() => { |
|||
// this.$refs.Config_form.initForm(type, row) |
|||
// }) |
|||
}else { |
|||
this.formTitle = '修改标签' |
|||
this.formShow = true |
|||
console.log(row); |
|||
this.rowObj = row |
|||
this.$nextTick(() => { |
|||
this.$refs.Config_form.initForm(type, row) |
|||
}) |
|||
} |
|||
}, |
|||
handleSizeChange(val) { |
|||
console.log(`每页 ${val} 条`); |
|||
this.pageSize = val; |
|||
this.getlabelConfigList() |
|||
}, |
|||
async handleDel(row){ |
|||
const url = `/governance/resiSearchTag/deleteResiSearchTag/${row.tagId}` |
|||
let {code,msg} = await requestPost(url) |
|||
if(code == 0 ){ |
|||
this.$message.success('删除成功') |
|||
}else { |
|||
this.$message.error(msg) |
|||
|
|||
} |
|||
this.getlabelConfigList() |
|||
}, |
|||
handleSearchFrom(){ |
|||
this.getlabelConfigList() |
|||
}, |
|||
handleCurrentChange(val) { |
|||
this.pageNo = val; |
|||
this.getlabelConfigList(); |
|||
}, |
|||
diaClose () { |
|||
this.formShow = false |
|||
}, |
|||
}, |
|||
async mounted(){ |
|||
this.getlabelConfigList() |
|||
}, |
|||
computed:{ |
|||
...mapGetters(["clientHeight", "iframeHeight"]), |
|||
tableHeight() { |
|||
const h = this.clientHeight - this.searchH - 275 + this.iframeHeight; |
|||
const _h = this.clientHeight - 275 - this.searchH; |
|||
return this.$store.state.inIframe ? h : _h; |
|||
}, |
|||
}, |
|||
watch:{} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "@/assets/scss/modules/management/list-main.scss"; |
|||
.div_btn{ |
|||
margin-bottom: 12px; |
|||
} |
|||
</style> |
|||
File diff suppressed because it is too large
Loading…
Reference in new issue