|
@@ -7,6 +7,7 @@
|
|
|
filterable
|
|
|
block
|
|
|
placeholder="文件存储类型"
|
|
|
+ @change="changeFileType"
|
|
|
>
|
|
|
<el-option
|
|
|
v-for="item in fileStorageTypeData"
|
|
@@ -162,11 +163,60 @@
|
|
|
</el-button>
|
|
|
</template>
|
|
|
</hc-dialog>
|
|
|
+ <!-- 设置分类元数据 -->
|
|
|
+ <hc-dialog
|
|
|
+ isTable
|
|
|
+ v-model="congfigShow"
|
|
|
+ title="设置分类元数据"
|
|
|
+ @save="saveConfig"
|
|
|
+ :loading="saveConfigLoad"
|
|
|
+ >
|
|
|
+ <hc-card>
|
|
|
+ <template #header>
|
|
|
+ <div class="w-40">
|
|
|
+ <el-select
|
|
|
+ v-model="fileStorageType"
|
|
|
+ filterable
|
|
|
+ block
|
|
|
+ placeholder="文件存储类型"
|
|
|
+ @change="changeType"
|
|
|
+ >
|
|
|
+ <el-option
|
|
|
+ v-for="item in fileStorageTypeData"
|
|
|
+ :key="item.value"
|
|
|
+ :label="item.label"
|
|
|
+ :value="item.value"
|
|
|
+ />
|
|
|
+ </el-select>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <hc-table
|
|
|
+ :column="congfigTableColumn"
|
|
|
+ :datas="configTableData"
|
|
|
+ :is-current-row="false"
|
|
|
+ isCheck
|
|
|
+ :isIndex="false"
|
|
|
+ ref="configTableRef"
|
|
|
+ :loading="configTableLoading"
|
|
|
+ >
|
|
|
+ <template #captureMode="{ row }">
|
|
|
+ {{ getCaptureMode(row.captureMode) }}
|
|
|
+ </template>
|
|
|
+ <template #mandatoryType="{ row }">
|
|
|
+ {{ getMandatoryType(row.mandatoryType) }}
|
|
|
+ </template>
|
|
|
+ </hc-table>
|
|
|
+ <template #action>
|
|
|
+ <hc-pages :pages="searchForm" @change="pageChange1" />
|
|
|
+ </template>
|
|
|
+ </hc-card>
|
|
|
+ </hc-dialog>
|
|
|
</hc-card>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { nextTick, onActivated, onDeactivated, onUnmounted, ref } from "vue";
|
|
|
+import { nextTick, onActivated, ref } from "vue";
|
|
|
import { deepClone, formValidate, getArrValue } from "js-fast-way";
|
|
|
import { HcDelMsg } from "hc-vue3-ui";
|
|
|
import mainApi from "~api/desk/meta";
|
|
@@ -215,6 +265,11 @@ const getTableData = async () => {
|
|
|
tableData.value = getArrValue(data?.records);
|
|
|
searchForm.value.total = data?.total || 0;
|
|
|
};
|
|
|
+const changeFileType = () => {
|
|
|
+ searchForm.value.current = 1;
|
|
|
+ searchForm.value.size = 20;
|
|
|
+ getTableData();
|
|
|
+};
|
|
|
|
|
|
//文件存储类型
|
|
|
const fileStorageTypeData = [
|
|
@@ -355,7 +410,7 @@ const dialogSubmit = async () => {
|
|
|
window?.$message?.success("操作成功");
|
|
|
getTableData();
|
|
|
};
|
|
|
-//删除
|
|
|
+
|
|
|
//删除
|
|
|
const delRowClick = async ({ item }, resolve) => {
|
|
|
const { isRes } = await mainApi.remove(item.id);
|
|
@@ -364,7 +419,87 @@ const delRowClick = async ({ item }, resolve) => {
|
|
|
window.$message.success("删除成功");
|
|
|
getTableData().then();
|
|
|
};
|
|
|
-const configClick = () => {};
|
|
|
+//配置
|
|
|
+const congfigShow = ref(false);
|
|
|
+const configClick = () => {
|
|
|
+ congfigShow.value = true;
|
|
|
+ getConfigTableData();
|
|
|
+};
|
|
|
+const fileStorageType = ref("");
|
|
|
+const configTableLoading = ref(false);
|
|
|
+const changeType = (val) => {
|
|
|
+ searchForm.value.fileStorageType = "";
|
|
|
+ configTableRef.value.clearSelection();
|
|
|
+ searchForm.value.current = 1;
|
|
|
+ getConfigTableData();
|
|
|
+};
|
|
|
+const pageChange1 = ({ current, size }) => {
|
|
|
+ searchForm.value.current = current;
|
|
|
+ searchForm.value.size = size;
|
|
|
+ getConfigTableData();
|
|
|
+};
|
|
|
+const configTableRef = ref(null);
|
|
|
+//表格数据
|
|
|
+const congfigTableColumn = ref([
|
|
|
+ { key: "containerName", name: "元数据项" },
|
|
|
+ { key: "captureMode", name: "捕获方式", align: "center" },
|
|
|
+ { key: "mandatoryType", name: "是否必选", align: "center" },
|
|
|
+]);
|
|
|
+const configTableData = ref([]);
|
|
|
+const getConfigTableData = async () => {
|
|
|
+ configTableData.value = [];
|
|
|
+ fileStorageType.value = searchForm.value.fileStorageType;
|
|
|
+ configTableLoading.value = true;
|
|
|
+ const { data } = await mainApi.page({
|
|
|
+ ...searchForm.value,
|
|
|
+ fileStorageType: "",
|
|
|
+ total: null,
|
|
|
+ });
|
|
|
+ configTableLoading.value = false;
|
|
|
+ configTableData.value = getArrValue(data?.records);
|
|
|
+ searchForm.value.total = data?.total || 0;
|
|
|
+
|
|
|
+ //设置选中
|
|
|
+ let checkarr = [];
|
|
|
+ if (fileStorageType.value) {
|
|
|
+ checkarr = configTableData.value.filter((item) => {
|
|
|
+ if (item.fileStorageType.indexOf(fileStorageType.value) !== -1) {
|
|
|
+ return item;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ await nextTick();
|
|
|
+ checkarr.forEach((ele) => {
|
|
|
+ configTableRef.value.toggleRowSelection(ele, true);
|
|
|
+ });
|
|
|
+};
|
|
|
+const saveConfigLoad = ref(false);
|
|
|
+const saveConfig = async () => {
|
|
|
+ let list = [];
|
|
|
+ list = configTableRef.value.tableRef.getSelectionRows();
|
|
|
+ let ids = [];
|
|
|
+ list.forEach((item) => {
|
|
|
+ ids.push(item.id);
|
|
|
+ });
|
|
|
+ if (!fileStorageType.value) {
|
|
|
+ window.$message.warning("请选择文件存储类型");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ saveConfigLoad.value = true;
|
|
|
+ const { error, code, msg } = await mainApi.allocation({
|
|
|
+ ids: ids.join(","),
|
|
|
+ type: fileStorageType.value,
|
|
|
+ });
|
|
|
+ saveConfigLoad.value = false;
|
|
|
+ //判断状态
|
|
|
+ if (!error && code === 200) {
|
|
|
+ window.$message.success(msg);
|
|
|
+ congfigShow.value = false;
|
|
|
+ getTableData();
|
|
|
+ }
|
|
|
+
|
|
|
+ fileStorageType.value = "";
|
|
|
+};
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss"></style>
|