浏览代码

fix:bug修复,物料导入导出优化

lupeng 1 年之前
父节点
当前提交
c73e377904

+ 79 - 156
src/views/base/materials/columns.ts

@@ -1,81 +1,49 @@
 import { useDictionaryStoreHook } from "@/store";
 const { dicts } = useDictionaryStoreHook();
-
 export const columns = [
-  {
-    label: "物料编码",
-    prop: "materialCode",
-    width: 130,
-    overHidden: true,
-    search: true,
-    rules: [
-      {
-        required: true,
-        editDisabled: false,
-        message: "请填写物料编码",
-        trigger: "blur",
-      },
-    ],
-  },
-  {
-    label: "物料名称",
-    prop: "materialName",
-    width: 140,
-    overHidden: true,
-    search: true,
-    rules: [
-      {
-        required: true,
-        message: "请填写物料名称",
-        trigger: "blur",
-      },
-    ],
-  },
+  { label: "物料编码", prop: "materialCode", width: 130,overHidden: true,search: true ,rules: [{
+      required: true,
+      editDisabled:false,
+      message: "请填写物料编码",
+      trigger: "blur"
+    }],},
+  { label: "物料名称", prop: "materialName", width: 140,overHidden: true,search: true ,rules: [{
+      required: true,
+      message: "请填写物料名称",
+      trigger: "blur"
+    }],},
   {
     label: "物料属性",
     prop: "attributeDictValue",
     search: true,
     filterable: true,
-    type: "select",
-    width: 100,
-    overHidden: true,
-    dicData: dicts.material_properties,
+    type: 'select',
+    width: 100,overHidden: true,
+    dicData:dicts.material_properties,
     props: { label: "dictLabel", value: "dictValue" },
-    rules: [
-      {
-        required: true,
-        message: "请选择物料属性",
-        trigger: "blur",
-      },
-    ],
-  },
-  {
-    label: "物料规格",
-    prop: "spec",
-    width: 100,
-    overHidden: true,
-    rules: [
-      {
-        required: true,
-        message: "请填写物料规格",
-        trigger: "blur",
-      },
-    ],
-  },
+    rules: [{
+      required: true,
+      message: "请选择物料属性",
+      trigger: "blur"
+    }],
+  },
+  { label: "物料规格", prop: "spec", width: 100,overHidden: true,rules: [{
+      required: true,
+      message: "请填写物料规格",
+      trigger: "blur"
+    }], },
   {
     label: "单位",
     prop: "unitDictValue",
     filterable: true,
     type: "select",
-    dicData: dicts.danwei_type,
+    dicData:dicts.danwei_type,
     props: { label: "dictLabel", value: "dictValue" },
-    rules: [
-      {
-        required: true,
-        message: "请选择单位",
-        trigger: "blur",
-      },
-    ],
+    rules: [{
+      required: true,
+      message: "请选择单位",
+      trigger: "blur"
+    }],
   },
   {
     label: "物料级别",
@@ -83,40 +51,28 @@ export const columns = [
     search: true,
     filterable: true,
     type: "select",
-    width: 100,
-    overHidden: true,
-    dicData: dicts.material_level,
+    width: 100,overHidden: true,
+    dicData:dicts.material_level,
     props: { label: "dictLabel", value: "dictValue" },
-    rules: [
-      {
-        required: true,
-        message: "请选择物料级别",
-        trigger: "blur",
-      },
-    ],
-  },
-  {
-    label: "生产厂家",
-    prop: "manufacturer",
-    width: 100,
-    overHidden: true,
-    rules: [
-      {
-        required: true,
-        message: "请填写生产厂家",
-        trigger: "blur",
-      },
-    ],
-  },
+    rules: [{
+      required: true,
+      message: "请选择物料级别",
+      trigger: "blur"
+    }],
+  },
+  { label: "生产厂家", prop: "manufacturer",width: 100,overHidden: true ,rules: [{
+      required: true,
+      message: "请填写生产厂家",
+      trigger: "blur"
+    }],},
   {
     label: "质检方案",
     prop: "inspectDictValue",
     search: true,
     filterable: true,
     type: "select",
-    width: 100,
-    overHidden: true,
-    dicData: dicts.quality_testing_plan,
+    width: 100,overHidden: true,
+    dicData:dicts.quality_testing_plan,
     props: { label: "dictLabel", value: "dictValue" },
   },
   {
@@ -125,45 +81,37 @@ export const columns = [
     search: true,
     filterable: true,
     type: "select",
-    width: 100,
-    overHidden: true,
-    dicData: dicts.applicable_platforms,
+    width: 100,overHidden: true,
+    dicData:dicts.applicable_platforms,
     props: { label: "dictLabel", value: "dictValue" },
-    rules: [
-      {
-        required: true,
-        message: "请选择适用平台",
-        trigger: "blur",
-      },
-    ],
+    rules: [{
+     required: true, message: "请选择适用平台",
+     trigger: "blur"
+    }],
   },
   {
     label: "质量等级",
     prop: "qualityLevelDictValue",
     search: true,
-    width: 100,
-    overHidden: true,
+    width: 100,overHidden: true,
     filterable: true,
     type: "select",
-    dicData: dicts.quality_grade,
+    dicData:dicts.quality_grade,
     props: { label: "dictLabel", value: "dictValue" },
-    rules: [
-      {
-        required: true,
-        message: "请选择质量等级",
-        trigger: "blur",
-      },
-    ],
+    rules: [{
+      required: true,
+      message: "请选择质量等级",
+      trigger: "blur"
+    }],
   },
   {
     label: "选用类型",
     prop: "selectionDictValue",
     search: true,
     filterable: true,
-    width: 100,
-    overHidden: true,
+    width: 100,overHidden: true,
     type: "select",
-    dicData: dicts.selection_type,
+    dicData:dicts.selection_type,
     props: { label: "dictLabel", value: "dictValue" },
   },
   {
@@ -171,39 +119,29 @@ export const columns = [
     prop: "stageDictValue",
     search: true,
     filterable: true,
-    width: 100,
-    overHidden: true,
+    width: 100,overHidden: true,
     type: "select",
-    dicData: dicts.stage,
+    dicData:dicts.stage,
     props: { label: "dictLabel", value: "dictValue" },
   },
-  { label: "客户型号", prop: "customerModel", width: 100, overHidden: true },
-  {
-    label: "保质期(天)",
-    prop: "qualityGuaranteePeriod",
-    width: 100,
-    overHidden: true,
-    type: "number",
-    min: 0,
-  },
+  { label: "客户型号", prop: "customerModel",width: 100,overHidden: true,  },
+  { label: "保质期(天)", prop: "qualityGuaranteePeriod",width: 100,overHidden: true,type:"number" ,min:0 },
   {
     label: "封装方法",
     prop: "packageDictValue",
     search: true,
-    width: 100,
-    overHidden: true,
+    width: 100,overHidden: true,
     filterable: true,
     type: "select",
-    dicData: dicts.packaging_method,
-    props: { label: "dictLabel", value: "dictLabel" },
+    dicData:dicts.packaging_method,
+    props: { label: "dictLabel", value: "dictValue" },
   },
 
   {
     label: "是否工装",
     prop: "frock",
     search: true,
-    width: 90,
-    overHidden: true,
+    width: 90,overHidden: true,
     filterable: true,
     type: "radio", //类型为单选框
     dicData: [
@@ -215,31 +153,16 @@ export const columns = [
         label: "否",
         value: "0",
       },
+
     ],
-    value: 1,
-    rules: [
-      {
-        required: true,
-        message: "是否工装",
-        trigger: "blur",
-      },
-    ],
-  },
-  {
-    label: "筛选规范",
-    prop: "selectionSpec",
-    width: 150,
-    overHidden: true,
-    type: "textarea",
-    span: 18,
-  },
+    value: "1",
+    rules: [{
+      required: true,
+      message: "是否工装",
+      trigger: "blur"
+    }],
+  },
+  { label: "筛选规范", prop: "selectionSpec",width: 150,overHidden: true,  type: "textarea",span:18},
 
-  {
-    label: "备注",
-    prop: "remark",
-    width: 150,
-    overHidden: true,
-    type: "textarea",
-    span: 18,
-  },
+  { label: "备注", prop: "remark", width: 150,overHidden: true,type: "textarea", span:18 },
 ];

