liuyanpeng před 4 měsíci
rodič
revize
41fca075c7
3 změnil soubory, kde provedl 59 přidání a 18 odebrání
  1. 1 1
      package.json
  2. 3 1
      src/common/transferTask.js
  3. 55 16
      src/customer/TransferTask.vue

+ 1 - 1
package.json

@@ -1,7 +1,7 @@
 {
   "name": "client-wms-v5",
   "description": "Leanwo Prodog Client",
-  "version": "1.0.0-yd.3",
+  "version": "1.0.0-yd.5",
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",

+ 3 - 1
src/common/transferTask.js

@@ -2,11 +2,13 @@
 export const taskColumns = [
   { title: '序号', dataIndex: 'index', width: 80 },
   { title: '任务类型', dataIndex: 'workCategory', width: 150 },
+  { title: '单据编号', dataIndex: 'documentNo', width: 150 },
   { title: '创建时间', dataIndex: 'created', width: 150 },
   { title: '执行时间', dataIndex: 'excuteDate', width: 150 },
   { title: '起始货位编号', dataIndex: 'positionBeginNo', width: 150 },
   { title: '终点货位编号', dataIndex: 'positionEndNo', width: 150 },
   { title: 'AGV编号', dataIndex: 'agvNo', width: 150 },
+  { title: '备注', dataIndex: 'description', width: 150 },
   // { title: '执行状态', dataIndex: 'executeStatus', width: 150 },
   { title: '执行成功', dataIndex: 'success', width: 150 },
   { title: '成功时间', dataIndex: 'successDate', width: 150 },
@@ -14,7 +16,7 @@ export const taskColumns = [
   { title: '失败原因', dataIndex: 'errorMessage', width: 150 },
   { title: '上次执行时间', dataIndex: 'lastExcuteDate', width: 150 },
   { title: '执行次数', dataIndex: 'countExcute', width: 150 },
-  { title: '操作', dataIndex: 'operation', width: 80, fixed: 'right' },
+  { title: '操作', dataIndex: 'operation', width: 100, fixed: 'right' },
 ].map(item => ({ ...item, align: 'center', ellipsis: true, resizable: true }));
 // 任务类型
 export const workOptions = [

+ 55 - 16
src/customer/TransferTask.vue

@@ -28,10 +28,7 @@
           />
         </a-form-item>
         <a-form-item label="AGV编号" class="horizontal-form-item">
-          <a-input
-            v-model:value="formData.agvNo" class="w-full" placeholder="请输入AGV编号"
-            @press-enter="searchDatas"
-          />
+          <a-input v-model:value="formData.agvNo" class="w-full" placeholder="请输入AGV编号" @press-enter="searchDatas" />
         </a-form-item>
         <a-form-item label="是否成功" class="horizontal-form-item">
           <a-select
@@ -49,20 +46,25 @@
     </a-form>
 
     <CommonTable
-      ref="commonTableRef" :columns="columns" :data-source="taskList" :total="totalSize"
-      :is-select="false" @get-pager="getPageParams"
+      ref="commonTableRef" :columns="columns" :data-source="taskList" :total="totalSize" :is-select="false" :extra-height="90"
+      @get-pager="getPageParams"
     >
       <template #bodyCell="{ column, record, index }">
         <template v-if="column.dataIndex === 'index'">
           {{ index + 1 }}
         </template>
+        <template v-if="column.dataIndex === 'documentNo'">
+          <a-button type="link" @click="openWindow(record)">{{ record.documentNo }}</a-button>
+        </template>
         <template v-if="column.dataIndex === 'success'">
           <a-tag v-if="record.success === true" color="green">成功</a-tag>
         </template>
         <template v-if="column.dataIndex === 'operation'">
           <a-tag v-if="record.executeStatus === '已完成'" color="green">已完成</a-tag>
-          <a-tag v-if="record.executeStatus === '执行中'" color="error">执行中</a-tag>
-          <a-button v-else type="link" @click="executeTask(record)">执行</a-button>
+          <a-button v-if="record.executeStatus === '执行中'" type="link" danger @click="cancelTask(record)">取消任务</a-button>
+          <a-button v-if="record.executeStatus === '未开始'" type="link" @click="executeTask(record)">
+            执行
+          </a-button>
         </template>
       </template>
     </CommonTable>
@@ -73,6 +75,7 @@
 <script setup>
 import { ref, onMounted } from 'vue';
 import Common from '../common/Common';
+import { Uuid } from 'pc-component-v3';
 import { message } from 'ant-design-vue';
 import CommonTable from '../common/CommonTable.vue';
 import { taskColumns, workOptions, executeOptions, successOptions } from '../common/transferTask';
@@ -116,6 +119,17 @@ const executeTask = record => {
   executeTaskById(record.schedulingTasksId);
 };
 
+// 执行任务
+const cancelTask = record => {
+  cancelTaskById(record.schedulingTasksId);
+};
+
+// 打开窗口
+const openWindow = record => {
+  const url = Common.getHostPageBaseURL() + `#/desktop/window1/window-read/view/${record.windowNo}/0/${record.documentId}?currPage=1&currIndex=1&totalCount=1&uuid=${Uuid.createUUID()}`;
+  window.open(url,'_blank');
+};
+
 // 条件变化查询
 const searchDatas = () => {
   commonTableRef.value.backFirstPage();
@@ -206,26 +220,51 @@ const executeTaskById = id => {
   });
 
 };
+// 取消任务Api
+const cancelTaskById = id => {
+  loading.value = true;
+  $.ajax({
+    type: 'get',
+    url: Common.getApiURL(`SchedulingTasksResource/cancelWorkById?schedulingTasksId=${id}`),
+    beforeSend(request) {
+      Common.addTokenToRequest(request);
+    },
+    success: function ({ errorCode, errorMessage }) {
+      if (errorCode === 0) {
+        searchDatas();
+        message.success('取消成功!');
+      } else {
+        searchDatas();
+        message.warning(errorMessage);
+      }
+      loading.value = false;
+    },
+    error: function (XMLHttpRequest, textStatus, errorThrown) {
+      loading.value = false;
+      Common.processException(XMLHttpRequest, textStatus, errorThrown);
+    },
+  });
+};
 </script>
 
 <style scoped>
 .horizontal-form-item {
-    display: flex;
-    align-items: center;
-    gap: 8px;
+  display: flex;
+  align-items: center;
+  gap: 8px;
 }
 
 .w-full {
-    width: 230px;
+  width: 230px;
 }
 
 :deep(.ant-form-item-label > label) {
-    font-size: 14px !important;
-    font-weight: 600 !important;
+  font-size: 14px !important;
+  font-weight: 600 !important;
 }
 
 :deep(.ant-form-item) {
-    margin-bottom: 0px !important;
-    margin-right: 16px !important;
+  margin-bottom: 0px !important;
+  margin-right: 16px !important;
 }
 </style>