|
@@ -2,7 +2,7 @@
|
|
|
<hc-dialog
|
|
|
v-model="isShow"
|
|
|
is-footer-center
|
|
|
- title="创建新的元素表"
|
|
|
+ :title="modelTitle"
|
|
|
@close="dialogClose"
|
|
|
@save="saveFormAndElementHandle"
|
|
|
widths="56rem"
|
|
@@ -14,6 +14,7 @@
|
|
|
:rules="formRules"
|
|
|
label-position="top"
|
|
|
label-width="auto"
|
|
|
+ v-if="!tableId"
|
|
|
>
|
|
|
<el-row :gutter="60">
|
|
|
<el-col :span="12">
|
|
@@ -88,7 +89,7 @@
|
|
|
</el-button>
|
|
|
</el-tooltip>
|
|
|
</template>
|
|
|
- <template #extra>
|
|
|
+ <template #extra v-if="!tableId">
|
|
|
<el-button size="small" type="success" @click="addRowClick"
|
|
|
>新增</el-button
|
|
|
>
|
|
@@ -210,7 +211,7 @@ import { getDictionaryData } from "~src/utils/tools";
|
|
|
import mainApi from "~api/wbs/wbsforelement";
|
|
|
import { useAppStore } from "~src/store";
|
|
|
import { HcUploadFileApi } from "hc-vue3-ui";
|
|
|
-import { formValidate, getArrValue, downloadBlob } from "js-fast-way";
|
|
|
+import { formValidate, getArrValue, downloadBlob, type } from "js-fast-way";
|
|
|
const store = useAppStore();
|
|
|
const userInfo = ref(store.getUserInfo);
|
|
|
const props = defineProps({
|
|
@@ -230,6 +231,14 @@ const props = defineProps({
|
|
|
type: Object,
|
|
|
default: () => {},
|
|
|
},
|
|
|
+ title: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
+ tableId: {
|
|
|
+ type: String,
|
|
|
+ default: "",
|
|
|
+ },
|
|
|
});
|
|
|
//事件
|
|
|
const emit = defineEmits(["close"]);
|
|
@@ -246,21 +255,46 @@ watch(isShow, (val) => {
|
|
|
emit("close");
|
|
|
}
|
|
|
});
|
|
|
+
|
|
|
const ownerTypeList = ref(props.ownerTypeList);
|
|
|
const tableTypelist = ref(props.tableTypelist);
|
|
|
const wbsId = ref(props.wid);
|
|
|
const node = ref(props.node);
|
|
|
+const modelTitle = ref(props.title);
|
|
|
+const tableId = ref(props.tableId);
|
|
|
//监听数据
|
|
|
watch(
|
|
|
- () => [props.ownerTypeList, props.tableTypelist, props.wid, props.node],
|
|
|
- ([own, table, wbsid, nodeInfo]) => {
|
|
|
+ () => [
|
|
|
+ props.ownerTypeList,
|
|
|
+ props.tableTypelist,
|
|
|
+ props.wid,
|
|
|
+ props.node,
|
|
|
+ props.title,
|
|
|
+ props.tableId,
|
|
|
+ ],
|
|
|
+ ([own, table, wbsid, nodeInfo, til, tid]) => {
|
|
|
ownerTypeList.value = own;
|
|
|
tableTypelist.value = table;
|
|
|
wbsId.value = wbsid;
|
|
|
node.value = nodeInfo;
|
|
|
+ modelTitle.value = til;
|
|
|
+ tableId.value = tid;
|
|
|
},
|
|
|
{ deep: true }
|
|
|
);
|
|
|
+watch(
|
|
|
+ tableId,
|
|
|
+ (val) => {
|
|
|
+ if (val) {
|
|
|
+ getEditEleList();
|
|
|
+ } else {
|
|
|
+ editEleList.value = [];
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ deep: true,
|
|
|
+ }
|
|
|
+);
|
|
|
//表单
|
|
|
const formRef = ref(null);
|
|
|
const formRules = {
|
|
@@ -297,6 +331,14 @@ const tableColumn = [
|
|
|
{ key: "action", name: "操作", width: 80, align: "center" },
|
|
|
];
|
|
|
const editEleList = ref([]);
|
|
|
+const getEditEleList = async () => {
|
|
|
+ const { data } = await mainApi.getTableElements({
|
|
|
+ id: tableId.value,
|
|
|
+ search: "",
|
|
|
+ type: 1,
|
|
|
+ });
|
|
|
+ editEleList.value = getArrValue(data);
|
|
|
+};
|
|
|
const dataTypeList = ref([]);
|
|
|
const getDataTypelist = async () => {
|
|
|
if (dataTypeList.value.length > 1) {
|