@zscreate/zhxy-app-component 1.0.342 → 1.0.344
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.
|
@@ -51,9 +51,11 @@
|
|
|
51
51
|
<view class="option-font-size" v-if="widget.options.defaultValue.length === 0">暂无模板</view>
|
|
52
52
|
</view>
|
|
53
53
|
<view class="evan-form-item-container__main download_moban" style="display: flex" :style="mContentStyle" v-else>
|
|
54
|
+
<!-- #ifdef H5 -->
|
|
54
55
|
<view class="download_item" @click.prevent.native="uploadFileQYS" style="margin-right: 10px;color: #007AFF;">
|
|
55
56
|
文件下载
|
|
56
57
|
</view>
|
|
58
|
+
<!-- #endif -->
|
|
57
59
|
<view class="download_item" @click.prevent.native="uploadFileQYS('perview')" style="margin-right: 20px;color: #007AFF;">
|
|
58
60
|
预览
|
|
59
61
|
</view>
|
|
@@ -1507,92 +1509,143 @@ export default {
|
|
|
1507
1509
|
},
|
|
1508
1510
|
// 锲约锁模版下载
|
|
1509
1511
|
uploadFileQYS(type) {
|
|
1510
|
-
if(this.widget.options.disabled) return
|
|
1511
|
-
if (type ===
|
|
1512
|
+
if (this.widget.options.disabled) return;
|
|
1513
|
+
if (type === "perview") {
|
|
1512
1514
|
if (!this.dataObj().config.applyId) {
|
|
1513
1515
|
uni.showToast({
|
|
1514
|
-
title:
|
|
1516
|
+
title: "当前状态不支持文件预览",
|
|
1515
1517
|
icon: "none",
|
|
1516
1518
|
duration: 1500,
|
|
1517
|
-
})
|
|
1518
|
-
return
|
|
1519
|
+
});
|
|
1520
|
+
return;
|
|
1519
1521
|
}
|
|
1520
|
-
this.$u
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1522
|
+
this.$u
|
|
1523
|
+
.get("/form/qiyuesuo/viewQiyuesuoDoc", {
|
|
1524
|
+
applyId: this.dataObj().config.applyId,
|
|
1525
|
+
})
|
|
1526
|
+
.then((res) => {
|
|
1527
|
+
if (res.success && res.result) {
|
|
1528
|
+
// #ifdef H5
|
|
1529
|
+
window.open(res.result, "_blank");
|
|
1530
|
+
// #endif
|
|
1531
|
+
// #ifdef MP
|
|
1532
|
+
// uni.setClipboardData({
|
|
1533
|
+
// data: res.result,
|
|
1534
|
+
// success: () =>
|
|
1535
|
+
// uni.showToast({
|
|
1536
|
+
// title: '链接已复制,请通过浏览器预览'
|
|
1537
|
+
// })
|
|
1538
|
+
// });
|
|
1539
|
+
this.$u.http
|
|
1540
|
+
.request({
|
|
1541
|
+
url: "/form/qiyuesuo/download",
|
|
1542
|
+
method: "GET",
|
|
1543
|
+
header: {},
|
|
1544
|
+
responseType: "arraybuffer",
|
|
1545
|
+
dataType: "binary",
|
|
1546
|
+
originalData: true,
|
|
1547
|
+
data: { applyId: this.dataObj().config.applyId },
|
|
1548
|
+
})
|
|
1549
|
+
.then((res) => {
|
|
1550
|
+
let data = res.data;
|
|
1551
|
+
if (data instanceof String) {
|
|
1552
|
+
console.log(data);
|
|
1553
|
+
uni.showToast({
|
|
1554
|
+
title: "导出失败!",
|
|
1555
|
+
icon: "none",
|
|
1556
|
+
duration: 1500,
|
|
1557
|
+
});
|
|
1558
|
+
return;
|
|
1559
|
+
}
|
|
1560
|
+
const fs = uni.getFileSystemManager(); //全局唯一的文件管理器
|
|
1561
|
+
const filePath =
|
|
1562
|
+
wx.env.USER_DATA_PATH +
|
|
1563
|
+
`/${this.dataObj().config.formName || "文件下载"}.pdf`;
|
|
1564
|
+
fs.writeFile({
|
|
1565
|
+
filePath, //这里填文件的名字
|
|
1566
|
+
data,
|
|
1567
|
+
encoding: "binary",
|
|
1568
|
+
success(res) {
|
|
1569
|
+
uni.openDocument({
|
|
1570
|
+
showMenu: true,
|
|
1571
|
+
filePath,
|
|
1572
|
+
success: function (res) {
|
|
1573
|
+
console.log("打开文档成功");
|
|
1574
|
+
},
|
|
1575
|
+
});
|
|
1576
|
+
},
|
|
1577
|
+
});
|
|
1578
|
+
});
|
|
1579
|
+
// #endif
|
|
1580
|
+
} else {
|
|
1581
|
+
this.$message.warning(res.message);
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1538
1584
|
} else {
|
|
1539
1585
|
if (!this.dataObj().config.applyId) {
|
|
1540
1586
|
uni.showToast({
|
|
1541
|
-
title:
|
|
1587
|
+
title: "当前状态不支持文件下载",
|
|
1542
1588
|
icon: "none",
|
|
1543
1589
|
duration: 1500,
|
|
1544
|
-
})
|
|
1545
|
-
return
|
|
1590
|
+
});
|
|
1591
|
+
return;
|
|
1546
1592
|
}
|
|
1547
|
-
this.$u.http
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
}
|
|
1566
|
-
//#ifdef MP
|
|
1567
|
-
const fs = uni.getFileSystemManager(); //全局唯一的文件管理器
|
|
1568
|
-
const filePath = wx.env.USER_DATA_PATH + `/${(this.dataObj().config.formName || '文件下载')}.pdf`
|
|
1569
|
-
fs.writeFile({
|
|
1570
|
-
filePath, //这里填文件的名字
|
|
1571
|
-
data,
|
|
1572
|
-
encoding: "binary",
|
|
1573
|
-
success(res) {
|
|
1574
|
-
uni.openDocument({
|
|
1575
|
-
showMenu: true,
|
|
1576
|
-
filePath,
|
|
1577
|
-
success: function (res) {
|
|
1578
|
-
console.log('打开文档成功');
|
|
1579
|
-
}
|
|
1593
|
+
this.$u.http
|
|
1594
|
+
.request({
|
|
1595
|
+
url: "/form/qiyuesuo/download",
|
|
1596
|
+
method: "GET",
|
|
1597
|
+
header: {},
|
|
1598
|
+
responseType: "arraybuffer",
|
|
1599
|
+
dataType: "binary",
|
|
1600
|
+
originalData: true,
|
|
1601
|
+
data: { applyId: this.dataObj().config.applyId },
|
|
1602
|
+
})
|
|
1603
|
+
.then((res) => {
|
|
1604
|
+
let data = res.data;
|
|
1605
|
+
if (data instanceof String) {
|
|
1606
|
+
console.log(data);
|
|
1607
|
+
uni.showToast({
|
|
1608
|
+
title: "导出失败!",
|
|
1609
|
+
icon: "none",
|
|
1610
|
+
duration: 1500,
|
|
1580
1611
|
});
|
|
1612
|
+
return;
|
|
1581
1613
|
}
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1614
|
+
//#ifdef MP
|
|
1615
|
+
const fs = uni.getFileSystemManager(); //全局唯一的文件管理器
|
|
1616
|
+
const filePath =
|
|
1617
|
+
wx.env.USER_DATA_PATH +
|
|
1618
|
+
`/${this.dataObj().config.formName || "文件下载"}.pdf`;
|
|
1619
|
+
fs.writeFile({
|
|
1620
|
+
filePath, //这里填文件的名字
|
|
1621
|
+
data,
|
|
1622
|
+
encoding: "binary",
|
|
1623
|
+
success(res) {
|
|
1624
|
+
uni.openDocument({
|
|
1625
|
+
showMenu: true,
|
|
1626
|
+
filePath,
|
|
1627
|
+
success: function (res) {
|
|
1628
|
+
console.log("打开文档成功");
|
|
1629
|
+
},
|
|
1630
|
+
});
|
|
1631
|
+
},
|
|
1632
|
+
});
|
|
1633
|
+
//#endif
|
|
1634
|
+
//#ifdef H5
|
|
1635
|
+
let url = window.URL.createObjectURL(new Blob([data]));
|
|
1636
|
+
let link = document.createElement("a");
|
|
1637
|
+
link.style.display = "none";
|
|
1638
|
+
link.href = url;
|
|
1639
|
+
link.setAttribute(
|
|
1640
|
+
"download",
|
|
1641
|
+
(this.dataObj().config.formName || "文件下载") + ".pdf"
|
|
1642
|
+
);
|
|
1643
|
+
document.body.appendChild(link);
|
|
1644
|
+
link.click();
|
|
1645
|
+
document.body.removeChild(link); //下载完成移除元素
|
|
1646
|
+
window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
1647
|
+
//#endif
|
|
1648
|
+
});
|
|
1596
1649
|
}
|
|
1597
1650
|
},
|
|
1598
1651
|
/**纠错**/
|
|
@@ -2110,8 +2163,14 @@ export default {
|
|
|
2110
2163
|
let departId = -1
|
|
2111
2164
|
let departName = ""
|
|
2112
2165
|
if (this.widget.options.departRelation) {
|
|
2113
|
-
|
|
2114
|
-
|
|
2166
|
+
let userInfo = uni.getStorageSync('userinfo')
|
|
2167
|
+
if (typeof userinfo === 'string') {
|
|
2168
|
+
try {
|
|
2169
|
+
userinfo = JSON.parse(userinfo);
|
|
2170
|
+
} catch (e) {
|
|
2171
|
+
userinfo = {};
|
|
2172
|
+
}
|
|
2173
|
+
}
|
|
2115
2174
|
departId = this.widget.options.departId || userInfo.departId || userInfo.depart_id
|
|
2116
2175
|
departName = this.widget.options.departName || userInfo.departName || userInfo.depart_name
|
|
2117
2176
|
}
|