应用中心 脚本管理、数据源管理修改与开发

This commit is contained in:
hyt 2024-06-20 15:15:25 +08:00
parent ce3fc2f6ca
commit aa1b38e226
8 changed files with 932 additions and 187 deletions

View File

@ -67,6 +67,14 @@ const permission = {
hidden: true
}
},
{
path: 'scriptAdmin',
name: 'scriptAdmin',
component: () => import('@/views/applicationList/scriptAdmin'),
meta: {
hidden: true
}
},
{
path: 'appApiadd',
name: 'appApiAdd',

View File

@ -205,6 +205,11 @@ const settingMenu = [
icon: "appMenu06",
path: 'inserterAdmin'
},
{
title: "脚本管理",
icon: "appMenu06",
path: 'scriptAdmin'
},
]
const configData = {
addForm,

View File

@ -2,230 +2,265 @@ const exploitSettingFormRow = [
{
elCol: [
{
type: "select",
title: "接入方式",
id: "accessMode",
type: 'select',
title: '接入方式',
id: 'accessMode',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: [
{
id: "1",
label: "接口",
id: '1',
label: '接口'
},
{
id: "2",
label: "H5",
id: '2',
label: 'H5'
},
{
id: "3",
label: "PC网页",
id: '3',
label: 'PC网页'
},
{
id: "4",
label: "PC应用程序",
},
],
multiple: true,
},
id: '4',
label: 'PC应用程序'
}
],
multiple: true
}
]
},
{
elCol: [
{
type: "input",
title: "应用客户端地址pc)",
id: "clientPath",
type: 'input',
title: '应用客户端地址pc)',
id: 'clientPath',
row: 24,
disabled: false,
required: false,
fontSize: 16
},
],
}
]
},
{
elCol: [
{
type: "input",
title: "应用网页端地址pc)",
id: "webPath",
type: 'input',
title: '应用网页端地址pc)',
id: 'webPath',
row: 24,
disabled: false,
required: false,
fontSize: 16
},
],
}
]
},
{
elCol: [
{
type: "input",
title: "应用程序地址(移动端)",
id: "programPath",
type: 'input',
title: '应用程序地址(移动端)',
id: 'programPath',
row: 24,
disabled: false,
required: false,
fontSize: 16
},
],
}
]
},
{
elCol: [
{
type: "input",
title: "ip白名单",
id: "systemAddress",
type: 'input',
title: 'ip白名单',
id: 'systemAddress',
row: 24,
disabled: false,
fontSize: 16,
placeholder:"请输入ip白名单并以,分割"
},
],
placeholder: '请输入ip白名单并以,分割'
}
]
},
{
elCol: [
{
type: "input",
title: "应用Key",
id: "publicKey",
type: 'input',
title: '应用Key',
id: 'publicKey',
row: 24,
disabled: true,
required: false,
fontSize: 16,
double: true
},
],
}
]
},
{
elCol: [
{
type: "input",
title: "应用密钥",
id: "secretKey",
type: 'input',
title: '应用密钥',
id: 'secretKey',
row: 24,
disabled: true,
fontSize: 16,
double: true
},
],
}
]
},
{
elCol: [
{
type: "input",
title: "appId ",
id: "appId",
type: 'input',
title: 'appId ',
id: 'appId',
row: 24,
disabled: true,
fontSize: 16,
double: true,
required: false,
},
],
},
required: false
}
]
}
]
const apiEnvFormRow = [
{
elCol: [
{
type: "input",
title: "接口地址",
id: "interfaceAddress",
type: 'input',
title: '接口地址',
id: 'interfaceAddress',
row: 24,
disabled: false,
required: false,
fontSize: 16
},
],
},
}
]
}
]
const tableColumn = [
{
id: 'interfaceKey',
title: "Key"
title: 'Key'
},
{
id: 'interfaceValue',
title: "Value"
title: 'Value'
},
{
id: 'interfaceType',
title: "位置"
},
title: '位置'
}
]
const dataSettingFormRow = [
{
elCol: [
{
type: "select",
title: "数据源类型",
id: "sourceType",
elCol: [{
title: '数据源编码',
id: 'sourceCode',
type: 'input',
row: 24,
disabled: false,
required: true,
fontSize: 16
}]
},
{
elCol: [{
title: '数据源名称',
id: 'sourceName',
type: 'input',
row: 24,
disabled: false,
required: true,
fontSize: 16
}]
},
{
elCol: [{
title: 'ip',
id: 'sourceIp',
type: 'input',
changeRemind: true,
row: 12,
required: true,
fontSize: 16
}, {
title: '端口',
id: 'sourcePort',
type: 'input',
changeRemind: true,
row: 12,
required: true,
fontSize: 16
}]
},
{
elCol: [{
title: '数据库名称',
id: 'dbName',
type: 'input',
changeRemind: true,
row: 12,
required: true,
fontSize: 16
}, {
title: '数据源类型',
id: 'sourceType',
type: 'select',
changeRemind: true,
row: 12,
required: true,
fontSize: 16,
options: [
{
id: "1",
label: "oracle "
id: '1',
label: 'oracle'
},
{
id: "2",
label: "sqlServer"
id: '2',
label: 'sqlsever'
},
{
id: "3",
label: "mysql"
},
],
},
],
id: '3',
label: 'mysql'
}
]
}]
},
{
elCol: [
{
type: "input",
title: "实例地址",
id: "sourceUrl",
row: 24,
disabled: false,
elCol: [{
title: '登录名',
id: 'loginName',
type: 'input',
changeRemind: true,
row: 12,
required: true,
fontSize: 16
},
],
},
{
elCol: [
{
type: "input",
title: "账户",
id: "loginName",
row: 8,
disabled: false,
}, {
title: '密码',
id: 'password',
type: 'input',
changeRemind: true,
row: 12,
required: true,
fontSize: 16
}]
},
{
type: "input",
title: "密码",
id: "password",
row: 8,
disabled: false,
elCol: [{
title: '服务名称',
id: 'serviceName',
type: 'input',
show: false,
changeRemind: true,
row: 12,
required: true,
fontSize: 16
},
{
type: "input",
title: "库名",
id: "dbName",
row: 8,
disabled: false,
required: true,
fontSize: 16
},
],
},
},]
}
]
const config = {
exploitSettingFormRow,

View File

@ -111,7 +111,7 @@
@click="testHandle"
:type="testResult ? 'success' : 'primary'"
style="margin-right: 10px"
>{{ testResult ? "测试通过" : "点击测试" }}
>{{ testResult ? '测试通过' : '点击测试' }}
<i v-if="testResult" class="el-icon-check el-icon--right"></i>
</el-button>
<el-switch
@ -128,7 +128,7 @@
<div class="form">
<baseNewForm
ref="dataSettingForm"
:spanNumber="24"
:spanNumber="12"
:isFunBtn="false"
:lookFlag="lookFlag"
:formRule="!lookFlag"
@ -137,6 +137,7 @@
@onSubmit="dataSettingOnSubmit"
@onSelect="dataSettingFormChange"
@onInput="dataSettingFormChange"
@changeRemind="dataSettingFormChange"
></baseNewForm>
</div>
</div>
@ -145,10 +146,10 @@
</template>
<script>
import BaseTable from "@/views/intergrationTask/compoments/baseTable.vue";
import configData from "./configData";
import {getApiModuleApi} from "@/api/apiChunks/index.js";
import baseNewForm from "@/views/intergrationTask/compoments/baseNewForm";
import BaseTable from '@/views/intergrationTask/compoments/baseTable.vue'
import configData from './configData'
import { getApiModuleApi } from '@/api/apiChunks/index.js'
import baseNewForm from '@/views/intergrationTask/compoments/baseNewForm'
export default {
data() {
@ -158,7 +159,7 @@ export default {
// list
fileList: [],
// base
iconBase64: "",
iconBase64: '',
//
lookFlag: false,
//
@ -168,14 +169,14 @@ export default {
},
//
apiEnvFormRow: configData.apiEnvFormRow,
apiEnvRuleForm: {interfaceAddress: ""},
apiEnvRuleForm: { interfaceAddress: '' },
tableData: [],
tableColumn: configData.tableColumn,
funData: [
{
text: "删除",
color: "#e47470",
},
text: '删除',
color: '#e47470'
}
],
apiEnvOpen: 2,
//
@ -183,13 +184,13 @@ export default {
dataSettingRuleForm: {},
locationOptions: [
{
value: "1",
label: "Header",
value: '1',
label: 'Header'
},
{
value: "2",
label: "Body",
},
value: '2',
label: 'Body'
}
],
testResult: false,
// loading
@ -197,58 +198,66 @@ export default {
//
interfaceStatus: 2,
//
dbStatus: 2,
};
dbStatus: 2
}
},
methods: {
//
dblclick(val) {
navigator.clipboard.writeText(val)
this.$vmNews("内容已复制到剪贴板", 'success')
this.$vmNews('内容已复制到剪贴板', 'success')
},
//
dataSettingFormChange() {
this.testResult = false;
this.dbStatus = 2;
dataSettingFormChange(val, index, indexRow, row = {}) {
this.testResult = false
this.dbStatus = 2
if (row.id === 'sourceType') {
if (val == 1) {
this.dataSettingFormRow[5].elCol[0].show = true
} else {
this.dataSettingFormRow[5].elCol[0].show = false
}
}
},
//
switchCLick() {
if (!this.testResult) {
this.$vmNews("请测试通过后再开启", "warning");
this.$vmNews('请测试通过后再开启', 'warning')
}
},
//
tableButtonHandle(index, row) {
this.tableData.splice(index.index, 1);
this.tableData.splice(index.index, 1)
},
//
newRow() {
this.tableData.push({interfaceType: "1"});
this.tableData.push({ interfaceType: '1' })
},
//
testHandle() {
this.$refs.dataSettingForm.submitForm();
this.$refs.dataSettingForm.submitForm()
},
//
saveHandle() {
let pattern = /^http(s)?:\/\/?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\*\+,;=.]+$/
if (this.apiEnvRuleForm.interfaceAddress && !pattern.test(this.apiEnvRuleForm.interfaceAddress)) {
this.$vmNews("接口地址不合法,请重新输入!", "warning")
this.$vmNews('接口地址不合法,请重新输入!', 'warning')
return
}
if (this.interfaceStatus != 2) {
if (!this.apiEnvRuleForm.interfaceAddress) {
this.$vmNews("接口环境开启时,接口地址不能为空!", "warning");
return;
this.$vmNews('接口环境开启时,接口地址不能为空!', 'warning')
return
}
let flag = this.tableData.some((item, index) => {
if (item.interfaceKey == "" || !item.interfaceKey) {
if (item.interfaceKey == '' || !item.interfaceKey) {
this.$vmNews(`接口环境开启时,接口环境第${index + 1}行Key不能为空!`)
return true
} else if (item.interfaceValue == "" || !item.interfaceValue) {
} else if (item.interfaceValue == '' || !item.interfaceValue) {
this.$vmNews(`接口环境开启时,接口环境第${index + 1}行Value不能为空!`)
return true
} else if (item.interfaceType == "" || !item.interfaceType) {
} else if (item.interfaceType == '' || !item.interfaceType) {
this.$vmNews(`接口环境开启时,接口环境第${index + 1}行位置不能为空!`)
return true
} else {
@ -259,26 +268,28 @@ export default {
return
}
}
this.$refs.exploitSettingForm.submitForm();
this.$refs.exploitSettingForm.submitForm()
},
async dataSettingOnSubmit() {
this.testLoading = true;
this.testLoading = true
//
// this.testResult = true;
try {
const res = await getApiModuleApi({
tl: "sysApplicationService",
as: "application",
dj: "testDatabase"
}, {...this.dataSettingRuleForm})
if (res.status === '200' && res.flag) {
this.testResult = true;
this.$vmNews("测试通过开关已开启", "success")
tl: 'sysApplicationService',
as: 'application',
dj: 'testDatabase'
}, { ...this.dataSettingRuleForm })
if (res.status === '200' && res.attribute) {
this.testResult = true
this.$vmNews('测试通过开关已开启', 'success')
} else {
this.$vmNews(res.msg)
}
} catch (err) {
this.testResult = false
}
this.testLoading = false;
this.testLoading = false
},
//
async exploitSettingOnSubmit() {
@ -305,31 +316,32 @@ export default {
...this.apiEnvRuleForm,
apiParas: this.tableData,
databaseEntity: {
...this.dataSettingRuleForm,
...this.dataSettingRuleForm
}
}
const res = await getApiModuleApi({
tl: "sysApplicationService",
as: "application",
dj: "updateApp"
}, {...obj})
tl: 'sysApplicationService',
as: 'application',
dj: 'updateApp'
}, { ...obj })
if (res.status === '200') {
this.$vmNews("保存成功", "success")
this.$vmNews('保存成功', 'success')
this.initDataInfo()
}
},
async initDataInfo() {
const res = await getApiModuleApi({
tl: 'sysApplicationService',
as: "application",
dj: "queryAppAll"
}, {id: this.$route.query.id})
as: 'application',
dj: 'queryAppAll'
}, { id: this.$route.query.id })
if (res.status === '200') {
if (res.attribute.databaseEntity) {
this.dataSettingRuleForm = res.attribute.databaseEntity;
this.dataSettingRuleForm = res.attribute.databaseEntity
console.log(this.dataSettingRuleForm, 'this.dataSettingRuleForm')
console.log('数据源设置id:' + res.attribute.databaseEntity.id)
}
this.tableData = res.attribute.apiParas;
this.tableData = res.attribute.apiParas
this.apiEnvRuleForm.interfaceAddress = res.attribute.app.interfaceAddress
this.dbStatus = res.attribute.app.dbStatus
if (this.dbStatus == 1) {
@ -344,18 +356,18 @@ export default {
publicKey: res.attribute.app.publicKey,
secretKey: res.attribute.app.secretKey,
appId: res.attribute.app.appId,
systemAddress: res.attribute.app.systemAddress,
systemAddress: res.attribute.app.systemAddress
}
}
}
},
components: {
baseNewForm,
BaseTable,
BaseTable
},
created() {
this.initDataInfo()
this.$emit("flashActive", 1)
this.$emit('flashActive', 1)
// if (this.$route.query.id) {
// this.lookFlag = true;
// } else {
@ -370,8 +382,8 @@ export default {
// this.dbStatus = 2;
// },
// },
},
};
}
}
</script>
<style scoped lang="scss">

