|
@@ -5761,7 +5761,7 @@ $(document).ready(() => {
|
|
|
xmjSpread.refresh();
|
|
|
}
|
|
|
});
|
|
|
- if (!readOnly) {
|
|
|
+ if (!readOnly || shenpiPower) {
|
|
|
// 自动编号
|
|
|
$('.reduction-code').click(function () {
|
|
|
const code = $(this).attr('data-code');
|
|
@@ -5846,24 +5846,6 @@ $(document).ready(() => {
|
|
|
}
|
|
|
toastr.success('已还原到上次保存状态');
|
|
|
});
|
|
|
-
|
|
|
- // 判断是否有更改过
|
|
|
- function judgeChange() {
|
|
|
- let change = false;
|
|
|
- console.log(changeInfo, back_changeInfo);
|
|
|
- if (!isObjEqual(changeInfo, back_changeInfo)) {
|
|
|
- change = true;
|
|
|
- }
|
|
|
- if (change) {
|
|
|
- $('#show-save-btn').show();
|
|
|
- $('#sp-btn').hide();
|
|
|
- $('.title-main').addClass('bg-warning');
|
|
|
- } else {
|
|
|
- $('#show-save-btn').hide();
|
|
|
- $('#sp-btn').show();
|
|
|
- $('.title-main').removeClass('bg-warning');
|
|
|
- }
|
|
|
- }
|
|
|
function changeFormRemake() {
|
|
|
changeInfo = Object.assign({}, back_changeInfo);
|
|
|
$('#change_form input[name="code"]').val(changeInfo.code);
|
|
@@ -5884,85 +5866,88 @@ $(document).ready(() => {
|
|
|
$('#change_form input[name="charge"][value="'+ changeInfo.charge +'"]').prop('checked', true);
|
|
|
$('#change_form input[name="state"][value="'+ changeInfo.state +'"]').prop('checked', true);
|
|
|
$('#change_form input[name="type[]"]').prop('checked', false);
|
|
|
+ $('#change_form input[name="w_code"]').val(changeInfo.w_code);
|
|
|
const typecheck = changeInfo.type.split(',');
|
|
|
for (const type of typecheck) {
|
|
|
$('#change_form input[name="type[]"][value="'+ type +'"]').prop('checked', true);
|
|
|
}
|
|
|
}
|
|
|
- $('.checkChangeFrom').on('click', function () {
|
|
|
- let returnFlag = false;
|
|
|
- // 表单判断
|
|
|
- if ($('input[name="code"]').val() === '') {
|
|
|
- toastr.error('申请编号不能为空!');
|
|
|
- returnFlag = true;
|
|
|
- }
|
|
|
- if ($('input[name="name"]').val() === '') {
|
|
|
- toastr.error('变更工程名称不能为空!');
|
|
|
- returnFlag = true;
|
|
|
- }
|
|
|
- if ($('textarea[name="content"]').val() === '') {
|
|
|
- toastr.error('工程变更理由及内容不能为空!');
|
|
|
- returnFlag = true;
|
|
|
- }
|
|
|
- if (changeList.length === 0) {
|
|
|
- toastr.error('请添加变更清单!');
|
|
|
- returnFlag = true;
|
|
|
- } else {
|
|
|
- const whiteList = _.filter(changeList, item => item.lid == 0 && (item.name === '' || item.name === null));
|
|
|
- if (whiteList.length > 0) {
|
|
|
- toastr.error('存在空白清单未完整填写数据(名称不可为空)');
|
|
|
+ if (!readOnly) {
|
|
|
+ $('.checkChangeFrom').on('click', function () {
|
|
|
+ let returnFlag = false;
|
|
|
+ // 表单判断
|
|
|
+ if ($('input[name="code"]').val() === '') {
|
|
|
+ toastr.error('申请编号不能为空!');
|
|
|
returnFlag = true;
|
|
|
}
|
|
|
- // for (const [i,cl] of changeSpreadSheet.zh_data.entries()) {
|
|
|
- // if (cl.name === '') {
|
|
|
- // toastr.error('清单第' + (i+1) + '行未完整填写数据(名称不可为空)');
|
|
|
- // returnFlag = true;
|
|
|
- // }
|
|
|
- // }
|
|
|
- }
|
|
|
- if(!checkAuditorFrom ()) {
|
|
|
- returnFlag = true;
|
|
|
- }
|
|
|
- // 判断非空白变更清单是否有重复值(gcl_id及mx_id),如果存在完全相同则需要提示并删除,上报失败,这功能主要是因为清单数据过多服务器处理不过来偶然出现
|
|
|
- const doubleList = findDuplicates(_.filter(changeList, item => item.lid != 0));
|
|
|
- console.log(doubleList);
|
|
|
- if (doubleList.length > 0) {
|
|
|
- for (const double of doubleList) {
|
|
|
- const msgIndex = [];
|
|
|
- for (const one of double) {
|
|
|
- const index = _.findIndex(changeSpreadSheet.zh_data[double[0].order - 1].children, { id: one.id });
|
|
|
- if (index !== -1) msgIndex.push(index+1);
|
|
|
+ if ($('input[name="name"]').val() === '') {
|
|
|
+ toastr.error('变更工程名称不能为空!');
|
|
|
+ returnFlag = true;
|
|
|
+ }
|
|
|
+ if ($('textarea[name="content"]').val() === '') {
|
|
|
+ toastr.error('工程变更理由及内容不能为空!');
|
|
|
+ returnFlag = true;
|
|
|
+ }
|
|
|
+ if (changeList.length === 0) {
|
|
|
+ toastr.error('请添加变更清单!');
|
|
|
+ returnFlag = true;
|
|
|
+ } else {
|
|
|
+ const whiteList = _.filter(changeList, item => item.lid == 0 && (item.name === '' || item.name === null));
|
|
|
+ if (whiteList.length > 0) {
|
|
|
+ toastr.error('存在空白清单未完整填写数据(名称不可为空)');
|
|
|
+ returnFlag = true;
|
|
|
+ }
|
|
|
+ // for (const [i,cl] of changeSpreadSheet.zh_data.entries()) {
|
|
|
+ // if (cl.name === '') {
|
|
|
+ // toastr.error('清单第' + (i+1) + '行未完整填写数据(名称不可为空)');
|
|
|
+ // returnFlag = true;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ if(!checkAuditorFrom ()) {
|
|
|
+ returnFlag = true;
|
|
|
+ }
|
|
|
+ // 判断非空白变更清单是否有重复值(gcl_id及mx_id),如果存在完全相同则需要提示并删除,上报失败,这功能主要是因为清单数据过多服务器处理不过来偶然出现
|
|
|
+ const doubleList = findDuplicates(_.filter(changeList, item => item.lid != 0));
|
|
|
+ console.log(doubleList);
|
|
|
+ if (doubleList.length > 0) {
|
|
|
+ for (const double of doubleList) {
|
|
|
+ const msgIndex = [];
|
|
|
+ for (const one of double) {
|
|
|
+ const index = _.findIndex(changeSpreadSheet.zh_data[double[0].order - 1].children, { id: one.id });
|
|
|
+ if (index !== -1) msgIndex.push(index+1);
|
|
|
+ }
|
|
|
+ if (msgIndex.length > 0) {
|
|
|
+ toastr.error('第 ' + double[0].order + ' 行' + double[0].code + '清单项目节第 ' + msgIndex.splice(',') + '行重复,请只保留一条数据');
|
|
|
+ }
|
|
|
}
|
|
|
- if (msgIndex.length > 0) {
|
|
|
- toastr.error('第 ' + double[0].order + ' 行' + double[0].code + '清单项目节第 ' + msgIndex.splice(',') + '行重复,请只保留一条数据');
|
|
|
+ returnFlag = true;
|
|
|
+ }
|
|
|
+ if (returnFlag) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ postData(window.location.pathname + '/audit/start', {}, function (result) {
|
|
|
+ window.location.reload();
|
|
|
+ })
|
|
|
+ });
|
|
|
+ // 检查上报情况
|
|
|
+ function checkAuditorFrom () {
|
|
|
+ if ($('#auditList li').length === 0) {
|
|
|
+ if(shenpi_status === shenpiConst.sp_status.gdspl) {
|
|
|
+ toastr.error('请联系管理员添加审批人');
|
|
|
+ } else {
|
|
|
+ toastr.error('请先选择审批人,再上报数据');
|
|
|
}
|
|
|
+ return false;
|
|
|
}
|
|
|
- returnFlag = true;
|
|
|
+ return true;
|
|
|
}
|
|
|
- if (returnFlag) {
|
|
|
- return false;
|
|
|
+ // 找出数组中相同的清单
|
|
|
+ function findDuplicates(arr, keys = ['lid', 'gcl_id', 'mx_id']) {
|
|
|
+ const groupedData = _.groupBy(arr, item => JSON.stringify(_.pick(item, keys)));
|
|
|
+ const duplicates = _.filter(groupedData, group => group.length > 1);
|
|
|
+ return _.values(duplicates);
|
|
|
}
|
|
|
- postData(window.location.pathname + '/audit/start', {}, function (result) {
|
|
|
- window.location.reload();
|
|
|
- })
|
|
|
- });
|
|
|
- // 检查上报情况
|
|
|
- function checkAuditorFrom () {
|
|
|
- if ($('#auditList li').length === 0) {
|
|
|
- if(shenpi_status === shenpiConst.sp_status.gdspl) {
|
|
|
- toastr.error('请联系管理员添加审批人');
|
|
|
- } else {
|
|
|
- toastr.error('请先选择审批人,再上报数据');
|
|
|
- }
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
- }
|
|
|
- // 找出数组中相同的清单
|
|
|
- function findDuplicates(arr, keys = ['lid', 'gcl_id', 'mx_id']) {
|
|
|
- const groupedData = _.groupBy(arr, item => JSON.stringify(_.pick(item, keys)));
|
|
|
- const duplicates = _.filter(groupedData, group => group.length > 1);
|
|
|
- return _.values(duplicates);
|
|
|
}
|
|
|
}
|
|
|
|