+ 25 - 14
src/views/base/materials/components/drawing-page.vue

@@ -2,7 +2,13 @@
   <div class="mainContentBox">
     <avue-form ref="formRef" v-model="form" :option="option" @submit="rowSave">
       <template #drawingPath="scope">
-        <single-upload v-model="form.drawingPath" />
+        <!--        <single-upload v-model="form.drawingPath" :generatePdf="true"/>-->
+        <FilesUpload
+          v-model:src="fileUrl"
+          v-model:pdf-list="pdfUrlList"
+          :generate-pdf="true"
+          @finished="testFiles"
+        />
       </template>
     </avue-form>
     <avue-crud
@@ -41,7 +47,15 @@
           </el-option>
         </el-select>
       </template>
-
+      <template #menu="{row,index,type}">
+        <PDFView
+          :need-to-show-pdf="true"
+          content-type="button"
+          :is-link="true"
+          :show-pdf-number="1"
+          :pdf-source="filePath + row.pdfPath"
+        />
+      </template>
     </avue-crud>
   </div>
 </template>
@@ -55,11 +69,15 @@ const { isShowTable, tableType } = toRefs(useCommonStoreHook());
 import { useDictionaryStoreHook } from "@/store";
 import { addDrawing,getDrawing } from "@/api/drawing";
 const { dicts } = useDictionaryStoreHook();
+const filePath = import.meta.env.VITE_APP_UPLOAD_URL;
 const test = () => {
   isShowTable.value = true;
   tableType.value = tableType.value == 1 ? 2 : 1;
 };
