Commit 60ab4acc authored by 陈浩玮's avatar 陈浩玮

Merge branch 'feature/chw' into 'master'

Feature/chw

See merge request product/kim3-web-vue/starter-web-vue!19
parents e133766b eea69e87
<template> <template>
<a-drawer <a-drawer
placement="right" placement="right"
:visible="visible" :visible="value"
:drawerStyle="drawerStyle" :drawerStyle="drawerStyle"
:bodyStyle="bodyStyle" :bodyStyle="bodyStyle"
destroyOnClose destroyOnClose
:width="600"
v-bind="$attrs" v-bind="$attrs"
v-on="$listeners"
@close="onClose"
> >
<div class="tw-overflow-y-hidden"> <div class="tw-overflow-y-hidden tw-flex-1">
<div class="tw-overflow-y-auto tw-h-full"> <div class="tw-overflow-y-auto tw-h-full">
<slot /> <slot />
</div> </div>
</div> </div>
<template> <template>
<a-divider /> <a-divider />
<a-space> <a-space class="tw-justify-end">
<a-button @click="cancel">取消</a-button>
<slot name="footer"> <slot name="footer">
<a-button @click="cancel">取消</a-button>
<a-button type="primary" @click="ok" :loading="loading">确认</a-button> <a-button type="primary" @click="ok" :loading="loading">确认</a-button>
</slot> </slot>
</a-space> </a-space>
...@@ -29,10 +32,14 @@ export default { ...@@ -29,10 +32,14 @@ export default {
props: { props: {
oncancel: Function, oncancel: Function,
onok: Function, onok: Function,
value: Boolean,
},
model: {
prop: 'value',
event: 'change',
}, },
data() { data() {
return { return {
visiable: false,
loading: false, loading: false,
drawerStyle: { drawerStyle: {
display: 'flex', display: 'flex',
...@@ -48,21 +55,18 @@ export default { ...@@ -48,21 +55,18 @@ export default {
}; };
}, },
methods: { methods: {
show() {
this.visiable = true;
},
hidden() {
this.visiable = false;
},
cancel() { cancel() {
this.oncancel && this.oncancel(); this.oncancel && this.oncancel();
this.visiable = false; this.$emit('change', false);
},
onClose() {
this.cancel();
}, },
async ok() { async ok() {
this.loading = true; this.loading = true;
await (this.onok && this.onok()); await (this.onok && this.onok());
this.loading = false; this.loading = false;
this.visiable = false; this.$emit('change', false);
}, },
}, },
}; };
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</div> </div>
<template v-if="!noFooter"> <template v-if="!noFooter">
<a-divider /> <a-divider />
<a-space> <a-space class="tw-justify-end">
<a-button @click="addVisible = false">取消</a-button> <a-button @click="addVisible = false">取消</a-button>
<a-button type="primary" @click="submit" :loading="submitLoading"> 确认 </a-button> <a-button type="primary" @click="submit" :loading="submitLoading"> 确认 </a-button>
</a-space> </a-space>
......
<template> <template>
<my-table url="/api/v1/users" rowKey="userId" ref="table"> <div>
<template #drawer> <my-table url="/api/v1/users" rowKey="userId" ref="table">
<Form ref="form" /> <template #search="{ query }">
</template> <my-form-item label="归属部门">
<template #search="{ query }"> <OrganizationTree v-model="query.orgId" />
<my-form-item label="归属部门"> </my-form-item>
<OrganizationTree v-model="query.orgId" /> <my-form-item label="账号">
</my-form-item> <a-input placeholder="Basic usage" v-model="query.loginId" />
<my-form-item label="账号"> </my-form-item>
<a-input placeholder="Basic usage" v-model="query.loginId" /> </template>
</my-form-item> <template #buttons>
</template> <a-button type="primary" @click="onAdd">新增</a-button>
<template #buttons>
<a-button type="primary">新增</a-button>
</template>
<a-table-column title="账号" data-index="loginId" />
<a-table-column title="姓名" data-index="userName" />
<a-table-column title="职称" data-index="userTitleName" />
<a-table-column title="移动电话" data-index="mobilePhone" />
<a-table-column title="固定电话" data-index="fixedPhone" />
<a-table-column title="电子邮箱" data-index="userEmail" />
<a-table-column title="是否锁定" data-index="isLockedName" />
<a-table-column title="操作">
<template #default="row">
<!-- <a @click="() => view(row, 1)">编辑</a>
<a-divider type="vertical" />
<PopconfirmDelete :url="`/api/v1/jobs/${row.jobId}`" :cb="refreshTable" /> -->
<ActionButton :buttons="buttons" :row="row" />
</template> </template>
</a-table-column>
</my-table> <a-table-column title="账号" data-index="loginId" />
<a-table-column title="姓名" data-index="userName" />
<a-table-column title="职称" data-index="userTitleName" />
<a-table-column title="移动电话" data-index="mobilePhone" />
<a-table-column title="固定电话" data-index="fixedPhone" />
<a-table-column title="电子邮箱" data-index="userEmail" />
<a-table-column title="是否锁定" data-index="isLockedName" />
<a-table-column title="操作">
<template #default="row">
<ActionButton :buttons="buttons" :row="row" />
</template>
</a-table-column>
</my-table>
<Form ref="form" />
</div>
</template> </template>
<script> <script>
import Form from './form.vue'; import Form from './form.vue';
...@@ -103,6 +100,9 @@ export default { ...@@ -103,6 +100,9 @@ export default {
refreshTable() { refreshTable() {
this.$refs['table']?.getData(); this.$refs['table']?.getData();
}, },
onAdd() {
this.$refs['form']?.open();
},
// view(data, type) { // view(data, type) {
// this.$refs['table']?.show({ type }); // this.$refs['table']?.show({ type });
// this.$nextTick(() => { // this.$nextTick(() => {
......
<template> <template>
<a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm"> <Drawer ref="drawerRef" v-model="visible">
<a-form-model-item label="名称" prop="jobName"> <a-form-model layout="vertical" :model="form" :rules="rules" ref="DrawerForm">
<a-input v-model="form.jobName" :disabled="isView" /> <a-form-model-item label="名称" prop="jobName">
</a-form-model-item> <a-input v-model="form.jobName" :disabled="isView" />
<a-form-model-item label="描述" prop="jobDescription"> </a-form-model-item>
<a-textarea v-model="form.jobDescription" :disabled="isView" :rows="4" /> <a-form-model-item label="描述" prop="jobDescription">
</a-form-model-item> <a-textarea v-model="form.jobDescription" :disabled="isView" :rows="4" />
</a-form-model> </a-form-model-item>
</a-form-model>
</Drawer>
</template> </template>
<script> <script>
import Drawer from '@/components/table/drawer.vue';
import JobsApi from '@/api/organization'; import JobsApi from '@/api/organization';
import FormMixin from '@/components/FormMixin'; import FormMixin from '@/components/FormMixin';
export default { export default {
components: { Drawer },
mixins: [FormMixin], mixins: [FormMixin],
data() { data() {
return { return {
visible: false,
rules: { rules: {
jobName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }], jobName: [{ required: true, message: 'Please select Activity zone', trigger: 'change' }],
jobDescription: [ jobDescription: [
...@@ -25,6 +30,9 @@ export default { ...@@ -25,6 +30,9 @@ export default {
}; };
}, },
methods: { methods: {
open() {
this.visible = true;
},
add() { add() {
return JobsApi.addJobs({ ...this.form }); return JobsApi.addJobs({ ...this.form });
}, },
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment