Forráskód Böngészése

feat:增加质量目标维护

lupeng 2 napja
szülő
commit
e2240bf883

+ 12 - 1
src/components/CommonTable/index.vue

@@ -13,6 +13,7 @@
       :data="data"
       :option="option"
       v-model:page="page"
+      :row-class-name="rowStyle"
       @row-click="rowClick"
       @row-save="createRow"
       @row-update="updateRow"
@@ -60,7 +61,11 @@ const props = defineProps({
     type: Boolean,
   },
 });
-
+const rowStyle = ({row}) => {
+   if(row.isSelected){
+     return "row-color";
+   }
+}
 const isShowTable = ref(false);
 const startSelect = async (param) => {
   if (param) {
@@ -229,3 +234,9 @@ const onSelected = () => {
 
 defineExpose({ startSelect, refreshDictData, mergeOption });
 </script>
+<style>
+   .row-color{
+       background-color: #d3d3d3 !important;
+       pointer-events: none;
+   }
+</style>

+ 31 - 5
src/views/statistic/qualityGoal/index.vue

@@ -37,11 +37,10 @@
 <script setup>
 import { ref, getCurrentInstance } from "vue";
 import { useCrud } from "@/hooks/userCrud";
-import reportTemplate from "@/components/ReportView/reportTemplate.vue";
 import ProcessGoal from "./processGoal.vue";
 import dictDataUtil from "@/common/configs/dictDataUtil";
 // 传入一个url,后面不带/
-const { form, data, option, search, page, toDeleteIds, Methords, Utils } =
+const { form, data, option, search, page, Methords, Utils } =
   useCrud({
     src: "/api/v1/categoryTarget",
   });
@@ -71,6 +70,7 @@ option.value = Object.assign(option.value, {
       label: "产品类型",
       prop: "prodtCategory",
       type: "select",
+      search: "true",
       dicUrl:
         dictDataUtil.request_url +
         dictDataUtil.EXPAND_FIELD_TABLE.prodt_category,
@@ -78,31 +78,57 @@ option.value = Object.assign(option.value, {
         label: "dictLabel",
         value: "dictValue",
       },
+      rules: [
+        {
+          required: true,
+          message: "请选择产品类型",
+          trigger: "blur",
+        },
+      ],
     },
     {
       label: "年份",
       prop: "year",
+      type: "year",
+      format: "YYYY",
+      search: "true",
+      valueFormat: "YYYY",
+      rules: [
+        {
+          required: true,
+          message: "请选择年份",
+          trigger: "blur",
+        },
+      ],
     },
     {
       label: "成品率(%)",
       prop: "yield",
+      rules: [
+        {
+          required: true,
+          message: "请填写成品率",
+          trigger: "blur",
+        },
+      ],
     },
     {
       label: "是否显示",
       prop: "isShow",
+      search: "true",
       type: "radio", //类型为单选框
       addDisplay: false,
       dicData: [
         {
           label: "否",
-          value: false,
+          value: "0",
         },
         {
           label: "是",
-          value: true,
+          value: "1",
         },
       ],
-      value: true,
+      value: "1",
     },
   ],
 });

+ 22 - 3
src/views/statistic/qualityGoal/processGoal.vue

@@ -26,7 +26,16 @@ option.value = Object.assign(option.value, {
     {
       label: "工序编码",
       prop: "operationCode",
-      readonly: "true",
+      display: false,
+      search: "true",
+
+
+    },
+    {
+      label: "工序编号",
+      prop: "operationCodes",
+      readonly: true,
+      hide: true,
       rules: [
         {
           required: true,
@@ -41,13 +50,16 @@ option.value = Object.assign(option.value, {
     {
       label: "工序名称",
       prop: "operationName",
+      search: "true",
       disabled: "true",
     },
+
     {
       label: "目标值(%)",
       prop: "target",
       type: "number",
       min: 0,
+      max: 100,
       rules: [
         {
           required: true,
@@ -76,8 +88,15 @@ defineExpose({
 const commonTableRef = ref({});
 const commonTableType = ref("PROCESS_SELECT");
 const onSelectedFinish = (row) => {
-  console.log("onSelectedFinish", row);
-  // form.value.operationCode = row.operationCode;
+  if(!row||!row.operationCode){
+    ElMessage.error("未选择任何工序!");
+    return;
+  }
+  if(row.isSelect==="1"){
+    ElMessage.error("该工序已被选过,不可再次选择!");
+    return;
+  }
+  form.value.operationCodes = row.operationCode;
   form.value = { ...row };
   form.value.targetId = targetId.value;
 };