-
+const testFiles =()=>{
+  form.value.pdfPath = pdfUrlList.value[0]
+  form.value.drawingPath = fileUrl.value
+}
 // 传入一个url,后面不带/
 const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
   useCrud({
@@ -81,7 +99,9 @@ const version=ref({
   label: '请选择图纸版本',
 });
 const options=ref([]);
-
+const fileUrl = ref(""); //单文件
+const pdfUrlList = ref([]);
+import dictDataUtil from "@/common/configs/dictDataUtil";
 const getVersionDrawing=()=>{
   if(version.value.value!="0"){
     search.value.materialCode = props.materialCode;
@@ -184,7 +204,7 @@ option.value = Object.assign(option.value, {
       filterable: true,
       type: 'select',
       width: 100,overHidden: true,
-      dicData:dicts.drawing_type,
+      dicUrl: dictDataUtil.request_url + "drawing_type",
       props: { label: "dictLabel", value: "dictValue" },
       rules: [{
         required: true,
@@ -227,21 +247,12 @@ option.value = Object.assign(option.value, {
         }
 */
     },
-    { label: "图纸",
-      prop: "drawing",
-      type: 'img',
-      span: 24,
-      display:false,
-      slot: true,
-      formatter: (row, column, cellValue, index) => {
-        return import.meta.env.VITE_APP_UPLOAD_URL+`${row.drawingPath}`;} },
 
   ],
   delBtn: false,
   editBtn: false,
   viewBtn: false,
   addBtn: false,
-  menu: false,
 });
 const props = defineProps({
   materialCode: {

+ 13 - 12
src/views/base/materials/index.vue

@@ -41,7 +41,7 @@
           <template #dropdown>
             <el-dropdown-menu>
               <el-dropdown-item
-                @click="downloadTemplate('/api/v1/plan/order/template')"
+                @click="downloadTemplate('/api/v1/base/material/template')"
               >
                 <i-ep-download />下载模板
               </el-dropdown-item>
@@ -53,7 +53,7 @@
         </el-dropdown>
         <el-button
           class="ml-3"
-          @click="exportData('/api/v1/plan/order/export')"
+          @click="exportData('/api/v1/base/material/export')"
         >
           <template #icon> <i-ep-download /> </template>导出
         </el-button>
@@ -82,8 +82,7 @@ import { useCrud } from "@/hooks/userCrud";
 import ButtonPermKeys from "@/common/configs/buttonPermission";
 import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
 const { isShowTable, tableType } = toRefs(useCommonStoreHook());
-// 数据字典相关
-const { dicts } = useDictionaryStoreHook();
+import { columns } from "./columns";
 
 const test = () => {
   isShowTable.value = true;
@@ -121,14 +120,9 @@ const binding = (row) => {
   router.push(`/base/bom/${row.materialCode}`);
 };
 onMounted(() => {
-  // 设置表格列或者其他自定义的option
-  import("./columns").then((res) => {
-    option.value = Object.assign(option.value, {
-      selection: true,
-      column: res.columns,
-    });
+
     dataList();
-  });
+
 });
 
 /**
@@ -142,7 +136,14 @@ const uploadFinished = () => {
 };
 const importExcelData = () => {
   if (uploadRef.value) {
-    uploadRef.value.show("/api/v1/plan/order/import");
+    uploadRef.value.show("/api/v1/base/material/import");
   }
 };
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  selection: true,
+  column: columns,
+});
+
 </script>

+ 9 - 2
src/views/base/skill/components/edit-skill.vue

@@ -83,7 +83,6 @@ onMounted(() => {
   getSkillDetail(props.skillId).then(
     (data)=>{
       form.value=data.data;
-      console.info("222",data2.value);
     }
   )
   search.value.employeeSkillId=props.skillId;
@@ -152,6 +151,7 @@ const onHandle=()=>{
   employeeSkill.value.userId=form.value.userId;
   employeeSkill.value.postId=form.value.postId;
   employeeSkill.value.skillList=Array.from(data.value);
+  employeeSkill.value.id=form.value.id;
   addEmployeeSkill(employeeSkill.value).then(
     (data)=>{
       if(data.code==="200") {
@@ -159,7 +159,7 @@ const onHandle=()=>{
           message: data.msg,
           type: "success",
         });
-        props.dialog.visible=false;
+        props.editDialog.visible=false;
       }
       else {
         ElMessage({
@@ -178,6 +178,13 @@ option2.value = {
   clearAbleBtn:false,
   emptyBtn:false,
   column: [
+    { label: "id", prop: "id", width: 130,overHidden: true,search: true ,
+      filterable: true,
+      width: 100,overHidden: true,
+      disabled:false,
+      display:false,
+
+    },
 
     { label: "用户id", prop: "userId", width: 130,overHidden: true,search: true ,
       filterable: true,

+ 5 - 2
src/views/base/skill/index.vue

@@ -55,7 +55,7 @@
       :title="editDialog.title"
       width="800px"
       :destroy-on-close="true"
-      @close="editDialog.visible = false"
+      @close="editClose"
     >
       <editSkill   :editDialog="editDialog" :skillId="editUser.id" :postId="editUser.postId"/>
     </el-dialog>
@@ -85,7 +85,10 @@ const editDialog = reactive({
   title: "编辑",
   visible: false,
 });
-
+const editClose=()=>{
+  editDialog.visible = false;
+  dataList();
+}
 const addRow=()=>{
   dialog.visible=true;
 }