|
@@ -1,6 +1,24 @@
|
|
<template>
|
|
<template>
|
|
- <hc-dialog v-model="isShow" ui="hc-exctab-element-add-col-tab" title="添加新元素字段" widths="800px" :padding="false" @close="dialogClose">
|
|
|
|
- 11111
|
|
|
|
|
|
+ <hc-dialog v-model="isShow" ui="hc-exctab-element-add-col-tab" title="添加新元素字段" widths="800px" :padding="false" :is-close="false" @close="dialogClose">
|
|
|
|
+ <template #extra>
|
|
|
|
+ <el-button type="primary" size="small" @click="addTableData">合成文本</el-button>
|
|
|
|
+ </template>
|
|
|
|
+ <hc-table ref="tabRef" :column="tableColumn" :datas="tableData" :is-index="false">
|
|
|
|
+ <template #textInfo="{ row }">
|
|
|
|
+ <hc-table-input v-model="row.textInfo" />
|
|
|
|
+ </template>
|
|
|
|
+ <template #textElementType="{ row }">
|
|
|
|
+ <el-select v-model="row.textElementType" filterable block>
|
|
|
|
+ <el-option v-for="item in dataType" :key="item.value" :label="item.label" :value="item.value" />
|
|
|
|
+ </el-select>
|
|
|
|
+ </template>
|
|
|
|
+ <template #textDeviation="{ row }">
|
|
|
|
+ <hc-table-input v-model="row.textDeviation" />
|
|
|
|
+ </template>
|
|
|
|
+ <template #action="{ index }">
|
|
|
|
+ <el-link type="danger" @click="delRowClick(index)">删除</el-link>
|
|
|
|
+ </template>
|
|
|
|
+ </hc-table>
|
|
<template #footer>
|
|
<template #footer>
|
|
<el-button hc-btn @click="dialogClose">取消</el-button>
|
|
<el-button hc-btn @click="dialogClose">取消</el-button>
|
|
<el-button hc-btn type="primary" :loading="submitLoading" @click="dialogSubmit">提交</el-button>
|
|
<el-button hc-btn type="primary" :loading="submitLoading" @click="dialogSubmit">提交</el-button>
|
|
@@ -9,9 +27,9 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { nextTick, ref, watch } from 'vue'
|
|
|
|
|
|
+import { ref, watch } from 'vue'
|
|
import { getDictionaryData } from '~uti/tools'
|
|
import { getDictionaryData } from '~uti/tools'
|
|
-import { getArrValue, getObjValue, isNullES } from 'js-fast-way'
|
|
|
|
|
|
+import { getObjValue } from 'js-fast-way'
|
|
import mainApi from '~api/exctab/exceltab'
|
|
import mainApi from '~api/exctab/exceltab'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
@@ -42,19 +60,46 @@ watch(isShow, (val) => {
|
|
|
|
|
|
//获取数据详情
|
|
//获取数据详情
|
|
const getInfoData = () => {
|
|
const getInfoData = () => {
|
|
- console.log(dataInfo.value)
|
|
|
|
getDataType()
|
|
getDataType()
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//元素表格
|
|
|
|
+const tabRef = ref(null)
|
|
|
|
+const tableColumn = [
|
|
|
|
+ { key: 'textInfo', name: '元素名称' },
|
|
|
|
+ { key: 'textElementType', name: '数据类型' },
|
|
|
|
+ { key: 'textDeviation', name: '允许偏差值' },
|
|
|
|
+ { key: 'action', name: '操作', width: 80, align: 'center' },
|
|
|
|
+]
|
|
|
|
+const tableData = ref([])
|
|
|
|
+
|
|
//获取元素类型
|
|
//获取元素类型
|
|
const dataType = ref([])
|
|
const dataType = ref([])
|
|
const getDataType = async () => {
|
|
const getDataType = async () => {
|
|
dataType.value = await getDictionaryData('data_type')
|
|
dataType.value = await getDictionaryData('data_type')
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+//新增元素
|
|
|
|
+const addTableData = () => {
|
|
|
|
+ tableData.value.push({
|
|
|
|
+ exctabId: dataInfo.value.id,
|
|
|
|
+ textInfo: '',
|
|
|
|
+ })
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//删除
|
|
|
|
+const delRowClick = (index) => {
|
|
|
|
+ tableData.value.splice(index, 1)
|
|
|
|
+}
|
|
|
|
+
|
|
//提交
|
|
//提交
|
|
const submitLoading = ref(false)
|
|
const submitLoading = ref(false)
|
|
const dialogSubmit = async () => {
|
|
const dialogSubmit = async () => {
|
|
|
|
+ submitLoading.value = true
|
|
|
|
+ const { isRes } = await mainApi.addColByTabId(tableData.value)
|
|
|
|
+ submitLoading.value = false
|
|
|
|
+ if (!isRes) return
|
|
|
|
+ window.$message.success('操作成功')
|
|
emit('finish')
|
|
emit('finish')
|
|
}
|
|
}
|
|
|
|
|
|
@@ -62,6 +107,8 @@ const dialogSubmit = async () => {
|
|
const dialogClose = () => {
|
|
const dialogClose = () => {
|
|
isShow.value = false
|
|
isShow.value = false
|
|
submitLoading.value = false
|
|
submitLoading.value = false
|
|
|
|
+ tableData.value = []
|
|
|
|
+ dataInfo.value = {}
|
|
emit('close')
|
|
emit('close')
|
|
}
|
|
}
|
|
</script>
|
|
</script>
|