wenhongquan 3 years ago
parent
commit
8c9641c771

+ 8 - 0
.env.dev

@@ -0,0 +1,8 @@
+# .env.dev
+
+NODE_ENV = dev
+
+VITE_API_SERVER = 'http://61.147.254.211:30876'
+VITE_MAP_SERVER = 'http://61.147.254.211:21009'
+VITE_LOGIN_SERVER = 'http://61.147.254.211:9999'
+VITE_DH_SERVER = 'http://sqdh.xt.wenhq.top:8083'

+ 8 - 0
.env.prod

@@ -0,0 +1,8 @@
+# .env.dev
+
+NODE_ENV = prod
+
+VITE_API_SERVER = 'http://61.147.254.211:30876'
+VITE_MAP_SERVER = 'http://61.147.254.211:21009'
+VITE_LOGIN_SERVER = 'http://61.147.254.211:9999'
+VITE_DH_SERVER = 'http://sqdh.xt.wenhq.top:8083'

+ 8 - 0
.env.test

@@ -0,0 +1,8 @@
+# .env.dev
+
+NODE_ENV = test
+
+VITE_API_SERVER = 'http://61.147.254.211:30876'
+VITE_MAP_SERVER = 'http://61.147.254.211:21009'
+VITE_LOGIN_SERVER = 'http://61.147.254.211:9999'
+VITE_DH_SERVER = 'http://sqdh.xt.wenhq.top:8083'

+ 57 - 56
package.json

@@ -1,57 +1,58 @@
 {
-  "name": "squi",
-  "version": "0.1.0",
-  "private": true,
-  "scripts": {
-    "dev": "vite serve",
-    "build": "vite build",
-    "lint": "eslint --fix --ext .ts,.tsx,.json src"
-  },
-  "dependencies": {
-    "@element-plus/icons": "^0.0.11",
-    "axios": "^0.24.0",
-    "clsx": "^1.1.1",
-    "core-js": "^3.6.5",
-    "echarts": "^5.2.1",
-    "element-plus": "^1.1.0-beta.24",
-    "nprogress": "^0.2.0",
-    "ol": "^6.9.0",
-    "pinia": "^2.0.0",
-    "vant": "3",
-    "vue": "^3.0.0",
-    "vue-router": "^4.0.12",
-    "vuex": "^4.0.0-0"
-  },
-  "devDependencies": {
-    "@types/lodash": "^4.14.176",
-    "@types/node": "^16.11.6",
-    "@types/nprogress": "^0.2.0",
-    "@typescript-eslint/eslint-plugin": "^5.2.0",
-    "@typescript-eslint/parser": "^5.2.0",
-    "@vitejs/plugin-vue": "^1.9.3",
-    "@vitejs/plugin-vue-jsx": "^1.2.0",
-    "@vue/babel-plugin-jsx": "^1.1.1",
-    "@vue/compiler-sfc": "^3.0.0",
-    "@vue/eslint-config-prettier": "^6.0.0",
-    "@vue/eslint-config-typescript": "^8.0.0",
-    "babel-eslint": "^10.1.0",
-    "eslint": "^6.7.2",
-    "eslint-plugin-prettier": "^4.0.0",
-    "eslint-plugin-vue": "^7.0.0",
-    "prettier": "^2.4.1",
-    "sass": "^1.27.0",
-    "sass-loader": "^10.0.4",
-    "typescript": "^4.4.4",
-    "unplugin-element-plus": "^0.1.3",
-    "unplugin-vue-components": "^0.16.0",
-    "vite": "^2.6.11",
-    "vite-plugin-style-import": "^1.4.0",
-    "vite-svg-loader": "^2.2.0",
-    "vue-cli-plugin-element-plus": "~0.0.13"
-  },
-  "browserslist": [
-    "> 1%",
-    "last 2 versions",
-    "not dead"
-  ]
-}
+    "name": "squi",
+    "version": "0.1.0",
+    "private": true,
+    "scripts": {
+        "dev": "vite serve --mode dev",
+        "build": "vite build --mode dev",
+        "prod": "vite build --mode prod",
+        "lint": "eslint --fix --ext .ts,.tsx,.json src"
+    },
+    "dependencies": {
+        "@element-plus/icons": "^0.0.11",
+        "axios": "^0.24.0",
+        "clsx": "^1.1.1",
+        "core-js": "^3.6.5",
+        "echarts": "^5.2.1",
+        "element-plus": "^1.1.0-beta.24",
+        "nprogress": "^0.2.0",
+        "ol": "^6.9.0",
+        "pinia": "^2.0.0",
+        "vant": "3",
+        "vue": "^3.0.0",
+        "vue-router": "^4.0.12",
+        "vuex": "^4.0.0-0"
+    },
+    "devDependencies": {
+        "@types/lodash": "^4.14.176",
+        "@types/node": "^16.11.6",
+        "@types/nprogress": "^0.2.0",
+        "@typescript-eslint/eslint-plugin": "^5.2.0",
+        "@typescript-eslint/parser": "^5.2.0",
+        "@vitejs/plugin-vue": "^1.9.3",
+        "@vitejs/plugin-vue-jsx": "^1.2.0",
+        "@vue/babel-plugin-jsx": "^1.1.1",
+        "@vue/compiler-sfc": "^3.0.0",
+        "@vue/eslint-config-prettier": "^6.0.0",
+        "@vue/eslint-config-typescript": "^8.0.0",
+        "babel-eslint": "^10.1.0",
+        "eslint": "^6.7.2",
+        "eslint-plugin-prettier": "^4.0.0",
+        "eslint-plugin-vue": "^7.0.0",
+        "prettier": "^2.4.1",
+        "sass": "^1.27.0",
+        "sass-loader": "^10.0.4",
+        "typescript": "^4.4.4",
+        "unplugin-element-plus": "^0.1.3",
+        "unplugin-vue-components": "^0.16.0",
+        "vite": "^2.6.11",
+        "vite-plugin-style-import": "^1.4.0",
+        "vite-svg-loader": "^2.2.0",
+        "vue-cli-plugin-element-plus": "~0.0.13"
+    },
+    "browserslist": [
+        "> 1%",
+        "last 2 versions",
+        "not dead"
+    ]
+}

