mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-28 04:40:37 +00:00
优化确认输入框
This commit is contained in:
parent
1a31939eaa
commit
575e569048
@ -46,7 +46,7 @@
|
|||||||
"stylus-loader": "^6.2.0",
|
"stylus-loader": "^6.2.0",
|
||||||
"tinymce": "^5.10.3",
|
"tinymce": "^5.10.3",
|
||||||
"tui-calendar-hi": "^1.15.1-5",
|
"tui-calendar-hi": "^1.15.1-5",
|
||||||
"view-design-hi": "^4.7.0-29",
|
"view-design-hi": "^4.7.0-30",
|
||||||
"vue": "^2.6.14",
|
"vue": "^2.6.14",
|
||||||
"vue-clipboard2": "^0.3.3",
|
"vue-clipboard2": "^0.3.3",
|
||||||
"vue-kityminder-ggg": "^1.3.10",
|
"vue-kityminder-ggg": "^1.3.10",
|
||||||
|
|||||||
@ -129,7 +129,7 @@ export default {
|
|||||||
if (this.isNotServer()) {
|
if (this.isNotServer()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
axios.get($A.apiUrl('../version')).then(({status, data}) => {
|
axios.get($A.apiUrl('system/version')).then(({status, data}) => {
|
||||||
if (status === 200) {
|
if (status === 200) {
|
||||||
this.apiVersion = data.version || ''
|
this.apiVersion = data.version || ''
|
||||||
// 检查接口版本
|
// 检查接口版本
|
||||||
|
|||||||
59
resources/assets/js/functions/web.js
vendored
59
resources/assets/js/functions/web.js
vendored
@ -441,15 +441,29 @@
|
|||||||
if (typeof config === "string") config = {title:config};
|
if (typeof config === "string") config = {title:config};
|
||||||
let inputId = "modalInput_" + $A.randomString(6);
|
let inputId = "modalInput_" + $A.randomString(6);
|
||||||
const onOk = () => {
|
const onOk = () => {
|
||||||
if (typeof config.onOk === "function") {
|
return new Promise((resolve, reject) => {
|
||||||
if (config.onOk(config.value, () => {
|
if (!config.onOk) {
|
||||||
$A.Modal.remove();
|
reject() // 没有返回:取消等待
|
||||||
}) === true) {
|
return
|
||||||
$A.Modal.remove();
|
|
||||||
}
|
}
|
||||||
} else {
|
const call = config.onOk(config.value);
|
||||||
$A.Modal.remove();
|
if (!call) {
|
||||||
}
|
resolve() // 返回无内容:关闭弹窗
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (call.then) {
|
||||||
|
call.then(msg => {
|
||||||
|
msg && $A.messageSuccess(msg)
|
||||||
|
resolve()
|
||||||
|
}).catch(err => {
|
||||||
|
err && $A.messageError(err)
|
||||||
|
reject()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
typeof call === "string" && $A.messageError(call)
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})
|
||||||
};
|
};
|
||||||
const onCancel = () => {
|
const onCancel = () => {
|
||||||
if (typeof config.onCancel === "function") {
|
if (typeof config.onCancel === "function") {
|
||||||
@ -502,6 +516,35 @@
|
|||||||
setTimeout(() => { $A.modalConfirm(config) }, millisecond);
|
setTimeout(() => { $A.modalConfirm(config) }, millisecond);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
config = $A.modalConfig(config);
|
||||||
|
if (config.loading) {
|
||||||
|
const {onOk} = config;
|
||||||
|
config.onOk = () => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
if (!onOk) {
|
||||||
|
reject() // 没有返回:取消等待
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const call = onOk();
|
||||||
|
if (!call) {
|
||||||
|
resolve() // 返回无内容:关闭弹窗
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (call.then) {
|
||||||
|
call.then(msg => {
|
||||||
|
msg && $A.messageSuccess(msg)
|
||||||
|
resolve()
|
||||||
|
}).catch(err => {
|
||||||
|
err && $A.messageError(err)
|
||||||
|
reject()
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
typeof call === "string" && $A.messageError(call)
|
||||||
|
reject()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
$A.Modal.confirm($A.modalConfig(config));
|
$A.Modal.confirm($A.modalConfig(config));
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -302,18 +302,17 @@ export default {
|
|||||||
title: "使用 SSO 登录",
|
title: "使用 SSO 登录",
|
||||||
value,
|
value,
|
||||||
placeholder: "请输入服务器地址",
|
placeholder: "请输入服务器地址",
|
||||||
onOk: (value, cb) => {
|
onOk: (value) => {
|
||||||
if (value) {
|
if (!value) {
|
||||||
this.inputServerChack($A.trim(value)).then(cb)
|
return '请输入服务器地址'
|
||||||
} else {
|
|
||||||
this.clearServerUrl();
|
|
||||||
}
|
}
|
||||||
|
return this.inputServerChack($A.trim(value))
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
inputServerChack(value) {
|
inputServerChack(value) {
|
||||||
return new Promise(resolve => {
|
return new Promise((resolve, reject) => {
|
||||||
let url = value;
|
let url = value;
|
||||||
if (!/\/api\/$/.test(url)) {
|
if (!/\/api\/$/.test(url)) {
|
||||||
url = url + ($A.rightExists(url, "/") ? "api/" : "/api/");
|
url = url + ($A.rightExists(url, "/") ? "api/" : "/api/");
|
||||||
@ -330,18 +329,12 @@ export default {
|
|||||||
}).catch(({ret, msg}) => {
|
}).catch(({ret, msg}) => {
|
||||||
if (ret === -1001) {
|
if (ret === -1001) {
|
||||||
if (!/^https*:\/\//i.test(value)) {
|
if (!/^https*:\/\//i.test(value)) {
|
||||||
this.inputServerChack(`http://${value}`).then(resolve);
|
this.inputServerChack(`http://${value}`).then(resolve).catch(reject);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
msg = "服务器地址无效";
|
msg = "服务器地址无效";
|
||||||
}
|
}
|
||||||
$A.modalError({
|
reject(msg)
|
||||||
content: msg,
|
|
||||||
onOk: () => {
|
|
||||||
setTimeout(this.inputServerUrl, 301)
|
|
||||||
}
|
|
||||||
}, 301);
|
|
||||||
resolve()
|
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
@ -989,7 +989,7 @@ export default {
|
|||||||
else if (command.name) {
|
else if (command.name) {
|
||||||
this.updateColumn(column, {
|
this.updateColumn(column, {
|
||||||
color: command.color
|
color: command.color
|
||||||
});
|
}).catch($A.modalError);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -999,37 +999,41 @@ export default {
|
|||||||
title: "修改列表",
|
title: "修改列表",
|
||||||
placeholder: "输入列表名称",
|
placeholder: "输入列表名称",
|
||||||
onOk: (value) => {
|
onOk: (value) => {
|
||||||
if (value) {
|
if (!value) {
|
||||||
this.updateColumn(column, {
|
return '列表名称不能为空'
|
||||||
name: value
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return true;
|
return this.updateColumn(column, {
|
||||||
|
name: value
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updateColumn(column, updata) {
|
updateColumn(column, updata) {
|
||||||
if (this.columnLoad[column.id] === true) {
|
return new Promise((resolve, reject) => {
|
||||||
return;
|
if (this.columnLoad[column.id] === true) {
|
||||||
}
|
resolve()
|
||||||
this.$set(this.columnLoad, column.id, true);
|
return;
|
||||||
//
|
}
|
||||||
Object.keys(updata).forEach(key => this.$set(column, key, updata[key]));
|
this.$set(this.columnLoad, column.id, true);
|
||||||
//
|
//
|
||||||
this.$store.dispatch("call", {
|
Object.keys(updata).forEach(key => this.$set(column, key, updata[key]));
|
||||||
url: 'project/column/update',
|
//
|
||||||
data: Object.assign(updata, {
|
this.$store.dispatch("call", {
|
||||||
column_id: column.id,
|
url: 'project/column/update',
|
||||||
}),
|
data: Object.assign(updata, {
|
||||||
}).then(({data}) => {
|
column_id: column.id,
|
||||||
this.$set(this.columnLoad, column.id, false);
|
}),
|
||||||
this.$store.dispatch("saveColumn", data);
|
}).then(({data}) => {
|
||||||
}).catch(({msg}) => {
|
this.$set(this.columnLoad, column.id, false);
|
||||||
this.$set(this.columnLoad, column.id, false);
|
this.$store.dispatch("saveColumn", data);
|
||||||
this.$store.dispatch("getColumns", this.projectId).catch(() => {})
|
resolve()
|
||||||
$A.modalError(msg);
|
}).catch(({msg}) => {
|
||||||
});
|
this.$set(this.columnLoad, column.id, false);
|
||||||
|
this.$store.dispatch("getColumns", this.projectId).catch(() => {})
|
||||||
|
reject(msg);
|
||||||
|
});
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
removeColumn(column) {
|
removeColumn(column) {
|
||||||
|
|||||||
@ -403,12 +403,12 @@ export default {
|
|||||||
$A.modalInput({
|
$A.modalInput({
|
||||||
value: item.name,
|
value: item.name,
|
||||||
title: "修改名称",
|
title: "修改名称",
|
||||||
placeholder: "输入流程名称",
|
placeholder: "请输入流程名称",
|
||||||
onOk: (name) => {
|
onOk: (name) => {
|
||||||
if (name) {
|
if (!name) {
|
||||||
this.$set(item, 'name', name);
|
return '请输入流程名称';
|
||||||
}
|
}
|
||||||
return true;
|
this.$set(item, 'name', name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -429,25 +429,25 @@ export default {
|
|||||||
onAdd(data) {
|
onAdd(data) {
|
||||||
$A.modalInput({
|
$A.modalInput({
|
||||||
title: "添加状态",
|
title: "添加状态",
|
||||||
placeholder: "输入状态名称",
|
placeholder: "请输入状态名称",
|
||||||
onOk: (name) => {
|
onOk: (name) => {
|
||||||
if (name) {
|
if (!name) {
|
||||||
let id = $A.randNum(100000, 999999) * -1;
|
return '请输入状态名称'
|
||||||
let turns = data.project_flow_item.map(({id}) => id)
|
|
||||||
data.project_flow_item.push({
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
status: 'end',
|
|
||||||
turns,
|
|
||||||
userids: [],
|
|
||||||
usertype: 'add',
|
|
||||||
userlimit: 0,
|
|
||||||
})
|
|
||||||
data.project_flow_item.some(item => {
|
|
||||||
item.turns.push(id)
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
return true;
|
const id = $A.randNum(100000, 999999) * -1;
|
||||||
|
const turns = data.project_flow_item.map(({id}) => id)
|
||||||
|
data.project_flow_item.push({
|
||||||
|
id,
|
||||||
|
name,
|
||||||
|
status: 'end',
|
||||||
|
turns,
|
||||||
|
userids: [],
|
||||||
|
usertype: 'add',
|
||||||
|
userlimit: 0,
|
||||||
|
})
|
||||||
|
data.project_flow_item.some(item => {
|
||||||
|
item.turns.push(id)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@ -115,7 +115,7 @@
|
|||||||
confirm
|
confirm
|
||||||
placement="bottom"
|
placement="bottom"
|
||||||
style="margin-left:8px"
|
style="margin-left:8px"
|
||||||
@on-ok="operationUser(disableData)"
|
@on-ok="operationUser(disableData, true)"
|
||||||
transfer>
|
transfer>
|
||||||
<div slot="title">
|
<div slot="title">
|
||||||
<p>{{$L('注意:离职操作不可逆!')}}</p>
|
<p>{{$L('注意:离职操作不可逆!')}}</p>
|
||||||
@ -236,7 +236,7 @@ export default {
|
|||||||
this.operationUser({
|
this.operationUser({
|
||||||
userid: row.userid,
|
userid: row.userid,
|
||||||
nickname: val
|
nickname: val
|
||||||
}).then(cb);
|
}, true).finally(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@ -258,7 +258,7 @@ export default {
|
|||||||
this.operationUser({
|
this.operationUser({
|
||||||
userid: row.userid,
|
userid: row.userid,
|
||||||
profession: val
|
profession: val
|
||||||
}).then(cb);
|
}, true).finally(cb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, [
|
}, [
|
||||||
@ -292,6 +292,12 @@ export default {
|
|||||||
}, [h('div', this.$L('设为管理员'))]));
|
}, [h('div', this.$L('设为管理员'))]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dropdownItems.push(h('EDropdownItem', {
|
||||||
|
props: {
|
||||||
|
command: 'email',
|
||||||
|
},
|
||||||
|
}, [h('div', this.$L('修改邮箱'))]))
|
||||||
|
|
||||||
dropdownItems.push(h('EDropdownItem', {
|
dropdownItems.push(h('EDropdownItem', {
|
||||||
props: {
|
props: {
|
||||||
command: 'password',
|
command: 'password',
|
||||||
@ -401,18 +407,34 @@ export default {
|
|||||||
|
|
||||||
dropUser(name, row) {
|
dropUser(name, row) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
|
case 'email':
|
||||||
|
$A.modalInput({
|
||||||
|
title: "修改邮箱",
|
||||||
|
placeholder: `请输入新的邮箱(${row.email})`,
|
||||||
|
onOk: (value) => {
|
||||||
|
if (!value) {
|
||||||
|
return '请输入新的邮箱地址'
|
||||||
|
}
|
||||||
|
return this.operationUser({
|
||||||
|
userid: row.userid,
|
||||||
|
email: value
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
|
||||||
case 'password':
|
case 'password':
|
||||||
$A.modalInput({
|
$A.modalInput({
|
||||||
title: "修改密码",
|
title: "修改密码",
|
||||||
placeholder: "请输入新的密码",
|
placeholder: "请输入新的密码",
|
||||||
onOk: (value) => {
|
onOk: (value) => {
|
||||||
if (value) {
|
if (!value) {
|
||||||
this.operationUser({
|
return '请输入新的密码'
|
||||||
userid: row.userid,
|
|
||||||
password: value
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return true;
|
return this.operationUser({
|
||||||
|
userid: row.userid,
|
||||||
|
password: value
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
@ -429,8 +451,9 @@ export default {
|
|||||||
case 'cleardisable':
|
case 'cleardisable':
|
||||||
$A.modalConfirm({
|
$A.modalConfirm({
|
||||||
content: `你确定恢复已离职帐号【ID:${row.userid},${row.nickname}】吗?(注:此操作仅恢复帐号状态,无法恢复操作离职时移交的数据)`,
|
content: `你确定恢复已离职帐号【ID:${row.userid},${row.nickname}】吗?(注:此操作仅恢复帐号状态,无法恢复操作离职时移交的数据)`,
|
||||||
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
this.operationUser({
|
return this.operationUser({
|
||||||
userid: row.userid,
|
userid: row.userid,
|
||||||
type: name
|
type: name
|
||||||
});
|
});
|
||||||
@ -441,8 +464,9 @@ export default {
|
|||||||
case 'delete':
|
case 'delete':
|
||||||
$A.modalConfirm({
|
$A.modalConfirm({
|
||||||
content: `你确定要删除帐号【ID:${row.userid},${row.nickname}】吗?`,
|
content: `你确定要删除帐号【ID:${row.userid},${row.nickname}】吗?`,
|
||||||
|
loading: true,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
this.operationUser({
|
return this.operationUser({
|
||||||
userid: row.userid,
|
userid: row.userid,
|
||||||
type: name,
|
type: name,
|
||||||
});
|
});
|
||||||
@ -454,13 +478,13 @@ export default {
|
|||||||
this.operationUser({
|
this.operationUser({
|
||||||
userid: row.userid,
|
userid: row.userid,
|
||||||
type: name
|
type: name
|
||||||
});
|
}, true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
operationUser(data) {
|
operationUser(data, tipErr) {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve, reject) => {
|
||||||
if (data.type == 'setdisable') {
|
if (data.type == 'setdisable') {
|
||||||
this.disableLoading++;
|
this.disableLoading++;
|
||||||
} else {
|
} else {
|
||||||
@ -477,9 +501,11 @@ export default {
|
|||||||
this.disableShow = false;
|
this.disableShow = false;
|
||||||
}
|
}
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg, 301);
|
if (tipErr === true) {
|
||||||
|
$A.modalError(msg);
|
||||||
|
}
|
||||||
this.getLists();
|
this.getLists();
|
||||||
resolve()
|
reject(msg)
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
if (data.type == 'setdisable') {
|
if (data.type == 'setdisable') {
|
||||||
this.disableLoading--;
|
this.disableLoading--;
|
||||||
|
|||||||
@ -163,28 +163,25 @@ export default {
|
|||||||
$A.modalInput({
|
$A.modalInput({
|
||||||
title: "测试邮件",
|
title: "测试邮件",
|
||||||
placeholder: "请输入收件人地址",
|
placeholder: "请输入收件人地址",
|
||||||
onOk: (value, cb) => {
|
onOk: (value) => {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
cb()
|
return '请输入收件人地址'
|
||||||
return
|
|
||||||
}
|
}
|
||||||
if (!$A.isEmail(value)) {
|
if (!$A.isEmail(value)) {
|
||||||
$A.modalError("请输入正确的收件人地址", 301)
|
return '请输入正确的收件人地址'
|
||||||
cb()
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
this.$store.dispatch("call", {
|
return new Promise((resolve, reject) => {
|
||||||
url: 'system/email/check',
|
this.$store.dispatch("call", {
|
||||||
data: Object.assign(this.formData, {
|
url: 'system/email/check',
|
||||||
to: value
|
data: Object.assign(this.formData, {
|
||||||
}),
|
to: value
|
||||||
}).then(({msg}) => {
|
}),
|
||||||
$A.messageSuccess(msg)
|
}).then(({msg}) => {
|
||||||
cb()
|
resolve(msg)
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
$A.modalError(msg, 301)
|
reject(msg)
|
||||||
cb()
|
});
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
42
resources/assets/js/store/actions.js
vendored
42
resources/assets/js/store/actions.js
vendored
@ -66,8 +66,8 @@ export default {
|
|||||||
dispatch("call", Object.assign(cloneParams, {
|
dispatch("call", Object.assign(cloneParams, {
|
||||||
checkNick: false
|
checkNick: false
|
||||||
})).then(resolve).catch(reject);
|
})).then(resolve).catch(reject);
|
||||||
}).catch(({msg}) => {
|
}).catch(err => {
|
||||||
reject({ret: -1, data, msg: msg || $A.L('请设置昵称!')})
|
reject({ret: -1, data, msg: err || $A.L('请设置昵称!')})
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -425,26 +425,17 @@ export default {
|
|||||||
* @returns {Promise<unknown>}
|
* @returns {Promise<unknown>}
|
||||||
*/
|
*/
|
||||||
userNickNameInput({dispatch}) {
|
userNickNameInput({dispatch}) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (nameResolve, nameReject) {
|
||||||
let callback = (cb, result) => {
|
|
||||||
if (typeof cb === "function") {
|
|
||||||
cb();
|
|
||||||
}
|
|
||||||
if (result === true) {
|
|
||||||
setTimeout(resolve, 301)
|
|
||||||
} else {
|
|
||||||
setTimeout(_ => {
|
|
||||||
reject(result === false ? {} : {msg: result})
|
|
||||||
}, 301)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setTimeout(_ => {
|
setTimeout(_ => {
|
||||||
$A.modalInput({
|
$A.modalInput({
|
||||||
title: "设置昵称",
|
title: "设置昵称",
|
||||||
placeholder: "请输入昵称",
|
placeholder: "请输入昵称",
|
||||||
okText: "保存",
|
okText: "保存",
|
||||||
onOk: (value, cb) => {
|
onOk: (value) => {
|
||||||
if (value) {
|
if (!value) {
|
||||||
|
return '请输入昵称'
|
||||||
|
}
|
||||||
|
return new Promise((inResolve, inReject) => {
|
||||||
dispatch("call", {
|
dispatch("call", {
|
||||||
url: 'users/editdata',
|
url: 'users/editdata',
|
||||||
data: {
|
data: {
|
||||||
@ -452,21 +443,16 @@ export default {
|
|||||||
},
|
},
|
||||||
checkNick: false,
|
checkNick: false,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
dispatch('getUserInfo').then(() => {
|
dispatch('getUserInfo').finally(_ => {
|
||||||
callback(cb, true);
|
inResolve()
|
||||||
}).catch(() => {
|
nameResolve()
|
||||||
callback(cb, false);
|
|
||||||
});
|
});
|
||||||
}).catch(({msg}) => {
|
}).catch(({msg}) => {
|
||||||
callback(cb, msg);
|
inReject(msg)
|
||||||
});
|
});
|
||||||
} else {
|
})
|
||||||
callback(cb, false);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
onCancel: () => {
|
onCancel: _ => setTimeout(nameReject, 301)
|
||||||
callback(null, false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}, 100)
|
}, 100)
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user