Commit 5912ff6f by jianshuqin

优化:组件功能

parent fce43ca4
......@@ -118,7 +118,25 @@
v-bind:href="item.href"
v-bind:disabled="disabled != null ? disabled :(item.disabled == true || javaScript.call(this,item.disabled))"
v-on:click="$emit('click')">
{{item.name}}
<template v-if="item.format">
<template v-if="item.format.constructor === Boolean && (item_value.constructor === Boolean || item_value == 1 || item_value == 0)">
{{ item_value ? '是' : '否' }}
</template>
<template v-else-if="item.format.constructor === String">
<template v-if="item.format == 'money'">
{{ (item.precision && item.precision > 0 ? parseFloat(Math.round((item_value || 0 )*Math.pow(10, item.precision))/Math.pow(10, 2).toFixed(item.precision)) : item_value || 0).toLocaleString('zh',{minimumFractionDigits: (item.precision > 0 ? item.precision : 2)}) }}
</template>
<template v-else-if="item.format == 'number'">
{{ item.precision && item.precision > 0 ? Math.round(item_value*Math.pow(10, item.precision))/Math.pow(10, 2).toFixed(item.precision) : item_value }}
</template>
<template v-else-if="/[y|Y|m|M|d|h|H|s|S]+/.test(item.format)">
{{ new Date(item_value).format(item.format) }}
</template>
</template>
</template>
<template v-else>
{{ item.prop ? item_value : item.name }}
</template>
</el-link>
<el-upload ref="upload" class="el-upload"
v-else-if="item.type == 'file'"
......
......@@ -55,15 +55,15 @@
v-bind:width="setting.operateColumnWidth || 80">
<template slot-scope="scope">
<el-form-control v-for="(operateColumn,index) in setting.listOperateColumnControl"
v-if="!operateColumn.isHide || !javaScript.call(scope,operateColumn.isHide,scope)"
v-if="!operateColumn.isHide || !javaScript.call(scope,operateColumn.isHide,scope,operateColumn)"
class="inline"
v-bind:key="index"
v-bind:item="operateColumn"
v-bind:scope="scope"
v-bind:disabled="operateColumn.disabled != null && (operateColumn.disabled == true || javaScript.call(setting,operateColumn.disabled,scope))"
v-bind:disabled="operateColumn.disabled != null && (operateColumn.disabled == true || javaScript.call(setting,operateColumn.disabled,scope,operateColumn))"
v-model="scope.row[operateColumn.prop]"
v-on:click="javaScript.call(scope,operateColumn.click,scope)"
v-on:change="javaScript.call(scope,operateColumn.change,scope)">
v-on:click="javaScript.call(scope,operateColumn.click,scope,operateColumn)"
v-on:change="javaScript.call(scope,operateColumn.change,scope,operateColumn)">
</el-form-control>
</template>
</el-table-column>
......@@ -74,10 +74,10 @@
v-bind:key="index"
v-bind:item="operateColumn"
v-bind:scope="scope"
v-bind:disabled="operateColumn.disabled != null && (operateColumn.disabled == true || javaScript.call(setting,operateColumn.disabled,scope))"
v-bind:disabled="operateColumn.disabled != null && (operateColumn.disabled == true || javaScript.call(setting,operateColumn.disabled,scope,operateColumn))"
v-model="scope.row[operateColumn.prop]"
v-on:click="javaScript.call(scope,operateColumn.click,scope)"
v-on:change="javaScript.call(scope,operateColumn.change,scope)">
v-on:click="javaScript.call(scope,operateColumn.click,scope,operateColumn)"
v-on:change="javaScript.call(scope,operateColumn.change,scope,operateColumn)">
</el-form-control>
</template>
</el-table-column>
......@@ -110,8 +110,8 @@
<el-form-control v-model="scope.row[column.prop]"
v-bind:item="column"
v-bind:scope="scope"
v-on:click="javaScript.call(scope,column.click,scope)"
v-on:change="javaScript.call(scope,column.change,scope)">
v-on:click="javaScript.call(scope,column.click,scope,column)"
v-on:change="javaScript.call(scope,column.change,scope,column)">
</el-form-control>
</template>
</el-table-column>
......@@ -128,8 +128,8 @@
<el-form-control v-model="scope.row[column.prop]"
v-bind:item="column"
v-bind:scope="scope"
v-on:click="javaScript.call(scope,column.click,scope)"
v-on:change="javaScript.call(scope,column.change,scope)">
v-on:click="javaScript.call(scope,column.click,scope,column)"
v-on:change="javaScript.call(scope,column.change,scope,column)">
</el-form-control>
</template>
</el-table-column>
......@@ -137,8 +137,8 @@
<el-form-control v-model="scope.row[column.prop]"
v-bind:item="column"
v-bind:scope="scope"
v-on:click="javaScript.call(scope,column.click,scope)"
v-on:change="javaScript.call(scope,column.change,scope)">
v-on:click="javaScript.call(scope,column.click,scope,column)"
v-on:change="javaScript.call(scope,column.change,scope,column)">
</el-form-control>
</template>
</el-table-column>
......
......@@ -199,6 +199,9 @@
case "prev month()":
date = [new Date(new Date(date.setMonth(date.getMonth() - 1)).setDate(1)), new Date(new Date(date.setMonth(date.getMonth() + 1)).setDate(1) - (24 * 60 * 60 * 1000))];
break;
default:
date = that.item.defaultValue;
break;
}
that.$set(that, "item_value", date);
break;
......
......@@ -17,6 +17,23 @@
getFilter: function (defaultValue) {
var that = this;
var listFilter = [];
//URI参数过虑条件
if (location.search) {
var uriFilters = decodeURIComponent(location.search.replace("?", "")).split("&");
uriFilters.forEach(function (l) {
var uriFilter = l.split("=");
if (uriFilter.length > 1 && uriFilter[0] != "code") {
var values = (uriFilter[1] && uriFilter[1].replace("[", "").replace("]", "").split(",")) || [null];
var filterControlIndex = that.filter && that.filter.listFilterControl && that.filter.listFilterControl.length && that.filter.listFilterControl.findIndex(function (l2) { return l2.prop == uriFilter[0] });
if (filterControlIndex >= 0) {
Vue.set(that.filter.listFilterControl[filterControlIndex], 'defaultValue', values.length > 1 ? (that.filter.listFilterControl[filterControlIndex].type == 'daterange' ? [new Date(values[0]), new Date(values[1])] : values) : ((that.filter.listFilterControl[filterControlIndex].type == 'date' || that.filter.listFilterControl[filterControlIndex].type == 'month') ? new Date(values[0]) : values[0]));
Vue.set(that.filter.listFilterControl[filterControlIndex], 'disabled', true);
} else if (listFilter.findIndex(function (l2) { return l2.field == uriFilter[0] }) < 0) {
listFilter.push({ field: uriFilter[0], operator: values.length > 1 ? 'in' : '=', value: values.length > 1 ? values.join(",") : values[0] });
}
}
})
}
//当前筛选区域过虑条件
if (that.filter && that.filter.listFilterControl) {
that.filter.listFilterControl.forEach(function (l) {
......@@ -45,6 +62,9 @@
case "prev month()":
date = l.type == "daterange" ? [new Date(new Date(date.setMonth(date.getMonth() - 1)).setDate(1)), new Date(new Date(date.setMonth(date.getMonth() + 1)).setDate(1) - (24 * 60 * 60 * 1000))] : new Date(date.setMonth(date.getMonth() - 1));
break;
default:
date = l.defaultValue;
break
}
Vue.set(l, "value", date);
} else {
......@@ -126,7 +146,7 @@
if (result) {
this.$message("导入成功!")
this.onSearch();
} else {
} else {
this.$message.error(message)
}
},
......
......@@ -134,7 +134,7 @@
return this.$refs.table.selection;
},
//自定义JS
javaScript(js, scope) {
javaScript(js, scope, column) {
if (js) {
return eval(js)
}
......@@ -190,7 +190,9 @@
//查询数据
onSearchData: function (filterParams, cb) {
var that = this;
that.$http.post("/Component/Table/GetListData", $.extend({ code: that.code }, (filterParams || that.filterParams)), { emulateJSON: true, code: that.code }).then(function (response) {
var data = $.extend({ code: that.code }, (filterParams || that.filterParams));
delete data.total
that.$http.post("/Component/Table/GetListData", data, { emulateJSON: true, code: that.code }).then(function (response) {
var result = response.data;
if (response.status === 200 && result.result && result.data) {
if (that.filterParams) {
......
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