View File

@ -0,0 +1,140 @@
const formRow = [
{
elCol: [
{
type: 'input',
title: '脚本名称',
id: 'scriptName',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'input',
title: '脚本编号',
id: 'scriptCode',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'input',
title: '脚本版本',
id: 'scriptVersion',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'datepick',
title: '发布日期',
id: 'releaseDate',
row: 24,
disabled: false,
required: true,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'textrea',
title: '脚本内容',
id: 'scriptData',
row: 24,
disabled: false,
required: false,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'textrea',
title: '描述',
id: 'scriptRemark',
row: 24,
disabled: false,
required: false,
fontSize: 16
}
]
},
{
elCol: [
{
type: 'radio',
title: '是否启用',
id: 'scriptStatus',
row: 24,
disabled: false,
required: true,
fontSize: 16,
options: [
{
label: '启用',
id: '1'
},
{
label: '停用',
id: '2'
}
]
}
]
}
]
const tableColumn = [
{
id: 'pluginName',
title: '插件名称'
},
{
id: 'pluginCode',
title: '插件编号'
},
{
id: 'pluginVersion',
title: '插件版本'
},
{
id: 'pluginRemark',
title: '描述',
tooltip: true,
width: 150
},
{
id: 'releaseDate',
title: '发布日期',
tooltip: true,
width: 150
},
{
id: 'modify_time',
title: '更新日期',
tooltip: true
}
]
const configData = {
formRow,
tableColumn
}
export default configData

