123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- <template>
- <div class="device-manager-box">
- <CustomNormalTable
- :columns="[]"
- :searchFormSchema="searchFormSchema"
- :list="list"
- :formSchema="formSchema"
- :deleteById="deleteById"
- :batchDelete="batchDeleteById"
- :saveOrUpdate="saveOrUpdate"
- @edit-handler="changeFormItems"
- designScope="workingFace-tabel"
- title="智能管控"
- :showTab="true"
- deviceType="managesys"
- columnsType="managesys_list"
- />
- </div>
- </template>
- <script lang="ts" name="system-user" setup>
- //ts语法
- import { ref, onMounted } from 'vue'
- // import CustomNormalTable from './CustomNormalTable.vue';
- import { searchFormSchema, commentFormSchema } from './workingFace.data';
- import { list, deleteById, batchDeleteById, saveOrUpdate } from './workingFace.api';
- import { FormSchema } from '/@/components/Table';
- import { getFormSchemaColumns } from '/@/hooks/web/useWebColumns';
-
- const formSchema = ref<FormSchema[]>([])
- const isRefresh = ref(false)
- const arrToFormColumns = (tableHeaderColumns = []) => {
- const columnList: any[] = [];
- if(tableHeaderColumns.length > 0){
- tableHeaderColumns.forEach((item: any) => {
- let columnsItem;
- if (item.type == 1 || item.type == 10) {
- columnsItem = {
- label: item.unit ? `${item.des}(${item.unit})` : item.des, //_dictText
- field: item.monitorcode,
- component: item.type == 1 ? 'Input' : item.type == 10 ? 'InputTextArea' : '',
- };
- } else {
- if (item.type == 3) {
- columnsItem = {
- label: item.unit ? `${item.des}(${item.unit})` : item.des, //_dictText
- field: item.monitorcode,
- component: 'RadioGroup',
- defaultValue: 1,
- componentProps: () => {
- return {
- options: [
- { label: '是', value: 1, key: '1' },
- { label: '否', value: 0, key: '2' },
- ],
- stringToNumber: true,
- };
- },
- };
- }
- if (item.type == 4) {
- columnsItem = {
- label: item.unit ? `${item.des}(${item.unit})` : item.des, //_dictText
- field: item.monitorcode,
- component: 'JDictSelectTag',
- componentProps: {
- dictCode: item.dict,
- placeholder: '请选择',
- stringToNumber: true,
- },
- };
- }
- }
- columnList.push(columnsItem);
- formSchema.value = [...commentFormSchema, ...columnList]
- });
- }else{
- formSchema.value = commentFormSchema as any[]
- }
- };
- const changeFormItems = (data) => {
- if(data && data['strtype']){
- const formSchemaColumns = getFormSchemaColumns(`${data['strtype']}_edit`) || []
- arrToFormColumns(formSchemaColumns)
- isRefresh.value = true
- }else{
- formSchema.value = commentFormSchema as any[]
- isRefresh.value = true
- }
- }
- onMounted(() => {
-
- })
- </script>
- <style scoped></style>
|