From 8160387437fca829f30108c37ee21dc2570d5bc6 Mon Sep 17 00:00:00 2001
From: yiwenpeng <ywp303@163.com>
Date: Mon, 26 Jun 2023 17:34:42 +0800
Subject: [PATCH] 任务状态高亮

---
 ant-design-vue-jeecg/src/views/system/task/AgvTaskList.vue            | 390 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue   |  18 ++++++++++++++++++
 ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue |  17 +++++++++++++++++
 3 files changed, 242 insertions(+), 183 deletions(-)

diff --git a/ant-design-vue-jeecg/src/views/system/task/AgvTaskList.vue b/ant-design-vue-jeecg/src/views/system/task/AgvTaskList.vue
index 28e4a8b..5a8e64d 100644
--- a/ant-design-vue-jeecg/src/views/system/task/AgvTaskList.vue
+++ b/ant-design-vue-jeecg/src/views/system/task/AgvTaskList.vue
@@ -49,24 +49,26 @@
     <!-- 操作按钮区域 -->
     <div class="table-operator">
       <a-button v-has="'agvTask:add'" @click="handleAdd" type="primary" icon="plus">新增</a-button>
-      <a-button v-has="'agvTask:export'" type="primary" icon="download" @click="handleExportXls('AGV任务')">导出</a-button>
-      <a-upload v-has="'agvTask:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">
+      <a-button v-has="'agvTask:export'" type="primary" icon="download" @click="handleExportXls('AGV任务')">导出
+      </a-button>
+      <a-upload v-has="'agvTask:import'" name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader"
+                :action="importExcelUrl" @change="handleImportExcel">
         <a-button type="primary" icon="import">导入</a-button>
       </a-upload>
-<!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
-<!--        <a-menu slot="overlay">-->
-<!--          <a-menu-item key="1" v-has="'agvTask:delete'" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
-<!--        </a-menu>-->
-<!--        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
-<!--      </a-dropdown>-->
+      <!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
+      <!--        <a-menu slot="overlay">-->
+      <!--          <a-menu-item key="1" v-has="'agvTask:delete'" @click="batchDel"><a-icon type="delete"/>删除</a-menu-item>-->
+      <!--        </a-menu>-->
+      <!--        <a-button style="margin-left: 8px"> 批量操作 <a-icon type="down" /></a-button>-->
+      <!--      </a-dropdown>-->
     </div>
 
     <!-- table区域-begin -->
     <div>
-<!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
-<!--        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项-->
-<!--        <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
-<!--      </div>-->
+      <!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
+      <!--        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a> 项-->
+      <!--        <a style="margin-left: 24px" @click="onClearSelected">清空</a>-->
+      <!--      </div>-->
 
       <a-table
         ref="table"
@@ -81,12 +83,20 @@
         :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange}"
         class="j-table-force-nowrap"
         @change="handleTableChange">
+
+        <span slot="status_dictText" slot-scope="status_dictText">
+            <a-tag :key="status_dictText" :color="getStatusColor(status_dictText)">
+              {{ status_dictText }}
+            </a-tag>
+        </span>
+
         <template slot="htmlSlot" slot-scope="text">
           <div v-html="text"></div>
         </template>
         <template slot="imgSlot" slot-scope="text">
           <span v-if="!text" style="font-size: 12px;font-style: italic;">无图片</span>
-          <img v-else :src="getImgView(text)" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>
+          <img v-else :src="getImgView(text)" height="25px" alt=""
+               style="max-width:80px;font-size: 12px;font-style: italic;"/>
         </template>
         <template slot="fileSlot" slot-scope="text">
           <span v-if="!text" style="font-size: 12px;font-style: italic;">无文件</span>
@@ -101,12 +111,14 @@
         </template>
 
         <span slot="action" slot-scope="text, record">
-          <a v-if="record.status == 1"  v-has="'agvTask:executeTask'" @click="executeAgvTask(record)">执行<a-divider type="vertical"/></a>
-          <a-popconfirm v-if="record.status < 100" title="确定删除吗?" v-has="'agvTask:delete'" @confirm="() => handleDelete(record.id)">
+          <a v-if="record.status == 1" v-has="'agvTask:executeTask'" @click="executeAgvTask(record)">执行<a-divider
+            type="vertical"/></a>
+          <a-popconfirm v-if="record.status < 100" title="确定删除吗?" v-has="'agvTask:delete'"
+                        @confirm="() => handleDelete(record.id)">
             <a>删除 <a-divider type="vertical"/></a>
           </a-popconfirm>
           <a-dropdown>
