|
@@ -6,32 +6,27 @@
|
|
|
<el-form :model="formData[0]" :rules="rules" ref="ruleForm" label-width="100px" class="demo-ruleForm">
|
|
|
<el-form-item label="事件名称" prop="name">
|
|
|
<el-autocomplete class="inline-input" v-model="formData[0].name" value-key="name" v-SelectLazyLoading="load"
|
|
|
- :fetch-suggestions="querySearchQuestion"
|
|
|
- placeholder="请输入或选择事件" :trigger-on-focus="false"
|
|
|
+ :fetch-suggestions="querySearchQuestion" placeholder="请输入或选择事件" :trigger-on-focus="false"
|
|
|
@select="handleSelectQuestion" @blur="blur($event, { $index: 0 })" style="width: 100%;">
|
|
|
</el-autocomplete>
|
|
|
</el-form-item>
|
|
|
- <el-form-item label="所属客户" prop="clientId" v-if="userinfo.tenantType == 1" >
|
|
|
+ <el-form-item label="所属客户" prop="clientId" v-if="userinfo.tenantType == 1">
|
|
|
<!-- <el-select v-model="formData[0].clientId" :disabled="(formData[0].id && !this.row) ? true : false" -->
|
|
|
- <el-select ref="select" v-model="formData[0].clientId" clearable
|
|
|
- style="width: 100%;" placeholder="请选择客户">
|
|
|
- <el-option
|
|
|
- v-for="item in clientList"
|
|
|
- :key="parseInt(item.id)" :label="item.name" :value="parseInt(item.id)">
|
|
|
+ <el-select ref="select" v-model="formData[0].clientId" clearable filterable remote style="width: 100%;"
|
|
|
+ placeholder="请选择客户" v-SelectLazyLoading="loadClient" :remote-method="remoteMethod" :loading="client.loading">
|
|
|
+ <el-option v-for="item in clientList" :key="parseInt(item.id)" :label="item.name"
|
|
|
+ :value="parseInt(item.id)">
|
|
|
</el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="事件日期" prop="eventDate">
|
|
|
- <el-date-picker
|
|
|
- style="width: 100%" v-model="formData[0].eventDate"
|
|
|
- type="date" value-format="yyyy-MM-dd" placeholder="请选择事件日期"
|
|
|
- >
|
|
|
+ <el-date-picker style="width: 100%" v-model="formData[0].eventDate" type="date" value-format="yyyy-MM-dd"
|
|
|
+ placeholder="请选择事件日期">
|
|
|
</el-date-picker>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="事件场景" prop="scenarioId">
|
|
|
<!-- <el-select v-model="formData[0].applicationScenarios[0]" :disabled="(formData[0].id && !this.row) ? true : false" -->
|
|
|
- <el-select ref="select2" v-model="formData[0].scenarioId"
|
|
|
- style="width: 100%;" placeholder="请选择事件场景">
|
|
|
+ <el-select ref="select2" v-model="formData[0].scenarioId" style="width: 100%;" placeholder="请选择事件场景">
|
|
|
<el-option
|
|
|
v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO ? commonData.ENTERPRISE_APPLICATION_SCENARIO : []"
|
|
|
:key="parseInt(item.value)" :label="item.label" :value="parseInt(item.value)">
|
|
@@ -39,11 +34,12 @@
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="文件上传">
|
|
|
- <myUpload :file-list="handleConcat(formData[0].systemFileList)" @on-change="onchange" @on-remove="onRemove" style="height: 180px;"></myUpload>
|
|
|
+ <myUpload :file-list="handleConcat(formData[0].systemFileList)" @on-change="onchange" @on-remove="onRemove"
|
|
|
+ style="height: 180px;"></myUpload>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="事件描述" prop="description">
|
|
|
- <el-input type="textarea" :rows="2" v-model="formData[0].description" autocomplete="off" placeholder="请输入事件描述"
|
|
|
- ></el-input>
|
|
|
+ <el-input type="textarea" :rows="2" v-model="formData[0].description" autocomplete="off"
|
|
|
+ placeholder="请输入事件描述"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
</div>
|
|
@@ -60,9 +56,9 @@
|
|
|
</template>
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
- <el-autocomplete class="inline-input" v-model="scope.row.name"
|
|
|
- :fetch-suggestions="querySearchQuestion" placeholder="请输入或选择事件" :trigger-on-focus="false"
|
|
|
- @select="handleSelectQuestion" @blur="blur($event, scope)" style="width: 100%;">
|
|
|
+ <el-autocomplete class="inline-input" v-model="scope.row.name" :fetch-suggestions="querySearchQuestion"
|
|
|
+ placeholder="请输入或选择事件" :trigger-on-focus="false" @select="handleSelectQuestion"
|
|
|
+ @blur="blur($event, scope)" style="width: 100%;">
|
|
|
</el-autocomplete>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -70,19 +66,18 @@
|
|
|
<el-table-column prop="eventDate" label="事件时间" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
- <el-date-picker style="width: 100%" v-model="scope.row.eventDate"
|
|
|
- type="datetime" value-format="yyyy-MM-dd" placeholder="选择事件日期时间">
|
|
|
+ <el-date-picker style="width: 100%" v-model="scope.row.eventDate" type="datetime"
|
|
|
+ value-format="yyyy-MM-dd" placeholder="选择事件日期时间">
|
|
|
</el-date-picker>
|
|
|
</div>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
-
|
|
|
+
|
|
|
<el-table-column prop="applicationScenarios" label="事件场景" align="center">
|
|
|
<template slot-scope="scope">
|
|
|
<div>
|
|
|
<!-- multiple -->
|
|
|
- <el-select v-model="scope.row.scenarioId"
|
|
|
- style="width: 100%;" placeholder="请选择事件场景">
|
|
|
+ <el-select v-model="scope.row.scenarioId" style="width: 100%;" placeholder="请选择事件场景">
|
|
|
<el-option
|
|
|
v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO ? commonData.ENTERPRISE_APPLICATION_SCENARIO : []"
|
|
|
:key="parseInt(item.value)" :label="item.label" :value="parseInt(item.value)">
|
|
@@ -116,7 +111,8 @@
|
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<el-button size="small" @click="handleClose()" style="width:100px">取消</el-button>
|
|
|
<el-button size="small" @click="resetForm()" style="width:100px">重置</el-button>
|
|
|
- <el-button type="primary" @click="submitForm1()" size="small" :loading="loading" style="width:100px">确定</el-button>
|
|
|
+ <el-button type="primary" @click="submitForm1()" size="small" :loading="loading"
|
|
|
+ style="width:100px">确定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
|
|
@@ -129,7 +125,7 @@ export default {
|
|
|
props: [],
|
|
|
data() {
|
|
|
return {
|
|
|
- loading:false,
|
|
|
+ loading: false,
|
|
|
//弹窗标题
|
|
|
title: '',
|
|
|
//弹窗状态
|
|
@@ -147,30 +143,39 @@ export default {
|
|
|
],
|
|
|
//检验规则
|
|
|
rules: {
|
|
|
- name: [ { required: true, message: '请输入事件名称', trigger: 'blur' },],
|
|
|
- scenarioId: [ { required: true, message: '请选择事件场景', trigger: 'change' },],
|
|
|
+ name: [{ required: true, message: '请输入事件名称', trigger: 'blur' },],
|
|
|
+ scenarioId: [{ required: true, message: '请选择事件场景', trigger: 'change' },],
|
|
|
},
|
|
|
//应用场景数据
|
|
|
commonData: {},
|
|
|
//弹窗类型
|
|
|
type: 1,
|
|
|
- questionNameArr:{
|
|
|
+ questionNameArr: {
|
|
|
queryParams: {
|
|
|
current: 1,
|
|
|
- size:10,
|
|
|
+ size: 10,
|
|
|
},
|
|
|
- eventInput:'',
|
|
|
- data:[]
|
|
|
+ eventInput: '',
|
|
|
+ data: []
|
|
|
},
|
|
|
-
|
|
|
+
|
|
|
//客户集合
|
|
|
clientList: [],
|
|
|
+ // 客户懒加载所需
|
|
|
+ client: {
|
|
|
+ queryParams: {
|
|
|
+ current: 1,
|
|
|
+ size: 10,
|
|
|
+ },
|
|
|
+ isLazy: true,
|
|
|
+ loading:false,
|
|
|
+ },
|
|
|
// 文件数组
|
|
|
- files:[],
|
|
|
+ files: [],
|
|
|
}
|
|
|
},
|
|
|
watch: {},
|
|
|
- computed:{
|
|
|
+ computed: {
|
|
|
...mapGetters(["userinfo"]),
|
|
|
},
|
|
|
async mounted() {
|
|
@@ -186,43 +191,70 @@ export default {
|
|
|
})
|
|
|
this.formData[0].systemFileList.splice(a, 1)
|
|
|
} else {
|
|
|
- let a=this.files.findIndex(item => {
|
|
|
+ let a = this.files.findIndex(item => {
|
|
|
return item.size == file.size
|
|
|
})
|
|
|
this.files.splice(a, 1)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 自定义组件文件监听
|
|
|
onchange(file, fileList) {
|
|
|
- if (this.files && this.files.length>0) {
|
|
|
- let a=this.files.findIndex(item => {
|
|
|
+ if (this.files && this.files.length > 0) {
|
|
|
+ let a = this.files.findIndex(item => {
|
|
|
return item.size == file.size
|
|
|
})
|
|
|
if (a != -1) {
|
|
|
this.$message.error(`${file.raw.name}文件重复`)
|
|
|
- this.files.splice(a,1,file.raw)
|
|
|
+ this.files.splice(a, 1, file.raw)
|
|
|
} else {
|
|
|
this.files.push(file.raw)
|
|
|
}
|
|
|
} else {
|
|
|
this.files.push(file.raw)
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
},
|
|
|
// 合并已上传的文件和未上传的文件
|
|
|
handleConcat(arr) {
|
|
|
let files = (arr || []).concat(this.files)
|
|
|
return files
|
|
|
},
|
|
|
+ loadClient() {
|
|
|
+ if(this.client.queryParams.current * this.client.queryParams.size>=this.client.queryParams.total){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.client.queryParams.current +=1
|
|
|
+ this.getAdminClientList()
|
|
|
+ },
|
|
|
+ remoteMethod(query) {
|
|
|
+ // this.client.isLazy = true
|
|
|
+ // if (query !== '') {
|
|
|
+ // this.client.loading = true;
|
|
|
+ // this.client.queryParams = {
|
|
|
+ // current: 1,
|
|
|
+ // size: 10,
|
|
|
+ // searchQuery: `name=${query}`
|
|
|
+ // }
|
|
|
+ // this.$api.getAdminClientList(this.client.queryParams).then(response => {
|
|
|
+ // if (response.code == 200) {
|
|
|
+ // this.client.loading = false;
|
|
|
+ // this.clientList = response.data.records
|
|
|
+ // }
|
|
|
+ // }).catch(error => {
|
|
|
+ // this.client.loading = false;
|
|
|
+ // })
|
|
|
+ // } else {
|
|
|
+ // this.client.queryParams.name = null
|
|
|
+ // this.clientList = [];
|
|
|
+ // this.getAdminClientList()
|
|
|
+ // }
|
|
|
+ },
|
|
|
//获取客户信息
|
|
|
getAdminClientList() {
|
|
|
- let params = {
|
|
|
- current: 1,
|
|
|
- size:9999
|
|
|
- }
|
|
|
- this.$api.getAdminClientList(params).then(response => {
|
|
|
- this.clientList = response.data.records
|
|
|
+ this.$api.getAdminClientList(this.client.queryParams).then(response => {
|
|
|
+ this.clientList.push(...response.data.records)
|
|
|
+ this.client.queryParams.total = response.data.total
|
|
|
}).catch(error => {
|
|
|
|
|
|
})
|
|
@@ -236,9 +268,9 @@ export default {
|
|
|
this.$set(this.formData, 0, data)
|
|
|
} else {
|
|
|
if (this.type == 1) {
|
|
|
- this.title='新增事件'
|
|
|
+ this.title = '新增事件'
|
|
|
} else {
|
|
|
- this.title='批量新增事件'
|
|
|
+ this.title = '批量新增事件'
|
|
|
}
|
|
|
this.formData = [
|
|
|
{
|
|
@@ -259,7 +291,7 @@ export default {
|
|
|
this.$refs.ruleForm.resetFields()
|
|
|
}
|
|
|
this.files = []
|
|
|
- this.loading=false
|
|
|
+ this.loading = false
|
|
|
this.dialogVisible = false
|
|
|
},
|
|
|
// 请求应用场景(是通过字典还是接口待定)
|
|
@@ -272,16 +304,16 @@ export default {
|
|
|
submitForm1() {
|
|
|
var list = []
|
|
|
try {
|
|
|
- if (this.type=='1') {//单个新增事件
|
|
|
- list=this.formData
|
|
|
+ if (this.type == '1') {//单个新增事件
|
|
|
+ list = this.formData
|
|
|
} else {//多个新增事件
|
|
|
this.formData.forEach(item => {
|
|
|
var a = false
|
|
|
for (let key in item) {
|
|
|
// if (key != 'scenarioId') {
|
|
|
- if (item[key] != '' && item[key] != null) {
|
|
|
- a = true
|
|
|
- }
|
|
|
+ if (item[key] != '' && item[key] != null) {
|
|
|
+ a = true
|
|
|
+ }
|
|
|
// }else {
|
|
|
// if (item[key].length > 0) {
|
|
|
// a = true
|
|
@@ -315,12 +347,12 @@ export default {
|
|
|
// 提交保存事件
|
|
|
addFormData(val) {
|
|
|
let lists = JSON.parse(JSON.stringify(val.list))
|
|
|
-
|
|
|
- if (this.type=='1') {//单个事件新增
|
|
|
+
|
|
|
+ if (this.type == '1') {//单个事件新增
|
|
|
this.$refs.ruleForm.validate(valid => {
|
|
|
if (valid) {
|
|
|
this.addInterface(lists)
|
|
|
- }
|
|
|
+ }
|
|
|
})
|
|
|
} else {//多个事件新增
|
|
|
this.addInterface(lists)
|
|
@@ -328,15 +360,15 @@ export default {
|
|
|
},
|
|
|
//提交保存、编辑事件接口
|
|
|
addInterface(forms) {
|
|
|
- this.loading=true
|
|
|
+ this.loading = true
|
|
|
let formData = new FormData()
|
|
|
if (this.files && this.files.length > 0) {
|
|
|
- for (var i = 0; i < this.files.length; i++) {
|
|
|
- formData.append('files',this.files[i])//文件数据
|
|
|
+ for (var i = 0; i < this.files.length; i++) {
|
|
|
+ formData.append('files', this.files[i])//文件数据
|
|
|
}
|
|
|
}
|
|
|
- if (forms[0].systemFileList && forms[0].systemFileList.length>0) {
|
|
|
- forms[0].fileGuids=forms[0].systemFileList.map(item => {
|
|
|
+ if (forms[0].systemFileList && forms[0].systemFileList.length > 0) {
|
|
|
+ forms[0].fileGuids = forms[0].systemFileList.map(item => {
|
|
|
return item.guid
|
|
|
})
|
|
|
}
|
|
@@ -344,23 +376,23 @@ export default {
|
|
|
if (forms[0].id) {//编辑
|
|
|
this.$api.updateEvent(formData).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.$emit('isSuccess','编辑成功')
|
|
|
+ this.$emit('isSuccess', '编辑成功')
|
|
|
this.$message.success('事件编辑成功')
|
|
|
this.handleClose()
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
- this.loading=false
|
|
|
+ this.loading = false
|
|
|
this.$message.error(error.message)
|
|
|
})
|
|
|
} else {//新增
|
|
|
this.$api.eventAddEvent(formData).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.$emit('isSuccess','新增成功')
|
|
|
+ this.$emit('isSuccess', '新增成功')
|
|
|
this.$message.success('事件新增成功')
|
|
|
this.handleClose()
|
|
|
}
|
|
|
}).catch(error => {
|
|
|
- this.loading=false
|
|
|
+ this.loading = false
|
|
|
this.$message.error(error.message)
|
|
|
})
|
|
|
}
|
|
@@ -408,22 +440,22 @@ export default {
|
|
|
|
|
|
// 懒加载事件方法
|
|
|
load() {
|
|
|
- if(this.questionNameArr.queryParams.current * this.questionNameArr.queryParams.size>=this.questionNameArr.queryParams.total){
|
|
|
+ if (this.questionNameArr.queryParams.current * this.questionNameArr.queryParams.size >= this.questionNameArr.queryParams.total) {
|
|
|
return false
|
|
|
}
|
|
|
- this.questionNameArr.queryParams.current ++
|
|
|
+ this.questionNameArr.queryParams.current++
|
|
|
this.questionEventList()
|
|
|
},
|
|
|
// 查询事件
|
|
|
async questionEventList() {
|
|
|
- let searchValue={name:this.questionNameArr.eventInput}
|
|
|
+ let searchValue = { name: this.questionNameArr.eventInput }
|
|
|
let params = {
|
|
|
...this.questionNameArr.queryParams,//分页信息
|
|
|
- searchQuery:this.$commonJS.objectToString(searchValue)//输入的建议
|
|
|
+ searchQuery: this.$commonJS.objectToString(searchValue)//输入的建议
|
|
|
}
|
|
|
await this.$api.queryEvent(params).then(res => {
|
|
|
if (res.code == 200) {
|
|
|
- this.questionNameArr.data.push(...res.data.data)
|
|
|
+ this.questionNameArr.data.push(...res.data.data)
|
|
|
this.questionNameArr.queryParams.total = res.data.total
|
|
|
this.questionNameArr.cb(this.questionNameArr.data);
|
|
|
}
|
|
@@ -432,9 +464,9 @@ export default {
|
|
|
//获取下拉建议事件数据
|
|
|
async querySearchQuestion(queryString, cb) {
|
|
|
this.questionNameArr.queryParams.current = 1
|
|
|
- this.questionNameArr.eventInput=queryString
|
|
|
+ this.questionNameArr.eventInput = queryString
|
|
|
this.questionNameArr.data = []
|
|
|
- this.questionNameArr.cb=cb
|
|
|
+ this.questionNameArr.cb = cb
|
|
|
await this.questionEventList()
|
|
|
},
|
|
|
|