|
|
@@ -110,10 +110,10 @@
|
|
|
shape="dot"
|
|
|
inline>
|
|
|
<wd-radio value="all">所有页</wd-radio>
|
|
|
- <wd-radio v-if="fileList.length == 1" value="range">输入范围</wd-radio>
|
|
|
+ <wd-radio v-if="fileList.length == 1 && !isImg()" value="range">输入范围</wd-radio>
|
|
|
</wd-radio-group>
|
|
|
- <!-- 2. 当上传单个文件且radio选择 range 时允许输入范围, 从 XXX 到 XXX) -->
|
|
|
- <view v-if="formData[option.key] == 'range'" style="text-align: left; margin-top: 10px">
|
|
|
+ <!-- 2. 当上传单个文件(非图片)且radio选择 range 时允许输入范围, 从 XXX 到 XXX) -->
|
|
|
+ <view v-if="!isImg() && formData[option.key] == 'range'" style="text-align: left; margin-top: 10px">
|
|
|
<view class="inline-txt" style="margin-left: 0">从</view>
|
|
|
<wd-input
|
|
|
custom-style="display: inline-block; width: 70px; vertical-align: middle"
|
|
|
@@ -268,6 +268,7 @@ function getPrinterList() {
|
|
|
getUserHubPrints(params)
|
|
|
.then((res: any) => {
|
|
|
if (res.code === 0 && res.body) {
|
|
|
+ // printerList.value = res.body && res.body.length > 0 ? res.body.filter(i => i['printer-type'] == 'normal' ) : []
|
|
|
printerList.value = res.body || []
|
|
|
printerList.value.forEach(item => {
|
|
|
item.showName = `${item.name} (${item.userHubName})`
|
|
|
@@ -490,6 +491,11 @@ function selectFile() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// 判断是否选图片, 或者选一个文件 并且图片类型 ['png', 'jpg', 'jpeg', 'gif', 'webp']
|
|
|
+function isImg() {
|
|
|
+ return accept.value == "image" || (fileList.value.length == 1 && ['png', 'jpg', 'jpeg', 'gif', 'webp'].includes(getFileType(fileList.value[0].name)))
|
|
|
+}
|
|
|
+
|
|
|
// 处理文件列表增减
|
|
|
function handleFileListChange() {
|
|
|
// 处理打印选项参数
|
|
|
@@ -526,7 +532,7 @@ function downloadFile(fileName, fileUrl) {
|
|
|
// 预览文件 (区分文件&图片)
|
|
|
function previewFile(fileName, filePath) {
|
|
|
let fileType = getFileType(fileName)
|
|
|
- if (['png', 'jpg', 'jpeg', 'webp'].includes(fileType)) {
|
|
|
+ if (['png', 'jpg', 'jpeg', 'gif', 'webp'].includes(fileType)) {
|
|
|
// 图片预览
|
|
|
let imgUrl = filePath
|
|
|
uni.previewImage({
|
|
|
@@ -710,12 +716,36 @@ function handleSubmit() {
|
|
|
toast.warning('请先上传文件')
|
|
|
return
|
|
|
}
|
|
|
- // 校验打印机属性 范围最小最小 option.min option.max
|
|
|
- // for (let item of printerOptions.value) {
|
|
|
- // if (item.type == 'rang') {
|
|
|
- // if ()
|
|
|
- // }
|
|
|
- // }
|
|
|
+ // 校验打印机属性 范围最小最大 item.min item.max
|
|
|
+ for (let item of printerOptions.value) {
|
|
|
+ if (item.type == 'rang' && formData.value[item.key] == "range") {
|
|
|
+ let strValue = formData.value[item.key + "_str"]
|
|
|
+ let endValue = formData.value[item.key + "_end"]
|
|
|
+ if (!strValue) {
|
|
|
+ toast.warning(`请输入${item.text}起始页`)
|
|
|
+ return
|
|
|
+ } else if (item.min && strValue < item.min) {
|
|
|
+ toast.warning(`${item.text} 起始页的最小值为${item.min}`)
|
|
|
+ return
|
|
|
+ } else if (item.max && strValue > item.max) {
|
|
|
+ toast.warning(`${item.text} 起始页的最大值为${item.max}`)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if (!endValue) {
|
|
|
+ toast.warning(`请输入${item.text}结束页`)
|
|
|
+ return
|
|
|
+ } else if (item.min && endValue < item.min) {
|
|
|
+ toast.warning(`${item.text} 结束页的最小值为${item.min}`)
|
|
|
+ return
|
|
|
+ } else if (item.max && endValue > item.max) {
|
|
|
+ toast.warning(`${item.text} 结束页的最大值为${item.max}`)
|
|
|
+ return
|
|
|
+ } else if (strValue && endValue < strValue) {
|
|
|
+ toast.warning(`${item.text} 结束页不能小于起始页`)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
form.value.validate().then(({ valid }) => {
|
|
|
if (valid) {
|
|
|
// 不区分单个/批量, 以批量打印处理
|