cuiqian2004
2025-08-29 f9aa1010e164e21a3c8147e0f2e13b828676800a
pages/modal/3202_view.vue
@@ -113,7 +113,7 @@
         },
      },
      onBackPress(e) {
         this.navigateBackEvent()
          this.beforeNavigateBack()
      },
      async onLoad(options) {
         console.log(options);
@@ -393,67 +393,69 @@
               var $this = this;
               runCustomEvent(dataInfo).then(result => {
                     console.log(result);
                  console.log(result);
                     if (result.ret != 0 && result.ret != 1) {
                        let cls_name = result.event_info?.cls_name
                        let event_name = result.event_info?.event_name
                        tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info : result
                           .err_info
                           .join('\n') : ''
                        if (result.ret == 801) {
                           if (this.param.Only_Script_Error) {
                              let pos = tip.indexOf(":");
                              if (pos > -1) tip = tip.substring(pos + 1);
                           }
                  if (result.ret != 0 && result.ret != 1) {
                     let cls_name = result.event_info?.cls_name
                     let event_name = result.event_info?.event_name
                     tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info :
                        result
                        .err_info
                        .join('\n') : ''
                     if (result.ret == 801) {
                        if (this.param.Only_Script_Error) {
                           let pos = tip.indexOf(":");
                           if (pos > -1) tip = tip.substring(pos + 1);
                        }
                        if (cls_name && event_name) tip = `执行“${cls_name}”数据类的“${event_name}”脚本时返回错误:${tip}`
                        if (result.ret == 801) showInfo(tip)
                        else showError(`${tip},提示:${result.ret}`, this.translateSys('tip'))
                        this.saving = false
                        return false
                     } else {
                        var tip = result.info ? typeof result.info == 'string' ? result.info :
                           result.info.join('\n') : '';
                        tip = tip || result.err_info
                        let time = result.info_time || 0
                        if (time)
                           showError(tip, this.translateSys('tip'))
                        else
                     }
                     if (cls_name && event_name) tip =
                        `执行“${cls_name}”数据类的“${event_name}”脚本时返回错误:${tip}`
                     if (result.ret == 801) showInfo(tip)
                     else showError(`${tip},提示:${result.ret}`, this.translateSys('tip'))
                     this.saving = false
                     return false
                  } else {
                     var tip = result.info ? typeof result.info == 'string' ? result.info :
                        result.info.join('\n') : '';
                     tip = tip || result.err_info
                     let time = result.info_time || 0
                     if (time)
                        showError(tip, this.translateSys('tip'))
                     else
                        showInfo(tip)
                        if ([0, 2, 3, 4, -1].includes(result.result_type)) {
                           if (result.result_type == 2) {
                     if ([0, 2, 3, 4, -1].includes(result.result_type)) {
                        if (result.result_type == 2) {
                           } else if (typeof result.result == 'string') {
                              showInfo(result.result)
                           }
                           try {
                              var actionList = result.action || []
                              actionList.forEach(item => {
                                    if (item.action_type == "goback_to_pre_page") { //返回上一页
                                       var value = item.value;
                                       uni.navigateBack({
                                          delta: 1, //返回层数,2则上上页
                                       });
                                    } else {
                                       showInfo(this
                                          .translateSys(
                                             "quotation_mark_left"
                                          ) +
                                          item
                                          .action_type +
                                          this
                                          .translateSys(
                                             "quotation_mark_right"
                                          ) +
                                          this
                                          .translate(
                                             "tip_action_unprocessed"
                                          ))
                        } else if (typeof result.result == 'string') {
                           showInfo(result.result)
                                 }
                              });
                        }
                        try {
                           var actionList = result.action || []
                           actionList.forEach(item => {
                              if (item.action_type == "goback_to_pre_page") { //返回上一页
                                 var value = item.value;
                                 uni.navigateBack({
                                    delta: 1, //返回层数,2则上上页
                                 });
                              } else {
                                 showInfo(this
                                    .translateSys(
                                       "quotation_mark_left"
                                    ) +
                                    item
                                    .action_type +
                                    this
                                    .translateSys(
                                       "quotation_mark_right"
                                    ) +
                                    this
                                    .translate(
                                       "tip_action_unprocessed"
                                    ))
                              }
                           });
                        } catch (ex) {
                           let actionList = (result.action || []).map(a => a.action_type).join(';')
@@ -466,380 +468,431 @@
                  }
               }).catch(ex => {
               console.log(ex);
               showError(ex, this.translateSys("error") + "9.1")
                  console.log(ex);
                  showError(ex, this.translateSys("error") + "9.1")
            });
         } catch (ex) {
            showError(ex, this.translateSys('error') + "9.2")
               });
            } catch (ex) {
               showError(ex, this.translateSys('error') + "9.2")
         }
      },
      //点击按钮列表
      clickDropdownBtns() {
         var that = this
         var itemlist = [];
         this.dropdownBtns.forEach((btn) => {
            itemlist.push(btn.ShowName);
         });
         uni.showActionSheet({
            // title: '按钮列表',
            itemList: itemlist,
            success: (e) => {
               console.log(e.tapIndex);
               var btn = that.dropdownBtns[e.tapIndex];
               that.onButtonClicked(btn);
            }
         })
      },
      onButtonClicked(btn) {
         let enviroment = {
            button: "top",
            button_name: btn.ShowName,
            cls_id: btn.Cls_ID,
            function: "3202",
            master: {},
         };
         if (btn.FunCode == "TriggerEvent") {
            this.onTriggerEvent(btn, enviroment);
         } else {
            this.$Message.warning(this.$t("sys.unrealized"));
         }
      },
      async onTriggerEvent(btn, enviroment) {
         let data_json = [];
         let jsonlist = [];
         let detailStyleList = this.detail1StyleDefList;
         detailStyleList.forEach((style) => {
            let detail_attr = {};
            style.form.items.forEach((item) => {
               if (item.name == "Layout") {
                  item.setting.colList.forEach((cols) => {
                     if (cols != null) detail_attr[cols.fieldId] = cols.value;
                  });
               } else detail_attr[item.fieldId] = item.value;
         },
         //点击按钮列表
         clickDropdownBtns() {
            var that = this
            var itemlist = [];
            this.dropdownBtns.forEach((btn) => {
               itemlist.push(btn.ShowName);
            });
            jsonlist.push(detail_attr);
         });
         data_json = Base64.encode(JSON.stringify(jsonlist));
            uni.showActionSheet({
               // title: '按钮列表',
               itemList: itemlist,
               success: (e) => {
                  console.log(e.tapIndex);
                  var btn = that.dropdownBtns[e.tapIndex];
                  that.onButtonClicked(btn);
               }
            })
         },
         onButtonClicked(btn) {
         let input_param = {};
         this.head_styledef.form.items.forEach((item) => {
            if (item.name == "Layout") {
               item.setting.colList.forEach((cols) => {
                  if (cols != null) input_param[cols.fieldId] = cols.value;
               });
            } else input_param[item.fieldId] = item.value;
         });
         input_param = Base64.encode(JSON.stringify(input_param));
         await this.runCustomEvent({
            ed_type: 0,
            start_transaction: true,
            class_id: btn.Cls_ID,
            event_id: btn.Event.ID,
            input_param,
            data_json,
         });
      },
      navigateBackEvent() {
         if (!this.exit_view_event.id)
            return
         let data_json = [];
         let jsonlist = [];
         let detailStyleList = this.detail1StyleDefList;
         detailStyleList.forEach((style) => {
            let detail_attr = {};
            style.form.items.forEach((item) => {
               if (item.name == "Layout") {
                  item.setting.colList.forEach((cols) => {
                     if (cols != null) detail_attr[cols.fieldId] = cols.value;
                  });
               } else detail_attr[item.fieldId] = item.value;
            });
            jsonlist.push(detail_attr);
         });
         data_json = Base64.encode(JSON.stringify(jsonlist));
         let input_param = {};
         this.head_styledef.form.items.forEach((item) => {
            if (item.name == "Layout") {
               item.setting.colList.forEach((cols) => {
                  if (cols != null) input_param[cols.fieldId] = cols.value;
               });
            } else input_param[item.fieldId] = item.value;
         });
         input_param = Base64.encode(JSON.stringify(input_param));
         const eventChannel = this.getOpenerEventChannel();
         eventChannel.emit('ExitViewEvent', {
            ed_type: 0,
            start_transaction: true,
            class_id: this.param.ClsID,
            event_id: this.exit_view_event.id,
            input_param,
            data_json,
         });
      },
      cancel(e) { //取消
         this.navigateBackEvent()
         uni.navigateBack({
            delta: 1, //返回层数,2则上上页
         });
      },
      /**
       * 只支持["column1='A' or column2='B'", "column3='C' and column4='D'", "column5='E'"]这种格式
       * {
       *     "model": 0 / 1,
       *     "condition":
       *     [
       *         [
       *             { },
       *             { },
       *             { }
       *         ],
       *         [
       *             { }
       *         ],
       *         [
       *             { }
       *         ]
       *     ]
       * }
       */
      toWhereBase64String(list) {
         if (typeof list == 'string') list = [list]
         var sql = []
         var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=',
            '>', ' like'
         ]
         list.forEach(ls => {
            var where = ls.trim()
            if (where.startsWith('(') && where.endsWith(')'))
               where = where.replace(
                  /^\(/,
                  '').replace(
                  /\)$/, '')
            if (where.toLowerCase().includes(' and ')) {
               // 二级and放在第一级数组中
               where.split(/ and /i).forEach(li => {
                  var l = li.trim()
                  if (l.startsWith('(') && l.endsWith(
                        ')')) l = l.replace(
                     /^\(/,
                     '').replace(
                     /\)$/, '')
                  var sep = ''
                  for (var i = 0; i < seps.length; i++) {
                     if (l.toLowerCase().includes(seps[
                           i])) {
                        sep = seps[i]
                        break
                     }
                  }
                  if (sep) {
                     var values = l.split(new RegExp(
                        sep, 'i'))
                     var field = values[0]?.trim()
                        .replace(/^\[/, '')
                        .replace(
                           /\]$/, '')
                     var value = ''
                     var op = sep.trim()
                     if ([' in', ' not in'].includes(
                           sep) && values[1]
                        ?.toLowerCase().includes(
                           'select ') && values[1]
                        ?.toLowerCase()
                        .includes(
                           ' from ')) {
                        value = l.replace(field, '')
                           .replace(
                              /^\s*(in|not in)\s*/i,
                              '').trim()
                        if (value.startsWith('(') &&
                           value.endsWith(')'))
                           value = value
                           .replace(/^\(/, '')
                           .replace(/\)$/, '').trim()
                     } else {
                        value = values[1]?.trim()
                           .replace(/^\'/, '')
                           .replace(
                              /\'$/, '')
                        if (['in', 'not in'].includes(
                              op)) {
                           value = value.replace(
                              /^\(/, '').replace(
                              /\)$/,
                              '')
                           value = value.split(',')
                              .map(v => v.trim()
                                 .replace(
                                    /^\'/, '')
                                 .replace(/\'$/, '')
                              )
                        }
                     }
                     sql.push([{
                        field,
                        value,
                        op
                     }])
                  }
               })
            } else if (where.toLowerCase().includes(' or ')) {
               // 二级or放在第二级同一组数组中
               var s = []
               where.split(/ or /i).forEach(li => {
                  var l = li.trim()
                  if (l.startsWith('(') && l.endsWith(
                        ')')) l = l.replace(
                     /^\(/,
                     '').replace(
                     /\)$/, '')
                  var sep = ''
                  for (var i = 0; i < seps.length; i++) {
                     if (l.toLowerCase().includes(seps[
                           i])) {
                        sep = seps[i]
                        break
                     }
                  }
                  if (sep) {
                     var values = l.split(new RegExp(
                        sep, 'i'))
                     var field = values[0]?.trim()
                        .replace(/^\[/, '')
                        .replace(
                           /\]$/, '')
                     var value = ''
                     var op = sep.trim()
                     if ([' in', ' not in'].includes(
                           sep) && values[1]
                        ?.toLowerCase().includes(
                           'select ') && values[1]
                        ?.toLowerCase()
                        .includes(
                           ' from ')) {
                        value = l.replace(field, '')
                           .replace(
                              /^\s*(in|not in)\s*/i,
                              '').trim()
                        if (value.startsWith('(') &&
                           value.endsWith(')'))
                           value = value
                           .replace(/^\(/, '')
                           .replace(/\)$/, '').trim()
                     } else {
                        value = values[1]?.trim()
                           .replace(/^\'/, '')
                           .replace(
                              /\'$/, '')
                        if (['in', 'not in'].includes(
                              op)) {
                           value = value.replace(
                              /^\(/, '').replace(
                              /\)$/,
                              '')
                           value = value.split(',')
                              .map(v => v.trim()
                                 .replace(
                                    /^\'/, '')
                                 .replace(/\'$/, '')
                              )
                        }
                     }
                     sql.push([{
                        field,
                        value,
                        op
                     }])
                  }
               })
               sql.push(s)
            let enviroment = {
               button: "top",
               button_name: btn.ShowName,
               cls_id: btn.Cls_ID,
               function: "3202",
               master: {},
            };
            if (btn.FunCode == "TriggerEvent") {
               this.onTriggerEvent(btn, enviroment);
            } else {
               var li = where
               // 单一查询条件直接放在第一级数组中
               var l = li.trim()
               if (l.startsWith('(') && l.endsWith(')')) l = l
                  .replace(/^\(/, '')
                  .replace(
                     /\)$/, '')
               var sep = ''
               for (var i = 0; i < seps.length; i++) {
                  if (l.toLowerCase().includes(seps[i])) {
                     sep = seps[i]
                     break
                  }
               }
               if (sep) {
                  var values = l.split(new RegExp(sep, 'i'))
                  var field = values[0]?.trim().replace(/^\[/,
                     '').replace(/\]$/, '')
                  var value = ''
                  var op = sep.trim()
               this.$Message.warning(this.$t("sys.unrealized"));
            }
                  if ([' in', ' not in'].includes(sep) && values[
                        1]?.toLowerCase()
                     .includes('select ') &&
                     values[1]?.toLowerCase().includes(' from ')
                  ) {
                     value = l.replace(field, '').replace(
                           /^\s*(in|not in)\s*/i, '')
                        .trim()
                     if (value.startsWith('(') && value
                        .endsWith(')')) value = value
                        .replace(/^\(/, '')
                        .replace(/\)$/, '').trim()
                  } else {
                     value = values[1]?.trim().replace(/^\'/,
                        '').replace(/\'$/, '')
         },
         async onTriggerEvent(btn, enviroment) {
            let data_json = [];
            let jsonlist = [];
                     if (['in', 'not in'].includes(op)) {
                        value = value.replace(/^\(/, '')
                           .replace(/\)$/, '')
                        value = value.split(',').map(v => v
                           .trim().replace(/^\'/,
                              '')
                           .replace(/\'$/,
                              ''))
            let detailStyleList = this.detail1StyleDefList;
            detailStyleList.forEach((style) => {
               let detail_attr = {};
               style.form.items.forEach((item) => {
                  if (item.name == "Layout") {
                     item.setting.colList.forEach((cols) => {
                        if (cols != null) detail_attr[cols.fieldId] = cols.value;
                     });
                  } else detail_attr[item.fieldId] = item.value;
               });
               jsonlist.push(detail_attr);
            });
            data_json = Base64.encode(JSON.stringify(jsonlist));
            let input_param = {};
            this.head_styledef.form.items.forEach((item) => {
               if (item.name == "Layout") {
                  item.setting.colList.forEach((cols) => {
                     if (cols != null) input_param[cols.fieldId] = cols.value;
                  });
               } else input_param[item.fieldId] = item.value;
            });
            input_param = Base64.encode(JSON.stringify(input_param));
            await this.runCustomEvent({
               ed_type: 0,
               start_transaction: true,
               class_id: btn.Cls_ID,
               event_id: btn.Event.ID,
               input_param,
               data_json,
            });
         },
         async navigateBackEvent() {
            try {
               var $this = this;
               if (!this.exit_view_event.id)
                  return
               let data_json = [];
               let jsonlist = [];
               let detailStyleList = this.detail1StyleDefList;
               detailStyleList.forEach((style) => {
                  let detail_attr = {};
                  style.form.items.forEach((item) => {
                     if (item.name == "Layout") {
                        item.setting.colList.forEach((cols) => {
                           if (cols != null) detail_attr[cols.fieldId] = cols.value;
                        });
                     } else detail_attr[item.fieldId] = item.value;
                  });
                  jsonlist.push(detail_attr);
               });
               data_json = Base64.encode(JSON.stringify(jsonlist));
               let input_param = {};
               this.head_styledef.form.items.forEach((item) => {
                  if (item.name == "Layout") {
                     item.setting.colList.forEach((cols) => {
                        if (cols != null) input_param[cols.fieldId] = cols.value;
                     });
                  } else input_param[item.fieldId] = item.value;
               });
               input_param = Base64.encode(JSON.stringify(input_param));
               const result = await runCustomEvent({
                  ed_type: 0,
                  start_transaction: true,
                  class_id: this.param.ClsID,
                  event_id: this.exit_view_event.id,
                  input_param,
                  data_json,
               })
               if (result.ret != 0 && result.ret != 1) {
                  let cls_name = result.event_info?.cls_name
                  let event_name = result.event_info?.event_name
                  tip = result.err_info ? typeof result.err_info == 'string' ? result.err_info :
                     result
                     .err_info
                     .join('\n') : ''
                  if (result.ret == 801) {
                     if (this.param.Only_Script_Error) {
                        let pos = tip.indexOf(":");
                        if (pos > -1) tip = tip.substring(pos + 1);
                     }
                  }
                  sql.push([{
                     field,
                     value,
                     op
                  }])
                  if (cls_name && event_name) tip =
                     `执行“${cls_name}”数据类的“${event_name}”脚本时返回错误:${tip}`
                  if (result.ret == 801) showInfo(tip)
                  else showError(`${tip},提示:${result.ret}`, this.translateSys('tip'))
                  this.saving = false
                  return false
               } else {
                  var tip = result.info ? typeof result.info == 'string' ? result.info :
                     result.info.join('\n') : '';
                  tip = tip || result.err_info
                  let time = result.info_time || 0
                  if (time)
                     showError(tip, this.translateSys('tip'))
                  else
                     showInfo(tip)
                  if ([0, 2, 3, 4, -1].includes(result.result_type)) {
                     if (result.result_type == 2) {
                     } else if (typeof result.result == 'string') {
                        showInfo(result.result)
                     }
                  }
               }
            } catch (ex) {
               showError(ex, this.translateSys('error') + "9.2")
            }
         })
         if (sql.length > 0)
            return Base64.encode(JSON.stringify({
               model: 1,
               condition: sql
            }))
         else
            return ''
      },
      translate(t) {
         if (typeof this.$t == "function") return this.$t(`page.${t}`)
         else return t;
      },
      translateSys(t) {
         if (typeof this.$t == "function") return this.$t(`sys.${t}`)
         else return t;
      },
         },
          cancel(e) { //取消
            this.beforeNavigateBack()
            uni.navigateBack({
               delta: 1, //返回层数,2则上上页
            });
         },
         async beforeNavigateBack()
         {
            await this.navigateBackEvent()
            const eventChannel = this.getOpenerEventChannel();
            eventChannel.emit('ExitViewPage');
         },
         /**
          * 只支持["column1='A' or column2='B'", "column3='C' and column4='D'", "column5='E'"]这种格式
          * {
          *     "model": 0 / 1,
          *     "condition":
          *     [
          *         [
          *             { },
          *             { },
          *             { }
          *         ],
          *         [
          *             { }
          *         ],
          *         [
          *             { }
          *         ]
          *     ]
          * }
          */
   },
         toWhereBase64String(list) {
            if (typeof list == 'string') list = [list]
            var sql = []
            var seps = [' not in', ' in', '<>', '!=', '<=', '>=', '<', '=',
               '>', ' like'
            ]
            list.forEach(ls => {
               var where = ls.trim()
               if (where.startsWith('(') && where.endsWith(')'))
                  where = where.replace(
                     /^\(/,
                     '').replace(
                     /\)$/, '')
               if (where.toLowerCase().includes(' and ')) {
                  // 二级and放在第一级数组中
                  where.split(/ and /i).forEach(li => {
                     var l = li.trim()
                     if (l.startsWith('(') && l.endsWith(
                           ')')) l = l.replace(
                        /^\(/,
                        '').replace(
                        /\)$/, '')
                     var sep = ''
                     for (var i = 0; i < seps.length; i++) {
                        if (l.toLowerCase().includes(seps[
                              i])) {
                           sep = seps[i]
                           break
                        }
                     }
                     if (sep) {
                        var values = l.split(new RegExp(
                           sep, 'i'))
                        var field = values[0]?.trim()
                           .replace(/^\[/, '')
                           .replace(
                              /\]$/, '')
                        var value = ''
                        var op = sep.trim()
                        if ([' in', ' not in'].includes(
                              sep) && values[1]
                           ?.toLowerCase().includes(
                              'select ') && values[1]
                           ?.toLowerCase()
                           .includes(
                              ' from ')) {
                           value = l.replace(field, '')
                              .replace(
                                 /^\s*(in|not in)\s*/i,
                                 '').trim()
                           if (value.startsWith('(') &&
                              value.endsWith(')'))
                              value = value
                              .replace(/^\(/, '')
                              .replace(/\)$/, '').trim()
                        } else {
                           value = values[1]?.trim()
                              .replace(/^\'/, '')
                              .replace(
                                 /\'$/, '')
                           if (['in', 'not in'].includes(
                                 op)) {
                              value = value.replace(
                                 /^\(/, '').replace(
                                 /\)$/,
                                 '')
                              value = value.split(',')
                                 .map(v => v.trim()
                                    .replace(
                                       /^\'/, '')
                                    .replace(/\'$/, '')
                                 )
                           }
                        }
                        sql.push([{
                           field,
                           value,
                           op
                        }])
                     }
                  })
               } else if (where.toLowerCase().includes(' or ')) {
                  // 二级or放在第二级同一组数组中
                  var s = []
                  where.split(/ or /i).forEach(li => {
                     var l = li.trim()
                     if (l.startsWith('(') && l.endsWith(
                           ')')) l = l.replace(
                        /^\(/,
                        '').replace(
                        /\)$/, '')
                     var sep = ''
                     for (var i = 0; i < seps.length; i++) {
                        if (l.toLowerCase().includes(seps[
                              i])) {
                           sep = seps[i]
                           break
                        }
                     }
                     if (sep) {
                        var values = l.split(new RegExp(
                           sep, 'i'))
                        var field = values[0]?.trim()
                           .replace(/^\[/, '')
                           .replace(
                              /\]$/, '')
                        var value = ''
                        var op = sep.trim()
                        if ([' in', ' not in'].includes(
                              sep) && values[1]
                           ?.toLowerCase().includes(
                              'select ') && values[1]
                           ?.toLowerCase()
                           .includes(
                              ' from ')) {
                           value = l.replace(field, '')
                              .replace(
                                 /^\s*(in|not in)\s*/i,
                                 '').trim()
                           if (value.startsWith('(') &&
                              value.endsWith(')'))
                              value = value
                              .replace(/^\(/, '')
                              .replace(/\)$/, '').trim()
                        } else {
                           value = values[1]?.trim()
                              .replace(/^\'/, '')
                              .replace(
                                 /\'$/, '')
                           if (['in', 'not in'].includes(
                                 op)) {
                              value = value.replace(
                                 /^\(/, '').replace(
                                 /\)$/,
                                 '')
                              value = value.split(',')
                                 .map(v => v.trim()
                                    .replace(
                                       /^\'/, '')
                                    .replace(/\'$/, '')
                                 )
                           }
                        }
                        sql.push([{
                           field,
                           value,
                           op
                        }])
                     }
                  })
                  sql.push(s)
               } else {
                  var li = where
                  // 单一查询条件直接放在第一级数组中
                  var l = li.trim()
                  if (l.startsWith('(') && l.endsWith(')')) l = l
                     .replace(/^\(/, '')
                     .replace(
                        /\)$/, '')
                  var sep = ''
                  for (var i = 0; i < seps.length; i++) {
                     if (l.toLowerCase().includes(seps[i])) {
                        sep = seps[i]
                        break
                     }
                  }
                  if (sep) {
                     var values = l.split(new RegExp(sep, 'i'))
                     var field = values[0]?.trim().replace(/^\[/,
                        '').replace(/\]$/, '')
                     var value = ''
                     var op = sep.trim()
                     if ([' in', ' not in'].includes(sep) && values[
                           1]?.toLowerCase()
                        .includes('select ') &&
                        values[1]?.toLowerCase().includes(' from ')
                     ) {
                        value = l.replace(field, '').replace(
                              /^\s*(in|not in)\s*/i, '')
                           .trim()
                        if (value.startsWith('(') && value
                           .endsWith(')')) value = value
                           .replace(/^\(/, '')
                           .replace(/\)$/, '').trim()
                     } else {
                        value = values[1]?.trim().replace(/^\'/,
                           '').replace(/\'$/, '')
                        if (['in', 'not in'].includes(op)) {
                           value = value.replace(/^\(/, '')
                              .replace(/\)$/, '')
                           value = value.split(',').map(v => v
                              .trim().replace(/^\'/,
                                 '')
                              .replace(/\'$/,
                                 ''))
                        }
                     }
                     sql.push([{
                        field,
                        value,
                        op
                     }])
                  }
               }
            })
            if (sql.length > 0)
               return Base64.encode(JSON.stringify({
                  model: 1,
                  condition: sql
               }))
            else
               return ''
         },
         translate(t) {
            if (typeof this.$t == "function") return this.$t(`page.${t}`)
            else return t;
         },
         translateSys(t) {
            if (typeof this.$t == "function") return this.$t(`sys.${t}`)
            else return t;
         },
      },
   };
</script>
<style lang="scss">