Переглянути джерело

Merge branch 'master' into Branch_qinhb

qinhb 1 рік тому
батько
коміт
60c2e9034d

+ 18 - 0
src/common/configs/dictDataUtil.ts

@@ -19,6 +19,24 @@ const DictDataUtil = {
     device_run_status: "device_run_status",
     //设备维护频率
     device_maintenance_cycle: "device_maintenance_cycle",
+    //物料属性
+    material_properties:"material_properties",
+    //单位
+    unit:"danwei_type",
+    //物料级别
+    material_level:"material_level",
+    //质检方案
+    quality_testing_plan:"quality_testing_plan",
+    //适用平台
+    applicable_platforms:"applicable_platforms",
+    //质量等级
+    quality_grade:"quality_grade",
+    //选用类型
+    selection_type:"selection_type",
+    //阶段
+    stage:"stage",
+    //封装方法
+    packaging_method:"packaging_method",
   },
   EXPAND_FIELD_TABLE: {
     //映射表列表

+ 13 - 1
src/store/modules/dictionary.ts

@@ -6,7 +6,19 @@ export const useDictionaryStore = defineStore("dictionaryStore", {
     /**
      * 需要后端返回的type
      */
-    types: ["station_type", "station_operate_type"],
+    types: [
+      "station_type",
+      "station_operate_type",
+      "applicable_platforms",
+      "material_properties",
+      "quality_testing_plan",
+      "material_level",
+      "packaging_method",
+      "quality_grade",
+      "selection_type",
+      "stage",
+      "danwei_type",
+    ],
     dicts: [],
   }),
   persist: {

+ 171 - 0
src/views/base/materials/columns.ts

@@ -0,0 +1,171 @@
+import { useDictionaryStoreHook } from "@/store";
+const { dicts } = useDictionaryStoreHook();
+import dictDataUtil from "@/common/configs/dictDataUtil";
+export const columns = [
+  { label: "物料编码", prop: "materialCode", search: true ,rules: [{
+      required: true,
+      message: "请填写物料编码",
+      trigger: "blur"
+    }],},
+  { label: "物料名称", prop: "materialName", search: true ,rules: [{
+      required: true,
+      message: "请填写物料名称",
+      trigger: "blur"
+    }],},
+  {
+    label: "物料属性",
+    prop: "attributeDictValue",
+    search: true,
+    filterable: true,
+    type: 'select',
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.material_properties,
+    props: { label: "dictLabel", value: "dictValue" },
+    rules: [{
+      required: true,
+      message: "请选择物料属性",
+      trigger: "blur"
+    }],
+  },
+  { label: "物料规格", prop: "spec", search: true,rules: [{
+      required: true,
+      message: "请填写物料规格",
+      trigger: "blur"
+    }], },
+  {
+    label: "单位",
+    prop: "unitDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.unit,
+    props: { label: "dictLabel", value: "dictValue" },
+    rules: [{
+      required: true,
+      message: "请选择单位",
+      trigger: "blur"
+    }],
+  },
+  {
+    label: "物料级别",
+    prop: "levelDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.material_level,
+    props: { label: "dictLabel", value: "dictValue" },
+    rules: [{
+      required: true,
+      message: "请选择物料级别",
+      trigger: "blur"
+    }],
+  },
+  { label: "生产厂家", prop: "manufacturer", search: true ,rules: [{
+      required: true,
+      message: "请填写生产厂家",
+      trigger: "blur"
+    }],},
+  {
+    label: "质检方案",
+    prop: "inspectDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.quality_testing_plan,
+    props: { label: "dictLabel", value: "dictValue" },
+  },
+  {
+    label: "适用平台",
+    prop: "applicablePlatformsDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.applicable_platforms,
+    props: { label: "dictLabel", value: "dictValue" },
+    rules: [{
+     required: true, message: "请选择适用平台",
+     trigger: "blur"
+    }],
+  },
+  {
+    label: "质量等级",
+    prop: "qualityLevelDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.quality_grade,
+    props: { label: "dictLabel", value: "dictValue" },
+    rules: [{
+      required: true,
+      message: "请选择质量等级",
+      trigger: "blur"
+    }],
+  },
+  {
+    label: "选用类型",
+    prop: "selectionDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.selection_type,
+    props: { label: "dictLabel", value: "dictValue" },
+  },
+  {
+    label: "产品阶段",
+    prop: "stageDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.stage,
+    props: { label: "dictLabel", value: "dictValue" },
+  },
+  { label: "客户型号", prop: "customerModel", search: true },
+  { label: "保质期(天)", prop: "qualityGuaranteePeriod", search: true },
+
+
+
+
+
+
+  {
+    label: "封装方法",
+    prop: "packageDictValue",
+    search: true,
+    filterable: true,
+    type: "select",
+    dicUrl:dictDataUtil.request_url+dictDataUtil.TYPE_CODE.packaging_method,
+    props: { label: "dictLabel", value: "dictValue" },
+  },
+
+  {
+    label: "是否工装",
+    prop: "frock",
+    search: true,
+    filterable: true,
+    type: "radio", //类型为单选框
+    dicData: [
+      {
+        label: "是",
+        value: 1,
+      },
+      {
+        label: "否",
+        value: 0,
+      },
+
+    ],
+    value: 1,
+    rules: [{
+      required: true,
+      message: "是否工装",
+      trigger: "blur"
+    }],
+  },
+
+
+
+
+
+  { label: "筛选规范", prop: "selectionSpec", search: true , type: "textarea",span:18},
+
+  { label: "备注", prop: "remark", type: "textarea", span:18 },
+];

+ 115 - 0
src/views/base/materials/index.vue

@@ -0,0 +1,115 @@
+<template>
+  <div class="mainContentBox">
+    <avue-crud
+      ref="crudRef"
+      v-model:search="search"
+      v-model="form"
+      :data="data"
+      :option="option"
+      v-model:page="page"
+      @row-save="createRow"
+      @row-update="updateRow"
+      @row-del="deleteRow"
+      @search-change="searchChange"
+      @search-reset="resetChange"
+      @size-change="dataList"
+      @current-change="dataList"
+      @selection-change="selectionChange"
+    >
+      <template #menu-left="{ size }">
+        <el-button
+          :disabled="toDeleteIds.length < 1"
+          type="danger"
+          icon="el-icon-delete"
+          :size="size"
+          @click="multipleDelete"
+          >删除</el-button
+        >
+      </template>
+      <template #menu-right="{}">
+        <el-dropdown split-button
+          >导入
+          <template #dropdown>
+            <el-dropdown-menu>
+              <el-dropdown-item
+                @click="downloadTemplate('/api/v1/plan/order/template')"
+              >
+                <i-ep-download />下载模板
+              </el-dropdown-item>
+              <el-dropdown-item @click="importExcelData">
+                <i-ep-top />导入数据
+              </el-dropdown-item>
+            </el-dropdown-menu>
+          </template>
+        </el-dropdown>
+        <el-button
+          class="ml-3"
+          @click="exportData('/api/v1/plan/order/export')"
+        >
+          <template #icon> <i-ep-download /> </template>导出
+        </el-button>
+      </template>
+    </avue-crud>
+    <ExcelUpload ref="uploadRef" @finished="uploadFinished" />
+  </div>
+</template>
+<script setup>
+import { ref, getCurrentInstance } from "vue";
+import { useCrud } from "@/hooks/userCrud";
+import ButtonPermKeys from "@/common/configs/buttonPermission";
+import { columns } from "./columns";
+import { useCommonStoreHook, useDictionaryStoreHook } from "@/store";
+const { isShowTable, tableType } = toRefs(useCommonStoreHook());
+// 数据字典相关
+const { dicts } = useDictionaryStoreHook();
+
+const test = () => {
+  isShowTable.value = true;
+  tableType.value = tableType.value == 1 ? 2 : 1;
+};
+
+// 传入一个url,后面不带/
+const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+  useCrud({
+    src: "/api/v1/base/material",
+  });
+const { dataList, createRow, updateRow, deleteRow, searchChange, resetChange } =
+  Methords; //增删改查
+const { selectionChange, multipleDelete } = Methords; //选中和批量删除事件
+const { checkBtnPerm, downloadTemplate, exportData } = Utils; //按钮权限等工具
+// checkBtnPerm(ButtonPermKeys.PLAN.BTNS.order_add) :permission="permission"
+// const permission = reactive({
+//   delBtn: checkPerm(buttonPermission.PLAN.BTNS.order_del),
+//   addBtn: checkPerm(buttonPermission.PLAN.BTNS.order_add),
+//   editBtn: checkPerm(buttonPermission.PLAN.BTNS.order_edit),
+//   menu: true,
+// });
+
+const crudRef = ref(null); //crudRef.value 获取avue-crud对象
+
+onMounted(() => {
+  // console.log("crudRef", crudRef)
+  dataList();
+});
+
+/**
+ * 上传excel相关
+ */
+const uploadRef = ref(null);
+const uploadFinished = () => {
+  // 上传完成后的刷新操作
+  page.currentPage = 1;
+  dataList();
+};
+const importExcelData = () => {
+  if (uploadRef.value) {
+    uploadRef.value.show("/api/v1/plan/order/import");
+  }
+};
+
+// 设置表格列或者其他自定义的option
+option.value = Object.assign(option.value, {
+  selection: true,
+  column: columns,
+});
+</script>

+ 19 - 10
src/views/system/dict/components/dict-item.vue

@@ -60,7 +60,7 @@ const dialog = reactive({
 });
 
 const formData = reactive<DictForm>({
-  state: 1,
+  state: 0,
   dictCode: props.typeCode,
   dictSort: 1,
 });
@@ -114,8 +114,8 @@ function openDialog(form?: any) {
     Object.assign(formData, form);
   } else {
     dialog.title = "新增字典";
-    dataFormRef.label = ''
-    dataFormRef.value = ''
+    dataFormRef.value.label = "";
+    dataFormRef.value = "";
   }
 }
 
@@ -199,7 +199,7 @@ onMounted?.(() => {
 
 <template>
   <div class="app-container">
-<!--    <div class="search-container">
+    <!--    <div class="search-container">
       &lt;!&ndash; 搜索表单 &ndash;&gt;
       <el-form ref="queryFormRef" :model="queryParams" :inline="true">
         <el-form-item label="关键字" prop="name">
@@ -225,7 +225,7 @@ onMounted?.(() => {
           @click="openDialog()"
           ><i-ep-plus />新增</el-button
         >
-<!--        <el-button
+        <!--        <el-button
           v-hasPerm="[ButtonPermKeys.SYSTEM.BTNS.dict_del]"
           type="danger"
           :disabled="ids.length === 0"
@@ -260,7 +260,7 @@ onMounted?.(() => {
               @click="openDialog(scope.row)"
               ><i-ep-edit />编辑</el-button
             >
-<!--            <el-button
+            <!--            <el-button
               v-hasPerm="[ButtonPermKeys.SYSTEM.BTNS.dict_del]"
               type="primary"
               link
@@ -297,8 +297,17 @@ onMounted?.(() => {
           <el-input v-model="formData.dictLabel" placeholder="请输入字典名称" />
         </el-form-item>
         <el-form-item label="字典值" prop="dictValue">
-          <el-input v-if="formData.id" disabled v-model="formData.dictValue" placeholder="字典值" />
-          <el-input v-if="!formData.id" v-model="formData.dictValue" placeholder="字典值" />
+          <el-input
+            v-if="formData.id"
+            disabled
+            v-model="formData.dictValue"
+            placeholder="字典值"
+          />
+          <el-input
+            v-if="!formData.id"
+            v-model="formData.dictValue"
+            placeholder="字典值"
+          />
         </el-form-item>
 
         <el-form-item label="排序" prop="dictSort">
@@ -310,8 +319,8 @@ onMounted?.(() => {
         </el-form-item>
         <el-form-item label="状态" prop="status">
           <el-radio-group v-model="formData.state">
-            <el-radio :value=0>正常</el-radio>
-            <el-radio :value=1>停用</el-radio>
+            <el-radio :value="0">正常</el-radio>
+            <el-radio :value="1">停用</el-radio>
           </el-radio-group>
         </el-form-item>
         <el-form-item label="备注" prop="remark">

+ 9 - 10
src/views/system/dict/index.vue

@@ -88,10 +88,10 @@ function openDialog(row?: any) {
     dialog.title = "修改字典类型";
     Object.assign(formData, row);
   } else {
-    formData.id = null
-    formData.dictName = ''
-    formData.dictType = ''
-    formData.remark = ''
+    formData.id = null;
+    formData.dictName = "";
+    formData.dictType = "";
+    formData.remark = "";
     dialog.title = "新增字典类型";
   }
 }
@@ -253,7 +253,7 @@ onMounted?.(() => {
               @click.stop="openDialog(scope.row)"
               ><i-ep-edit />编辑</el-button
             >
-<!--            <el-button
+            <!--            <el-button
               v-hasPerm="[ButtonPermKeys.SYSTEM.BTNS.dictType_del]"
               type="primary"
               link
@@ -291,10 +291,9 @@ onMounted?.(() => {
         </el-form-item>
         <el-form-item label="字典编码" prop="dictType">
           <el-input
-              v-model="formData.dictType"
-              v-if="formData.id"
-              disabled
-              placeholder="请输入字典编码 sys_test user_test"
+            v-model="formData.dictType"
+            v-if="formData.id"
+            placeholder="请输入字典编码 sys_test user_test"
           />
           <el-input
             v-model="formData.dictType"
@@ -308,7 +307,7 @@ onMounted?.(() => {
             <el-radio :value="0">停用</el-radio>
           </el-radio-group>
         </el-form-item>
-<!--        <el-form-item label="字典类别" prop="type">
+        <!--        <el-form-item label="字典类别" prop="type">
           <el-radio-group v-model="formData.type">
             <el-radio value="0">用户字典</el-radio>
             <el-radio value="1">系统字典</el-radio>