zhangyanpeng
2024-08-03 64b37e266f4f95f8167d34dfbc5bca668a555f75
module/visit/page/popup/visit_log_detail.html
@@ -16,7 +16,7 @@
               el: "#vbody",
               data: {
                  dataname: "md_terminal_visition",
                  table_dataname: "wm_transfer_detail",
                  table_dataname: "md_terminal_visition_detail",
                  title: "拜访详情",
                  dataRequest: [
                     {
@@ -42,7 +42,7 @@
                  formAttr: {
                     istitle: false,
                     title: "表单名称",
                     columnnumber: 2,
                     columnnumber: 4,
                     labelwidth: "120px",
                     labelposition: "left",//"left",// right//top
                     size: "mini",
@@ -286,34 +286,36 @@
                           var tableFields_ = [];
                           metas.map(f=>{
                              f.isshow = "T";
                              if(f.field == "from_warehouse_name") {
                                 f.options = me.options_wm_warehouse
                              if(f.field == "is_clinical" || f.field == "is_clinical_purchase" || f.field == "is_formal_purchase" ) {
                                 f.inputtype = 'ischeckbox'
                                 // f.isshow = 'F'
                                 // if (result.data[me.dataname][f.field]) {
                                 //    var promotion_process = {
                                 //       field_name: "promotion_process",
                                 //       input_type: "span",
                                 //       label_chinese: "推广过程",
                                 //       label_english: "promotion_process",
                                 //       form_order_no: 10,
                                 //       options: {}
                                 //    }
                                 // }
                              }
                              if(f.field == "to_warehouse_name") {
                                 f.options = me.options_wm_warehouse
                              }
                              if (f.field == "org_name" && me.iscustomer) {
                                 f.inputtype = "span"
                              }
                              if(f.field == "doc_date") {
                                 f.disabled = true
                              }
                              // if(f.field == "to_warehouse_name") {
                              //    f.options = me.options_wm_warehouse
                              // }
                              // if (f.field == "org_name" && me.iscustomer) {
                              //    f.inputtype = "span"
                              // }
                              // if(f.field == "doc_date") {
                              //    f.disabled = true
                              // }
                              
                              formFields_.push(clone(f));
                           })
                           table_metas.map(f=>{
                              f.isshow = "T";
                              if (f.field == "stock_type_code") {
                                 f.options = me.dataRequestObj.wm_stock_type
                                 var formatterjson_ = {};
                                 me.dataRequestObj.wm_stock_type.map(r=>{
                                    formatterjson_[r.code] = r.name;
                                 })
                                 f.formatterjson = formatterjson_
                              }
                              if (f.field == "qty") {
                                 f.inputkeys = "number";//按键正整数
                              if (f.field == 'longitude' || f.field == 'latitude' ) {
                                 f.isshow = 'F'
                              }
                              tableFields_.push(clone(f));
                           })
@@ -329,21 +331,10 @@
                        }
                        if (me.rowData[me.table_dataname]) {
                           me.tableData = me.rowData[me.table_dataname];
                           // me.tableData.is_distance_include =  me.tableData.is_distance_include == 'true' ? '已完成' : '未完成'
                        }
                        
                        // 调拨附件的赋值
                        if (me.rowData["wm_transfer_file"] && me.rowData["wm_transfer_file"].length) {
                           var comeback_attachment_name_ = []
                           me.rowData["wm_transfer_file"].map(f=>{
                              var f_ = {
                                 id: f.id,
                                 file_name: f.file_name
                              }
                              comeback_attachment_name_.push(f_);
                           })
                           me.$set(me.formData, "transfer_file", comeback_attachment_name_);
                        }
                     })
                     
@@ -741,222 +732,6 @@
                     
                  },
                  
                  tablepopup_productlist(sceneCode, obj , callback) {
                     var me = this;
                     var data_ = {};
                     var selectmap_ = {};
                     console.log(obj);
                     //排除已选物料
                     me.tableData.map(row=>{
                        if (row.batch_sn) {
                           var key_ = row.from_warehouse_id + "_" + row.product_code + "_" + row.batch_no + "_" + row.batch_sn
                           selectmap_[key_] = true
                        }
                        else if (row.product_code) {
                           var key_ = row.from_warehouse_id + "_" + row.product_code + "_" + row.batch_no
                           selectmap_[key_] = true
                        }
                     })
                     var config = {
                        totab: false, //true: 以Tab导航的方式打开
                        width: "1100px",
                        height: "520px",
                        icon: "icon-product",
                        text: "明细选择",
                        id: "popup_book_detail",//totab: true时需设置,用于判断是否已打开此页面
                        url: "module/md/page/popup/page/popup_bookDetail_upload_transfer.html",
                        data: data_,
                        delta: {isinputqty: true, selectmap: selectmap_, customer_id: this.formData.account_id},
                        // filter: "org_id='"+ me.selectedrow.org_id + "' and bu_id='" + me.selectedrow.bu_id + "'",
                        // filter: "warehouse_name='" + me.formData.from_warehouse_name +"'" ,
                        filter: "qty_available > 0 and wm_book_detail.account_id='" + me.formData.account_id +"'" ,
                        sceneCode: sceneCode,//"refuseedit",//"approval", //"add"//"browse",
                        callback: function(popupobj, popupcallback) {
                           callback(popupobj);
                           if (popupcallback) {
                              popupcallback();
                           }
                        }
                     };
                     me.doPopupByPublic(config);
                  },
                  deleteDataById(id, dataname, confirm_txt, callback){
                     var me = this;
                     var formData_ = clone(me.formData);
                     Root.confirm('确定删除该' + confirm_txt + '吗?', '删除提示', {
                       confirmButtonText: '删除',
                       cancelButtonText: '取消',
                       type: 'warning'
                     }).then(() => {
                        if (id) {
                           let param = {
                              dataname: dataname,
                              id: id
                           }
                           Server.call("root/data/deleteEntity", param, function(result) {
                              console.log(result);
                              if (result && result.data) {
                                 callback();
                              }
                           });
                        }
                        else {
                           callback();
                        }
                     }).catch(() => {
                        Root.message({
                           type: 'info',
                           message: '已取消删除'
                        });
                     });
                  },
                  showFileImgByFileId_n(filenamefield, fileobj, objformdata){
                     let me = this;
                     var formData_ = clone(me.formData);
                     var file_id = fileobj.id
                     var file_name = fileobj.file_name
                     var dataname_ = this.dataname
                     this.zzimg = {};
                     this.zzimgList = [];
                     this.file_txt = false;
                     if(file_id) {
                        var fileid = file_id;
                        let fileName = clone(file_name);
                        let index1 = fileName.lastIndexOf(".");
                        let index2 = fileName.length;
                        let suffix = fileName.substring(index1, index2).toLowerCase(); //后缀名
                        if (suffix == ".png" || suffix == ".jpg" || suffix == ".jpeg" || suffix == ".pdf") {
                           var row = {
                              fileid: fileid,
                              dataname: dataname_,
                              filename: fileName
                           }
                           var config = {
                              totab: false,
                              width: "1200px",
                              height: 800,
                              icon: "icon-product",
                              text: "附件预览",
                              id: "pdf_" + fileid,
                              url: "module/tool/page/popup_file_pdf.html",
                              data: row,
                              delta: {},
                              callback: function(obj, callback) {
                                 if (callback) {
                                    callback();
                                 }
                              }
                           };
                           this.doPopupByPublic(config);
                        }
                        else {//只可下载,不可预览
                           // handleDownloadUrl(fileid,false);
                           handleDownload(fileid, dataname_);
                        }
                     }
                  },
                  onPopupByUploadFile_n(filenamefield, fileidfield, dataname, objformdata) {
                     var me = this;
                     var analysistype_ = "";
                     var sender_id_ = ""; // 业务数据id;
                     if (objformdata.id) {
                        sender_id_ = objformdata.id;
                     }
                     // var analysistype = "invoiceIdentify"; // 发票验真
                     // if (me.formData.implant_evidence_code == "deliver") { // 出库单
                     //    analysistype = "";
                     // }
                     var delta_ = {filetypelist: [".png", ".jpg", ".jpeg",".pdf"]}; //, ".pdf"
                     var config = {
                        totab: false,
                        width: "500px",
                        icon: "icon-product",
                        text: "附件上传",
                        id: "popupByUploadFile",
                        url: "module/tool/page/popup_uploadFile.html",
                        data: {
                           dataName: dataname,
                           fileidfieldName: fileidfield,
                           id: sender_id_,
                           fileNamefieldName: filenamefield
                        },
                        delta: delta_,
                        callback: function(obj, callback) {
                           var f_ = {
                              id: obj.row[0].id,
                              file_name: decodeURI(obj.row[0].name)
                           }
                           if (!objformdata[filenamefield]) {
                              objformdata[filenamefield] = []
                           }
                           me.$message({
                              showClose: true,
                              message: '上传成功!',
                              type: 'success'
                           });
                           objformdata[filenamefield].push(f_);
                           if (!objformdata.id) {
                              objformdata.id = obj.row[0].sender_id;
                           }
                           if (callback) {
                              callback();
                           }
                        }
                     };
                     this.doPopupByPublic(config);
                  },
                  deleteByFileId_n(filenamefield, fileobj, objformdata){
                     var me = this;
                     var formData_ = clone(me.formData);
                     Root.confirm('确定删除附件【' + fileobj.file_name + '】吗?', '删除提示', {
                       confirmButtonText: '删除',
                       cancelButtonText: '取消',
                       type: 'warning'
                     }).then(() => {
                        if (fileobj.id) {
                           let param = {
                              dataname: "wm_transfer_file",
                              id: fileobj.id
                           }
                           Server.call("root/data/deleteEntity", param, function(result) {
                              console.log(result);
                              if (result && result.data) {
                                 objformdata[filenamefield].remove(fileobj);
                                 // me.formData[filenamefield].remove(fileobj);
                                 // me.formData = formData_;
                                 Root.message({
                                    type: 'success',
                                    message: '删除成功!'
                                 });
                              }
                           });
                        }
                     }).catch(() => {
                        Root.message({
                           type: 'info',
                           message: '已取消删除'
                        });
                     });
                  },
                  dddd(obj){
                     var me = this;
                     me.checkarr = obj;
                  },
                  
                  openOrg(obj,callback){
                     var me = this;
@@ -1026,120 +801,6 @@
                  //    });
                  // },
                  
                  GFG_Fun() { //标识四
                     var suiji = Math.random().toString(36).slice(2);
                     return suiji;
                  },
                  rowChange(row, type, tablename) {
                     var me = this;
                     if (type == "add") {
                        this.tableData.unshift(row);
                     }
                     else if (type == "del") {
                        if (row.id) {
                           let param = {
                              dataname: tablename,
                              id: row.id
                           }
                           Server.call("root/data/deleteEntity", param, function(result) {
                              console.log(result);
                              if (result && result.data) {
                                 me.tableData.remove(row);
                                 Root.message({
                                    type: 'success',
                                    message: '删除成功!'
                                 });
                              }
                           });
                        }
                        else {
                           this.tableData.remove(row);
                        }
                     }
                     else {
                     }
                  },
                  //提交
                  // submitRowTable() {
                  //    this.iscommit = true;
                  //    this.saveRowTable();
                  // },
                  //保存
                  // saveRowTable() {
                  //    var me = this;
                  //    var operator_ = "save";//保存
                  //    if(me.iscommit) {
                  //       operator_ = "commit";//提交
                  //    }
                  //    var entity_ = clone(this.formData);
                  //    var entity = {};
                  //    for (var r in entity_) {
                  //       if (entity_[r] || entity_[r] == "" || entity_[r] == false || entity_[r] == 0) {
                  //          entity[r] = entity_[r];
                  //       }
                  //    }
                  //    var tableData_ = [];
                  //    this.tableData.map(r=>{
                  //       var row_ = {};
                  //       for (var k in r) {
                  //          if (r[k]) {
                  //             row_[k] = r[k];
                  //          }
                  //       }
                  //       tableData_.push(row_);
                  //    })
                  //    if (tableData_.length == 0) {
                  //       Root.message({
                  //          type: 'warning',
                  //          message: '请先添加明细数据'
                  //       });
                  //       return
                  //    }
                  //    let param = {
                  //       dataname: this.dataname,
                  //       // operator: operator_,
                  //       data: {},
                  //    }
                  //    param.data[this.dataname] = entity;
                  //    param.data[this.table_dataname] = tableData_;
                  //    Server.call("root/data/saveEntity", param, function(result) {
                  //       console.log(result);
                  //       if (result.success) {
                  //          if(me.iscommit){
                  //             me.iscommit = false;
                  //             Root.message({
                  //                type: 'success',
                  //                message: '提交成功'
                  //             });
                  //             me.saveAfter();
                  //          }
                  //          else {
                  //             Root.message({
                  //                type: 'success',
                  //                message: '保存成功'
                  //             });
                  //             me.saveAfter();
                  //          }
                  //       }
                  //    });
                  // },
                  
                  submitRowTable() {
                     var me = this;
@@ -1515,7 +1176,6 @@
                           :istablebuttons="false"
                           :isbasicfilterfields="false"
                           :isdraggableorder="false"
                           :show-summary="true"
                           v-on:get-data="getData"
                           v-on:del-data="delData"