提交 cd63a6f0 authored 作者: 潘鹏's avatar 潘鹏

attributes

上级 6ae78ae9
......@@ -25,7 +25,7 @@
border-radius: 6px;
color: red;
cursor:pointer;
margin-left: 5px;
margin-left: 30px;
}
.activityAdd{
margin-top: 20px;
......@@ -75,7 +75,7 @@
<div class="activityEdit">
<ul>
<li v-for="(item,index) in attrDesc" :key="index">
描述(英文)&nbsp;&nbsp;<i-input v-model="item.attrValue" style="width: 77px"></i-input>&nbsp;&nbsp;
描述(英文)&nbsp;&nbsp;<i-input v-model="item.attrValue" style="width: 77px" @on-change="verifyInput(index)"></i-input>&nbsp;&nbsp;
(中文)&nbsp;&nbsp;<i-input v-model="item.attrDesc" style="width: 77px"></i-input>
<!-- <i-input v-model="item" style="width: 77px"></i-input>-->
<span @click="delCondition(item)">删除</span>
......
......@@ -4,15 +4,15 @@ $(function () {
colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '属性名', name: 'attrName', index: 'attr_name', width: 80},
{label: '属性描述', name: 'descs', index: 'descs', width: 80,formatter:function (value, grid, rows){
let returnStr = '';
value.forEach(item=>{
let Str = `${item.attrValue}(${item.attrDesc}),`
returnStr+=Str
})
// returnStr=returnStr.split("undefined")[1]
return returnStr;
}},
// {label: '属性描述', name: 'descs', index: 'descs', width: 80,formatter:function (value, grid, rows){
// let returnStr = '';
// value.forEach(item=>{
// let Str = `${item.attrValue}(${item.attrDesc});`
// returnStr+=Str
// })
// // returnStr=returnStr.split("undefined")[1]
// return returnStr;
// }},
{label: '是否开启', name: 'status', index: 'status', width: 80,formatter:function (value, grid, rows){
let returnStr;
if (value == '0') {
......@@ -181,6 +181,7 @@ let vm = new Vue({
handleResetForm(this, name);
},
delCondition(item){
confirm('确定要删除选中的记录?', function () {
vm.attrDesc.remove(item)
console.log("删除",item)
let arr = [item.attrDescId]
......@@ -190,11 +191,10 @@ let vm = new Vue({
type: "POST",
contentType: "application/json",
successCallback: function (r) {
alert('删除成功', function (index) {
vm.reload();
});
alert('删除成功');
}
});
});
console.log(item)
},
addCondition(){
......@@ -221,6 +221,23 @@ let vm = new Vue({
vm.attrDesc.push(obj)
})
console.log(vm.attrDesc)
},
verifyInput(index) {
document.onkeyup = function () {
// 合并两个空格为一个空格
String.prototype.ResetBlank = function () {
let regEx = /\s{2,}/g;
return this.replace(regEx,' ');
};
String.prototype.ResetBlank2 = function () {
let regEx = /[^\w_\s]/g;
return this.replace(regEx,'');
};
// var str = e;//获取文本框的值
// [^\w_]
vm.attrDesc[index].attrValue = vm.attrDesc[index].attrValue.ResetBlank().ResetBlank2()//trim()去除首尾空格
}
}
}
});
\ No newline at end of file
......@@ -1269,7 +1269,7 @@ let vm = new Vue({
String.prototype.ResetBlank=function(){
let regEx = /\s{2,}/g;
return this.replace(regEx, '');
return this.replace(regEx,' ');
};
String.prototype.ResetBlank2=function(){
let regEx = /[^\w_\s]/g;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论