Browse Source

Merge branch 'dev_v1.0.0' of http://git.qmth.com.cn/sop/web into dev_v1.0.0

刘洋 1 year ago
parent
commit
dce0e5f956

+ 12 - 0
src/assets/icons/icon-task.svg

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg width="20px" height="20px" viewBox="0 0 20 20" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
+    <title>icon-任务管理</title>
+    <g id="系统管理" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
+        <g id="35.01-系统管理-任务管理" transform="translate(-96, -424)">
+            <g id="icon-任务管理" transform="translate(96, 424)">
+                <rect id="calendar-(Background)" opacity="0" x="0" y="0" width="20" height="20"></rect>
+                <path d="M12.5,1.875 C13.1903559,1.875 13.75,2.43464406 13.75,3.125 L13.75,3.75 L16.25,3.75 C16.9403559,3.75 17.5,4.30964406 17.5,5 L17.5,16.25 C17.5,16.9403559 16.9403559,17.5 16.25,17.5 L3.75,17.5 C3.05964406,17.5 2.5,16.9403559 2.5,16.25 L2.5,5 C2.5,4.30964406 3.05964406,3.75 3.75,3.75 L6.25,3.75 L6.25,3.125 C6.25,2.43464406 6.80964406,1.875 7.5,1.875 L12.5,1.875 Z M12.5,5.625 L7.5,5.625 C7.0341773,5.625 6.62786738,5.37019552 6.41284474,4.99236106 L6.41810313,5.00151085 L3.75,5 L3.75,16.25 L16.25,16.25 L16.25,5 L13.5818969,5.00151085 L13.5871553,4.99236106 C13.3721326,5.37019552 12.9658227,5.625 12.5,5.625 Z M12.8216034,8.30836773 L13.7054956,9.19224262 L9.23675299,13.6610699 L6.29443526,10.7187569 L7.1783179,9.83487248 L9.23674345,11.893295 L12.8216034,8.30836773 Z M12.5,3.125 L7.5,3.125 L7.5,4.375 L12.5,4.375 L12.5,3.125 Z" id="形状结合" fill="#165DFF" fill-rule="nonzero"></path>
+            </g>
+        </g>
+    </g>
+</svg>

+ 8 - 0
src/components/common/status-tag/config.js

@@ -70,6 +70,14 @@ const configs = {
     },
     valFilter: runningStatusFilter,
   },
+  taskStatus: {
+    themeDict: {
+      已完成: 'success',
+      进行中: 'primary',
+      未开始: 'default',
+    },
+    valFilter: (val) => val,
+  },
 };
 export function getConfig(type) {
   return configs[type] || { themeDict: {}, valFilter: (val) => val };

+ 1 - 1
src/router/modules/system.js

@@ -138,7 +138,7 @@ export default {
             title: '任务管理',
             sort: 1,
             alias: 'task',
-            icon: 'service-crm',
+            icon: 'task',
           },
         },
       ],

+ 9 - 0
src/style/global.less

@@ -323,6 +323,15 @@ body {
   color: @light-text-color;
 }
 
+.color-brand {
+  color: @brand-color;
+}
+.color-error {
+  color: @error-color;
+}
+.color-success {
+  color: @success-color;
+}
 .color-warning {
   color: @warning-color;
 }

+ 0 - 6
src/utils/crypto.js

@@ -4,14 +4,8 @@ import Utf8 from 'crypto-js/enc-utf8';
 import AES from 'crypto-js/aes';
 import SHA1 from 'crypto-js/sha1';
 import MD5 from 'crypto-js/md5';
-import { cookie } from '@/utils/tool';
 import SparkMD5 from 'spark-md5';
 
