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