const defaultOptions = { | const defaultOptions = { | ||||
url: url, | url: url, | ||||
method: "get", | method: "get", | ||||
params: data, | |||||
params: data | |||||
} | } | ||||
//合并用户配置参数信息 | //合并用户配置参数信息 | ||||
options = mergeOptions(defaultOptions, options); | |||||
options = Object.assign(defaultOptions, options) | |||||
return common(options) | return common(options) | ||||
} | } | ||||
params: data, | params: data, | ||||
} | } | ||||
//合并用户配置参数信息 | //合并用户配置参数信息 | ||||
options = mergeOptions(defaultOptions, options); | |||||
options = Object.assign(defaultOptions, options); | |||||
return common(options) | return common(options) | ||||
} | } | ||||
function uploadFile(file) { | |||||
// if ((objfile.size / 1024 / 1024) > 0) { | |||||
// console.log("文件不能大于1MB"); | |||||
// return false; | |||||
// } | |||||
// console.log(this.$refs.upload.files[0]); | |||||
// if (objfile.type != "image/jpeg" || objfile.type != "image/png") { | |||||
// console.log("文件只能是jpg或者png格式"); | |||||
// return false; | |||||
// } | |||||
var formData = new FormData(); | |||||
formData.append('file', file); | |||||
return formData; | |||||
} |
table: { | table: { | ||||
style: '', | style: '', | ||||
customDialog: true, //自定义Dialog (默认false) | customDialog: true, //自定义Dialog (默认false) | ||||
footerDialog: true, | |||||
footerDialog: true, //是否隐藏Dialog页脚 | |||||
extend: [{ | extend: [{ | ||||
type: 'index', | type: 'index', | ||||
label: '序号', | label: '序号', | ||||
}], | }], | ||||
field: [ //表格 | field: [ //表格 | ||||
{ | { | ||||
prop: 'one', | |||||
prop: 'userName', | |||||
label: '客户名称', | label: '客户名称', | ||||
width: '120', | width: '120', | ||||
overflow: true, | overflow: true, | ||||
placeholder: '请输入车牌颜色' | placeholder: '请输入车牌颜色' | ||||
} | } | ||||
}, { | }, { | ||||
prop: 'four', | |||||
prop: 'cardId', | |||||
label: '卡号', | label: '卡号', | ||||
width: '200', | width: '200', | ||||
form: { | form: { | ||||
placeholder: '卡号' | placeholder: '卡号' | ||||
} | } | ||||
}, { | }, { | ||||
prop: 'five', | |||||
prop: 'cardStatus', | |||||
label: '卡片状态', | label: '卡片状态', | ||||
width: '120', | width: '120', | ||||
form: { | form: { | ||||
type: 'input', | type: 'input', | ||||
placeholder: '请输入卡片类型' | placeholder: '请输入卡片类型' | ||||
} | } | ||||
},{ | |||||
prop: 'seven', | |||||
}, { | |||||
prop: 'obuId', | |||||
label: 'OBU编号', | label: 'OBU编号', | ||||
width: '200', | width: '200', | ||||
form: { | form: { | ||||
placeholder: 'OBU编号' | placeholder: 'OBU编号' | ||||
} | } | ||||
}, { | }, { | ||||
prop: 'eight', | |||||
prop: 'obuStatus', | |||||
label: 'OBU状态', | label: 'OBU状态', | ||||
width: '120', | width: '120', | ||||
form: { | form: { |
function closeTabs() { | function closeTabs() { | ||||
if (data.indexes !== -1) { | if (data.indexes !== -1) { | ||||
nextTick(() => { | nextTick(() => { | ||||
const tabs = editableTabs.value | |||||
$storeTab.dispatch('removeTab', data.indexes) | $storeTab.dispatch('removeTab', data.indexes) | ||||
const tabDatas = editableTabs.value[editableTabs.value.length - 1] | const tabDatas = editableTabs.value[editableTabs.value.length - 1] | ||||
sessionStorage.setItem('newTab', JSON.stringify(tabDatas)) | sessionStorage.setItem('newTab', JSON.stringify(tabDatas)) | ||||
router.replace({name: tabs[editableTabs.value.length - 1].path}) | |||||
}) | }) | ||||
} | } | ||||
} | } |
<el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> | <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value" /> | ||||
</el-select> | </el-select> | ||||
</template> | </template> | ||||
<!-- 自定义编辑提交按钮 --> | <!-- 自定义编辑提交按钮 --> | ||||
<template #operation="{ scope , tableFrom}"> | |||||
<template #operation="{ scope , tableFrom }"> | |||||
<el-button size="small" @click="reissue(scope,tableFrom)">补卡</el-button> | <el-button size="small" @click="reissue(scope,tableFrom)">补卡</el-button> | ||||
</template> | </template> | ||||
<!-- 自定义弹框内容 --> | <!-- 自定义弹框内容 --> | ||||
ref, | ref, | ||||
reactive | reactive | ||||
} from 'vue' | } from 'vue' | ||||
import { | |||||
useRequest | |||||
} from 'vue-request'; | |||||
import axios from 'axios'; | |||||
import { | |||||
getCurrentInstance | |||||
} from 'vue' | |||||
const { | |||||
proxy | |||||
} = getCurrentInstance(); | |||||
proxy.$request.get('api/user', {}, { | |||||
baseURL: 'http://192.168.1.101:8080' | |||||
}).then((res) => { | |||||
console.log(res); | |||||
}).catch((err) => { | |||||
console.log(err); | |||||
}) | |||||
const datas = reactive(Data); | const datas = reactive(Data); | ||||
const crudRef = ref() | const crudRef = ref() |
<template> | <template> | ||||
<!-- <CRUD @add="add"></CRUD> --> | |||||
</template> | |||||
<!-- accept 限制上传文件格式 .text--> | |||||
<el-upload ref="uploadRef" class="upload-demo" action="https://jsonplaceholder.typicode.com/posts/" | |||||
on-progress="progress" :auto-upload="false"> | |||||
<template #trigger> | |||||
<el-button type="primary">select file</el-button> | |||||
</template> | |||||
<el-button class="ml-3" type="success" @click="submitUpload"> | |||||
upload to server | |||||
</el-button> | |||||
<template #tip> | |||||
<div class="el-upload__tip"> | |||||
jpg/png files with a size less than 500kb | |||||
</div> | |||||
</template> | |||||
</el-upload> | |||||
</template> | |||||
<script lang="ts" setup> | <script lang="ts" setup> | ||||
import CRUD from "@/crud/index.vue"; | |||||
import { | |||||
ref | |||||
} from 'vue' | |||||
const uploadRef = ref() | |||||
const submitUpload = () => { | |||||
uploadRef.value.submit() | |||||
} | |||||
function add() {} | |||||
const progress = (evt, uploadFile, uploadFiles) => { | |||||
console.log(evt, uploadFile, uploadFiles); | |||||
} | |||||
</script> | </script> |
}, | }, | ||||
"types": ["element-plus/global"] //指定全局组件类型 | "types": ["element-plus/global"] //指定全局组件类型 | ||||
}, | }, | ||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"] | |||||
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue", "src/api/system/commonApi.js"] | |||||
} | } |