刘洋 1 tahun lalu
induk
melakukan
b0aa43b9fc

+ 12 - 1
src/components/common/select-product/index.vue

@@ -27,6 +27,7 @@ const attrs = useAttrs();
 const emit = defineEmits(['update:modelValue', 'change']);
 const props = defineProps({
   modelValue: { type: [Number, String, Array], default: '' },
+  productType: { type: String, default: '' },
 });
 const isMultiple = computed(() => {
   const multiple = attrs.multiple;
@@ -36,10 +37,13 @@ const isMultiple = computed(() => {
 const search = async () => {
   optionList.value = [];
   let data = { enable: true };
+  if (props.productType) {
+    data.productType = props.productType;
+  }
   const res = await productListApi(data).catch(() => {});
   if (!res) return;
 
-  optionList.value = res;
+  optionList.value = props.productType ? res : [];
 };
 
 const onChange = () => {
@@ -65,4 +69,11 @@ watch(
     immediate: true,
   }
 );
+watch(
+  () => props.productType,
+  (val) => {
+    selected.value = '';
+    search();
+  }
+);
 </script>

+ 2 - 1
src/components/common/select-supplier/index.vue

@@ -24,7 +24,7 @@ let selected = ref('');
 
 const attrs = useAttrs();
 
-const emit = defineEmits(['update:modelValue', 'change']);
+const emit = defineEmits(['update:modelValue', 'change', 'getOptions']);
 const props = defineProps({
   modelValue: { type: [Number, String, Array], default: '' },
   type: { type: String, default: '' },
@@ -45,6 +45,7 @@ const search = async () => {
   if (!res) return;
 
   optionList.value = res;
+  emit('getOptions', optionList.value);
 };
 
 const onChange = () => {

+ 27 - 12
src/views/report/service-analysis/index.vue

@@ -432,23 +432,33 @@ const options3 = computed(() => {
 const options41 = computed(() => {
   let projectRoleQuota = result4.value?.projectRoleQuota || {};
   return createWaterBallOption({
-    data: projectRoleQuota.effectDistributed / projectRoleQuota.effectQuota,
-    title: `剩${
+    data: projectRoleQuota.effectQuota
+      ? projectRoleQuota.effectDistributed / projectRoleQuota.effectQuota
+      : 0,
+    title:
       projectRoleQuota.effectQuota - projectRoleQuota.effectDistributed
-    }配额`,
+        ? `剩${
+            projectRoleQuota.effectQuota - projectRoleQuota.effectDistributed
+          }配额`
+        : '无数据',
     radius: '80%',
   });
 });
 const options42 = computed(() => {
   let projectRoleQuota = result4.value?.projectRoleQuota || {};
   return createWaterBallOption({
-    data:
-      projectRoleQuota.coordinatorDistributed /
-      projectRoleQuota.coordinatorQuota,
-    title: `剩${
+    data: projectRoleQuota.coordinatorQuota
+      ? projectRoleQuota.coordinatorDistributed /
+        projectRoleQuota.coordinatorQuota
+      : 0,
+    title:
       projectRoleQuota.coordinatorQuota -
       projectRoleQuota.coordinatorDistributed
-    }配额`,
+        ? `剩${
+            projectRoleQuota.coordinatorQuota -
+            projectRoleQuota.coordinatorDistributed
+          }配额`
+        : '无数据',
     radius: '80%',
     color: '35, 195, 67',
   });
@@ -456,11 +466,16 @@ const options42 = computed(() => {
 const options43 = computed(() => {
   let projectRoleQuota = result4.value?.projectRoleQuota || {};
   return createWaterBallOption({
-    data:
-      projectRoleQuota.assistantDistributed / projectRoleQuota.assistantQuota,
-    title: `剩${
+    data: projectRoleQuota.assistantQuota
+      ? projectRoleQuota.assistantDistributed / projectRoleQuota.assistantQuota
+      : 0,
+    title:
       projectRoleQuota.assistantQuota - projectRoleQuota.assistantDistributed
-    }配额`,
+        ? `剩${
+            projectRoleQuota.assistantQuota -
+            projectRoleQuota.assistantDistributed
+          }配额`
+        : '无数据',
     radius: '80%',
     color: '255, 154, 46',
   });

+ 1 - 0
src/views/service-unit/dispatch/dispatch-manage/add-dispatch-dialog.vue

@@ -86,6 +86,7 @@
             <select-product
               v-model="formData.productId"
               clearable
+              :productType="formData.customType"
             ></select-product>
           </t-form-item>
         </t-col>

+ 12 - 12
src/views/sop/components/dynamic-form-item/device-table/edit-column-dialog.vue

@@ -51,7 +51,7 @@
         ></select-area>
       </t-form-item> -->
       <t-form-item label="发往地">
-        <t-input v-model="formData.address"></t-input>
+        <t-input v-model="formData.address" disabled></t-input>
       </t-form-item>
       <t-form-item label="快递单拍照" name="basePhotoPath">
         <my-upload
@@ -127,18 +127,18 @@ const rules = {
   //     trigger: 'change',
   //   },
   // ],
-  addressArr: [
-    {
-      validator: () => {
-        if (formData.addressArr.some((item) => !item))
-          return { result: false, message: '发往地必选' };
+  // addressArr: [
+  //   {
+  //     validator: () => {
+  //       if (formData.addressArr.some((item) => !item))
+  //         return { result: false, message: '发往地必选' };
 
-        return { result: true, type: 'success' };
-      },
-      type: 'error',
-      trigger: 'change',
-    },
-  ],
+  //       return { result: true, type: 'success' };
+  //     },
+  //     type: 'error',
+  //     trigger: 'change',
+  //   },
+  // ],
   basePhotoPath: [
     {
       required: true,

+ 19 - 4
src/views/system/config-manage/device-manage/edit-device-dialog.vue

@@ -52,7 +52,11 @@
         </t-col>
         <t-col :span="6">
           <t-form-item label="供应商" name="supplierId">
-            <select-supplier v-model="formData.supplierId" type="DEVICE">
+            <select-supplier
+              v-model="formData.supplierId"
+              type="DEVICE"
+              @getOptions="getSupplierOptions"
+            >
             </select-supplier>
           </t-form-item>
         </t-col>
@@ -79,9 +83,17 @@
             />
           </t-form-item>
         </t-col>
-        <t-col :span="12">
+        <t-col :span="6">
           <t-form-item label="当前所在地" name="location">
-            <select-area v-model="formData.location" :level="2"></select-area>
+            <!-- <select-area v-model="formData.location" :level="2"></select-area> -->
+            <t-select v-model="formData.location">
+              <t-option
+                v-for="item in supplierOptions"
+                :key="item.id"
+                :value="item.name"
+                :label="item.name"
+              ></t-option>
+            </t-select>
           </t-form-item>
         </t-col>
       </t-row>
@@ -112,7 +124,10 @@ const props = defineProps({
     },
   },
 });
-
+const supplierOptions = ref([]);
+const getSupplierOptions = (options) => {
+  supplierOptions.value = options;
+};
 const title = computed(() => {
   return (isEdit.value ? '编辑' : '新增') + '设备';
 });