|
@@ -11,7 +11,7 @@
|
|
|
$(document).ready(() => {
|
|
|
//提出单位编辑
|
|
|
$('#addcompany').click(function(){
|
|
|
- let newinput = '<div class="form-group"><input type="text" class="form-control" placeholder="请输入名称"></div>';
|
|
|
+ let newinput = '<div class="form-group"><input type="text" class="form-control form-control-sm" placeholder="请输入名称"></div>';
|
|
|
$('#companyadddiv').append(newinput);
|
|
|
});
|
|
|
|
|
@@ -19,7 +19,9 @@ $(document).ready(() => {
|
|
|
$(this).attr('disabled','disabled');
|
|
|
let addcompanyArr = new Array();
|
|
|
$('#companyadddiv').find('.form-control').each(function(){
|
|
|
- addcompanyArr.push($(this).val());
|
|
|
+ if ($.trim($(this).val()) !== '') {
|
|
|
+ addcompanyArr.push($(this).val());
|
|
|
+ }
|
|
|
});
|
|
|
var updatecompanyArr = new Array();
|
|
|
var updatecompanyidArr = new Array();
|
|
@@ -39,8 +41,8 @@ $(document).ready(() => {
|
|
|
};
|
|
|
postData('/change/update/company', data, function (result) {
|
|
|
$('#companyadddiv').html('');
|
|
|
- addCompanyHtml(result);
|
|
|
- selectCOmpanyHtml(result);
|
|
|
+ updateCompanyHtml(result);
|
|
|
+ selectCompanyHtml(result);
|
|
|
$('#editcompany').modal('hide');
|
|
|
toastr.success('变更单位已更新');
|
|
|
$('#updatecompany').attr('disabled',false);
|
|
@@ -55,24 +57,24 @@ $(document).ready(() => {
|
|
|
function isRepeat(arr){
|
|
|
let hash = {};
|
|
|
for(let i in arr) {
|
|
|
- if(hash[arr[i]])
|
|
|
+ if($.trim(arr[i]) !== '' && hash[arr[i]])
|
|
|
return true;
|
|
|
hash[arr[i]] = true;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-function addCompanyHtml(data) {
|
|
|
+function updateCompanyHtml(data) {
|
|
|
const html = [];
|
|
|
|
|
|
- for (const a of data.add) {
|
|
|
+ for (const a of data.select) {
|
|
|
html.push('<div class="form-group">');
|
|
|
- html.push('<input type="text" id="' + a.id +'" class="form-control" value="'+ a.name +'">');
|
|
|
+ html.push('<input type="text" id="' + a.id +'" class="form-control form-control-sm" value="'+ a.name +'">');
|
|
|
html.push('</div>');
|
|
|
}
|
|
|
- $('#companyshow').append(html.join(''));
|
|
|
+ $('#companyshow').html(html.join(''));
|
|
|
}
|
|
|
-function selectCOmpanyHtml(data) {
|
|
|
+function selectCompanyHtml(data) {
|
|
|
const html = [];
|
|
|
for (const s of data.select) {
|
|
|
html.push('<option>'+ s.name +'</option>');
|