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

attributes

上级 6ae78ae9
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
border-radius: 6px; border-radius: 6px;
color: red; color: red;
cursor:pointer; cursor:pointer;
margin-left: 5px; margin-left: 30px;
} }
.activityAdd{ .activityAdd{
margin-top: 20px; margin-top: 20px;
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
<div class="activityEdit"> <div class="activityEdit">
<ul> <ul>
<li v-for="(item,index) in attrDesc" :key="index"> <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> (中文)&nbsp;&nbsp;<i-input v-model="item.attrDesc" style="width: 77px"></i-input>
<!-- <i-input v-model="item" style="width: 77px"></i-input>--> <!-- <i-input v-model="item" style="width: 77px"></i-input>-->
<span @click="delCondition(item)">删除</span> <span @click="delCondition(item)">删除</span>
......
...@@ -4,15 +4,15 @@ $(function () { ...@@ -4,15 +4,15 @@ $(function () {
colModel: [ colModel: [
{label: 'id', name: 'id', index: 'id', key: true, hidden: true}, {label: 'id', name: 'id', index: 'id', key: true, hidden: true},
{label: '属性名', name: 'attrName', index: 'attr_name', width: 80}, {label: '属性名', name: 'attrName', index: 'attr_name', width: 80},
{label: '属性描述', name: 'descs', index: 'descs', width: 80,formatter:function (value, grid, rows){ // {label: '属性描述', name: 'descs', index: 'descs', width: 80,formatter:function (value, grid, rows){
let returnStr = ''; // let returnStr = '';
value.forEach(item=>{ // value.forEach(item=>{
let Str = `${item.attrValue}(${item.attrDesc}),` // let Str = `${item.attrValue}(${item.attrDesc});`
returnStr+=Str // returnStr+=Str
}) // })
// returnStr=returnStr.split("undefined")[1] // // returnStr=returnStr.split("undefined")[1]
return returnStr; // return returnStr;
}}, // }},
{label: '是否开启', name: 'status', index: 'status', width: 80,formatter:function (value, grid, rows){ {label: '是否开启', name: 'status', index: 'status', width: 80,formatter:function (value, grid, rows){
let returnStr; let returnStr;
if (value == '0') { if (value == '0') {
...@@ -181,19 +181,19 @@ let vm = new Vue({ ...@@ -181,19 +181,19 @@ let vm = new Vue({
handleResetForm(this, name); handleResetForm(this, name);
}, },
delCondition(item){ delCondition(item){
vm.attrDesc.remove(item) confirm('确定要删除选中的记录?', function () {
console.log("删除",item) vm.attrDesc.remove(item)
let arr = [item.attrDescId] console.log("删除",item)
Ajax.request({ let arr = [item.attrDescId]
url: "../attributesdesc/delete", Ajax.request({
params: JSON.stringify(arr), url: "../attributesdesc/delete",
type: "POST", params: JSON.stringify(arr),
contentType: "application/json", type: "POST",
successCallback: function (r) { contentType: "application/json",
alert('删除成功', function (index) { successCallback: function (r) {
vm.reload(); alert('删除成功');
}); }
} });
}); });
console.log(item) console.log(item)
}, },
...@@ -221,6 +221,23 @@ let vm = new Vue({ ...@@ -221,6 +221,23 @@ let vm = new Vue({
vm.attrDesc.push(obj) vm.attrDesc.push(obj)
}) })
console.log(vm.attrDesc) 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({ ...@@ -1269,7 +1269,7 @@ let vm = new Vue({
String.prototype.ResetBlank=function(){ String.prototype.ResetBlank=function(){
let regEx = /\s{2,}/g; let regEx = /\s{2,}/g;
return this.replace(regEx, ''); return this.replace(regEx,' ');
}; };
String.prototype.ResetBlank2=function(){ String.prototype.ResetBlank2=function(){
let regEx = /[^\w_\s]/g; let regEx = /[^\w_\s]/g;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论