easybill-ui 1.0.26 → 1.0.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,7 +36,7 @@ const current = computed(() => {
36
36
  label: curs.map((a) => a.label).join(","),
37
37
  }
38
38
  }
39
- return (result && result.find((a) => a.value == props.value)) || {}
39
+ return (result && result.find((a) => a.value == props.value)) || { label: props.value }
40
40
  })
41
41
  const currentProps = computed(() => {
42
42
  const defaults = { type: "", label: "", value: "", style: {} } as OptionItem
@@ -322,13 +322,13 @@ const onMenuOption = (optionKey: MenuEventKey, val: string) => {
322
322
  }
323
323
  if (schema.formatter) {
324
324
  let result = schema.formatter(row, schema, val, i) as string
325
- if (/^[0-9\.,+-]+\.[0-9]{2}$/.test(String(result))) {
325
+ if (/^[0-9\.,+-]+\.[0-9]{2}$/.test(String(result)) && String(result).split(".").length < 3) {
326
326
  const resultNum = +parseFloat(String(result).replace(/,|$|¥/g, ""))
327
327
  return resultNum
328
328
  }
329
329
  return result === "--" ? "" : result
330
330
  }
331
- if (/^[0-9\.,+-]+\.[0-9]{2}$/.test(String(val))) {
331
+ if (/^[0-9\.,+-]+\.[0-9]{2}$/.test(String(val)) && String(val).split(".").length < 3) {
332
332
  val = +parseFloat(String(val).replace(/,|$|¥/g, ""))
333
333
  }
334
334
  return val
@@ -413,10 +413,7 @@ const startremove = (scope: any) => {
413
413
  await (props.fetchRemove && props.fetchRemove(scope.row, scope.$index)).finally(() => {
414
414
  loading.close()
415
415
  })
416
- ElMessage({
417
- type: "success",
418
- message: "删除成功",
419
- })
416
+ ElMessage({ type: "success", message: "删除成功" })
420
417
  })
421
418
  }
422
419
 
@@ -22,8 +22,7 @@
22
22
  </template>
23
23
  </template>
24
24
  <template v-if="!props.isSlot">
25
- <!-- <div v-if="props.schema.options">{{ ops }}</div> -->
26
- <ConstantStatus v-if="props.schema.options" :value="scope.row[props.schema.prop]" :options="ops" />
25
+ <ConstantStatus v-if="props.schema.options" :value="scope.row[props.schema.prop]" :options="props.schema.options" />
27
26
  <span v-else-if="props.schema.copy">
28
27
  <el-icon class="copy" title="点击复制" @click.stop="copyValue(getValue(scope))"><CopyDocument /></el-icon>
29
28
  <span v-if="props.schema.vHtml" v-html="getValue(scope)"></span>
@@ -38,7 +37,7 @@
38
37
  </el-table-column>
39
38
  </template>
40
39
  <script lang="ts" setup>
41
- import { computed, inject, PropType, ref, Ref, shallowRef } from "vue"
40
+ import { computed, inject, PropType, ref, Ref } from "vue"
42
41
  import ConstantStatus from "../../ConstantStatus"
43
42
  import STableItemFilter from "./STableItemFilter.vue"
44
43
  import STableItemHeader from "./STableItemHeader.vue"
@@ -52,7 +51,7 @@ const props = defineProps({
52
51
  schema: {
53
52
  type: Object as PropType<ColumnItem>,
54
53
  default() {
55
- return {}
54
+ return { options: [] }
56
55
  },
57
56
  },
58
57
  isSlot: {
@@ -68,7 +67,6 @@ const props = defineProps({
68
67
  default: () => ({}),
69
68
  },
70
69
  })
71
- const ops = shallowRef(props.schema.options)
72
70
  const selectParams = inject<Ref<Array<ParamsItem>>>("selectParams")
73
71
  const filterSchema = computed(() => {
74
72
  let result = selectParams?.value.filter((a) => a.prop == props.schema.filter?.prop || a.prop == props.schema.prop) //getFilterFromColumn(props.schema)
@@ -10,10 +10,10 @@
10
10
  </div>
11
11
  <template #footer>
12
12
  <span v-if="handleOk" class="dialog-footer">
13
- <el-button :disabled="confirmLoading" type="default" @click="onCancel()">取消</el-button>
13
+ <el-button v-if="cancelBtnText" :disabled="confirmLoading" type="default" @click="onCancel()">{{ cancelBtnText }}</el-button>
14
14
  <el-button v-if="stepSchemaList.length > 1 && step > 0" :disabled="confirmLoading" type="primary" plain @click="prev">上一步</el-button>
15
15
  <el-button v-if="stepSchemaList.length > 1 && step < stepSchemaList.length - 1" :disabled="confirmLoading" type="primary" plain @click="next">下一步</el-button>
16
- <el-button v-if="step >= stepSchemaList.length - 1" :disabled="confirmLoading" type="primary" :loading="confirmLoading" @click="onOk">确 定</el-button>
16
+ <el-button v-if="step >= stepSchemaList.length - 1" :disabled="confirmLoading" type="primary" :loading="confirmLoading" @click="onOk">{{ confirmBtnText }}</el-button>
17
17
  </span>
18
18
  </template>
19
19
  </el-dialog>
@@ -54,8 +54,13 @@ export default defineComponent({
54
54
  type: Function as PropType<(form: Fields) => void>,
55
55
  default: null,
56
56
  },
57
+ // 点击确定
57
58
  handleOk: {
58
- // 点击确定
59
+ type: Function,
60
+ default: null,
61
+ },
62
+ // 关闭的回调,通过类型判断是点取消按钮还是右上角关闭按钮
63
+ handleClose: {
59
64
  type: Function,
60
65
  default: null,
61
66
  },
@@ -67,6 +72,14 @@ export default defineComponent({
67
72
  type: Object,
68
73
  default: () => ({}),
69
74
  },
75
+ confirmBtnText: {
76
+ type: String,
77
+ default: "确 定",
78
+ },
79
+ cancelBtnText: {
80
+ type: String,
81
+ default: "取消",
82
+ },
70
83
  },
71
84
  setup(props) {
72
85
  const curdFormRef = ref()
@@ -109,12 +122,14 @@ export default defineComponent({
109
122
  }
110
123
  const onCancel = () => {
111
124
  state.visible = false
125
+ props.handleClose && props.handleClose("cancel")
112
126
  setTimeout(() => {
113
127
  props.remove && props.remove()
114
128
  }, 300)
115
129
  }
116
130
  const onBeforeClose = () => {
117
131
  state.visible = false
132
+ props.handleClose && props.handleClose("close")
118
133
  setTimeout(() => {
119
134
  props.remove && props.remove()
120
135
  }, 300)
@@ -9,7 +9,10 @@ export interface FormDialogOptions extends Partial<DialogProps> {
9
9
  stepSchema?: { name: string; description?: string; formSchema: FormSchema }[]
10
10
  formSchema?: FormSchema
11
11
  handleOk?: (modelRef: Fields) => Promise<void>
12
+ handleClose?: (e: "close" | "cancel") => void
12
13
  setForm?: (form: Fields) => void
13
14
  stepProps?: Partial<StepProps & Fields>
14
15
  extendContext?: FormContext
16
+ confirmBtnText?: string
17
+ cancelBtnText?: string
15
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easybill-ui",
3
- "version": "1.0.26",
3
+ "version": "1.0.29",
4
4
  "description": "A component library for easybill",
5
5
  "author": "tuchongyang <779311998@qq.com>",
6
6
  "private": false,
@@ -14,5 +14,5 @@
14
14
  "publishConfig": {
15
15
  "access": "public"
16
16
  },
17
- "gitHead": "6c4c6612c4b20a3e5819ef61f2f5624c48f50730"
17
+ "gitHead": "3e72af4edab56358ce12553bc965ced92e596706"
18
18
  }