+ 9 - 6
src/store/useIncidentStore.ts

@@ -13,9 +13,12 @@ import {
   addIncidentPlanTask,
   deleteIncidentTask,
 } from '@/api/incident';
-import { ElMessage } from 'element-plus';
+import {Toast} from 'vant';
+// import { ElMessage } from 'element-plus';
 import { defineStore } from 'pinia';
 
+var ElMessage = Toast; 
+
 export interface IncidentStateType {
   incidents: IncidentListResponse;
   loading: boolean;
@@ -84,7 +87,7 @@ export default defineStore<
         ElMessage.success({ message: '新增成功' });
         return true;
       } catch {
-        ElMessage.error({ message: '新增' });
+        ElMessage.fail({ message: '新增' });
       } finally {
         this.toggleLoading();
       }
@@ -102,7 +105,7 @@ export default defineStore<
         ElMessage.success({ message: '修改成功' });
         return true;
       } catch {
-        ElMessage.error({ message: '修改失败' });
+        ElMessage.fail({ message: '修改失败' });
       } finally {
         this.toggleLoading();
       }
@@ -115,7 +118,7 @@ export default defineStore<
         ElMessage.success({ message: '添加成功' });
         return true;
       } catch {
-        ElMessage.error({ message: '添加失败' });
+        ElMessage.fail({ message: '添加失败' });
       } finally {
         this.toggleLoading();
       }
@@ -128,7 +131,7 @@ export default defineStore<
         ElMessage.success({ message: '添加成功' });
         return true;
       } catch {
-        ElMessage.error({ message: '添加失败' });
+        ElMessage.fail({ message: '添加失败' });
       } finally {
         this.toggleLoading();
       }
@@ -140,7 +143,7 @@ export default defineStore<
         ElMessage.success({ message: '删除成功' });
         return true;
       } catch {
-        ElMessage.error({ message: '删除失败' });
+        ElMessage.fail({ message: '删除失败' });
       } finally {
         this.toggleLoading();
       }

+ 7 - 4
src/utils/constant.ts

