|
@@ -2022,7 +2022,7 @@ $(document).ready(() => {
|
|
|
this._initModifyDetail();
|
|
|
this._initLocateRela();
|
|
|
// 草图相关
|
|
|
- // this._initImageRela();
|
|
|
+ this._initImageRela();
|
|
|
this.reBuildImData();
|
|
|
}
|
|
|
_initImTypeSetRela() {
|
|
@@ -2334,7 +2334,6 @@ $(document).ready(() => {
|
|
|
}
|
|
|
_initModifyDetail() {
|
|
|
const self = this;
|
|
|
- let updateImageData;
|
|
|
// 编辑
|
|
|
$('#edit-detail').click(function () {
|
|
|
$(this).hide();
|
|
@@ -2342,7 +2341,7 @@ $(document).ready(() => {
|
|
|
$('#cancel-detail').show();
|
|
|
$('#detail-show').hide();
|
|
|
$('#detail-edit').show();
|
|
|
- makeImageItem();
|
|
|
+ self.updateImageData = null;
|
|
|
});
|
|
|
// 保存
|
|
|
$('#save-detail').click(() => {
|
|
@@ -2381,21 +2380,20 @@ $(document).ready(() => {
|
|
|
check('drawing_code', $('#drawing-code'), data, updateData);
|
|
|
check('calc_memo', $('#calc-memo'), data, updateData);
|
|
|
updateData.custom_define = updateData.custom_define.join(',');
|
|
|
- // updateData.bw = $('#bw-name').val();
|
|
|
- // updateData.peg = $('#peg').val();
|
|
|
- // updateData.xm = $('#xm-name').val();
|
|
|
- // updateData.position = $('#position').val();
|
|
|
- // updateData.jldy = $('#jldy').val();
|
|
|
- // updateData.drawing_code = $('#drawing-code').val();
|
|
|
- // updateData.calc_memo = $('#calc-memo').val();
|
|
|
postData(window.location.pathname + '/detail/save', updateData, function (result) {
|
|
|
stageIm.loadUpdateDetailData(result);
|
|
|
self.reLoadDetailData();
|
|
|
+ if (self.updateImageData && !self.updateImageData.uuid) {
|
|
|
+ self.updateImageData.uuid = result.uuid;
|
|
|
+ postData(window.location.pathname + '/detail/merge-img', self.updateImageData, function (result) {
|
|
|
+ stageIm.loadUpdateDetailData(result);
|
|
|
+ self.reLoadDetailData();
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
- if (updateImageData) {
|
|
|
- postData(window.location.pathname + '/detail/merge-img', updateImageData, function (result) {
|
|
|
+ if (self.updateImageData && self.updateImageData.uuid) {
|
|
|
+ postData(window.location.pathname + '/detail/merge-img', self.updateImageData, function (result) {
|
|
|
stageIm.loadUpdateDetailData(result);
|
|
|
- updateImageData = '';
|
|
|
self.reLoadDetailData();
|
|
|
});
|
|
|
}
|
|
@@ -2404,9 +2402,9 @@ $(document).ready(() => {
|
|
|
$('#cancel-detail').click(() => {
|
|
|
self.reLoadDetailData();
|
|
|
});
|
|
|
- // }
|
|
|
- // _initImageRela() {
|
|
|
- // const self = this;
|
|
|
+ }
|
|
|
+ _initImageRela() {
|
|
|
+ const self = this;
|
|
|
function setdraggrable(){
|
|
|
$( ".img-item" ).draggable({ containment: "parent" },{stop: function( event, ui ) {
|
|
|
}}).resizable({ containment: "parent" },{ handles: 'n, e, s, w, ne, se, sw, nw' },{ maxWidth: parseFloat($('#imgwidth').val())},{maxHeight: parseFloat($('#imgheight').val())},{
|
|
@@ -2452,24 +2450,8 @@ $(document).ready(() => {
|
|
|
$(this).parent().remove();
|
|
|
};
|
|
|
// 加载草图组成
|
|
|
- // $('#edit-img').on('show.bs.modal', function () {
|
|
|
- // const data = SpreadJsObj.getSelectObject(self.spread.getActiveSheet());
|
|
|
- // const items = data.calc_img_org ? JSON.parse(data.calc_img_org) : [];
|
|
|
- // const html = [];
|
|
|
- // for (const item of items) {
|
|
|
- // const itemStyle = 'top:' + item.top + ';' + 'left:' + item.left + ';' + 'width:' + item.width + ';' + 'height:' + item.height + ';';
|
|
|
- // html.push('<div class="img-item" style="' + itemStyle + '">');
|
|
|
- // html.push('<div class="img-bar">');
|
|
|
- // html.push('<a href="javascript: void(0);" class="text-danger" title="删除"><i class="fa fa-remove" style="font-size: 24px"></i></a>');
|
|
|
- // html.push('</div>');
|
|
|
- // html.push('<div class="focus" style="width:100%; height:100%"><img src="', item.src, '" id="draggable" style="width:100%; height:100%"></div>');
|
|
|
- // html.push('</div>');
|
|
|
- // }
|
|
|
- // $('.img-view').html(html.join(''));
|
|
|
- // $('.img-bar').click(removeImageItem);
|
|
|
- // setdraggrable();
|
|
|
- // });
|
|
|
- function makeImageItem () {
|
|
|
+ $('#edit-img').on('show.bs.modal', function () {
|
|
|
+ self.updateImageData = null;
|
|
|
const data = SpreadJsObj.getSelectObject(self.spread.getActiveSheet());
|
|
|
const items = data.calc_img_org ? JSON.parse(data.calc_img_org) : [];
|
|
|
const html = [];
|
|
@@ -2485,7 +2467,7 @@ $(document).ready(() => {
|
|
|
$('.img-view').html(html.join(''));
|
|
|
$('.img-bar').click(removeImageItem);
|
|
|
setdraggrable();
|
|
|
- };
|
|
|
+ });
|
|
|
// 上传图片
|
|
|
$('#upload-img').click(function () {
|
|
|
$('#upload-img-file').trigger('click');
|
|
@@ -2551,13 +2533,6 @@ $(document).ready(() => {
|
|
|
const updateData = {updateType: 'update', lid: data.lid, pid: data.pid};
|
|
|
if (data.uuid) {
|
|
|
updateData.uuid = data.uuid;
|
|
|
- } else {
|
|
|
- updateData.code = data.code;
|
|
|
- updateData.name = data.name;
|
|
|
- updateData.unit = data.unit;
|
|
|
- updateData.unit_price = data.unit_price;
|
|
|
- updateData.pid = data.pid;
|
|
|
- updateData.pos_name = data.pos_name;
|
|
|
}
|
|
|
if (data.custom_define.indexOf('calc_img') === -1) {
|
|
|
updateData.custom_define = data.custom_define;
|
|
@@ -2567,7 +2542,7 @@ $(document).ready(() => {
|
|
|
updateData.img = canvas.toDataURL('image/png');
|
|
|
updateData.imgInfo = itemInfo;
|
|
|
|
|
|
- updateImageData = updateData;
|
|
|
+ self.updateImageData = updateData;
|
|
|
$('#calc-img').attr('src', updateData.img);
|
|
|
$('#view-calc-img').attr('src', updateData.img);
|
|
|
$('#show-calc-img').attr('src', updateData.img);
|
|
@@ -2585,7 +2560,7 @@ $(document).ready(() => {
|
|
|
// $('#edit-img').modal('hide');
|
|
|
// });
|
|
|
} else if (data.calc_img) {
|
|
|
- updateImageData = {updateType: 'clear', lid: data.lid, pid: data.pid, uuid: data.uuid};
|
|
|
+ self.updateImageData = {updateType: 'clear', lid: data.lid, pid: data.pid, uuid: data.uuid};
|
|
|
$('#show-calc-img').attr('src', '');
|
|
|
$('#calc-img').attr('src', '');
|
|
|
$('#view-calc-img').attr('src', '');
|
|
@@ -2601,6 +2576,7 @@ $(document).ready(() => {
|
|
|
// $('#edit-img').modal('hide');
|
|
|
// });
|
|
|
} else {
|
|
|
+ self.updateImageData = null;
|
|
|
$('#show-calc-img').attr('src', '');
|
|
|
$('#calc-img').attr('src', '');
|
|
|
$('#view-calc-img').attr('src', '');
|