-if (!cookie.get('deviceId')) {
-  cookie.set('deviceId', MD5(Math.random() + '-' + Date.now()));
-}
-export const DEVICE_ID = cookie.get('deviceId');
-
 export const getBase64 = (content) => {
   const words = Utf8.parse(content);
   const base64Str = Base64.stringify(words);

+ 2 - 2
src/utils/filter.js

@@ -55,8 +55,8 @@ export function timestampFilter(val, fmt = 'mm') {
   // fmt: dd or yyyy-MM-dd
   const formats = {
     dd: 'yyyy-MM-dd',
-    mm: 'yyyy-MM-dd hh:mm',
-    ss: 'yyyy-MM-dd hh:mm:ss',
+    mm: 'yyyy/MM/dd hh:mm',
+    ss: 'yyyy/MM/dd hh:mm:ss',
   };
   return val ? dateFormat(val, formats[fmt] || fmt) : DEFAULT_FIELD;
 }

+ 15 - 3
src/utils/request.js

@@ -3,11 +3,23 @@ import { MessagePlugin as Message } from 'tdesign-vue-next';
 import { download, clear } from '@/utils/tool';
 import { get, isEmpty } from 'lodash';
 import qs from 'qs';
-import { h } from 'vue';
+// import { h } from 'vue';
 import { LoadingPlugin } from 'tdesign-vue-next';
-import { getAuthorization, DEVICE_ID } from './crypto';
+import { getAuthorization } from './crypto';
 import router from '@/router';
 import { initSyncTime, fetchTime } from './syncServerTime';
+import { cookie } from '@/utils/tool';
+
+function getDeviceId() {
+  let deviceId = cookie.get('deviceId');
+  if (deviceId) return deviceId;
+
+  if (!deviceId) {
+    deviceId = MD5(Math.random() + '-' + Date.now());
+    cookie.set('deviceId', deviceId);
+    return deviceId;
+  }
+}
 
 function setAuth(config) {
   let userSession = sessionStorage.getItem('user');
@@ -138,7 +150,7 @@ function createRequest(service) {
     const env = import.meta.env;
     let headers = {
       'platform': 'WEB',
-      'deviceId': DEVICE_ID,
+      'deviceId': getDeviceId(),
       ...(config.headers || {}),
       'Content-Type': get(
         config,

+ 30 - 10
src/views/sop/components/dynamic-form-item/device-table/edit-column-dialog.vue

@@ -30,10 +30,25 @@
         ></t-select>
       </t-form-item>
       <t-form-item v-if="!isOutType" label="总扫描量" name="scanCount">
-        <t-input v-model="formData.inOutType"></t-input>
+        <t-input-number
+          v-model="formData.scanCount"
+          theme="column"
+          :decimalPlaces="1"
+          :max="100000000"
+          :min="0"
+          style="width: 120px"
+        ></t-input-number>
       </t-form-item>
-      <t-form-item v-if="isOutType" label="发往地" name="address" required-mark>
-        <select-area v-model="formData.address" value-type="full"></select-area>
+      <t-form-item
+        v-if="isOutType"
+        label="发往地"
+        name="addressArr"
+        required-mark
+      >
+        <select-area
+          v-model="formData.addressArr"
+          value-type="full"
+        ></select-area>
       </t-form-item>
       <t-form-item label="快递单拍照" name="basePhotoPath">
         <my-upload
@@ -72,9 +87,10 @@ const formData = reactive({
   deviceNo: '',
   supplierName: '',
   deviceStatus: '',
-  scanCount: '',
+  scanCount: null,
   location: '',
-  address: ['', '', ''],
+  address: '',
+  addressArr: ['', '', ''],
   basePhotoPath: '',
 });
 
@@ -107,11 +123,10 @@ const rules = {
       trigger: 'change',
     },
   ],
-  address: [
+  addressArr: [
     {
       validator: () => {
-        console.log(formData.address);
-        if (formData.address.some((item) => !item))
+        if (formData.addressArr.some((item) => !item))
           return { result: false, message: '发往地必选' };
 
         return { result: true, type: 'success' };
@@ -139,6 +154,7 @@ const imgChange = (fileRes) => {
 const deviceChange = (val, { option }) => {
   formData.supplierName = option.supplierName;
   formData.deviceStatus = option.deviceStatus;
+  formData.deviceBrand = option.deviceBrand;
   formData.scanCount = option.scanCount;
   formData.location = option.location;
   if (!props.isOutType) {
@@ -157,8 +173,12 @@ const dialogOpened = async () => {
 const save = async () => {
   const valid = await formRef.value.validate();
   if (valid !== true) return;
-
+  let data = {};
+  for (let key in formData) {
+    data[key] = formData[key];
+  }
+  if (props.isOutType) data.address = data.addressArr.join('');
   emit('update:visible', false);
-  emit('success', formData);
+  emit('success', data);
 };
 </script>

+ 10 - 6
src/views/sop/components/dynamic-form-item/device-table/index.vue

@@ -22,10 +22,6 @@
       <template #deviceStatus="{ row }">
         <status-tag :value="row.deviceStatus" type="runningStatus"></status-tag>
       </template>
-      <template #address="{ row }">
-        <span v-if="!isOutType">{{ row.address }}</span>
-        <span v-else>{{ row.address.join('') }}</span>
-      </template>
       <template #basePhotoPath="{ row }">
         <t-image
           v-if="row.basePhotoPath"
@@ -34,13 +30,19 @@
         />
       </template>
     </t-table>
-    <t-button class="m-t-10px" theme="primary" @click="handleAdd">
+    <t-button
+      v-if="!readonly"
+      class="m-t-10px"
+      theme="primary"
+      @click="handleAdd"
+    >
       <template #icon><svg-icon name="add-circle" color="#fff" /></template>
       添加
     </t-button>
 
     <!-- EditColumnDialog -->
     <edit-column-dialog
+      v-if="!readonly"
       v-model:visible="showEditColumnDialog"
       :curRow="curRow"
       :isOutType="isOutType"
@@ -127,9 +129,11 @@ const handleAdd = () => {
     deviceNo: '',
     supplierName: '',
     deviceStatus: '',
+    deviceBrand: '',
     scanCount: '',
     location: '',
-    address: isOutType.value ? ['', '', ''] : '',
+    address: '',
+    addressArr: ['', '', ''],
     basePhotoPath: '',
   };
   showEditColumnDialog.value = true;

+ 4 - 4
src/views/sop/sop-manage/sop-step/index.vue

@@ -26,7 +26,7 @@
       <t-collapse-panel disabled>
         <template #expandIcon></template>
         <template #header>
-          项目派单信息(SOP流水单号:{{ sop.sopNo }})
+          项目派单信息(SOP流水单号:{{ sopInfo.sopNo }})
         </template>
         <t-form colon label-width="72px">
           <t-row :gutter="[0, 4]">
@@ -371,6 +371,7 @@ const initFill = async () => {
   loading.value = false;
   crmInfo.value = res.crmInfo;
   updateSopInfo(crmInfo.value);
+  sopInfo.value.sopNo = res.sopNo;
   currFlowTaskResultSetup.value = res.currFlowTaskResult.setup;
   res.flowTaskHistoryList = res.flowTaskHistoryList || [];
   res.flowTaskHistoryList.forEach((item) => {
@@ -625,9 +626,8 @@ const submitHandle = async (approve = 'START') => {
 };
 // 编辑-保存
 const saveHandle = async () => {
-  stepChange();
-  // const valid = await form.value[0].validate();
-  // if (valid !== true) return;
+  const valid = await form.value.validate();
+  if (valid !== true) return;
 
   const res = await sopSaveApi({
     id: props.sop.id,

+ 9 - 0
src/views/system/task/task-manage/index.vue

@@ -19,6 +19,15 @@
         }"
         v-loading="tableLoading"
       >
+        <template #result="{ col, row }">
+          <span
+            :class="row.result === '成功' ? 'color-success' : 'color-error'"
+            >{{ row.result }}</span
+          >
+        </template>
+        <template #status="{ col, row }">
+          <status-tag :value="row[col.colKey]" type="taskStatus"></status-tag>
+        </template>
         <template #create-time="{ col, row }">
           {{ timestampFilter(row[col.colKey]) }}
         </template>