@@ -1,4 +1,7 @@
-export const BASE_URL = "http://61.147.254.211:30876/YJZH-SQ/api";
-export const BASE_USER_URL = 'http://61.147.254.211:30876/tpbd-cas';
-export const BASE_RESOURCE_URL = BASE_URL + '/common/download/resource?resource=';
-export const LOGIN_URL = 'http://61.147.254.211:9999/home/#/login';
+
+export const BASE_URL = (import.meta.env.VITE_API_SERVER as string)+'/YJZH-SQ/api';
+export const BASE_USER_URL = (import.meta.env.VITE_API_SERVER as string)+'/tpbd-cas';
+export const BASE_RESOURCE_URL =
+  BASE_URL + '/common/download/resource?resource=';
+export const LOGIN_URL =
+  (import.meta.env.VITE_LOGIN_SERVER as string) + '/home/#/login';

+ 3 - 4
src/utils/request.ts

@@ -2,13 +2,12 @@ import axios, { AxiosRequestConfig } from 'axios';
 import qs from 'querystring';
 import { ElMessage } from 'element-plus';
 import useMainStore from '@/store/useMainStore';
-import {  LOGIN_URL,BASE_URL} from "@/utils/constant"
+import {  LOGIN_URL,BASE_URL} from "./constant"
 import { indexOf } from 'lodash';
 
 const baseURL =
-  process.env.NODE_ENV === 'production'
-    ? // ? 'http://api.xt.wenhq.top:8083/mock/43/zhdd'
-      BASE_URL
+  process.env.NODE_ENV === 'prod' || process.env.NODE_ENV === 'test'
+    ? (import.meta.env.VITE_API_SERVER as string) + '/YJZH-SQ/api'
     : '/api';
 
 const CancelToken = axios.CancelToken;

+ 53 - 0
src/views/IncidentManagementDetail/index.scss

@@ -25,10 +25,63 @@
         }
         .zl {
             color: #333333;
+            padding-bottom: 12px;
         }
         div {
             background: rgba(0, 0, 0, 0);
             color: #666666
         }
+        .cz-zh {
+            padding-bottom: 12px;
+        }
+    }
+    .czxq-item {
+        padding-left: 23px;
+        position: relative;
+        font-size: 14px;
+        font-weight: 400;
+        text-align: left;
+        .cz-yuan {
+            width: 10px;
+            height: 10px;
+            border: 2px solid #0B33A8;
+            border-radius: 10px;
+            position: absolute;
+            top: 3px;
+            left: 0;
+            background: white;
+            z-index: 1;
+        }
+        .cz-line {
+            width: 2px;
+            background: #f0f2f5;
+            position: absolute;
+            height: 100%;
+            left: 6px;
+            top: 10px;
+        }
+        .cz-time {}
+        .cz-des {
+            font-size: 14px;
+            font-weight: 400;
+            text-align: left;
+            color: #333333;
+            padding-bottom: 16px;
+        }
+    }
+    .van-field {
+        background: #ffffff;
+        border: 1px solid #dcdfe6;
+        border-radius: 4px;
+    }
+    .cz-action {
+        margin-top: 16px;
+        >button {
+            margin-right: 12px;
+        }
+        button {
+            width: 60px;
+            height: 32px;
+        }
     }
 }

+ 78 - 26
src/views/IncidentManagementDetail/index.tsx

@@ -12,7 +12,11 @@ import {
   Sticky,
   Collapse,
   CollapseItem,
+  Field,
+  Button,
   Loading,
+  Toast,
+  Step, Steps 
 } from 'vant';
 /** @ts-ignore */
 import icon_communication from '@/assets/icons/incident/communication@2x.png';
