parent
14c4e01175
commit
e1fdca95b8
|
|
@ -7,7 +7,7 @@ import type { Res } from "@/utils/http/types";
|
||||||
* @return {object}
|
* @return {object}
|
||||||
*/
|
*/
|
||||||
export function getenum(type) {
|
export function getenum(type) {
|
||||||
return http.request<Res<any>>("get", `public/enum/${type}`);
|
return http.request<Res<any>>("get", `Public/enum/${type}`);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @description 获取枚举对象
|
* @description 获取枚举对象
|
||||||
|
|
@ -15,5 +15,5 @@ export function getenum(type) {
|
||||||
* @return {object}
|
* @return {object}
|
||||||
*/
|
*/
|
||||||
export function getenumDic(type) {
|
export function getenumDic(type) {
|
||||||
return http.request<Res<any>>("get", `public/enum/${type}/Dic`);
|
return http.request<Res<any>>("get", `Public/enum/${type}/Dic`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ function fetchFormData() {
|
||||||
format="YYYY-MM-DD"
|
format="YYYY-MM-DD"
|
||||||
value-format="YYYY-MM-DD"
|
value-format="YYYY-MM-DD"
|
||||||
:placeholder="o.label"
|
:placeholder="o.label"
|
||||||
style="width: 100%"
|
class="elWidth"
|
||||||
@change="o.change"
|
@change="o.change"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -169,12 +169,12 @@ function fetchFormData() {
|
||||||
clearable
|
clearable
|
||||||
filterable
|
filterable
|
||||||
:placeholder="o.label"
|
:placeholder="o.label"
|
||||||
style="width: 100%"
|
class="elWidth"
|
||||||
@change="o.change"
|
@change="o.change"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
v-for="item in o.setting.datasource"
|
v-for="item in o.setting.datasource"
|
||||||
:key="item.Value"
|
:key="item.value"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
:label="item[o.setting.maplabel]"
|
:label="item[o.setting.maplabel]"
|
||||||
:value="item[o.setting.mapValue]"
|
:value="item[o.setting.mapValue]"
|
||||||
|
|
@ -187,6 +187,7 @@ function fetchFormData() {
|
||||||
:rows="o.editRows || 4"
|
:rows="o.editRows || 4"
|
||||||
type="textarea"
|
type="textarea"
|
||||||
:placeholder="o.label"
|
:placeholder="o.label"
|
||||||
|
class="elWidth"
|
||||||
@change="o.change"
|
@change="o.change"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -195,11 +196,16 @@ function fetchFormData() {
|
||||||
v-model="o.valueE as boolean"
|
v-model="o.valueE as boolean"
|
||||||
active-text="启用"
|
active-text="启用"
|
||||||
inactive-text="禁用"
|
inactive-text="禁用"
|
||||||
|
class="elWidth"
|
||||||
@change="o.change"
|
@change="o.change"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-else>
|
<div v-else>
|
||||||
<el-input v-model="o.valueE as string" :placeholder="o.label" />
|
<el-input
|
||||||
|
v-model="o.valueE as string"
|
||||||
|
class="elWidth"
|
||||||
|
:placeholder="o.label"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
|
|
@ -215,3 +221,9 @@ function fetchFormData() {
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<style>
|
||||||
|
.elWidth {
|
||||||
|
width: 100%;
|
||||||
|
min-width: 220px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -281,7 +281,7 @@ function handleReloadPaged(reload = true) {
|
||||||
data.ConditionalType = "Like";
|
data.ConditionalType = "Like";
|
||||||
}
|
}
|
||||||
data.FieldName = name.charAt(0).toUpperCase() + name.slice(1);
|
data.FieldName = name.charAt(0).toUpperCase() + name.slice(1);
|
||||||
data.FieldValue = table.value.column[name].value;
|
data.FieldValue = table.value.column[name].value.toString();
|
||||||
|
|
||||||
if (table.value.column[name].searchType != undefined) {
|
if (table.value.column[name].searchType != undefined) {
|
||||||
data.ConditionalType = table.value.column[name].searchType || 0;
|
data.ConditionalType = table.value.column[name].searchType || 0;
|
||||||
|
|
@ -303,11 +303,10 @@ async function fetchInitData() {
|
||||||
const element = table.value.column[key];
|
const element = table.value.column[key];
|
||||||
if (element.type === "dropdown") {
|
if (element.type === "dropdown") {
|
||||||
if (!element.setting.datasource) {
|
if (!element.setting.datasource) {
|
||||||
// 存在值就不处理
|
// 不安全取消 存在值就不处理
|
||||||
|
// let rdata = await eval(element.setting.datasourceStr);
|
||||||
let rdata = await eval(element.setting.datasourceStr);
|
// element.setting.datasource = rdata.data;
|
||||||
element.setting.datasource = rdata.data;
|
// console.log(key + " " + element.setting.datasourceStr, rdata);
|
||||||
console.log(key + " " + element.setting.datasourceStr, rdata);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,14 @@ import { TableConfig } from "@/components/hTable/hTable";
|
||||||
import { onMounted, ref } from "vue";
|
import { onMounted, ref } from "vue";
|
||||||
import { fa } from "element-plus/es/locales.mjs";
|
import { fa } from "element-plus/es/locales.mjs";
|
||||||
import { hTableAPI } from "@/api/hTable";
|
import { hTableAPI } from "@/api/hTable";
|
||||||
|
import { getenum } from "@/api/enum";
|
||||||
const ControllerName = "Class";
|
const ControllerName = "Class";
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: ControllerName
|
name: ControllerName
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const SchoolApi = new hTableAPI("School");
|
||||||
function searchCallback(data) {}
|
function searchCallback(data) {}
|
||||||
|
|
||||||
const table = ref<{ initTable: (config: TableConfig) => void }>();
|
const table = ref<{ initTable: (config: TableConfig) => void }>();
|
||||||
|
|
@ -59,24 +61,46 @@ const tableData: TableConfig = {
|
||||||
edit: false, // 字段允许修改
|
edit: false, // 字段允许修改
|
||||||
width: "150px"
|
width: "150px"
|
||||||
},
|
},
|
||||||
|
schoolId: {
|
||||||
|
label: "学校",
|
||||||
|
width: "180px",
|
||||||
|
search: true,
|
||||||
|
type: "dropdown",
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: true, // 字段允许修改
|
||||||
|
setting: {}
|
||||||
|
},
|
||||||
name: {
|
name: {
|
||||||
label: "角色名称",
|
label: "名称",
|
||||||
width: "180px",
|
width: "180px",
|
||||||
search: true,
|
search: true,
|
||||||
searchType: "Like",
|
searchType: "Like",
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true // 字段允许修改
|
edit: true // 字段允许修改
|
||||||
},
|
},
|
||||||
enable: {
|
Grade: {
|
||||||
label: "启用",
|
label: "年级",
|
||||||
type: "switch",
|
width: "180px",
|
||||||
search: false,
|
type: "dropdown",
|
||||||
add: false, // 字段允许添加
|
custom: row => `${row.grade ?? ""}`,
|
||||||
|
// `${row.grade ?? ""} ${row.gradeLevel + row.graduationYear}`,
|
||||||
|
search: true,
|
||||||
|
setting: {},
|
||||||
|
add: true, // 字段允许添加
|
||||||
|
edit: false // 字段允许修改
|
||||||
|
},
|
||||||
|
type: {
|
||||||
|
label: "类型",
|
||||||
|
width: "150px",
|
||||||
|
type: "dropdown",
|
||||||
|
search: true,
|
||||||
|
add: true, // 字段允许添加
|
||||||
edit: true, // 字段允许修改
|
edit: true, // 字段允许修改
|
||||||
valueE: true // 编辑时的默认值
|
setting: {}
|
||||||
},
|
},
|
||||||
createTime: {
|
createTime: {
|
||||||
label: "创建时间",
|
label: "创建时间",
|
||||||
|
width: "180px",
|
||||||
type: "datetime",
|
type: "datetime",
|
||||||
search: true,
|
search: true,
|
||||||
add: false, // 字段允许添加
|
add: false, // 字段允许添加
|
||||||
|
|
@ -84,6 +108,8 @@ const tableData: TableConfig = {
|
||||||
},
|
},
|
||||||
remark: {
|
remark: {
|
||||||
label: "备注",
|
label: "备注",
|
||||||
|
type: "textarea",
|
||||||
|
editRows: 3,
|
||||||
search: false,
|
search: false,
|
||||||
add: true, // 字段允许添加
|
add: true, // 字段允许添加
|
||||||
edit: true // 字段允许修改
|
edit: true // 字段允许修改
|
||||||
|
|
@ -100,6 +126,15 @@ const showTable = ref(false);
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
//初始化数据原
|
//初始化数据原
|
||||||
|
|
||||||
|
tableData.column.Grade.setting.datasource = (await getenum("GradeEnum")).data;
|
||||||
|
|
||||||
|
tableData.column.type.setting.datasource = (
|
||||||
|
await getenum("ClassTypeEnum")
|
||||||
|
).data;
|
||||||
|
tableData.column.schoolId.setting.datasource = (
|
||||||
|
await SchoolApi.querycombo({ TextName: "Name", ValueName: "Id" })
|
||||||
|
).data;
|
||||||
|
|
||||||
showTable.value = true;
|
showTable.value = true;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue