Bladeren bron

优化打印任务列表

“shengjie.huang” 1 jaar geleden
bovenliggende
commit
9d3a01710d

+ 14 - 0
src/pages.json

@@ -89,6 +89,20 @@
         "navigationBarTitleText": "远程打印"
       }
     },
+    {
+      "path": "pages/print/job",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "打印任务列表"
+      }
+    },
+    {
+      "path": "pages/print/jobDetail",
+      "type": "page",
+      "style": {
+        "navigationBarTitleText": "打印任务详情"
+      }
+    },
     {
       "path": "pages/printer/index",
       "type": "page",

+ 4 - 3
src/pages/assistant/detail.vue

@@ -40,7 +40,7 @@
           :readonly="type == 'view'"
           :rules="[{ required: true, message: '请填写设备名称' }]"
         />
-        <wd-select-picker
+        <!-- <wd-select-picker
           v-model="formData.addType"
           label="添加方式"
           label-width="100px"
@@ -52,8 +52,9 @@
           :max="1"
           :show-confirm="false"
           :rules="[{ required: true, message: '请选择添加方式' }]"
-        />
-        <wd-cell 
+        /> -->
+        <wd-cell
+          v-if="type != 'add'"
           title="设备状态"
           title-width="100px"
           :value="getLabel(formData.enabled, statusList)"

+ 5 - 5
src/pages/index/index.vue

@@ -28,12 +28,12 @@
       ></wd-swiper>
       <!-- 功能区 -->
       <view class="guide-box shadow-class">
-        <view class="guide-item" @click="toUserHub()">
+        <view class="guide-item" @click="toUserHub('')">
           <wd-img :src="deviceImgSrc" width="100" mode="widthFix"></wd-img>
           <view class="item-title">打印助手</view>
           <view class="item-desc">我的打印助手</view>
         </view>
-        <view class="guide-item" @click="toPrint()">
+        <view class="guide-item" @click="toPrint('all')">
           <wd-img :src="fileImgSrc" width="100" mode="widthFix"></wd-img>
           <view class="item-title">远程打印</view>
           <view class="item-desc">无需驱动 隔空打印</view>
@@ -48,7 +48,7 @@
               <view class="title-text">设备配网</view>
             </view>
           </view>
-          <view class="item" @click="developing()">
+          <view class="item" @click="toPrint('image')">
             <view class="title">
               <wd-img :src="pictureSrc" width="40" mode="widthFix"></wd-img>
               <view class="title-text">相册图片</view>
@@ -142,10 +142,10 @@ function toUserHub() {
   }
 }
 
