让企业管理更智慧、更快捷

Skip to content
源代码提交(7)
{
"name": "@package/lwc-ui-components",
"version": "0.1.34",
"version": "0.1.35",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
{
"name": "@package/lwc-ui-components",
"version": "0.1.34",
"version": "0.1.35",
"private": false,
"license": "UNLICENSED",
"scripts": {
......
......@@ -205,7 +205,7 @@ if (typeof window !== 'undefined' && window.Vue) {
}
export default {
version: '0.1.33',
version: '0.1.34',
install,
LwcBasicButton,
LwcBasicButtonIcon,
......
......@@ -8,6 +8,19 @@
`新特性`
`非兼容性更新`
---
### **v0.1.35 20210728**
#### 新增
- 新增 `lwc-upload-file` 按钮 `btnConfig` 显示隐藏按钮
#### Bug修复
- 修复 `lwc-upload-image` type=action 时数据回调问题
- 修复 `select` 组件 `value` 值为空时需点击两次展开下拉问题
- 修复 `lwc-upload-file` 组件文件为链接时下载文件错误
---
### **v0.1.34 20210722**
......
......@@ -53,7 +53,7 @@ let data = [
export const Default = Template.bind({});
Default.storyName = "Object单选";
Default.args = {
value: { id: 5, username: "用户5" },
value: {},
optionProps: {
id: "id",
name: "username",
......
......@@ -365,7 +365,7 @@ export default {
},
mounted() {
this.$watch('value', function(val){
if((typeof val === 'object' && !_.isEmpty(val)) || val) {
if((typeof val === 'object' && !_.isEmpty(val)) || (typeof val !== 'object' && val)) {
if(this.type === "obj") {
this.selectList = []
this.selectValue = this.multiple ? val.map(v => { return v[this.optionProps["id"]] }) : val[this.optionProps["id"]]
......
......@@ -47,7 +47,7 @@ let data = [
export const Default = Template.bind({});
Default.storyName = "Object单选"
Default.args = {
value: { id: 5, username: "用户5" },
value: {},
optionProps: {
id: "id",
name: "username"
......
......@@ -340,7 +340,7 @@ export default {
},
mounted() {
this.$watch('value', function(val){
if((typeof val === 'object' && !_.isEmpty(val)) || val) {
if((typeof val === 'object' && !_.isEmpty(val)) || (typeof val !== 'object' && val)) {
if(this.type === "obj") {
this.selectList = []
this.selectValue = this.multiple ? val.map(v => { return v[this.optionProps["id"]] }) : val[this.optionProps["id"]]
......
......@@ -28,7 +28,8 @@ const Template = (args, { argTypes }) => ({
return {
type: v.fileIndex,
name: v.fileName,
file: v.fileIndex !== 'pdf' ? image : test
// file: v.fileIndex !== 'pdf' ? image : test
file: "http://211.149.204.108:17002/leadwaycloud-oss/oss/file/preview/574533689957248/589747151982167?imageView2/1/w/80/h/80"
}
})
resolve(current)
......@@ -255,5 +256,27 @@ Default.args = {
rowKey: "id",
operColumn: {
align: "center"
},
showNote: false,
uploadConfig: {
type: "action",
path: "http://211.149.204.108:17002/leadwaycloud-oss/oss/file/preview",
action: "http://211.149.204.108:17002/leadwaycloud-oss/oss/file/upload",
accept: "image/*",
name: "file",
isZimg: false,
data:{ "merchantId":"system" },
listType: "text",
listConfig: {
tipText: "支持格式:.rar .zip .doc .docx .pdf ,单个文件不能超过20MB"
}
},
btnConfig: {
toolbar: {
delete: false
},
column: {
download: true
}
}
};
......@@ -28,6 +28,8 @@ function renderTableColumn(h, _vm) {
}
function renderOperColumn(h, _vm) {
const { column = {} } = _vm.btnConfig
const { preview = true, delete: del = true, download = true } = column
return h("el-table-column", {
props: {
width: "130px",
......@@ -37,7 +39,7 @@ function renderOperColumn(h, _vm) {
scopedSlots: {
default: ({ row }) => {
return [
h('el-button', {
preview ? h('el-button', {
props: {
size: "mini",
type: "text"
......@@ -48,8 +50,8 @@ function renderOperColumn(h, _vm) {
_vm.previewFile(row)
}
}
}, "预览"),
h('el-button', {
}, "预览") : null,
download ? h('el-button', {
props: {
size: "mini",
type: "text"
......@@ -60,8 +62,8 @@ function renderOperColumn(h, _vm) {
_vm.downFile("row", row)
}
}
}, "下载"),
h('el-button', {
}, "下载") : null,
del ? h('el-button', {
props: {
size: "mini",
type: "text"
......@@ -72,7 +74,7 @@ function renderOperColumn(h, _vm) {
_vm.deleteFile("row", row)
}
}
}, "删除")
}, "删除") : null
]
}
}
......@@ -163,13 +165,22 @@ function renderAddFile(h, _vm) {
..._vm.uploadConfig
},
on: {
// type=api返回
"change": (val) => {
_vm.fileForm.file.push(val)
_vm.fileForm.fileList.push(val)
},
// type=action/base64返回
"update:value": (val) => {
_vm.fileForm.filePathList.push(val)
},
// type=action返回
"upload": (val) => {
_vm.fileForm.fileList.push(JSON.parse(val))
}
}
})
]),
h("el-form-item", {
_vm.showNote ? h("el-form-item", {
props: {
label: "备注信息"
}
......@@ -187,7 +198,7 @@ function renderAddFile(h, _vm) {
}
}
})
])
]) : null
]),
h("div", {
class: 'text-right'
......@@ -255,6 +266,29 @@ export default {
return {}
}
},
showNote: {
type: Boolean,
default: function() {
return true
}
},
btnConfig: {
type: Object,
default: function() {
return {
toolbar: {
add: true,
delete: true,
download: true,
},
column: {
delete: true,
download: true,
preview: true
}
}
}
}
},
data() {
return {
......@@ -267,7 +301,8 @@ export default {
tableLoading: false,
checkedList: [],
fileForm: {
file: [],
filePathList: [],
fileList: [],
note: ""
},
search: null
......@@ -303,9 +338,12 @@ export default {
self.tableLoading = true
onPreview(type === "checked" ? self.checkedList : [file]).then(data => {
self.tableLoading = false
data.forEach(res => {
data.forEach(async (res) => {
let responsePromise = await fetch(res.file)
let blob = await responsePromise.blob()
let objectURL = window.URL.createObjectURL(blob)
let link = document.createElement('a');
link.href = res.file
link.href = objectURL
link.download = res.name;
link.click();
});
......@@ -332,6 +370,8 @@ export default {
}
},
render(h) {
const { toolbar = {} } = this.btnConfig
const { add = true, delete: del = true, download = true } = toolbar
return h('div',{
directives: [{
name: "loading",
......@@ -339,21 +379,22 @@ export default {
}]
},[
h("div", {
class: "text-right mb-3"
class: "mb-3"
}, [
h('el-button', {
add ? h('el-button', {
props: {
size: "small"
},
on: {
click: () => {
this.addFileDialog = true
this.$set(this.fileForm, "file", [])
this.$set(this.fileForm, "filePathList", [])
this.$set(this.fileForm, "fileList", [])
this.$set(this.fileForm, "note", null)
}
}
}, "新增"),
h('el-button', {
}, "新增") : null,
download ? h('el-button', {
props: {
size: "small"
},
......@@ -362,8 +403,8 @@ export default {
this.downFile("checked")
}
}
}, "下载"),
h('el-button', {
}, "下载") : null,
del ? h('el-button', {
props: {
size: "small"
},
......@@ -372,7 +413,7 @@ export default {
this.deleteFile("checked")
}
}
}, "删除")
}, "删除") : null
]),
h('el-table', {
class: "w-full",
......
......@@ -22,7 +22,10 @@ export default {
headers: { type: "object", description: "设置上传的请求头部" },
listType: { type: "string", description: "列表类型 可选参数:picture-图片类型 text-按钮文字类型 custom-不显示 默认picture", control: { type: "select", options: ["picture", "text", "custom"] } },
listConfig: { type: "object", description: "对象参数 btnType - 按钮类型 btnText - 按钮文字 tipText - 说明文字" },
customRender: { type: "object", description: "listType为custom可配置自定义组件" }
customRender: { type: "object", description: "listType为custom可配置自定义组件" },
upload: { type: "function", description: "type=action的emit" },
"update:value": { type: "function", description: "type=action/base64的emit" },
change: { type: "function", description: "type=api的emit" },
},
decorators: [() => ({ template: '<el-col class="bg-white p-4"><story/></el-col>' })]
};
......