update 项目管理
This commit is contained in:
@@ -10,6 +10,10 @@
|
||||
<a-icon slot="indicator" spin type="loading" />
|
||||
<div class="yo-form-group">
|
||||
<!-- 表单控件 -->
|
||||
<a-form-model-item label="所属区域" prop="areaId">
|
||||
<!-- <a-tree-select :dropdown-style="{ maxHeight: '300px', overflow: 'auto' }" :tree-data="areaData" :replace-fields="{ value: 'code', title: 'name', children: 'children' }" placeholder="请选择所属区域" tree-default-expand-all v-model="form.areaId" /> -->
|
||||
<a-cascader :field-names="{ label: 'name', value: 'code', children: 'children' }" :options="areaData" expand-trigger="hover" placeholder="请选择所属区域" v-model="form.areaCode" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="项目名称" prop="name">
|
||||
<a-input placeholder="请输入项目名称" v-model="form.name" />
|
||||
</a-form-model-item>
|
||||
@@ -19,6 +23,12 @@
|
||||
<a-form-model-item label="备注" prop="note">
|
||||
<a-textarea :rows="4" placeholder="请输入备注" v-model="form.note"></a-textarea>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="类型" prop="type">
|
||||
<a-radio-group v-model="form.type">
|
||||
<a-radio-button :value="1"> 住宅 </a-radio-button>
|
||||
<a-radio-button :value="2"> 非住宅 </a-radio-button>
|
||||
</a-radio-group>
|
||||
</a-form-model-item>
|
||||
<!-- ... -->
|
||||
</div>
|
||||
</a-spin>
|
||||
@@ -28,11 +38,7 @@
|
||||
/* 表单内容默认值 */
|
||||
const defaultForm = {
|
||||
/* ... */
|
||||
areaId: '330266001001',
|
||||
areaName: '测试社区',
|
||||
type: 1,
|
||||
};
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
@@ -48,6 +54,7 @@ export default {
|
||||
loading: false,
|
||||
|
||||
/** 其他成员属性 */
|
||||
areaData: [],
|
||||
/* ... */
|
||||
};
|
||||
},
|
||||
@@ -58,11 +65,38 @@ export default {
|
||||
* 在打开编辑页时允许填充数据
|
||||
*/
|
||||
onFillData(params) {
|
||||
// 从字符串areaCode查找到整个层级
|
||||
const areaCodeDeault = params.record ? params.record.areaId : params.pid ? params.pid : '';
|
||||
const areaCode = [];
|
||||
const findCode = (data, level) => {
|
||||
level = level || 0;
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const item = data[i];
|
||||
areaCode[level] = item.code;
|
||||
|
||||
if (item.code === areaCodeDeault) {
|
||||
areaCode.length = level + 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (item.children && item.children.length) {
|
||||
const found = findCode(item.children, level + 1);
|
||||
if (found) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (areaCodeDeault) {
|
||||
findCode(this.areaData);
|
||||
}
|
||||
/** 将默认数据覆盖到form */
|
||||
this.form = this.$_.cloneDeep({
|
||||
...defaultForm,
|
||||
...params.record,
|
||||
/** 在此处添加其他默认数据转换 */
|
||||
areaCode: areaCode,
|
||||
/* ... */
|
||||
});
|
||||
},
|
||||
@@ -116,11 +150,17 @@ export default {
|
||||
async onInit(params) {
|
||||
this.loading = true;
|
||||
/** 可以在这里await获取一些异步数据 */
|
||||
this.areaData = await this.onLoadAreaData();
|
||||
/* ... */
|
||||
this.loading = false;
|
||||
},
|
||||
|
||||
/** 当前组件的其他方法 */
|
||||
onLoadAreaData() {
|
||||
return this.$api.getAreaTree().then((res) => {
|
||||
return res.data;
|
||||
});
|
||||
},
|
||||
/* ... */
|
||||
},
|
||||
};
|
||||
|
||||
@@ -80,7 +80,7 @@ export default {
|
||||
name: '项目',
|
||||
|
||||
/* 查询条件 */
|
||||
query: { name: '' },
|
||||
query: {},
|
||||
|
||||
/* 表格字段 */
|
||||
columns: [
|
||||
@@ -94,6 +94,11 @@ export default {
|
||||
dataIndex: 'areaName',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '备注',
|
||||
dataIndex: 'note',
|
||||
sorter: true,
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'type',
|
||||
@@ -225,6 +230,10 @@ export default {
|
||||
* 从列表页调用窗口的打开方法
|
||||
*/
|
||||
onOpen(formName, record) {
|
||||
// if (formName == 'add-form' && !this.query.pid) {
|
||||
// this.$message.warn('请选择项目所属街道', 0.5);
|
||||
// return null;
|
||||
// }
|
||||
this.$refs[formName].onOpen({
|
||||
record,
|
||||
pid: this.query.pid,
|
||||
|
||||
@@ -16,17 +16,8 @@
|
||||
<a-input allow-clear placeholder="请输入姓名、账号、手机号" v-model="query.searchValue" />
|
||||
</a-form-model-item>
|
||||
<a-form-model-item label="状态">
|
||||
<a-select
|
||||
:style="{ width: '170px' }"
|
||||
allow-clear
|
||||
placeholder="请选择状态"
|
||||
v-model="query.searchStatus"
|
||||
>
|
||||
<a-select-option
|
||||
:key="i"
|
||||
:value="item.code"
|
||||
v-for="(item, i) in codes.find(p => p.code === 'common_status').values"
|
||||
>{{ item.value }}</a-select-option>
|
||||
<a-select :style="{ width: '170px' }" allow-clear placeholder="请选择状态" v-model="query.searchStatus">
|
||||
<a-select-option :key="i" :value="item.code" v-for="(item, i) in codes.find((p) => p.code === 'common_status').values">{{ item.value }}</a-select-option>
|
||||
</a-select>
|
||||
</a-form-model-item>
|
||||
<a-form-model-item>
|
||||
@@ -75,14 +66,7 @@
|
||||
<a-list-item-meta>
|
||||
<div slot="title">{{ record.nickName || record.name }}</div>
|
||||
<div slot="description">{{ record.account }}</div>
|
||||
<yo-image
|
||||
:id="record.avatar"
|
||||
:size="48"
|
||||
icon="user"
|
||||
shape="square"
|
||||
slot="avatar"
|
||||
type="avatar"
|
||||
/>
|
||||
<yo-image :id="record.avatar" :size="48" icon="user" shape="square" slot="avatar" type="avatar" />
|
||||
</a-list-item-meta>
|
||||
<div class="yo-list-content--h">
|
||||
<div class="yo-list-content--h--item">
|
||||
@@ -95,13 +79,7 @@
|
||||
</div>
|
||||
<Auth auth="sysUser:changeStatus">
|
||||
<div class="yo-list-content--h--item">
|
||||
<a-switch
|
||||
:checked="!record.status"
|
||||
:checked-children="bindCodeValue(0, 'common_status')"
|
||||
:loading="record.statusChanging"
|
||||
:un-checked-children="bindCodeValue(1, 'common_status')"
|
||||
@change="checked => onSetUserStatus(record, checked)"
|
||||
/>
|
||||
<a-switch :checked="!record.status" :checked-children="bindCodeValue(0, 'common_status')" :loading="record.statusChanging" :un-checked-children="bindCodeValue(1, 'common_status')" @change="(checked) => onSetUserStatus(record, checked)" />
|
||||
</div>
|
||||
</Auth>
|
||||
</div>
|
||||
@@ -216,15 +194,10 @@ export default {
|
||||
* 加载字典数据时的必要方法
|
||||
*/
|
||||
onLoadCodes() {
|
||||
this.$api
|
||||
.$queue([
|
||||
this.$api.sysDictTypeDropDownAwait({ code: 'sex' }),
|
||||
this.$api.sysDictTypeDropDownAwait({ code: 'common_status' }),
|
||||
])
|
||||
.then(([sex, commonStatus]) => {
|
||||
this.codes.find((p) => p.code === 'sex').values = sex.data;
|
||||
this.codes.find((p) => p.code === 'common_status').values = commonStatus.data;
|
||||
});
|
||||
this.$api.$queue([this.$api.sysDictTypeDropDownAwait({ code: 'sex' }), this.$api.sysDictTypeDropDownAwait({ code: 'common_status' })]).then(([sex, commonStatus]) => {
|
||||
this.codes.find((p) => p.code === 'sex').values = sex.data;
|
||||
this.codes.find((p) => p.code === 'common_status').values = commonStatus.data;
|
||||
});
|
||||
},
|
||||
bindCodeValue(code, name) {
|
||||
const c = this.codes.find((p) => p.code == name).values.find((p) => p.code == code);
|
||||
|
||||
Reference in New Issue
Block a user