|
@@ -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"));
|