-function toPrint() {
+function toPrint(accept) {
   if (isLogined.value) {
     uni.navigateTo({
-      url: `/pages/print/index`,
+      url: `/pages/print/index?accept=${accept}`,
     })
   } else {
     toast.warning('请先前往登录')

+ 15 - 0
src/pages/personal/index.vue

@@ -25,6 +25,10 @@
         <view>添加打印助手</view>
         <wd-icon name="arrow-right" size="20px" color="#808080"></wd-icon>
       </view>
+      <view class="content-item line-b" @click="toJob">
+        <view>查看打印任务</view>
+        <wd-icon name="arrow-right" size="20px" color="#808080"></wd-icon>
+      </view>
       <view v-if="isLogined" class="content-item" @click="handleLogout">
         <view>退出登录</view>
         <wd-icon name="arrow-right" size="20px" color="#808080"></wd-icon>
@@ -63,6 +67,17 @@ function toAddUserHub() {
   }
 }
 
+function toJob() {
+  if (isLogined.value) {
+    uni.navigateTo({
+      url: `/pages/print/job`,
+    })
+  } else {
+    toast.warning('请先前往登录')
+    toLogin(1500)
+  }
+}
+
 function handleLogout() {
   // logout().then((res) => {
   //   if (res.code === 0) {

+ 10 - 6
src/pages/print/index.vue

@@ -13,14 +13,14 @@
     <wd-form ref="form" :model="formData">
       <!-- :rules=rules -->
       <wd-cell-group custom-class="form-group" border>
-        <wd-cell title="上传文件"
+        <wd-cell :title="`上传${accept == 'image' ? '图片' : '文件'}`"
                  title-width="100px"
                  required
                  prop="fileList">
           <!-- :rules="[{ required: true, message: '请上传图片', validator: validateFileList }]" -->
           <wd-upload
             ref="uploader"
-            accept="all"
+            :accept="accept"
             :auto-upload="false"
             :limit="1"
             :file-list="fileList"
@@ -95,7 +95,7 @@
                        :min="option.min"
                        :max="option.max" /> -->
 
-            <!-- 输入框: 从 xx 到 xx (需增加 min max 控制) -->
+            <!-- 输入框: 从 xx 到 xx (TODO: 需增加 min max 控制) -->
             <view style="text-align: left">
               <view class="inline-txt" style="margin-left: 0">从</view>
               <wd-input
@@ -146,6 +146,7 @@ import { getEnvBaseUrl } from '@/utils'
 const baseUrl = getEnvBaseUrl()
 const toast = useToast()
 const message = useMessage()
+const accept = ref("all")
 const uploader = ref()
 const fileList = ref([])
 const form = ref()
@@ -240,7 +241,10 @@ function handleUpload(file, data, options) {
     formData, // 如果需要额外的 formData
     success: (res: any) => {
       if (res.statusCode === 200 && JSON.parse(res.data).code === 0) {
-        message.confirm("打印成功, 是否继续打印?").then(() => {
+        message.confirm({
+          msg: "打印成功, 是否继续打印?",
+          closeOnClickModal: false,
+        }).then(() => {
           hasFile.value = false
           fileList.value = []
           printerOptions.value = []
@@ -335,12 +339,12 @@ function handlePrinterChange(item: any) {
       }
     })
     .catch((e) => {
-      // TODO: 测试离线情况 417 设备离线没有属性值
     })
     .finally(() => {})
 }
 
-onLoad(() => {
+onLoad((option) => {
+  if (option && option.accept) accept.value = option.accept
   getPrinterList()
 })
 </script>

+ 457 - 0
src/pages/print/job.vue

@@ -0,0 +1,457 @@
+<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
+<route lang="json5">
+{
+  style: {
+    navigationBarTitleText: '打印任务列表',
+  },
+}
+</route>
+<template>
+  <view class="page-list">
+    <wd-sticky>
+      <view class="sticky-box">
+        <wd-tabs v-model="queryParams.completed" auto-line-width @change="resetDataList">
+          <wd-tab v-for="item of completedList" :key="item.value" :title="item.label" :name="item.value">
+          </wd-tab>
+        </wd-tabs>
+
+        <!-- <wd-search
+          placeholder="请输入打印任务名称"
+          placeholder-left
+          hide-cancel
+          v-model="queryParams.title"
+          @change="onSearch"
+          @clear="onSearch"
+        >
+          <template v-slot:prefix>
+            <wd-drop-menu custom-class="search-menu">
+              <wd-drop-menu-item v-model="queryParams.completed" :options="completedList" @change="onSearch" />
+            </wd-drop-menu>
+          </template>
+        </wd-search> -->
+      </view>
+    </wd-sticky>
+
+    <view class="list-contain">
+      <view v-if="queryParams.printer" class="printer">{{ `当前打印机: ${queryParams.printer}` }}</view>
+
+      <template v-if="dataList.length > 0 || loadStatus == 'loading'">
+        <view v-for="item of dataList" :key="item.id" class="item-contain" @click="toDetail(item.id)">
+          <view class="item-info">
+            <view class="image">
+              <wd-img
+                :src="getFileType(item.title)"
+                :width="60"
+                :height="60"
+                mode="aspectFit"
+              ></wd-img>
+            </view>
+            <view class="name">
+              <view class="main-text">
+                <view>{{ item.title }}</view>
+              </view>
+              <view class="sub-text">
+                <text>任务状态: </text>
+                <text :class="`color-${getLabelColor(item.jobStatus, jobStatus)}`">{{ getLabel(item.jobStatus, jobStatus) }}</text>
+              </view>
+              <view class="sub-text">
+                {{ `创建时间: ${item.createTime}` }}
+              </view>
+              <!-- <view class="sub-text flex-center">
+                <view class="flex-1">xxx</view>
+                <view class="flex-1">xxx</view>
+              </view> -->
+            </view>
+            <!-- <view class="opt" @click.stop="showActions(item)">
+              <wd-button type="icon" icon="more"></wd-button>
+            </view> -->
+          </view>
+          <view class="item-opt">
+            <!-- <view class="opt-btn">详情</view> -->
+            <view v-if="item.reprint == '1'" class="opt-btn" @click.stop="handleReprint(item.id)">重打</view>
+            <view v-if="['3', '4', '5', '6'].includes(item.jobStatus)" class="opt-btn" @click.stop="handleCancel(item.id)">取消</view>
+            <view class="opt-btn delete-btn" @click.stop="handleDelete(item)">删除</view>
+          </view>
+        </view>
+        <!-- 加载更多 -->
+        <wd-loadmore custom-class="loadmore" :state="loadStatus" />
+      </template>
+      <wd-status-tip v-else image="content" tip="暂无内容" />
+    </view>
+    
+    <!-- 动作面板 -->
+    <wd-action-sheet
+      v-model="isShowActions"
+      :actions="currentActions"
+      :title="actionsTitle"
+      @close="isShowActions = false"
+      @select="selectActions"
+    />
+  </view>
+</template>
+
+<script lang="ts" setup>
+import { useMessage, useToast } from 'wot-design-uni'
+import { getUserHubJobsPage, reprintUserHubJobs, cancelUserHubJobs, deleteUserHubJobs } from '@/service/api'
+import { getLabel, getLabelColor } from '@/utils'
+import { debounce } from 'wot-design-uni/components/common/util'
+
+const message = useMessage()
+const toast = useToast()
+const total = ref(0)
+const queryParams: any = reactive({
+  pageNo: 1,
+  pageSize: 10,
+  completed: "all",
+  title: '',
+  printer: "",
+})
+const completedList: any = ref([
+  { label: '全部', value: 'all' },
+  { label: '当前任务', value: '0' },
+  { label: '历史任务', value: '1' }
+])
+//  0连接中 3 等待中 4 已暂停 5 处理中 6已停止 7已取消 8已中止 9已完成
+const jobStatus: any = ref([
+  { label: '连接中', value: '0', color: 'primary' },
+  { label: '等待中', value: '3', color: 'info' },
+  { label: '已暂停', value: '4', color: 'info' },
+  { label: '处理中', value: '5', color: 'primary' },
+  { label: '已停止', value: '6', color: 'danger' },
+  { label: '已取消', value: '7', color: 'danger' },
+  { label: '已中止', value: '8', color: 'danger' },
+  { label: '已完成', value: '9', color: 'success' },
+])
+const dataList = ref([])
+const currentData: any = ref({})
+// 加载中: loading; 没有数据: finished; 错误: error;
+const loadStatus: any = ref('loading')
+// 动作面板
+const isShowActions = ref(false)
+const actionsTitle = ref('')
+const currentActions: any = ref([{ loading: true }])
+const isToTop = ref(false)
+// 文件类型
+const imageSrc = '/static/images/image.png'
+const docSrc = '/static/images/doc.png'
+const xlsSrc = '/static/images/xls.png'
+const pptSrc = '/static/images/ppt.png'
+const pdfSrc = '/static/images/pdf.png'
+const txtSrc = '/static/images/txt.png'
+const otherSrc = '/static/images/other.png'
+
+defineOptions({
+  name: 'Job',
+})
+
+// 根据文件类型获取图片
+// 允许的文件类型 allowType = ['txt', 'pdf', 'doc', 'docx', 'xlsx', 'xls', 'ppt', 'pptx', 'gif', 'png', 'jpg', 'jpeg', 'webp']
+function getFileType(fileName) {
+  let src = otherSrc
+  let fileType = ""
+  const lastIndex = fileName.lastIndexOf('.')
+  if (lastIndex != -1) fileType = fileName.substring(lastIndex + 1)
+  switch (fileType) {
+    case "doc":
+    case "docx":
+      src = docSrc
+      break;
+    case "xls":
+    case "xlsx":
+      src = xlsSrc;
+      break;
+    case "ppt":
+    case "pptx":
+      src = pptSrc;
+      break;
+    case "png":
+    case "jpg":
+    case "jpeg":
+    case "gif":
+    case "webp":
+      src = imageSrc;
+      break;
+    case "txt":
+      src = txtSrc;
+      break;
+    case "pdf":
+      src = pdfSrc;
+      break;
+  }
+  return src
+}
+
+// 根据状态 构造操作面板
+function buildCurrentActions() {
+  currentActions.value = [
+    { name: '查看' },
+    { name: '重打' },
+    { name: '取消' },
+    { name: '删除', color: '#fa4350' }
+  ]
+}
+
+// 获取列表数据
+function getDataList() {
+  loadStatus.value = 'loading'
+  const params = { ...queryParams }
+  if (params.title) {
+    params.title = '*' + params.title + '*'
+  } else {
+    delete params.title
+  }
+  if (params.completed === '' || params.completed === 'all') delete params.completed
+  if (!params.printer) delete params.printer
+  getUserHubJobsPage(params)
+    .then((res: any) => {
+      if (res.code === 0 && res.body) {
+        total.value = res.body.total
+        if (queryParams.pageNo === 1) {
+          dataList.value = res.body.records || []
+        } else {
+          dataList.value.push(...(res.body.records || []))
+        }
+      }
+    })
+    .catch((e) => {})
+    .finally(() => {
+      loadStatus.value = 'finished'
+    })
+}
+
+const onSearch = debounce(() => {
+  queryParams.pageNo = 1
+  getDataList()
+}, 500)
+
+// 查看详情
+function toDetail(id: string) {
+  uni.navigateTo({
+    url: `/pages/print/jobDetail?id=${id}`,
+  })
+}
+
+// 重打任务
+function handleReprint(id: string) {
+  reprintUserHubJobs({id}).then((res: any) => {
+    if (res.code === 0) {
+      toast.success('已发送重新打印')
+      getDataList()
+    }
+  })
+  .catch((error) => {
+    console.log(error)
+  })
+}
+
+// 取消任务
+function handleCancel(id: string) {
+  cancelUserHubJobs({id}).then((res: any) => {
+    if (res.code === 0) {
+      toast.success('取消打印任务成功')
+      getDataList()
+    }
+  })
+  .catch((error) => {
+    console.log(error)
+  })
+}
+
+// 删除任务
+function handleDelete(item) {
+  message
+    .confirm({
+      title: '提示',
+      msg: `是否删除打印任务: ${item.title} ?`,
+    })
+    .then(() => {
+      deleteUserHubJobs(item.id)
+        .then((res: any) => {
+          if (res.code === 0) {
+            toast.success('删除成功')
+            queryParams.pageNo = 1
+            getDataList()
+          }
+        })
+        .catch((error) => {
+          console.log(error)
+        })
+    })
+    .catch((error) => {
+      console.log(error)
+    })
+}
+
+// 显示操作
+function showActions(data: any) {
+  actionsTitle.value = data.title ? `打印任务: ${data.title}` : '操作'
+  currentData.value = data || {}
+  buildCurrentActions()
+  isShowActions.value = true
+}
+
+// 处理操作
+function selectActions(data: any) {
+  switch (data.item.name) {
+    case '查看':
+      toDetail(currentData.value.id)
+      break
+    case '重打':
+      handleReprint(currentData.value.id)
+      break
+    case '取消':
+      handleCancel(currentData.value.id)
+      break
+    case '删除':
+      handleDelete(currentData.value)
+      break
+  }
+}
+
+// 查询列表, 滚动到顶部, 返回第一页
+function resetDataList() {
+  uni.pageScrollTo({
+    scrollTop: 0,
+    duration: 300,
+  })
+  dataList.value = []
+  onSearch()
+}
+
+// 页面加载
+onLoad((option) => {
+  // 指定打印机
+  if (option && option.printer) queryParams.printer = option.printer
+  getDataList()
+  // 监听刷新
+  uni.$on('refreshData', () => {
+    resetDataList()
+    isToTop.value = true
+  })
+})
+
+// 页面显示
+onShow(() => {
+  if (isToTop.value) {
+    uni.pageScrollTo({
+      scrollTop: 0,
+      duration: 300,
+    })
+    isToTop.value = false
+  }
+})
+
+// 滚动到底部
+onReachBottom(() => {
+  if (dataList.value.length < total.value) {
+    queryParams.pageNo++
+    getDataList()
+  } else {
+    loadStatus.value = 'finished'
+  }
+})
+</script>
+
+<style lang="scss" scoped>
+.sticky-box {
+  width: 100vw;
+  height: 100rpx;
+  background-color: #ffffff;
+}
+.search-type {
+  position: relative;
+  height: 60rpx;
+  padding: 0 16rpx 0 32rpx;
+  line-height: 60rpx;
+}
+.search-type::after {
+  position: absolute;
+  top: 10rpx;
+  right: 0;
+  bottom: 10rpx;
+  width: 2rpx;
+  content: '';
+  background: rgba(0, 0, 0, 0.25);
+}
+.search-type {
+  :deep(.icon-arrow) {
+    display: inline-block;
+    font-size: 40rpx;
+    vertical-align: middle;
+  }
+}
+.printer {
+  margin-bottom: 20rpx;
+}
+.list-contain {
+  padding: 10rpx 30rpx 30rpx;
+  overflow-y: auto;
+
+  .item-contain {
+    padding: 30rpx;
+    margin-bottom: 30rpx;
+    border: 2rpx solid #eee;
+
+    .item-info {
+      display: flex;
+      align-items: flex-start;
+      .image {
+        display: flex;
+        padding-right: 14rpx;
+      }
+      .name {
+        flex: 1;
+        .main-text {
+          display: flex;
+          align-items: center;
+          word-break: break-all;
+        }
+        .sub-text {
+          margin-top: 14rpx;
+          font-size: 28rpx;
+          color: #00000073;
+        }
+      }
+      .opt {
+        width: 80rpx;
+        text-align: center;
+      }
+    }
+
+    .item-opt {
+      margin-top: 20rpx;
+      border-top: 2rpx solid #eee;
+      padding-top: 20rpx;
+      text-align: right;
+      font-size: 28rpx;
+      
+      .opt-btn {
+        display: inline-block;
+        padding: 4rpx 20rpx;
+        margin-left: 20rpx;
+        color: var(--wot-color-theme);
+        border: 2rpx solid var(--wot-color-theme);
+        border-radius: 8rpx;
+      }
+      .opt-btn:first-of-type {
+        margin-left: 0;
+      }
+      .delete-btn {
+        color: #fa4350;
+        border-color: #fa4350;
+      }
+    }
+  }
+}
+//搜索下拉菜单
+:deep(.search-menu .wd-drop-menu__list) {
+  background: none;
+}
+:deep(.search-menu .wd-drop-menu__item) {
+  height: 62rpx;
+  line-height: 62rpx;
+}
+:deep(.search-menu .wd-drop-menu__item-title::after) {
+  content: none;
+}
+</style>

+ 109 - 0
src/pages/print/jobDetail.vue

@@ -0,0 +1,109 @@
+<!-- 使用 type="home" 属性设置首页,其他页面不需要设置,默认为page;推荐使用json5,更强大,且允许注释 -->
+<route lang="json5">
+{
+  style: {
+    navigationBarTitleText: '打印任务详情',
+  },
+}
+</route>
+<template>
+  <view class="page-form">
+    <wd-form ref="form" :model="formData">
+      <view class="form-title">
+        <view>详细信息</view>
+        <!-- <view class="opt-item" @click="customRecognize">
+          <wd-icon name="list" size="30rpx"></wd-icon>
+          <text>右侧图标</text>
+        </view> -->
+      </view>
+      <wd-cell-group custom-class="form-group" border>
+        <wd-cell
+          title="任务名称"
+          title-width="100px"
+          :value="formData.title"
+        />
+        <wd-cell
+          title="打印机名称"
+          title-width="100px"
+          :value="formData.printer"
+        />
+        <wd-cell
+          title="打印状态"
+          title-width="100px"
+          :value="getLabel(formData.jobStatus, jobStatus)"
+        />
+        <wd-cell
+          title="任务类型"
+          title-width="100px"
+          :value="getLabel(formData.jobType, jobType)"
+        />
+        <wd-cell
+          title="创建时间"
+          title-width="100px"
+          :value="formData.createTime"
+        />
+        <wd-cell
+          title="完成时间"
+          title-width="100px"
+          :value="formData.completedTime"
+        />
+        <wd-textarea
+          v-model="formData.remark"
+          label="备注信息"
+          label-width="100px"
+          auto-height
+          readonly
+          placeholder=" "
+        />
+      </wd-cell-group>
+    </wd-form>
+  </view>
+</template>
+
+<script lang="ts" setup>
+import { useMessage, useToast } from 'wot-design-uni'
+import { getUserHubJobsDetail } from '@/service/api'
+import { getLabel } from '@/utils'
+
+const message = useMessage()
+const toast = useToast()
+const form = ref()
+const formData: any = ref({})
+const jobType: any = ref([
+  { label: " 文件打印", value: "file" },
+  { label: " 模板打印", value: "template" },
+])
+const jobStatus: any = ref([
+  { label: '连接中', value: '0' },
+  { label: '等待中', value: '3' },
+  { label: '已暂停', value: '4' },
+  { label: '处理中', value: '5' },
+  { label: '已停止', value: '6' },
+  { label: '已取消', value: '7' },
+  { label: '已中止', value: '8' },
+  { label: '已完成', value: '9' },
+  ])
+
+defineOptions({
+  name: 'JobDetail',
+})
+
+function getDetailById(id: string) {
+  getUserHubJobsDetail({id}).then((res: any) => {
+    if (res.code == 0 && res.body) {
+      formData.value = res.body || { }
+    }
+  })
+}
+
+onLoad((option) => {
+  if (option && option.id) getDetailById(option.id)
+})
+</script>
+
+<style lang="scss" scoped>
+:deep(.wd-cell__value) {
+  text-align: left !important;
+  word-break: break-all;
+}
+</style>

+ 8 - 8
src/pages/printer/index.vue

@@ -102,7 +102,7 @@ defineOptions({
 // 根据状态 构造操作面板
 function buildCurrentActions() {
   currentActions.value = [
-    { name: '查看' },
+    { name: '查看打印任务' },
   ]
 }
 
@@ -132,11 +132,11 @@ const onSearch = debounce(() => {
   getDataList()
 }, 500)
 
-// 跳转到详情
-function toDetail(id?: string) {
-  // uni.navigateTo({
-  //   url: `/pages/assistant/detail?type=${type}&id=${id || ''}`,
-  // })
+// 查看打印任务
+function toJob(name?: string) {
+  uni.navigateTo({
+    url: `/pages/print/job?printer=${name}`,
+  })
 }
 
 function showActions(data: any) {
@@ -148,8 +148,8 @@ function showActions(data: any) {
 
 function selectActions(data: any) {
   switch (data.item.name) {
-    case '查看':
-      toDetail(currentData.value.id)
+    case '查看打印任务':
+      toJob(currentData.value.name)
       break
   }
 }

+ 39 - 17
src/service/api/index.ts

@@ -95,6 +95,8 @@ export const updateUserHub = (data: any) => {
   })
 }
 
+// ---------------------- 打印相关 ----------------------
+
 /** 获取打印机列表 */
 export const getUserHubPrints = (data) => {
   return http<any>({
@@ -113,43 +115,63 @@ export const getUserHubAttr = (data) => {
   })
 }
 
-/** 查看已经完成任务列表 */
-export const getUserHubJobs = (data) => {
+/** 远程打印文件 */
+export const printFile = (params, data, contentType) => {
+  return http<any>({
+    url: "/sys/wx/userHub/print",
+    method: "POST",
+    query: params,
+    data: data,
+    header: {
+      'Content-Type': contentType,
+    },
+  })
+}
+
+// ---------------------- 打印任务相关 ----------------------
+
+/** 查看任务列表 */
+export const getUserHubJobsPage = (data) => {
+  return http<any>({
+    url: `/sys/hub/pintJob/page`,
+    method: 'GET',
+    query: data
+  })
+}
+
+/** 查看任务列表详情 */
+export const getUserHubJobsDetail = (data) => {
   return http<any>({
-    url: `/sys/wx/userHub/jobs`,
+    url: `/sys/hub/pintJob/get`,
     method: 'GET',
     query: data
   })
 }
 
-/** 查看未完成任务列表 */
-export const getUserHubJobsNotCompleted = (data) => {
+/** 重打打印任务 */
+export const reprintUserHubJobs = (data) => {
   return http<any>({
-    url: `/sys/wx/userHub/jobs-not-completed`,
+    url: `/sys/hub/pintJob/jobs-reprint`,
     method: 'GET',
     query: data
   })
 }
 
 /** 取消打印任务 */
-export const getUserHubJobsCancel = (data) => {
+export const cancelUserHubJobs = (data) => {
   return http<any>({
-    url: `/sys/wx/userHub/jobs-cancel`,
+    url: `/sys/hub/pintJob/jobs-cancel`,
     method: 'GET',
     query: data
   })
 }
 
-/** 远程打印文件 */
-export const printFile = (params, data, contentType) => {
+/** 删除打印任务 */
+export const deleteUserHubJobs = (data) => {
   return http<any>({
-    url: "/sys/wx/userHub/print",
-    method: "POST",
-    query: params,
-    data: data,
-    header: {
-      'Content-Type': contentType,
-    },
+    url: `/sys/hub/pintJob/delete`,
+    method: 'GET',
+    query: data
   })
 }
 

BIN
src/static/images/device.jpg


BIN
src/static/images/doc.png


BIN
src/static/images/image.png


BIN
src/static/images/other.png


BIN
src/static/images/pdf.png


BIN
src/static/images/picture.jpg


BIN
src/static/images/ppt.png


BIN
src/static/images/txt.png


BIN
src/static/images/xls.png


+ 21 - 1
src/style/index.scss

@@ -13,8 +13,12 @@ page {
   font-size: 32rpx;
   background-color: #f1f1f1;
 
-  // 修改主题色
+  // 修改主题色
   --wot-color-theme: #FF8D1A;
+  --wot-color-success: #34d19d;
+  --wot-color-waring: #f0883a;
+  --wot-color-danger: #fa4350;
+  --wot-color-info: #909399;
 
   // 修改按钮背景色
   // --wot-button-primary-bg-color: #FF8D1A;
@@ -185,4 +189,20 @@ page {
   box-sizing: border-box;
   width: 100vw !important;
   background: none !important;
+}
+
+.color-primary {
+  color: var(--wot-color-theme)
+}
+.color-success {
+  color: var(--wot-color-success)
+}
+.color-waring {
+  color: var(--wot-color-waring)
+}
+.color-danger {
+  color: var(--wot-color-danger)
+}
+.color-info {
+  color: var(--wot-color-info)
 }

+ 2 - 0
src/types/uni-pages.d.ts

@@ -11,6 +11,8 @@ interface NavigateToOptions {
        "/pages/login/index" |
        "/pages/personal/index" |
        "/pages/print/index" |
+       "/pages/print/job" |
+       "/pages/print/jobDetail" |
        "/pages/printer/index" |
        "/pages/webview/index";
 }

+ 9 - 0
src/utils/index.ts

@@ -201,6 +201,15 @@ export const getLabel = (code: string, options: any) => {
   return label || code
 }
 
+// 回显字典颜色
+export const getLabelColor = (code: string, options: any) => {
+  let color = ''
+  if (code) {
+    color = options.find((e: any) => e.value == code)?.color || ''
+  }
+  return color
+}
+
 // 字典转为label和value
 export const dictLabel = (lists: any[]) => {
   let datas: any = []