Prechádzať zdrojové kódy

数据订单:添加业务域检查及优化文本插入逻辑

Xiao_123 2 dní pred
rodič
commit
318a6c01b7

+ 7 - 2
src/views/dataService/dataOrder/components/OrderForm.vue

@@ -192,6 +192,10 @@ export default {
       this.contextMenuVisible = true
     },
     handleInsertBusinessDomainClick () {
+      if (!this.businessDomain?.length) {
+        this.$snackbar.warning('暂无业务域,请先添加业务域')
+        return
+      }
       this.contextMenuVisible = false
       this.insertDialogSelected = null
       this.insertDialogVisible = true
@@ -216,8 +220,9 @@ export default {
       const useAppend = !this.descriptionCursorTouched && desc.length > 0
       const insertStart = useAppend ? desc.length : start
       const insertEnd = useAppend ? desc.length : end
-      this.formValues.description = desc.slice(0, insertStart) + val + desc.slice(insertEnd)
-      this.descriptionCursor.start = this.descriptionCursor.end = insertStart + val.length
+      const insertValue = ` ${String(val).trim()} `
+      this.formValues.description = desc.slice(0, insertStart) + insertValue + desc.slice(insertEnd)
+      this.descriptionCursor.start = this.descriptionCursor.end = insertStart + insertValue.length
     },
     getValue () {
       if (!this.$refs.form.validate()) {