fix: 修复typescript一些编译报错

This commit is contained in:
郝先瑞
2022-01-21 00:26:24 +08:00
parent 9e15f53869
commit bcade4177e
11 changed files with 36 additions and 29 deletions

View File

@@ -11,16 +11,16 @@
:limit="1" :limit="1"
:http-request="uploadImage" :http-request="uploadImage"
> >
<img v-if="imgUrl" :src="imgUrl" class="avatar"/> <img v-if="imgURL" :src="imgURL" class="avatar"/>
<el-icon v-else class="avatar-uploader-icon"> <el-icon v-else class="avatar-uploader-icon">
<Plus/> <Plus/>
</el-icon> </el-icon>
<el-icon <el-icon
v-if="imgUrl" v-if="imgURL"
class="remove-icon" class="remove-icon"
@click.stop="handleRemove(imgUrl)" @click.stop="handleRemove(imgURL)"
> >
<Close/> <Close/>
</el-icon> </el-icon>
@@ -53,7 +53,7 @@ const state = reactive({
previewDialogVisible: false, previewDialogVisible: false,
}) })
const imgUrl = computed({ const imgURL = computed<string>({
get() { get() {
return props.modelValue return props.modelValue
}, },
@@ -84,8 +84,8 @@ function handleBeforeUpload(file: any) {
function uploadImage(params: any) { function uploadImage(params: any) {
const file = params.file const file = params.file
uploadFile(file).then(response => { uploadFile(file).then(response => {
const imgUrl = response.data const imgURL = response.data
emit('update:modelValue', imgUrl) emit('update:modelValue', imgURL)
}) })
} }
@@ -93,8 +93,8 @@ function handleExceed(file: any) {
ElMessage.warning('最多只能上传' + props.maxCount) ElMessage.warning('最多只能上传' + props.maxCount)
} }
function handleRemove(imgUrl: string) { function handleRemove(imgURL: string) {
deleteFile(imgUrl) deleteFile(imgURL)
emit('update:modelValue', '') emit('update:modelValue', '')
} }
</script> </script>

View File

@@ -64,7 +64,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="单价" prop="skuPrice"> <el-table-column align="center" label="单价" prop="skuPrice">
<template slot-scope="scope">{{ scope.row.skuPrice | moneyFormatter }}</template> <template slot-scope="scope">{{ scope.row.skuPrice}}</template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="数量" prop="skuQuantity"> <el-table-column align="center" label="数量" prop="skuQuantity">
<template slot-scope="scope">{{ scope.row.skuQuantity }}</template> <template slot-scope="scope">{{ scope.row.skuQuantity }}</template>
@@ -197,8 +197,7 @@ const state = reactive({
skuPrice : undefined, skuPrice : undefined,
couponPrice: undefined, couponPrice: undefined,
freightPrice: undefined, freightPrice: undefined,
orderPrice : undefined, orderPrice : undefined
couponPrice: undefined,
}, },
member: {}, member: {},
orderItems: [] orderItems: []
@@ -208,7 +207,7 @@ const state = reactive({
payTypeMap payTypeMap
}) })
const {loading, single, multiple, queryParams, pageList, total, dialog, orderDetail} = toRefs(state) const {loading, single, multiple, queryParams, pageList, total, dialog,dateRange, orderDetail} = toRefs(state)
function handleQuery() { function handleQuery() {
state.loading = true state.loading = true

View File

@@ -155,7 +155,7 @@ const state = reactive({
queryParams: { queryParams: {
pageNum: 1, pageNum: 1,
pageSize: 10, pageSize: 10,
title: undefined name: undefined
}, },
pageList: [], pageList: [],
total: 0, total: 0,

View File

@@ -6,7 +6,7 @@
v-loading="loading" v-loading="loading"
ref="categoryTreeRef" ref="categoryTreeRef"
:data="categoryOptions" :data="categoryOptions"
:props="{ label: 'name', children: 'children' }" :props="{ label: 'name', children: 'children',disabled:'' }"
node-key="id" node-key="id"
:expand-on-click-node="false" :expand-on-click-node="false"
default-expand-all default-expand-all
@@ -145,8 +145,8 @@ const state = reactive({
title: '', title: '',
visible: false visible: false
}, },
parent: {}, parent: {} as any,
current: {} current: {} as any
}) })
const {loading, categoryOptions, formData, rules, dialog, parent} = toRefs(state) const {loading, categoryOptions, formData, rules, dialog, parent} = toRefs(state)

View File

@@ -60,11 +60,10 @@ const categoryRef = ref(ElCascaderPanel)
function handleCategoryChange() { function handleCategoryChange() {
const checkNode = categoryRef.value.getCheckedNodes()[0] const checkNode = categoryRef.value.getCheckedNodes()[0]
state.pathLabels = checkNode.pathLabels // 商品分类选择层级提示 state.pathLabels = checkNode.pathLabels // 商品分类选择层级提示
state.categoryId = checkNode.value props.modelValue.categoryId = checkNode.value
} }
function handleNext() { function handleNext() {
console.log('商品属性',props.modelValue.categoryId)
if (!props.modelValue.categoryId) { if (!props.modelValue.categoryId) {
ElMessage.warning('请选择商品分类') ElMessage.warning('请选择商品分类')
return false return false

View File

@@ -14,8 +14,8 @@
<el-form-item> <el-form-item>
<el-input <el-input
v-model="queryParams.name" v-model="queryParams.title"
placeholder="广告名称" placeholder="广告标题"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />

View File

@@ -185,7 +185,7 @@ const state = reactive({
// 表格树数据 // 表格树数据
deptList: [], deptList: [],
// 部门树选项 // 部门树选项
deptOptions: [], deptOptions: [] as Array<any>,
// 弹窗属性 // 弹窗属性
dialog: { dialog: {
title: '', title: '',

View File

@@ -168,7 +168,9 @@ const state = reactive({
name: undefined, name: undefined,
code: undefined, code: undefined,
status: undefined, status: undefined,
remark: undefined remark: undefined,
sort:undefined,
value:undefined
}, },
rules: { rules: {
name: [ name: [
@@ -263,7 +265,9 @@ function resetForm() {
name: undefined, name: undefined,
code: undefined, code: undefined,
status: undefined, status: undefined,
remark: undefined remark: undefined,
sort:undefined,
value:undefined
} }
} }

View File

@@ -206,7 +206,8 @@ const state = reactive({
icon: '', icon: '',
sort: 1, sort: 1,
component: 'Layout', component: 'Layout',
path: undefined path: undefined,
redirect:''
}, },
rules: { rules: {
parentId: [ parentId: [
@@ -356,7 +357,8 @@ function resetForm() {
icon: '', icon: '',
sort: 1, sort: 1,
component: 'Layout', component: 'Layout',
path: undefined path: undefined,
redirect:''
} }
} }

View File

@@ -8,7 +8,7 @@
:inline="true" :inline="true"
> >
<el-form-item> <el-form-item>
<el-button type="success" :icon="Plus" :disabled="state.disabled" @click="handleAdd">新增</el-button> <el-button type="success" :icon="Plus" :disabled="state.single" @click="handleAdd">新增</el-button>
<el-button type="danger" :icon="Delete" :disabled="state.multiple" @click="handleDelete">删除</el-button> <el-button type="danger" :icon="Delete" :disabled="state.multiple" @click="handleDelete">删除</el-button>
</el-form-item> </el-form-item>
<el-form-item> <el-form-item>
@@ -137,7 +137,7 @@
<script setup lang="ts"> <script setup lang="ts">
import {listPermsWithPage, getPermDetail, addPerm, updatePerm, deletePerms} from "@/api/system/perm" import {listPermsWithPage, getPermDetail, addPerm, updatePerm, deletePerms} from "@/api/system/perm"
import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons' import {Search, Plus, Edit, Refresh, Delete} from '@element-plus/icons'
import {onMounted, watch, reactive, ref, unref, getCurrentInstance} from 'vue' import {onMounted, watch, reactive, ref, unref, getCurrentInstance, toRefs} from 'vue'
import {ElForm, ElMessage, ElMessageBox} from "element-plus" import {ElForm, ElMessage, ElMessageBox} from "element-plus"
const {proxy}: any = getCurrentInstance(); const {proxy}: any = getCurrentInstance();
@@ -197,7 +197,7 @@ const state = reactive({
] ]
}, },
microServiceOptions: [], microServiceOptions: [],
requestMethodOptions: [], requestMethodOptions: [] as Array<any>,
menuName: undefined, menuName: undefined,
urlPerm: { urlPerm: {
requestMethod: undefined, requestMethod: undefined,
@@ -206,6 +206,9 @@ const state = reactive({
}, },
}) })
toRefs(state)
function handleQuery() { function handleQuery() {
if (state.queryParams.menuId) { if (state.queryParams.menuId) {
state.loading = true state.loading = true

View File

@@ -17,7 +17,7 @@
<el-tree <el-tree
ref="deptTreeRef" ref="deptTreeRef"
:data="deptOptions" :data="deptOptions"
:props="{ children: 'children',label: 'label'}" :props="{ children: 'children',label: 'label',disabled:''}"
:expand-on-click-node="false" :expand-on-click-node="false"
:filter-node-method="filterDeptNode" :filter-node-method="filterDeptNode"
default-expand-all default-expand-all