Commit 4dcb9915 by 周海峰

no message

parent 9ffc9508
......@@ -313,12 +313,12 @@ export default {
async platformapplicationslistall(){
let dataRes = await platformapplicationslistall();
// 只显示pc端地址有值的
this.itemList = dataRes.data.data.filter(item=> item.href);
this.itemList = dataRes.data.data.filter(item=> item.href && item.qyflag=='1');
},
async platformapplicationslistallApp(){
let dataRes = await platformapplicationslistallApp();
// 只显示app端地址有值的
this.itemListApp = dataRes.data.data.filter(item=> item.wechatUrl);
this.itemListApp = dataRes.data.data.filter(item=> item.wechatUrl && item.qyflag=='1');
},
},
mounted() {
......
......@@ -23,8 +23,12 @@
</q-field>
<div class="row">
<div class="col-6 q-pr-sm">
<q-field :count="64">
<q-input v-model="localTemp.appid" float-label="应用唯一标识" @blur="getsecret" :disable="appidflag" />
<q-field :count="30" :error="appidError" :error-message="appidErrorMessage">
<q-input
v-model="localTemp.appid"
float-label="应用唯一标识"
:disable="appidflag"
/>
</q-field>
</div>
<div class="col-6 q-pl-sm">
......@@ -40,8 +44,11 @@
</q-field>
</div>
<div class="col-6 q-pr-sm">
<q-field :count="200">
<q-input v-model="localTemp.mailtype" float-label="待办标识" />
<q-field :count="10" :error="mailtypeError" :error-message="mailtypeErrorMessage">
<q-input
v-model="localTemp.mailtype"
float-label="待办标识"
/>
</q-field>
</div>
</div>
......@@ -82,7 +89,7 @@
</div>
</q-field>
<q-field>
<q-select v-model="localTemp.qyflag" float-label="启用/停用" radio :options="selectOptions"/>
<q-select v-model="localTemp.qyflag" float-label="应用启用/停用" radio :options="selectOptions"/>
</q-field>
</q-card-section>
</q-card>
......@@ -120,7 +127,7 @@
</template>
<script>
import { saveapp } from "@/service/permission/platformapplications";
import { saveapp, checkAppidUnique, checkMailtypeUnique } from "@/service/permission/platformapplications";
import { getApplicationsGroupList, addApplicationsGroup } from "@/service/permission/platformapplicationsGroup";
export default {
name: "EditApplication",
......@@ -137,9 +144,15 @@ export default {
return {
visible: this.value,
localTemp: JSON.parse(JSON.stringify(this.temp || {})),
fileCount: 0
,applicationsGroupOptions: []
,imageLoadError: false
fileCount: 0,
applicationsGroupOptions: [],
imageLoadError: false,
appidError: false,
appidErrorMessage: "",
mailtypeError: false,
mailtypeErrorMessage: "",
appidTimer: null,
mailtypeTimer: null
}
},
watch: {
......@@ -148,6 +161,8 @@ export default {
if (v) {
this.localTemp = JSON.parse(JSON.stringify(this.temp || {}));
this.fetchApplicationsGroupOptions();
this.resetValidation();
this.clearTimers();
if (this.localTemp.img === undefined) {
this.$set(this.localTemp, 'img', '');
......@@ -169,8 +184,44 @@ export default {
},
methods: {
close() {
this.clearTimers();
this.visible = false;
},
clearTimers() {
if (this.appidTimer) {
clearTimeout(this.appidTimer);
this.appidTimer = null;
}
if (this.mailtypeTimer) {
clearTimeout(this.mailtypeTimer);
this.mailtypeTimer = null;
}
},
resetValidation() {
this.appidError = false;
this.appidErrorMessage = "";
this.mailtypeError = false;
this.mailtypeErrorMessage = "";
},
async validateAppid() {
try {
const excludeId = this.subtype === 'edit' ? this.localTemp.id : null;
const response = await checkAppidUnique(this.localTemp.appid, excludeId);
return response.data.data;
} catch (e) {
return true;
}
},
async validateMailtype() {
try {
const excludeId = this.subtype === 'edit' ? this.localTemp.id : null;
const response = await checkMailtypeUnique(this.localTemp.mailtype, excludeId);
return response.data.data;
} catch (e) {
console.error("验证待办标识失败", e);
return true;
}
},
async onSave() {
// 表单验证
if (!this.localTemp.title || this.localTemp.title.trim() === '') {
......@@ -191,6 +242,49 @@ export default {
return;
}
// 验证应用唯一标识长度
if (this.localTemp.appid.length > 30) {
this.appidError = true;
this.appidErrorMessage = "应用唯一标识不能超过30个字符";
return;
}
// 验证应用唯一标识唯一性
const isAppidUnique = await this.validateAppid();
if (!isAppidUnique) {
this.$q.notify({
type: "negative",
message: "应用唯一标识重复",
position: "bottom-right"
});
return;
}
// 验证待办标识长度(如果有值)
if (this.localTemp.mailtype && this.localTemp.mailtype.length > 10) {
this.mailtypeError = true;
this.mailtypeErrorMessage = "待办标识不能超过10个字符";
this.$q.notify({
type: "negative",
message: "待办标识不能超过10个字符",
position: "bottom-right"
});
return;
}
// 验证待办标识唯一性(如果有值)
if (this.localTemp.mailtype && this.localTemp.mailtype.trim() !== '') {
const isMailtypeUnique = await this.validateMailtype();
if (!isMailtypeUnique) {
this.$q.notify({
type: "negative",
message: "待办标识标识重复",
position: "bottom-right"
});
return;
}
}
try {
await saveapp(JSON.parse(JSON.stringify(this.localTemp)));
this.$q.notify({
......@@ -210,6 +304,8 @@ export default {
},
getsecret() {
this.localTemp.secret = window.btoa(this.localTemp.appid || '');
this.appidError = false;
this.appidErrorMessage = "";
},
onImgError() {
this.imageLoadError = true;
......
......@@ -128,10 +128,10 @@
</div>
</div>
<div class="text-left text-caption text-grey-7">
<div class="row items-center q-gutter-sm">
<span v-if="app.wechatUrl">
<div class="row items-center q-gutter-sm ellipsis">
<span v-if="app.wechatUrl" class="ellipsis">
<q-icon name="smartphone" size="14px" />
{{ app.wechatUrl }}
<span class="ellipsis" :title="app.wechatUrl" style="max-width: 240px;">{{ app.wechatUrl }}</span>
</span>
</div>
</div>
......@@ -235,6 +235,8 @@
:loading="loadingApplications"
:no-data-label="$t('No data')"
separator="cell"
:pagination.sync="tablePagination"
rows-per-page-label="每页显示"
>
<template slot="body-cell-title" slot-scope="props">
<q-td :props="props">
......@@ -294,6 +296,9 @@ export default {
addApplicationDialog: false,
applicationFilter: "",
selectedApplications: [],
tablePagination: {
rowsPerPage: 10,
},
applicationColumns: [
{
......
......@@ -50,3 +50,21 @@ export function updateWechatNum(list) {
loading: "hourglass"
})
}
// 验证应用唯一标识是否唯一
export function checkAppidUnique(appid, excludeId = null) {
return request({
url: '/PlatformApplicationsController/platformapplications/checkAppidUnique',
method: 'get',
params: { appid, excludeId }
})
}
// 验证待办标识是否唯一
export function checkMailtypeUnique(mailtype, excludeId = null) {
return request({
url: '/PlatformApplicationsController/platformapplications/checkMailtypeUnique',
method: 'get',
params: { mailtype, excludeId }
})
}
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论