duy 1 жил өмнө
parent
commit
e63a8dcf06

+ 6 - 1
src/api/modules/other.js

@@ -20,7 +20,12 @@ export const getDictionary = (form, msg = true) => HcApi({
     method: 'get',
     params: form,
 }, msg)
-
+//业务字典
+export const getDictionaryBiz = (form, msg = true) => HcApi({
+    url: '/api/blade-system/dict-biz/dictionary',
+    method: 'get',
+    params: form,
+}, msg)
 //获取用户列表
 export const getContractUserList = (form, msg = true) => HcApi({
     url: '/api/blade-manager/contractInfo/get-contract-userList',

+ 10 - 4
src/views/project/debit/contract/components/unit/row-data.vue

@@ -17,7 +17,7 @@
                         </el-form-item>
                     </el-col>
                     <el-col :span="6">
-                        <el-form-item label="节点类型:">
+                        <el-form-item label="节点类型:" prop="nodeType">
                             <el-select v-model="formModel.nodeType" block>
                                 <el-option
                                     v-for="item in nodeOptions" :key="item.id" :label="item.dictValue"
@@ -195,6 +195,7 @@ import { nextTick, ref, watch } from 'vue'
 import { isNumberReg } from '~uti/tools'
 import AddCheckList from './addCheckList.vue'
 import unitApi from '~api/project/debit/contract/unit.js'
+import { getDictionaryBiz } from '~api/other'
 import { getDictionary } from '~api/other'
 import { formValidate, getArrValue, getObjValue, isArrIndex, isNullES } from 'js-fast-way'
 import { HcDelMsg } from 'hc-vue3-ui'
@@ -245,9 +246,9 @@ const tableRowStyle = ({ row }) => {
 
 //获节点类型
 const nodeOptions = ref([])
-const getNodeType = async (id) => {
-    const { data } = await unitApi.getNodeTypeListUpdate({
-        id,
+const getNodeType = async () => {
+    const { data } = await getDictionaryBiz({
+        code: 'meter_unit_type',
     })
     nodeOptions.value = getArrValue(data)
     nodeOptions.value.forEach((ele) => {
@@ -330,6 +331,11 @@ const formRules = ref({
         trigger: 'blur',
         message: '请输入28天强度比例',
     },
+    nodeType:{
+        required: true,
+        trigger: 'change',
+        message: '请选择节点类型',
+    },
 })
 const checkNegative = ()=>{
     if (formModel.value.sevenRatio < 0) {

+ 10 - 3
src/views/project/debit/contract/unit.vue

@@ -211,7 +211,7 @@ import { getDictionary } from '~api/other'
 import BigNumber from 'bignumber.js'
 import { getHeader } from 'hc-vue3-ui'
 
-
+import { getDictionaryBiz } from '~api/other'
 const useAppState = useAppStore()
 const projectId = ref(useAppState.getProjectId || '')
 const contractId = ref(useAppState.getContractId || '')
@@ -241,8 +241,15 @@ const setSplitRef = () => {
 //获节点类型
 const nodeOptions = ref([])
 const getNodeType = async (id) => {
-    const { data } = await unitApi.getNodeTypeList({
-        id,
+    // const { data } = await unitApi.getNodeTypeList({
+    //     id,
+    // })
+    // nodeOptions.value = getArrValue(data)
+    // nodeOptions.value.forEach((ele) => {
+    //     ele.dictKey = Number(ele.dictKey)
+    // })
+    const { data } = await getDictionaryBiz({
+        code: 'meter_unit_type',
     })
     nodeOptions.value = getArrValue(data)
     nodeOptions.value.forEach((ele) => {

+ 12 - 6
src/views/project/debit/project/unit.vue

@@ -36,7 +36,7 @@
                 <el-form-item label="节点名称:" prop="nodeName">
                     <el-input v-model="formModel.nodeName" />
                 </el-form-item>
-                <el-form-item label="节点类型:">
+                <el-form-item label="节点类型:" prop="nodeType">
                     <el-select v-model="formModel.nodeType" block>
                         <el-option v-for="item in nodeOptions" :key="item.id" :label="item.dictValue" :value="item.dictKey" />
                     </el-select>
@@ -87,7 +87,8 @@ import { arrToId, formValidate, getArrValue, getObjValue, getRandom } from 'js-f
 import unitApi from '~api/project/debit/project/unit.js'
 import { useAppStore } from '~src/store'
 import { getStoreValue, setStoreValue } from '~src/utils/storage'
-import { getDictionary } from '~api/other'
+import { getDictionaryBiz } from '~api/other'
+
 
 import { HcDelMsg } from 'hc-vue3-ui'
 const useAppState = useAppStore()
@@ -117,12 +118,12 @@ onMounted(() => {
 })
 //获节点类型
 const nodeOptions = ref([])
-const getNodeType = async (id) => {
-    const { data } = await unitApi.getNodeTypeList({
-        id,
+const getNodeType = async () => {
+    const { data } = await getDictionaryBiz({
+        code: 'meter_unit_type',
     })
     nodeOptions.value = getArrValue(data)
-    nodeOptions.value.forEach((ele)=>{
+    nodeOptions.value.forEach((ele) => {
         ele.dictKey = Number(ele.dictKey)
     })
 }
@@ -284,6 +285,11 @@ const formRules = ref({
         trigger: 'blur',
         message: '请输入节点名称',
     },
+    nodeType: {
+        required: true,
+        trigger: 'change',
+        message: '请选择节点类型',
+    },
 })
 
 //弹窗保存