Browse Source

更新依赖

ZaiZai 8 tháng trước cách đây
mục cha
commit
51881aabd8

+ 1 - 1
package.json

@@ -18,7 +18,7 @@
         "dayjs": "^1.11.11",
         "echarts": "^5.5.1",
         "element-plus": "2.7.6",
-        "hc-vue3-ui": "^4.0.4",
+        "hc-vue3-ui": "^4.0.5",
         "js-base64": "^3.7.7",
         "js-fast-way": "^0.5.0",
         "js-md5": "^0.8.3",

+ 16 - 0
src/api/modules/exctab/exceltab.js

@@ -160,4 +160,20 @@ export default {
             params: form,
         })
     },
+    //保存字段信息
+    async saveColByTabId(form) {
+        return HcApi({
+            url: '/api/blade-manager/exctabcell/update',
+            method: 'post',
+            data: form,
+        })
+    },
+    //删除字段信息
+    async delColByTabId(ids) {
+        return HcApi({
+            url: '/api/blade-manager/exctabcell/remove',
+            method: 'post',
+            params: { ids },
+        })
+    },
 }

+ 67 - 0
src/views/exctab/element/add-col-tab.vue

@@ -0,0 +1,67 @@
+<template>
+    <hc-dialog v-model="isShow" ui="hc-exctab-element-add-col-tab" title="添加新元素字段" widths="800px" :padding="false" @close="dialogClose">
+        11111
+        <template #footer>
+            <el-button hc-btn @click="dialogClose">取消</el-button>
+            <el-button hc-btn type="primary" :loading="submitLoading" @click="dialogSubmit">提交</el-button>
+        </template>
+    </hc-dialog>
+</template>
+
+<script setup>
+import { nextTick, ref, watch } from 'vue'
+import { getDictionaryData } from '~uti/tools'
+import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
+import mainApi from '~api/exctab/exceltab'
+
+const props = defineProps({
+    info: {
+        type: Object,
+        default: () => ({}),
+    },
+})
+
+//事件
+const emit = defineEmits(['finish', 'close'])
+
+//双向绑定
+const isShow = defineModel('modelValue', {
+    default: false,
+})
+
+//监听可否编辑
+const dataInfo = ref(props.info)
+watch(() => props.info, (data) => {
+    dataInfo.value = data
+}, { immediate: true, deep: true })
+
+//监听显示
+watch(isShow, (val) => {
+    if (val) getInfoData()
+})
+
+//获取数据详情
+const getInfoData = () => {
+
+}
+
+//提交
+const submitLoading = ref(false)
+const dialogSubmit = async () => {
+    emit('finish')
+}
+
+//关闭弹窗
+const dialogClose = () => {
+    isShow.value = false
+    submitLoading.value = false
+    emit('close')
+}
+</script>
+
+<style lang="scss">
+.el-overlay-dialog .el-dialog.hc-new-dialog.hc-exctab-element-add-col-tab .el-dialog__body{
+    height: 660px;
+    padding: 12px 0;
+}
+</style>

+ 29 - 8
src/views/exctab/element/index.vue

@@ -28,12 +28,13 @@
             <template #right>
                 <hc-card>
                     <template #header>
-                        <el-button color="#567722" size="small" class="text-white">元素匹配</el-button>
-                        <el-button color="#67C23B" size="small" class="text-white">调整表单</el-button>
+                        <el-button color="#2550A2" size="small" class="text-white">关联WBS并创建元素</el-button>
+                        <el-button color="#FF986A" size="small" class="text-white">添加到元素库</el-button>
+                        <!-- el-button color="#567722" size="small" class="text-white">元素匹配</el-button>
+                        <el-button color="#67C23B" size="small" class="text-white">调整表单</el-button -->
                     </template>
                     <template #extra>
-                        <el-button color="#FF986A" size="small" class="text-white">添加到元素库</el-button>
-                        <el-button color="#2550A2" size="small" class="text-white">关联WBS并创建元素</el-button>
+                        <el-button type="primary" size="small" @click="addColByTab">新增</el-button>
                     </template>
                     <hc-table ref="tabRef" :column="tableColumn" :datas="tableData" :index-style="{ width: 60 }" @row-click="tableRowClick">
                         <template #textInfo="{ row }">
@@ -55,13 +56,17 @@
                 </hc-card>
             </template>
         </hc-page-split>
+        <!-- 添加新元素字段 -->
+        <HcAddColTab v-model="addColTabShow" />
     </hc-drawer>
 </template>
 
 <script setup>
+import { HcDelMsg } from 'hc-vue3-ui'
 import { ref, watch } from 'vue'
 import { getArrValue, isNullES, isString } from 'js-fast-way'
 import { getDictionaryData } from '~uti/tools'
+import HcAddColTab from './add-col-tab.vue'
 import mainApi from '~api/exctab/exceltab'
 
 const props = defineProps({
@@ -215,13 +220,31 @@ const tableRowClick = ({ row }) => {
 }
 
 //保存元素表格
-const saveRowClick = (row) => {
-
+const saveRowClick = async (row) => {
+    if (isNullES(row.textInfo)) {
+        window?.$message.warning('请填写元素名称')
+        return
+    }
+    const { isRes } = await mainApi.saveColByTabId(row)
+    if (!isRes) return
+    window.$message.success('保存成功')
 }
 
 //删除元素表格
 const delRowClick = (row) => {
+    HcDelMsg(async (resolve) => {
+        const { isRes } = await mainApi.delColByTabId(row.id)
+        resolve() //关闭弹窗的回调
+        if (!isRes) return
+        window.$message.success('删除成功')
+        getTableData().then()
+    })
+}
 
+//添加新元素字段
+const addColTabShow = ref(false)
+const addColByTab = () => {
+    addColTabShow.value = true
 }
 
 //关闭抽屉
@@ -233,9 +256,7 @@ const drawerClose = () => {
 </script>
 
 <style scoped lang="scss">
-.hc-element-recognition {
 
-}
 </style>
 
 <style lang="scss">

+ 4 - 4
yarn.lock

@@ -2017,10 +2017,10 @@ has-flag@^4.0.0:
   resolved "http://39.108.216.210:9000/has-flag/-/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
   integrity sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==
 
-hc-vue3-ui@^4.0.4:
-  version "4.0.4"
-  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-4.0.4.tgz#c9deeaf8a4fe14adcf5d927c5f36c9345742a789"
-  integrity sha512-wT3RRoj196XqQ0oaao/qR37TOjCdSKlm46F1jOpPnPt/jUXAar+mwM7/+dkCGC+Zs2/YoPyxfeajisFCqWEARQ==
+hc-vue3-ui@^4.0.5:
+  version "4.0.5"
+  resolved "http://39.108.216.210:9000/hc-vue3-ui/-/hc-vue3-ui-4.0.5.tgz#6884ba25d6d887583d5c6479cc7a8f8e277e2c37"
+  integrity sha512-ou9IFaI8vhiU6rrtzlAMOvNOrdMauo/fU1gyu4nbLq0wL0lqKUUrh++UiTLe8BoNFxZI/NcCI48y8ExfeuQXPQ==
   dependencies:
     axios "^1.7.2"
     dayjs "^1.11.11"