@@ -47,6 +51,22 @@ export default defineComponent({
     const commonStore = useCommonStore();
 
     const activeNames = ref([]);
+    const activeoplanNames = ref([]);
+    const message = ref("");
+    const dosubmitdata = () => { 
+      if (!store.incidentDetail.baseInfo?.id || message.value == "") {
+        Toast.fail('信息不完整');
+      }
+        store.addIncidentProcess({
+          incidentId: store.incidentDetail.baseInfo?.id,
+          des: message.value,
+        }).then(() => { 
+          message.value = "";
+            store.getIncidentItem(store.incidentDetail.baseInfo?.id ?? '');
+        });
+      
+      
+    };
 
     const planOptions = computed(
       () =>
@@ -127,7 +147,7 @@ export default defineComponent({
               {commonStore.globalDict['zhdd_incident_source']?.find(
                 (i) =>
                   i.dictValue?.toString() ===
-                  store.incidentDetail?.baseInfo['source']?.toString(),
+                  (store.incidentDetail?.baseInfo?.source ?? '').toString(),
               )?.dictLabel ?? '-'}
             </p>
           </CollapseItem>
@@ -145,36 +165,68 @@ export default defineComponent({
             title="处置方案"
             name="处置方案"
             v-slots={{ icon: <img class="icon-i" src={icon_plan} /> }}>
-            {store.incidentDetail.task?.map((i) => (
-              <div class="cz-item">
-            
-                <CollapseItem title={i.taskName} name={i.taskName}>
-                  <div>
-                    指挥:
-                    {i.taskPersonVos?.map((p) => (
-                      <div>
-                        {p.person}
-                        {p.position}
-                      </div>
-                    ))}
-                  </div>
-                  <div>
-                    <div class="zl">指令</div>
-                    {i.taskCommandVos.map((c, index) => (
-                      <div>
-                        {index + 1}、{c.command}
-                      </div>
-                    ))}
-                  </div>
-                </CollapseItem>
-              </div>
-            ))}
+            <Collapse v-model={activeoplanNames.value}>
+              {store.incidentDetail.task?.map((i) => (
+                <div class="cz-item">
+                  <CollapseItem title={i.taskName} name={i.taskName}>
+                    <div class="cz-zh">
+                      {i.taskPersonVos
+                        ?.map((p) => {
+                          return p.person + p.position;
+                        })
+                        .join('、')}
+                    </div>
+                    <div>
+                      <div class="zl">指令</div>
+                      {i.taskCommandVos.map((c, index) => (
+                        <div>
+                          {index + 1}、{c.command}
+                        </div>
+                      ))}
+                    </div>
+                  </CollapseItem>
+                </div>
+              ))}
+            </Collapse>
           </CollapseItem>
           <CollapseItem
             title="处置详情"
             name="处置详情"
             v-slots={{ icon: <img class="icon-i" src={icon_detail} /> }}>
-            123
+            <div>
+              {store.incidentDetail.process?.map((i, index) => (
+                <div class="czxq-item">
+                  <div class="cz-yuan"></div>
+                  <div
+                    class="cz-line"
+                    style={`display:${
+                      index == (store.incidentDetail.process?.length ?? 0) - 1
+                        ? 'none'
+                        : 'block'
+                    }`}></div>
+                  <div class="cz-time"> {i.createTime}</div>
+                  <div class="cz-des"> {i.des}</div>
+                </div>
+              ))}
+              <Field
+                v-model={message.value}
+                autosize
+                type="textarea"
+                placeholder="请输入"
+              />
+              <div class="cz-action">
+                <Button size="small" type="primary" onClick={() => { 
+                  dosubmitdata();
+                }}>
+                  保存
+                </Button>
+                <Button size="small" type="default" onClick={() => { 
+                  message.value="";
+                }}>
+                  取消
+                </Button>
+              </div>
+            </div>
           </CollapseItem>
           <CollapseItem
             title="融合通信"

+ 7 - 2
vite.config.ts

@@ -1,5 +1,5 @@
 import path from "path";
-import { UserConfigExport, ConfigEnv } from "vite";
+import { UserConfigExport, ConfigEnv,loadEnv } from "vite";
 import vueJsx from "@vitejs/plugin-vue-jsx";
 import vue from "@vitejs/plugin-vue";
 import svgLoader from "vite-svg-loader";
@@ -8,6 +8,11 @@ import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
 import ElementPlus from "unplugin-element-plus/vite";
 import {  LOGIN_URL,BASE_URL} from "./src/utils/constant"
 import styleImport from "vite-plugin-style-import";
+
+const getEnvFn = (mode, target) => {
+  return loadEnv(mode, process.cwd())[target];
+};
+
 /**
  * @type {import('vite').UserConfig}
  * @link {https://vitejs.cn/config/}
@@ -26,7 +31,7 @@ export default ({ command, mode }: ConfigEnv): UserConfigExport => {
       proxy: {
         "/api": {
           // target: "http://sqpcbg.xt.wenhq.top:8083/",
-          target:BASE_URL,
+          target:(getEnvFn(mode,"VITE_API_SERVER") as string)+'/YJZH-SQ/api',
           changeOrigin: true,
           rewrite: (path) => path.replace(/^\/api/, ''),
         },