View File

@ -0,0 +1,336 @@
<template>
<div class="monitoring">
<header>
<div class="left">
<el-input
placeholder="脚本"
v-model="searchForm.scriptName"
@change="searchBtnHandle"
>
<i slot="suffix" class="el-input__icon el-icon-search" @click="searchBtnHandle"></i>
</el-input>
</div>
<div class="right">
<el-button
icon="el-icon-back"
@click="
$router.replace({ path: '/applicationList/applicationListAdmin' })
"
>返回
</el-button
>
<el-button type="primary" icon="el-icon-plus" @click="inserterAdd"
>添加脚本
</el-button
>
</div>
</header>
<main>
<BaseTable
ref="mainTable"
:tableData="tableData"
:tableColumn="tableColumn"
:funData="funData"
:funWidth="funWidth"
:showIndex="true"
:tabLoading="mainTabLoading"
@onFunc="tableButtonHandle"
:tableHeight="'70vh'"
:border="false"
>
<template #scriptStatus="{row}">
{{ row.scriptStatus == 1 ? '启用' : '停用' }}
</template>
<!-- 启用/停用-->
<template #scriptStatus="{row}">
<el-switch
v-model="row.scriptStatus"
active-value="1"
inactive-value="0"
@change="(val)=>{swithChangeHandle(val,row)}"
>
</el-switch>
</template>
</BaseTable>
<div class="page">
<basePage
:pageModel="pageModel"
@update:pageModel="currentChangeHandle"
></basePage>
</div>
</main>
<footer></footer>
<baseDialog
:title="'插件配置'"
v-model="plugInDialog"
@confirm="plugInConfirm"
:width="'50%'"
>
<div v-if="plugInDialog">
<baseNewForm
ref="dataSettingForm"
:spanNumber="24"
:isFunBtn="false"
:lookFlag="lookFlag"
:formRule="!lookFlag"
:formRow="formRow"
:ruleForm="ruleForm"
@onSubmit="onSubmit"
></baseNewForm>
</div>
</baseDialog>
</div>
</template>
<script>
import { deepClone } from '@/utils/index.js'
import baseNewForm from '@/views/intergrationTask/compoments/baseNewForm'
import baseDialog from '@/views/integrationOption/compoments/baseDialog'
import configData from './configData.js'
import dayjs from 'dayjs'
import BaseTable from '@/views/intergrationTask/compoments/baseTable.vue'
import basePage from '@/views/intergrationTask/compoments/basePage.vue'
import { getApiModuleApi } from '@/api/apiChunks/index.js'
import { authApi } from '@/api/apis/auth'
export default {
data() {
return {
ruleForm: { pluginStatus: '1' },
formRow: configData.formRow,
lookFlag: false,
plugInDialog: false,
refreshLoading: false,
searchForm: {
name: ''
},
mainTabLoading: false,
funData: [
{
type: 'view',
text: '更新',
color: '#5a9cf8'
},
{
type: 'dele',
text: '删除',
color: '#e47470'
}
],
tableColumn: [
{
id: 'scriptName',
title: '脚本名称',
tooltip: true
},
{
id: 'scriptCode',
title: '脚本编号',
tooltip: true
},
{
id: 'scriptVersion',
title: '脚本版本',
tooltip: true
},
{
id: 'scriptRemark',
title: '描述',
tooltip: true
},
{
id: 'releaseDate',
title: '发布日期',
tooltip: true
},
{
id: 'scriptStatus',
title: '启用状态',
tooltip: true
}
],
tableData: [],
pageModel: {
pageIndex: 1,
total: 10,
limit: 10
},
editFlag: false
}
},
methods: {
//
async swithChangeHandle(val, row) {
const res = await authApi('sysApplicationService', '', 'enableOrDisableAppScript', '', {
id: row.id,
scriptStatus: row.scriptStatus
})
this.$vmNews(res.msg, 'success')
console.log(res, 'res')
this.initMainTableData(this.searchForm)
},
searchBtnHandle() {
this.initMainTableData(this.searchForm)
},
async onSubmit() {
if (!this.ruleForm.id) {
const res = await getApiModuleApi({
tl: 'sysApplicationService',
as: '',
dj: 'saveAppScript'
}, { appId: this.$route.query.id, ...this.ruleForm })
if (res.status === '200') {
this.$vmNews('提交成功', 'success')
this.plugInDialog = false
this.ruleForm = {}
this.initMainTableData()
}
} else {
const res = await getApiModuleApi({
tl: 'sysApplicationService',
as: '',
dj: 'updateAppScript'
}, { appId: this.$route.query.id, ...this.ruleForm })
if (res.status === '200') {
this.$vmNews('提交成功', 'success')
this.plugInDialog = false
this.ruleForm = {}
this.initMainTableData()
}
}
},
plugInConfirm() {
this.$refs.dataSettingForm.submitForm()
},
//
inserterAdd() {
this.plugInDialog = true
// this.$router.push({ path: "/inserterAdmin/inserterAdd" });
},
//
getTimeHandler(time) {
var days = parseInt(time / (1000 * 60 * 60 * 24))
var hours = parseInt((time % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60))
var minutes = parseInt((time % (1000 * 60 * 60)) / (1000 * 60))
var seconds = (time % (1000 * 60)) / 1000
return days + '天' + hours + '小时' + minutes + '分钟' + seconds + '秒'
},
//
async initMainTableData(obj = {}) {
this.refreshLoading = true
this.openLoading('detail')
const res = await getApiModuleApi(
{
tl: 'sysApplicationService',
as: '',
dj: 'queryAppScriptPage'
},
{
pageNum: this.pageModel.pageIndex,
pageSize: this.pageModel.limit,
...obj,
appId: this.$route.query.id
}
)
this.refreshLoading = false
if (res.status == 200) {
this.tableData = res.attribute.list
this.pageModel.total = res.attribute.total
}
},
//
submitsearchForm() {
this.initMainTableData(this.searchForm)
},
//
tableButtonHandle(val, item) {
if (item.type === 'view') {
this.ruleForm = deepClone(val)
this.plugInDialog = true
} else if (item.type === 'dele') {
this.$confirm('确认删除?')
.then(async() => {
this.openLoading('submit')
const res = await getApiModuleApi({
tl: 'sysApplicationService',
as: '',
dj: 'deleteAppScript'
}, { id: val.id })
if (res.status === '200') {
this.$vmNews('删除脚本成功', 'success')
this.initMainTableData(this.searchForm)
}
})
.catch(() => {
})
}
},
//
currentChangeHandle(pageModel) {
this.pageModel = pageModel
this.$nextTick(() => {
this.initMainTableData(this.searchForm)
})
}
},
computed: {
//
funWidth() {
return this.funData.length * 70
}
},
components: {
BaseTable,
basePage,
baseDialog,
baseNewForm
},
created() {
this.initMainTableData()
this.$emit('flashActive', 6)
}
}
</script>
<style scoped lang="scss">
.monitoring {
position: relative;
width: 100%;
background-color: #fafafa;
header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px;
background-color: #fff;
border-radius: 20px;
.left {
width: 20vw;
align-items: center;
display: flex;
.search {
margin-left: 30px;
display: flex;
> .chunk {
margin-left: 10px;
}
}
}
}
main {
margin-top: 10px;
padding: 20px 20px 5px;
border-radius: 20px;
background-color: #fff;
}
footer {
margin-top: 20px;
}
}
</style>