-            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
+            <a class="ant-dropdown-link">更多 <a-icon type="down"/></a>
             <a-menu slot="overlay">
               <a-menu-item>
                 <a @click="handleDetail(record)">详情</a>
@@ -127,181 +139,193 @@
 
 <script>
 
-  import '@/assets/less/TableExpand.less'
-  import { mixinDevice } from '@/utils/mixin'
-  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
-  import AgvTaskModal from './modules/AgvTaskModal'
-  import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
-  import {executeAgv} from '@/api/api'
-  import {completeAgv, cancelAgv} from '@/api/api'
+import '@/assets/less/TableExpand.less'
+import {mixinDevice} from '@/utils/mixin'
+import {JeecgListMixin} from '@/mixins/JeecgListMixin'
+import AgvTaskModal from './modules/AgvTaskModal'
+import {filterMultiDictText} from '@/components/dict/JDictSelectUtil'
+import {executeAgv} from '@/api/api'
+import {completeAgv, cancelAgv} from '@/api/api'
 
-  export default {
-    name: 'AgvTaskList',
-    mixins:[JeecgListMixin, mixinDevice],
-    components: {
-      AgvTaskModal
-    },
-    data () {
-      return {
-        description: 'AGV任务管理页面',
-        isorter: {
-          column: 'status',
-          order: 'asc',
+export default {
+  name: 'AgvTaskList',
+  mixins: [JeecgListMixin, mixinDevice],
+  components: {
+    AgvTaskModal
+  },
+  data() {
+    return {
+      description: 'AGV任务管理页面',
+      isorter: {
+        column: 'status',
+        order: 'asc',
+      },
+      // 表头
+      columns: [
+        {
+          title: '任务ID',
+          align: "center",
+          dataIndex: 'id',
+          sorter: true,
         },
-        // 表头
-        columns: [
-          {
-            title: '任务ID',
-            align: "center",
-            dataIndex: 'id',
-            sorter: true,
-          },
-          {
-            title:'任务类型',
-            align:"center",
-            dataIndex: 'taskType_dictText'
-          },
-          {
-            title:'容器编码',
-            align:"center",
-            dataIndex: 'containerCode'
-          },
-          {
-            title:'小车编码',
-            align:"center",
-            dataIndex: 'carno'
-          },
-          {
-            title:'优先级',
-            align:"center",
-            dataIndex: 'priority'
-          },
-          {
-            title:'状态',
-            align:"center",
-            dataIndex: 'status_dictText'
-          },
-          {
-            title:'起始点位',
-            align:"center",
-            dataIndex: 'fromPort'
-          },
-          {
-            title:'目标点位',
-            align:"center",
-            dataIndex: 'toPort'
-          },
-          {
-            title:'创建人',
-            align:"center",
-            dataIndex: 'createBy'
-          },
-          {
-            title:'创建日期',
-            align:"center",
-            dataIndex: 'createTime'
-          },
-          {
-            title:'更新人',
-            align:"center",
-            dataIndex: 'updateBy'
-          },
-          {
-            title:'更新日期',
-            align:"center",
-            dataIndex: 'updateTime'
-          },
-          {
-            title: '操作',
-            dataIndex: 'action',
-            align:"center",
-            fixed:"right",
-            width:147,
-            scopedSlots: { customRender: 'action' }
-          }
-        ],
-        url: {
-          list: "/task/agvTask/list",
-          delete: "/task/agvTask/delete",
-          deleteBatch: "/task/agvTask/deleteBatch",
-          exportXlsUrl: "/task/agvTask/exportXls",
-          importExcelUrl: "task/agvTask/importExcel",
-
+        {
+          title: '任务类型',
+          align: "center",
+          dataIndex: 'taskType_dictText'
         },
-        dictOptions:{},
-        superFieldList:[],
-      }
-    },
-    created() {
+        {
+          title: '容器编码',
+          align: "center",
+          dataIndex: 'containerCode'
+        },
+        {
+          title: '小车编码',
+          align: "center",
+          dataIndex: 'carno'
+        },
+        {
+          title: '优先级',
+          align: "center",
+          dataIndex: 'priority'
+        },
+        {
+          title: '任务状态',
+          align: "center",
+          dataIndex: 'status_dictText',
+          scopedSlots: {customRender: 'status_dictText'}
+        },
+        {
+          title: '起始点位',
+          align: "center",
+          dataIndex: 'fromPort'
+        },
+        {
+          title: '目标点位',
+          align: "center",
+          dataIndex: 'toPort'
+        },
+        {
+          title: '创建人',
+          align: "center",
+          dataIndex: 'createBy'
+        },
+        {
+          title: '创建日期',
+          align: "center",
+          dataIndex: 'createTime'
+        },
+        {
+          title: '更新人',
+          align: "center",
+          dataIndex: 'updateBy'
+        },
+        {
+          title: '更新日期',
+          align: "center",
+          dataIndex: 'updateTime'
+        },
+        {
+          title: '操作',
+          dataIndex: 'action',
+          align: "center",
+          fixed: "right",
+          width: 147,
+          scopedSlots: {customRender: 'action'}
+        }
+      ],
+      url: {
+        list: "/task/agvTask/list",
+        delete: "/task/agvTask/delete",
+        deleteBatch: "/task/agvTask/deleteBatch",
+        exportXlsUrl: "/task/agvTask/exportXls",
+        importExcelUrl: "task/agvTask/importExcel",
+
+      },
+      dictOptions: {},
+      superFieldList: [],
+    }
+  },
+  created() {
     this.getSuperFieldList();
+  },
+  computed: {
+    importExcelUrl: function () {
+      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
     },
-    computed: {
-      importExcelUrl: function(){
-        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
-      },
+  },
+  methods: {
+    getStatusColor(status) {
+      const colors = {
+        '生成任务': 'green',
+        '下发任务': 'blue',
+        '开始执行': 'orange',
+        '取货完成': 'purple',
+        '任务完成': 'grey',
+        default: 'default'
+      };
+      return colors[status] || colors.default;
     },
-    methods: {
-      initDictConfig(){
-      },
-      executeAgvTask(record) {
-        this.loading = true;
-        this.model = Object.assign({}, record);
-        executeAgv(this.model.id).then((res) => {
-          this.loading = false;
-          if (res.success) {
-            this.$message.success(res.message);
-          } else {
-            this.$message.error(res.message);
-          }
-          this.searchQuery();
-        });
-      },
-      completeAgvTask(record) {
-        this.loading = true;
-        this.model = Object.assign({}, record);
-        completeAgv(this.model.id).then((res) => {
-          this.loading = false;
-          if (res.success) {
-            this.$message.success(res.message);
-          } else {
-            this.$message.error(res.message);
-          }
-          this.searchQuery();
-        });
-      },
-      cancelAgvTask(record) {
-        this.loading = true;
-        this.model = Object.assign({}, record);
-        cancelAgv(this.model.id).then((res) => {
-          this.loading = false;
-          if (res.success) {
-            this.$message.success(res.message);
-          } else {
-            this.$message.error(res.message);
-          }
-          this.searchQuery();
-        });
-      },
-      getSuperFieldList(){
-        let fieldList=[];
-        fieldList.push({type:'string',value:'warehouseCode',text:'仓库编码',dictCode:''})
-        fieldList.push({type:'string',value:'zoneCode',text:'库区',dictCode:''})
-        fieldList.push({type:'int',value:'taskType',text:'任务类型',dictCode:'agv_task_type'})
-        fieldList.push({type:'string',value:'containerCode',text:'容器编码',dictCode:''})
-        fieldList.push({type:'string',value:'carno',text:'小车编码',dictCode:''})
-        fieldList.push({type:'int',value:'priority',text:'优先级',dictCode:''})
-        fieldList.push({type:'int',value:'status',text:'状态',dictCode:'agv_task_status'})
-        fieldList.push({type:'string',value:'fromPort',text:'起始点位',dictCode:''})
-        fieldList.push({type:'string',value:'toPort',text:'目标点位',dictCode:''})
-        fieldList.push({type:'string',value:'createBy',text:'创建人',dictCode:''})
-        fieldList.push({type:'datetime',value:'createTime',text:'创建日期'})
-        fieldList.push({type:'string',value:'updateBy',text:'更新人',dictCode:''})
-        fieldList.push({type:'datetime',value:'updateTime',text:'更新日期'})
-        this.superFieldList = fieldList
-      }
+    initDictConfig() {
+    },
+    executeAgvTask(record) {
+      this.loading = true;
+      this.model = Object.assign({}, record);
+      executeAgv(this.model.id).then((res) => {
+        this.loading = false;
+        if (res.success) {
+          this.$message.success(res.message);
+        } else {
+          this.$message.error(res.message);
+        }
+        this.searchQuery();
+      });
+    },
+    completeAgvTask(record) {
+      this.loading = true;
+      this.model = Object.assign({}, record);
+      completeAgv(this.model.id).then((res) => {
+        this.loading = false;
+        if (res.success) {
+          this.$message.success(res.message);
+        } else {
+          this.$message.error(res.message);
+        }
+        this.searchQuery();
+      });
+    },
+    cancelAgvTask(record) {
+      this.loading = true;
+      this.model = Object.assign({}, record);
+      cancelAgv(this.model.id).then((res) => {
+        this.loading = false;
+        if (res.success) {
+          this.$message.success(res.message);
+        } else {
+          this.$message.error(res.message);
+        }
+        this.searchQuery();
+      });
+    },
+    getSuperFieldList() {
+      let fieldList = [];
+      fieldList.push({type: 'string', value: 'warehouseCode', text: '仓库编码', dictCode: ''})
+      fieldList.push({type: 'string', value: 'zoneCode', text: '库区', dictCode: ''})
+      fieldList.push({type: 'int', value: 'taskType', text: '任务类型', dictCode: 'agv_task_type'})
+      fieldList.push({type: 'string', value: 'containerCode', text: '容器编码', dictCode: ''})
+      fieldList.push({type: 'string', value: 'carno', text: '小车编码', dictCode: ''})
+      fieldList.push({type: 'int', value: 'priority', text: '优先级', dictCode: ''})
+      fieldList.push({type: 'int', value: 'status', text: '状态', dictCode: 'agv_task_status'})
+      fieldList.push({type: 'string', value: 'fromPort', text: '起始点位', dictCode: ''})
+      fieldList.push({type: 'string', value: 'toPort', text: '目标点位', dictCode: ''})
+      fieldList.push({type: 'string', value: 'createBy', text: '创建人', dictCode: ''})
+      fieldList.push({type: 'datetime', value: 'createTime', text: '创建日期'})
+      fieldList.push({type: 'string', value: 'updateBy', text: '更新人', dictCode: ''})
+      fieldList.push({type: 'datetime', value: 'updateTime', text: '更新日期'})
+      this.superFieldList = fieldList
     }
   }
+}
 </script>
 <style scoped>
-  @import '~@assets/less/common.less';
+@import '~@assets/less/common.less';
 </style>
\ No newline at end of file
diff --git a/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue b/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue
index 3593506..afbcdcb 100644
--- a/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue
+++ b/ant-design-vue-jeecg/src/views/system/task/CircleTaskHeaderList.vue
@@ -113,6 +113,13 @@
         :customRow="clickThenSelect"
         @change="handleTableChange">
 
+
+        <span slot="status_dictText" slot-scope="status_dictText">
+            <a-tag :key="status_dictText" :color="getStatusColor(status_dictText)">
+              {{ status_dictText }}
+            </a-tag>
+        </span>
+
         <span slot="zoneCode" slot-scope="zoneCode">
           <a-tag :key="zoneCode" color=blue>
             {{ solutionZoneCode(zoneCode) }}
@@ -240,6 +247,7 @@ export default {
           title: '任务状态',
           align: "center",
           dataIndex: 'status_dictText',
+          scopedSlots: {customRender: 'status_dictText'}
         },
         {
           title: '异常信息',
@@ -314,6 +322,16 @@ export default {
     }
   },
   methods: {
+    getStatusColor(status) {
+      const colors = {
+        '生成任务': 'green',
+        '下发任务': 'blue',
+        '到达拣选站台': 'orange',
+        '任务完成': 'grey',
+        default: 'default'
+      };
+      return colors[status] || colors.default;
+    },
     initDictConfig() {
     },
     clickThenSelect(record) {
diff --git a/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue b/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue
index eec6bed..903c053 100644
--- a/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue
+++ b/ant-design-vue-jeecg/src/views/system/task/TransferTaskHeaderList.vue
@@ -113,6 +113,12 @@
         :customRow="clickThenSelect"
         @change="handleTableChange">
 
+        <span slot="status_dictText" slot-scope="status_dictText">
+            <a-tag :key="status_dictText" :color="getStatusColor(status_dictText)">
+              {{ status_dictText }}
+            </a-tag>
+        </span>
+
         <span slot="zoneCode" slot-scope="zoneCode">
           <a-tag :key="zoneCode" color=blue>
             {{ solutionZoneCode(zoneCode) }}
@@ -247,6 +253,7 @@ export default {
           title: '任务状态',
           align: "center",
           dataIndex: 'status_dictText',
+          scopedSlots: {customRender: 'status_dictText'}
         },
         {
           title: '异常信息',
@@ -321,6 +328,16 @@ export default {
     }
   },
   methods: {
+    getStatusColor(status) {
+      const colors = {
+        '生成任务': 'green',
+        '下发任务': 'blue',
+        '到达拣选站台': 'orange',
+        '任务完成': 'grey',
+        default: 'default'
+      };
+      return colors[status] || colors.default;
+    },
     initDictConfig() {
     },
     clickThenSelect(record) {
--
libgit2 0.22.2