瀏覽代碼

Merge branch 'master' into jg-master

luoxiao 2 周之前
父節點
當前提交
bbd59de2e9

+ 2 - 2
src/views/analysis/process/CList.vue

@@ -37,10 +37,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/C控制图数据导入模.xlsx'
+                    '/spc/template/C控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
             </div>
           </div>

+ 2 - 2
src/views/analysis/process/EWMAList.vue

@@ -37,10 +37,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/EWMA控制图数据导入模.xlsx'
+                    '/spc/template/EWMA控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
             </div>
           </div>

+ 2 - 2
src/views/analysis/process/I-MRList.vue

@@ -37,10 +37,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/I-MR控制图数据导入模.xlsx'
+                    '/spc/template/I-MR控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
             </div>
           </div>

+ 2 - 2
src/views/analysis/process/NPList.vue

@@ -37,10 +37,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/NP控制图数据导入模.xlsx'
+                    '/spc/template/NP控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
             </div>
           </div>

+ 2 - 2
src/views/analysis/process/PList.vue

@@ -37,10 +37,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/P控制图数据导入模.xlsx'
+                    '/spc/template/P控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
             </div>
           </div>

+ 2 - 2
src/views/analysis/process/UList.vue

@@ -37,10 +37,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/U控制图数据导入模.xlsx'
+                    '/spc/template/U控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
             </div>
           </div>

+ 5 - 4
src/views/analysis/process/Xbar-RList.vue

@@ -39,10 +39,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/XBarR控制图数据导入模.xlsx'
+                    '/spc/template/XBarR控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
               <el-button
                 style="margin-left: 15px"
@@ -356,7 +356,7 @@ import {
 import Search from "@/components/Search/index.vue";
 import { XBarRCompute, collectData } from "@/api/analysis";
 import { useCrud } from "@/hooks/userCrud";
-import {ElMessageBox} from "element-plus";
+import { ElMessageBox } from "element-plus";
 
 const { Utils } = useCrud({
   src: "/api/v1/spc/pDownloadTemplate",
@@ -667,6 +667,7 @@ const submit = () => {
 const addSubmit = async () => {
   await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
+      addData.value.type = "1";
       const { data, code } = await addDatas({
         ...addData.value,
         yearStr: year.value,
@@ -759,7 +760,7 @@ onMounted(async () => {
   await getTableData();
   uploadUrl.value =
     import.meta.env.VITE_APP_BASE_API +
-    "/api/v1/spc/xBarRUpload?operation=" +
+    "/api/v1/spc/xBarRUpload?type=1&operation=" +
     lableValue.value;
 });
 onBeforeUnmount(() => {});

+ 4 - 3
src/views/analysis/process/Xbar-SList.vue

@@ -39,10 +39,10 @@
                 @click="
                   downloadSPCTemplate(
                     '/api/v1/spc/downloadTemplate',
-                    '/spc/template/XBarS控制图数据导入模.xlsx'
+                    '/spc/template/XBarS控制图数据导入模.xlsx'
                   )
                 "
-                >模下载</el-button
+                >模下载</el-button
               >
               <el-button
                 style="margin-left: 15px"
@@ -665,6 +665,7 @@ const submit = () => {
 const addSubmit = async () => {
   await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
+      addData.value.type = "1";
       const { data, code } = await addDatas({
         ...addData.value,
         yearStr: year.value,
@@ -757,7 +758,7 @@ onMounted(async () => {
   await getTableData();
   uploadUrl.value =
     import.meta.env.VITE_APP_BASE_API +
-    "/api/v1/spc/xBarRUpload?operation=" +
+    "/api/v1/spc/xBarRUpload?type=1&operation=" +
     lableValue.value;
 });
 onBeforeUnmount(() => {});

+ 64 - 2
src/views/analysis/target/index/index.vue

@@ -87,6 +87,33 @@
               <!--                size="small"-->
               <!--                >打印</el-button-->
               <!--              >-->
+              <el-upload
+                v-if="!addStatus && !editStatus"
+                style="float: left"
+                :action="uploadUrl"
+                :on-success="handleSuccess"
+                :before-upload="beforeUpload"
+                :limit="1"
+                accept=".xlsx, .xls"
+                :show-file-list="false"
+                ref="uploadRef"
+              >
+                <el-button size="small" type="primary">Excel导入</el-button>
+              </el-upload>
+              <el-button
+                v-if="!addStatus && !editStatus"
+                style="margin-left: 15px"
+                type="primary"
+                size="small"
+                class="btn"
+                @click="
+                  downloadSPCTemplate(
+                    '/api/v1/spc/downloadTemplate',
+                    '/spc/template/过程能力指标数据导入模板.xlsx'
+                  )
+                "
+                >模板下载</el-button
+              >
               <el-button
                 v-if="!addStatus && !editStatus"
                 type="primary"
@@ -744,6 +771,13 @@ import {
 import Search from "@/components/Search/index.vue";
 import { ElMessage, ElMessageBox } from "element-plus";
 import { getDictList, updateDict } from "@/api/dict";
+import { ref } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+
+const { Utils } = useCrud({
+  src: "/api/v1/spc/pDownloadTemplate",
+});
+const { downloadSPCTemplate } = Utils;
 
 const operationList = ref();
 const initOpOptions = () => {
@@ -1562,6 +1596,7 @@ const submit = () => {
 const addSubmit = async () => {
   await ruleFormRef.value.validate(async (valid, fields) => {
     if (valid) {
+      addData.value.type = "2";
       const { data, code } = await addDatas({
         ...addData.value,
         yearStr: year.value,
@@ -1619,6 +1654,28 @@ const resetData = () => {
   getTableData();
 };
 
+const uploadUrl = ref("");
+const beforeUpload = (file) => {
+  const isExcel =
+    file.type === "application/vnd.ms-excel" ||
+    file.type ===
+      "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
+  if (!isExcel) {
+    ElMessage.error("只能上传Excel文件!");
+  }
+  return isExcel;
+};
+const uploadRef = ref("uploadRef");
+const handleSuccess = (response) => {
+  if (response.code === "200") {
+    ElMessage.success("Excel导入成功!");
+    getTableData();
+  } else {
+    ElMessage.error(response.msg);
+  }
+  uploadRef.value.clearFiles();
+};
+
 watch(
   () => showTableData.value,
   (newVal, oldVal) => {
@@ -1628,7 +1685,7 @@ watch(
     deep: true,
   }
 );
-onMounted(() => {
+onMounted(async () => {
   getTaskOption();
   setHeight();
   year.value = new Date().getFullYear() + "";
@@ -1638,7 +1695,12 @@ onMounted(() => {
     }
   });
   displayValue.value = JSON.parse(value.value);
-  getTableData();
+  await getTableData();
+
+  uploadUrl.value =
+    import.meta.env.VITE_APP_BASE_API +
+    "/api/v1/spc/xBarRUpload?type=2&operation=" +
+    lableValue.value;
   // nextTick(() => {
   //   charts1.value = echarts.init(document.getElementById("charts"));
   //   charts2.value = echarts.init(document.getElementById("charts1"));