View File

@ -0,0 +1,206 @@
<template>
<div class="wrap">
<div class="btn">
<div class="chunk">
<el-button icon="el-icon-close" @click="$router.back()">取消</el-button>
</div>
<div class="chunk">
<el-button
icon="el-icon-first-aid-kit
"
type="primary"
>保存</el-button
>
</div>
</div>
<div class="main">
<div class="upload">
<div class="title">插件信息</div>
<div class="uploadMain">
<div class="left">
<div class="title">插件上传</div>
<el-upload
class="upload-demo"
action="https://jsonplaceholder.typicode.com/posts/"
:on-preview="handlePreview"
:on-remove="handleRemove"
:before-upload="beforeUpload"
:file-list="fileList"
list-type="picture"
:limit="1"
:disabled="lookFlag"
>
<div class="line">
<div class="left">
<el-image
style="width: 64px; height: 64px"
:src="iconBase64"
fit="cover"
alt="点击上传"
>
<template v-slot:error>
<div style="line-height: 64px; font-size: 12px">
logo上传
</div>
</template>
</el-image>
</div>
<div class="right" v-if="!lookFlag">
<el-button size="small" type="primary">点击上传</el-button>
</div>
</div>
<div slot="tip" class="el-upload__tip" v-if="!lookFlag">
只能上传jpg/png文件且不超过2MB
</div>
</el-upload>
</div>
</div>
</div>
<div class="form">
<baseNewForm
ref="mainForm"
:spanNumber="24"
:isFunBtn="false"
:lookFlag="lookFlag"
:formRule="!lookFlag"
:formRow="formRow"
></baseNewForm>
</div>
</div>
</div>
</template>
<script>
import configData from "./configData";
import baseNewForm from "@/views/intergrationTask/compoments/baseNewForm";
export default {
data() {
return {
fileList: [],
iconBase64: "",
value1: true,
ruleForm: {},
lookFlag: false,
formRow: configData.addForm,
};
},
methods: {
handleRemove(file, fileList) {
console.log(file, fileList, "123");
},
handlePreview(file) {
console.log(file, this.fileList, "12333");
},
beforeUpload(file) {
console.log(file);
if (
file.type.split("/")[1] != "jpeg" &&
file.type.split("/")[1] != "png"
) {
this.$message({
type: "warning",
message: "只能上传jpg/png文件",
});
return false;
} else {
if (file.size >= 2000000) {
this.$message({
type: "warning",
message: "文件大小不超过2MB",
});
return false;
}
let reader = new FileReader();
let that = this;
console.log(this, 111);
reader.onloadend = function () {
// base64
var base64String = reader.result;
that.iconBase64 = base64String;
console.log(that.iconBase64);
};
reader.readAsDataURL(file);
return false;
}
},
},
components: {
baseNewForm,
},
created() {
if (this.$route.query.id) {
this.lookFlag = true;
} else {
this.lookFlag = false;
}
},
};
</script>
<style scoped lang="scss">
::v-deep .el-button {
border-radius: 16px;
}
::v-deep .el-form-item {
display: block !important;
}
.wrap {
background-color: #fbfbfb;
width: 100%;
padding: 10px;
overflow: auto;
> .btn {
display: flex;
justify-content: flex-end;
> .chunk {
margin-left: 10px;
}
}
> .main {
margin-top: 10px;
> .upload {
background-color: #fff;
border-radius: 16px;
padding: 15px;
> .title {
font-size: 18px;
font-weight: 600;
}
> .uploadMain {
margin-top: 20px;
display: flex;
align-items: center;
justify-content: space-between;
> .left {
> .title {
font-size: 18px;
color: #999999;
margin-bottom: 10px;
}
.line {
display: flex;
align-items: center;
.left {
border: 1px dashed #999999;
width: 64px;
height: 64px;
> img {
width: 100%;
height: 100%;
}
}
.right {
margin-left: 15px;
}
}
}
}
}
> .form {
margin-top: 10px;
background-color: #fff;
border-radius: 16px;
}
}
}
</style>

View File

@ -89,7 +89,7 @@
:disabled="row.disabled && !newFlag ? row.disabled : false"
:precision="row.precisionNum ? row.precisionNum : 0"
:step="row.stepNum ? row.stepNum : 1"
@change="handleChange"
@change="row.changeRemind?changeRemind(row):''"
@input="(val) => limitPhoneNum(val, ruleForm, row.id)"
:maxlength="row.maxlength ? row.maxlength * 1 : 50"
:min="1"
@ -488,6 +488,9 @@ export default {
},
computed: {},
methods: {
changeRemind() {
this.$emit('changeRemind', this.ruleForm)
},
showValueHandle() {
},
limitPhoneNum(value, data, id) {