+
-
-
-
+
-
-
-
-
-
- {{handleDetail(scope.row,column,(crud.cascaderDIC[scope.row.$index] || {})[column.prop])}}
-
-
-
-
-
-
-
+
+ {{column.label}}
+
+
+
+
+
+
+
+
+
+
{{item}}
-
-
-
-
-
-
-
+ @click="openImg(getImgList(row,column),index)" />
+
+
+
+ {{item}}
+
+
+
+
+
+
+
+
@@ -87,15 +95,16 @@
diff --git a/packages/element-ui/crud/header-menu.vue b/packages/element-ui/crud/header-menu.vue
index acd45045e..24be670a6 100644
--- a/packages/element-ui/crud/header-menu.vue
+++ b/packages/element-ui/crud/header-menu.vue
@@ -205,6 +205,7 @@ export default create({
title: (this.crud.tableOption.title || '') + dateFtt('yyyy-MM-dd hh:mm:ss', new Date()),
columns: (() => {
let list = [];
+ console.log(this.crud.propOption);
this.crud.propOption.forEach(ele => {
if (this.columnIndex.includes(ele.prop)) {
list.push({
@@ -212,7 +213,7 @@ export default create({
prop: (() => {
if (
!this.validatenull(this.crud.DIC[ele.prop]) ||
- !this.validatenull(this.crud.cascaderDIC[ele.prop])
+ !this.validatenull(ele.parentProp)
) {
return "$" + ele.prop;
}
diff --git a/packages/element-ui/crud/header-search.vue b/packages/element-ui/crud/header-search.vue
index df21d7a0b..0c584d7e7 100644
--- a/packages/element-ui/crud/header-search.vue
+++ b/packages/element-ui/crud/header-search.vue
@@ -132,6 +132,8 @@ export default cteate({
const detailColumn = (list = []) => {
let column = [];
let count = 0;
+ //根据order排序
+ list = list.sort((a, b) => (b.searchOrder || 0) - (a.searchOrder || 0))
list.forEach(ele => {
if (ele.search) {
let isCount = count < this.searchIndex
diff --git a/packages/element-ui/crud/index.vue b/packages/element-ui/crud/index.vue
index 28552a11e..62f3ee9d7 100755
--- a/packages/element-ui/crud/index.vue
+++ b/packages/element-ui/crud/index.vue
@@ -54,240 +54,108 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ tableOption.menuBtnTitle || t('crud.menuBtn')}}
-
-
-
- {{t('crud.viewBtn')}}
- {{t('crud.editBtn')}}
- {{t('crud.copyBtn')}}
- {{t('crud.delBtn')}}
-
-
-
-
-
-
- {{menuIcon(scope.row.$cellEdit?'saveBtn':'editBtn')}}
-
-
-
-
- {{menuIcon('cancelBtn')}}
-
-
-
-
- {{menuIcon('viewBtn')}}
-
-
-
-
- {{menuIcon('editBtn')}}
-
-
-
-
- {{menuIcon('copyBtn')}}
-
-
-
-
- {{menuIcon('delBtn')}}
-
-
-
+
+
+
+
+
+
+
+
+
+ v-bind="scope">
-
-
-
-
-
+
+
+
+
+
+
+
-
+ v-bind="scope">
@@ -365,6 +231,8 @@ import headerMenu from "./header-menu";
import dialogColumn from "./dialog-column";
import dialogFilter from "./dialog-filter";
import dialogForm from "./dialog-form";
+import columnMenu from './column-menu'
+import columnDefault from './column-default'
import config from "./config.js";
import treeToArray, { addAttrs } from "./eval";
import { calcCascader, formInitVal } from "core/dataformat";
@@ -381,6 +249,8 @@ export default create({
},
components: {
column,
+ columnDefault,//其它列,
+ columnMenu,//操作栏,
tablePage, //分页
headerSearch, //搜索
headerMenu, //菜单头部
@@ -394,7 +264,6 @@ export default create({
isChild: false,
config: config,
list: [],
- expandList: [],
tableForm: {},
tableHeight: undefined,
tableIndex: -1,
@@ -418,18 +287,14 @@ export default create({
//动态计算表格高度
this.getTableHeight();
//是否开启表格排序
- this.setSort()
+ setTimeout(() => this.$refs.columnDefault.setSort())
})
},
computed: {
- isIconMenu () {
- return this.menuType === "icon"
- },
- isTextMenu () {
- return this.menuType === "text"
- },
- isMenu () {
- return this.menuType === "menu"
+ cellForm () {
+ return {
+ list: this.list
+ }
},
calcHeight () {
return (this.tableOption.calcHeight || 0) + this.$AVUE.calcHeight
@@ -472,9 +337,6 @@ export default create({
groupOption () {
return this.parentOption.group;
},
- isSortable () {
- return this.tableOption.sortable;
- },
dynamicOption () {
let list = [];
this.propOption.forEach(ele => {
@@ -509,9 +371,6 @@ export default create({
expandAll () {
return this.parentOption.expandAll || false;
},
- rowKey () {
- return this.tableOption.rowKey || "id";
- },
rowParentKey () {
return this.tableOption.rowParentKey || "parentId";
},
@@ -526,7 +385,7 @@ export default create({
},
selectLen () {
return this.tableSelect ? this.tableSelect.length : 0;
- }
+ },
},
watch: {
tableOption: {
@@ -651,32 +510,6 @@ export default create({
callback && callback()
})
},
- //开启排序
- setSort () {
- const callback = () => {
- if (!window.Sortable) {
- packages.logs("Sortable")
- return
- }
- const el = this.$refs.table.$el.querySelectorAll('.el-table__body-wrapper > table > tbody')[0]
- this.sortable = window.Sortable.create(el, {
- ghostClass: 'avue-crud__sortable',
- handle: this.tableOption.dragHandler ? '.avue-crud__drag-handler' : undefined,
- onEnd: evt => {
- const oldindex = evt.oldIndex;
- const newindex = evt.newIndex;
- const targetRow = this.list.splice(oldindex, 1)[0]
- this.list.splice(newindex, 0, targetRow)
- this.$emit('sortable-change', oldindex, newindex, targetRow, this.list)
- }
- })
- }
- if (this.isSortable) {
- this.$nextTick(() => {
- callback()
- })
- }
- },
//树懒加载
treeLoad (tree, treeNode, resolve) {
this.$emit('tree-load', tree, treeNode, (data) => {
@@ -706,6 +539,9 @@ export default create({
? "animation:treeTableShow 1s;-webkit-animation:treeTableShow 1s;"
: "display:none;";
},
+ menuIcon (value) {
+ return this.vaildData(this.tableOption[value + 'Text'], this.t("crud." + value))
+ },
//对部分表单字段进行校验的方法
validateField (val) {
return this.$refs.dialogForm.$refs.tableForm.validateField(val);
@@ -714,12 +550,6 @@ export default create({
const rowKey = row[this.rowKey];
return rowKey;
},
- menuIcon (value) {
- return this.vaildData(this.tableOption[value + 'Text'], this.t("crud." + value))
- },
- menuText (value) {
- return this.isTextMenu ? "text" : value;
- },
selectClear () {
this.$refs.table.clearSelection();
},
@@ -732,14 +562,6 @@ export default create({
setCurrentRow (row) {
this.$refs.table.setCurrentRow(row);
},
- indexMethod (index) {
- return (
- index +
- 1 +
- ((this.page.currentPage || 1) - 1) *
- (this.page.pageSize || 10)
- );
- },
formVal () {
Object.keys(this.value).forEach(ele => {
this.$set(this.tableForm, ele, this.value[ele]);
@@ -761,7 +583,6 @@ export default create({
},
//展开或则关闭
expandChange (row, expand) {
- this.expandList = [...expand];
this.$emit("expand-change", row, expand);
},
//设置单选
@@ -862,7 +683,7 @@ export default create({
))
this.list.push(row);
this.formIndexList.push(len);
- this.setSort();
+ setTimeout(() => this.$refs.columnDefault.setSort())
},
//行取消
rowCancel (row, index) {
@@ -890,32 +711,50 @@ export default create({
this.formIndexList.push(index);
}, 1000);
},
- //单元格更新
- rowCellUpdate (row, index) {
- this.asyncValidator(this.formRules, row)
- .then(res => {
- this.btnDisabledList[index] = true;
- this.btnDisabled = true;
- this.$emit(
- "row-update",
- row,
- index,
- () => {
- this.btnDisabledList[index] = false;
- this.btnDisabled = false;
- row.$cellEdit = false;
- this.$set(this.list, index, row);
- delete this.formCascaderList[index]
- },
- () => {
- this.btnDisabledList[index] = false;
- this.btnDisabled = false;
- }
- );
- })
- .catch(errors => {
- this.$message.error(`第${index + 1}行:${errors[0].message}`);
+ // 对部分表单字段进行校验
+ validateCellForm (cb) {
+ return new Promise(resolve => {
+ this.$refs.cellForm.validate((valid, msg) => {
+ resolve(msg)
});
+ })
+ },
+ validateCellField (index) {
+ let result = true
+ for (const item of this.$refs.cellForm.fields) {
+ if (item.prop.split('.')[1] == index) {
+ this.$refs.cellForm.validateField(item.prop, (error) => {
+ if (error) {
+ result = false
+ }
+ })
+ }
+ if (!result) break
+ }
+ return result
+ },
+ rowCellUpdate (row, index) {
+ var result = this.validateCellField(index)
+ if (result) {
+ this.btnDisabledList[index] = true;
+ this.btnDisabled = true;
+ this.$emit(
+ "row-update",
+ row,
+ index,
+ () => {
+ this.btnDisabledList[index] = false;
+ this.btnDisabled = false;
+ row.$cellEdit = false;
+ this.$set(this.list, index, row);
+ delete this.formCascaderList[index]
+ },
+ () => {
+ this.btnDisabledList[index] = false;
+ this.btnDisabled = false;
+ }
+ );
+ }
},
rowAdd () {
this.$refs.dialogForm.show("add");
diff --git a/packages/element-ui/dynamic/index.vue b/packages/element-ui/dynamic/index.vue
index 8d9eaacf0..7f53923bf 100644
--- a/packages/element-ui/dynamic/index.vue
+++ b/packages/element-ui/dynamic/index.vue
@@ -25,6 +25,7 @@
icon="el-icon-delete"
circle>
{{scope.row.$index+1}}
-
{
let list = [{
- label: '#',
+ label: this.children.indexLabel || '#',
prop: '_index',
display: this.showIndex,
detail: true,
diff --git a/packages/element-ui/form/index.vue b/packages/element-ui/form/index.vue
index 1660e4f9b..9a45fbb4a 100755
--- a/packages/element-ui/form/index.vue
+++ b/packages/element-ui/form/index.vue
@@ -5,7 +5,7 @@
:status-icon="parentOption.statusIcon"
@submit.native.prevent
:model="form"
- :label-suffix="parentOption.labelSuffix || ':'"
+ :label-suffix="labelSuffix"
:size="$AVUE.formSize || controlSize"
:label-position="parentOption.labelPosition"
:label-width="setPx(parentOption.labelWidth,labelWidth)"
@@ -76,6 +76,17 @@
:size="column.size || controlSize"
:dic="DIC[column.prop]">
+
+
+
+
+
+ {{column.label}}{{labelSuffix}}
+
@@ -239,6 +250,9 @@ export default create({
}
},
computed: {
+ labelSuffix () {
+ return this.parentOption.labelSuffix || ':'
+ },
isMenu () {
return this.columnOption.length != 1
},
@@ -316,9 +330,7 @@ export default create({
//处理级联属性
ele.column = calcCascader(ele.column);
//根据order排序
- ele.column = ele.column.sort((a, b) => {
- return (b.order || 0) - (a.order || 0)
- })
+ ele.column = ele.column.sort((a, b) => (b.order || 0) - (a.order || 0))
});;
return list;
},
@@ -460,6 +472,15 @@ export default create({
const value = this.form[column.prop];
// 下一个节点
const columnNext = this.findObject(list, columnNextProp)
+
+ // 如果不是首次加载则清空全部关联节点的属性值和字典值
+ if (this.formList.includes(str)) {
+ //清空子类字典列表和值
+ cascader.forEach(ele => {
+ this.form[ele] = "";
+ this.$set(this.DIC, ele, []);
+ });
+ }
/**
* 1.判断当前节点是否有下级节点
* 2.判断当前节点是否有值
@@ -471,15 +492,6 @@ export default create({
) {
return;
}
-
- // 如果不是首次加载则清空全部关联节点的属性值和字典值
- if (this.formList.includes(str)) {
- //清空子类字典列表和值
- cascader.forEach(ele => {
- this.form[ele] = "";
- this.$set(this.DIC, ele, []);
- });
- }
// 根据当前节点值获取下一个节点的字典
sendDic({
column: columnNext,
@@ -491,7 +503,7 @@ export default create({
// 修改字典
const dic = Array.isArray(res) ? res : [];
this.$set(this.DIC, columnNextProp, dic);
- if (!this.validatenull(dic) && !this.validatenull(columnNext.cascaderIndex) && this.validatenull(this.form[columnNextProp])) {
+ if (!this.validatenull(dic) && !this.validatenull(dic) && !this.validatenull(columnNext.cascaderIndex) && this.validatenull(this.form[columnNextProp])) {
this.form[columnNextProp] = dic[columnNext.cascaderIndex][(columnNext.props || {}).value || DIC_PROPS.value]
}
});
@@ -567,58 +579,56 @@ export default create({
this.$refs.form.clearValidate(list);
})
},
+ validateCellForm () {
+ return new Promise(resolve => {
+ this.$refs.form.validate((valid, msg) => {
+ resolve(msg)
+ });
+ })
+ },
validate (callback) {
- this.$refs.form.validate(valid => {
- if (valid) {
- let dynamicList = [];
- let dynamicError = [];
- const cb = () => {
- if (!this.validatenull(dynamicError)) {
- callback(false, dynamicError)
- return
+ this.$refs.form.validate((valid, msg) => {
+ let dynamicList = [];
+ let dynamicError = {};
+ this.dynamicOption.forEach(ele => {
+ let isForm = ele.children.type === 'form'
+ if (isForm) {
+ this.$refs[ele.prop][0].$refs.temp.$refs.main.forEach(ele => {
+ dynamicList.push(ele.validateCellForm());
+ })
+ } else {
+ dynamicList.push(this.$refs[ele.prop][0].$refs.temp.$refs.main.validateCellForm());
+ }
+ })
+ Promise.all(dynamicList).then(res => {
+ let count = 0;
+ res.forEach(res => {
+ console.log(res);
+ if (!res) {
+ dynamicError.push(res)
}
+ })
+ let result = Object.assign(dynamicError, msg);
+ if (this.validatenull(result)) {
this.show();
- callback(true, this.hide)
+ callback(true)
+ } else {
+ callback(false, result)
}
- this.dynamicOption.forEach(ele => {
- dynamicError.push({
- field: ele.prop,
- label: ele.label,
- children: {}
- });
- dynamicList.push(this.$refs[ele.prop][0].$refs.temp.validate());
- })
- Promise.all(dynamicList).then(res => {
- let count = 0;
- res.forEach((err, index) => {
- let objKey = Object.keys(dynamicError);
- if (this.validatenull(err)) {
- dynamicError.splice(count, 1)
- return
- }
- count = count + 1;
- if (index == 0) {
- let count = Object.keys(err)[0]
- this.$message.error(`【${dynamicError[index].label}】第${Number(count) + 1}行:${err[count][0].message}`);
- }
- dynamicError[objKey[index]].children = err;
- })
- cb();
- })
- } else callback(valid, this.hide)
+
+ })
});
},
resetForm () {
this.clearValidate();
if (this.reset) {
- this.resetFields();
this.clearVal();
}
this.$emit("input", this.form);
this.$emit("reset-change");
},
clearVal () {
- this.form = clearVal(this.form)
+ this.form = clearVal(this.form, (this.tableOption.clearExclude || []).concat([this.rowKey]))
},
resetFields () {
this.$refs.form.resetFields();
diff --git a/packages/element-ui/input-icon/index.vue b/packages/element-ui/input-icon/index.vue
index 963d58cee..fb5f8ff00 100644
--- a/packages/element-ui/input-icon/index.vue
+++ b/packages/element-ui/input-icon/index.vue
@@ -30,7 +30,7 @@
:key="index">
- {{item.label}}
+ {{item.label || item.value}}
diff --git a/packages/element-ui/input-tree/index.vue b/packages/element-ui/input-tree/index.vue
index d700a74f3..4ec6e2ca0 100644
--- a/packages/element-ui/input-tree/index.vue
+++ b/packages/element-ui/input-tree/index.vue
@@ -277,6 +277,7 @@ export default create({
});
},
clearHandle () {
+ this.filterValue = '';
this.$refs.tree.setCurrentKey(null)
this.$refs.tree.setCheckedKeys([]);
},
diff --git a/packages/element-ui/select/index.vue b/packages/element-ui/select/index.vue
index 10e1a8dc7..5da55be71 100755
--- a/packages/element-ui/select/index.vue
+++ b/packages/element-ui/select/index.vue
@@ -35,12 +35,17 @@
:label="labelKey"
:value="valueKey"
:item="citem"
- v-if="$scopedSlots[prop+'Type']">
+ v-if="typeslot">