Merge branch 'feature/permission-0723-ch' into msb_test

msb_test
ch 3 years ago
commit cb6d9fe6ac

@ -66,13 +66,14 @@ const actions = {
return res; return res;
}, },
enable: async ({ dispatch }, data) => { enable: async ({ dispatch }, data) => {
const statusStr = data.isEnable ? '启用' : '禁用';
try { try {
await ElMessageBox.confirm('确定要禁用该组织吗?', '危险操作'); await ElMessageBox.confirm(`确定要${statusStr}该组织吗?`, '危险操作');
let res = await api.update(data); let res = await api.update(data);
if (res) { if (res) {
ElMessage.success((data.isEnable ? '启用' : '禁用') + '成功'); ElMessage.success(statusStr + '成功');
} else { } else {
ElMessage.error((data.isEnable ? '启用' : '禁用') + '失败'); ElMessage.error(statusStr + '失败');
} }
} catch (e) { } catch (e) {
console.info('取消删除', e); console.info('取消删除', e);

@ -62,6 +62,9 @@ const actions = {
if (!data.id) { if (!data.id) {
data.id = res; data.id = res;
} }
if (!data.roleIds) {
return false;
}
res = await api.savePermission(data.id, { roleIds: data.roleIds }); res = await api.savePermission(data.id, { roleIds: data.roleIds });
if (res) { if (res) {
ElMessage.success('保存成功'); ElMessage.success('保存成功');

@ -292,7 +292,9 @@
label: '状态', label: '状态',
width: 160, width: 160,
slots: { slots: {
default: ({ row }) => <ElSwitch v-model={row.isEnable} />, default: ({ row }) => (
<ElSwitch v-model={row.isEnable} onClick={() => handleEmployeeEnabled(row)} />
),
}, },
}, },
{ {
@ -423,6 +425,13 @@
const handleEnabled = (row) => { const handleEnabled = (row) => {
store.dispatch('dept/enable', row); store.dispatch('dept/enable', row);
}; };
const handleEmployeeEnabled = (row) => {
const data = {
id: row.id,
isEnable: row.isEnable,
};
store.dispatch('employee/save', data);
};
const handleDelete = (row) => { const handleDelete = (row) => {
store.dispatch('dept/remove', [row.id]); store.dispatch('dept/remove', [row.id]);
}; };

@ -86,11 +86,11 @@
</template> </template>
</el-dialog> </el-dialog>
</el-form-item> </el-form-item>
</el-form> <el-form-item>
<div class="form-footer">
<el-button @click="handleCancel"></el-button> <el-button @click="handleCancel"></el-button>
<el-button :disabled="loading" :loading="submitting" type="primary" @click="handleSave"></el-button> <el-button :disabled="loading" :loading="submitting" type="primary" @click="handleSave"></el-button>
</div> </el-form-item>
</el-form>
</div> </div>
</template> </template>
@ -152,6 +152,9 @@
try { try {
await proxy.$validate(refsForm); await proxy.$validate(refsForm);
let data = { ...unref(form) }; let data = { ...unref(form) };
if (!data.password) {
delete data.password;
}
data.voucherClueUrls = data.voucherClueUrls || []; data.voucherClueUrls = data.voucherClueUrls || [];
data.voucherClueUrl = data.voucherClueUrls.join(','); data.voucherClueUrl = data.voucherClueUrls.join(',');
let res = await store.dispatch('employee/save', data); let res = await store.dispatch('employee/save', data);
@ -216,6 +219,8 @@
<style lang="less" scoped> <style lang="less" scoped>
.form-container { .form-container {
flex-direction: row-reverse !important;
align-items: flex-start !important;
.el-form { .el-form {
width: 480px; width: 480px;
} }

Loading…
Cancel
Save