|
@@ -128,16 +128,15 @@ function initCompanyPage(){
|
|
|
|
|
|
form.on('submit(submit)', function (data){
|
|
|
var data = form.val('dataForm');
|
|
|
- // var objs = $("input[name='otherClass']") //选择所有的name属性等于'otherClass'的input元素
|
|
|
- // console.log(objs)
|
|
|
- // var otherData = {};
|
|
|
- // if (objs && objs.length > 0) {
|
|
|
- // for (var i = 0; i < objs.length; i++){
|
|
|
- // console.log(objs[i].dataset.id)
|
|
|
- // var keyName = objs[i].dataset.id;
|
|
|
- // otherData[keyName] = objs[i].value;
|
|
|
- // }
|
|
|
- // }
|
|
|
+
|
|
|
+ var otherColumnData = {};
|
|
|
+ $('#columnOther').find($("input[name='otherColumnClass']")).each(function (){
|
|
|
+ var keyN = $(this).attr("data-id");
|
|
|
+ otherColumnData[keyN] = $(this).val();
|
|
|
+ })
|
|
|
+ var colExplain = JSON.stringify(otherColumnData)
|
|
|
+ data.columnExplain = colExplain;
|
|
|
+
|
|
|
var otherData = {};
|
|
|
$('#classificationOther').find($("input[name='otherClass']")).each(function (){
|
|
|
var keyName = $(this).attr("data-id");
|
|
@@ -229,6 +228,7 @@ function initCompanyPage(){
|
|
|
if (json.result) {
|
|
|
echoForm(json.data);
|
|
|
echoClassification(json.data);
|
|
|
+ echoColumn(json.data);
|
|
|
} else {
|
|
|
layer.msg(json.msg);
|
|
|
return false;
|
|
@@ -283,7 +283,25 @@ function initCompanyPage(){
|
|
|
xmSelectRenderColumnId([ ]);
|
|
|
xmSelectRender([ ]);
|
|
|
}
|
|
|
-
|
|
|
+function echoColumn (data) {
|
|
|
+ if (data.columnExplain != '{}') {
|
|
|
+ var othCloData = data.otherCloData;
|
|
|
+ var str = '';
|
|
|
+ if (othCloData && othCloData.length > 0) {
|
|
|
+ for (var i = 0; i < othCloData.length; i++){
|
|
|
+ var beforeName = othCloData[i].beforeName;
|
|
|
+ var otherDes = othCloData[i].otherDes;
|
|
|
+ var beforeDataId = othCloData[i].beforeDataId;
|
|
|
+ str += '<div class="layui-form-item"><label class="layui-form-label">'+beforeName+':</label>' +
|
|
|
+ '<div class="layui-input-block"><input type="text" data-id="'+beforeDataId+'" name="otherColumnClass"' +
|
|
|
+ 'maxlength="500" class="layui-input" ' +
|
|
|
+ 'value="'+ otherDes +'" autocomplete="off"></div></div>';
|
|
|
+ }
|
|
|
+ $("#columnOther").append(str)
|
|
|
+ form.render()
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
function echoClassification(data) {
|
|
|
if (data.classificationExplain != '{}') {
|
|
|
var othClsData = data.otherClsData;
|
|
@@ -302,9 +320,6 @@ function echoClassification(data) {
|
|
|
form.render()
|
|
|
}
|
|
|
}
|
|
|
- if (data.columnExplain) {
|
|
|
- $("#columnShow").show();
|
|
|
- }
|
|
|
}
|
|
|
function initColumn(){
|
|
|
ly.ajax({
|
|
@@ -591,6 +606,7 @@ function certificateImgUpload() {
|
|
|
* 清空数据
|
|
|
*/
|
|
|
function emptyForm(){
|
|
|
+ $("#columnOther").empty();
|
|
|
$("#classificationOther").empty();
|
|
|
// 清空input
|
|
|
var emptyObj = {
|
|
@@ -726,26 +742,28 @@ function xmSelectRenderColumnId(data){
|
|
|
el: '#columnId',
|
|
|
tips: '请选择栏目',
|
|
|
on: function(data){
|
|
|
+ $("#columnOther").empty()
|
|
|
//arr: 当前多选已选中的数据
|
|
|
var arr = data.arr;
|
|
|
- var colFlag = false;
|
|
|
+ var dictIds = '';
|
|
|
if (arr && arr.length > 0) {
|
|
|
- var dictIds = '';
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
dictIds += arr[i].value + ','
|
|
|
+ var otherId = arr[i].value;
|
|
|
+ var str = '';
|
|
|
if (arr[i].name === '其他') {
|
|
|
- colFlag = true;
|
|
|
+ str += '<div class="layui-form-item"><label class="layui-form-label">栏目说明:</label>' +
|
|
|
+ '<div class="layui-input-block"><input type="text" data-id="'+otherId+'" name="otherColumnClass"' +
|
|
|
+ 'maxlength="500" class="layui-input" ' +
|
|
|
+ 'placeholder="其他(需注明)" autocomplete="off"></div></div>';
|
|
|
}
|
|
|
+ $("#columnOther").append(str)
|
|
|
+ form.render()
|
|
|
}
|
|
|
dictIds = dictIds.substring(0, dictIds.lastIndexOf(","))
|
|
|
}
|
|
|
- if (colFlag) {
|
|
|
- $("#columnShow").show()
|
|
|
- }else {
|
|
|
- $("#columnExplain").val('');
|
|
|
- $("#columnShow").hide()
|
|
|
- }
|
|
|
initClassify(dictIds)
|
|
|
+ $("#classificationOther").empty();
|
|
|
},
|
|
|
data: data,
|
|
|
})
|
|
@@ -780,7 +798,6 @@ function xmSelectRender(data, vAttr, kAttr){
|
|
|
$("#classificationOther").empty()
|
|
|
//arr: 当前多选已选中的数据
|
|
|
var arr = data.arr;
|
|
|
- console.log(arr)
|
|
|
if (arr && arr.length > 0) {
|
|
|
for (let i = 0; i < arr.length; i++) {
|
|
|
var beforeName = arr[i].__node.parent.name;
|
|
@@ -790,7 +807,7 @@ function xmSelectRender(data, vAttr, kAttr){
|
|
|
str += '<div class="layui-form-item"><label class="layui-form-label">'+beforeName+':</label>' +
|
|
|
'<div class="layui-input-block"><input type="text" data-id="'+otherId+'" name="otherClass"' +
|
|
|
'maxlength="500" class="layui-input" ' +
|
|
|
- 'placeholder="'+ beforeName +'" autocomplete="off"></div></div>';
|
|
|
+ 'placeholder="'+ beforeName +' 其他(需注明)" autocomplete="off"></div></div>';
|
|
|
}
|
|
|
$("#classificationOther").append(str)
|
|
|
form.render()
|