| | |
| | | <template> |
| | | <div class="box"> |
| | | <el-button type="primary" :icon="Plus" @click="openD('新建')" size="default">新建</el-button> |
| | | <el-table :data="tableData" style="width: 100%" row-key="id" default-expand-all> |
| | | <el-button type="primary" :icon="Plus" @click="openD('新建', 0)" size="default">新建</el-button> |
| | | <el-table :data="tableData" style="width: 100%" row-key="id" :tree-props="propse"> |
| | | <el-table-column align="center" label="是否为设备内容"> |
| | | <template #default="scope"> |
| | | <span v-if="scope.row.isContent == 1">是</span> |
| | |
| | | </el-table-column> |
| | | <el-table-column align="center" prop="typeName" label="类别名称" /> |
| | | <el-table-column align="center" label="操作"> |
| | | <template #default> |
| | | <el-button type="primary" link :icon="View" @click="openD('查看')">查看</el-button> |
| | | <el-button type="primary" link :icon="EditPen" @click="openD('修改')">修改</el-button> |
| | | <el-button type="primary" link :icon="Delete">删除</el-button> |
| | | <el-button type="primary" link :icon="CirclePlus" @click="openD('添加')">添加下级设备设施类型管理</el-button> |
| | | <template #default="scope"> |
| | | <el-button type="primary" link :icon="View" @click="openD('查看', scope.row.id)">查看</el-button> |
| | | <el-button type="primary" link :icon="EditPen" @click="openD('修改', scope.row.id)">修改</el-button> |
| | | <el-button type="primary" link :icon="Delete" @click="Delete(scope.row.id)">删除</el-button> |
| | | <el-button type="primary" link :icon="CirclePlus" @click="openD('添加', scope.row.id)">添加下级设备设施类型管理</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | <Dailog ref="Show"></Dailog> |
| | | <Dailog ref="Show" @onAdd="add"></Dailog> |
| | | </div> |
| | | </template> |
| | | <script lang="ts"> |
| | |
| | | export default defineComponent({ |
| | | components: { Dailog }, |
| | | setup() { |
| | | // 列表 |
| | | const listApi = () => { |
| | | facilityManagementApi() |
| | | .getequipmentTypeMngTreeData() |
| | |
| | | } else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: 'Oops, this is a error message.', |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | } |
| | |
| | | onMounted(() => { |
| | | listApi(); |
| | | }); |
| | | const tableData = ref([ |
| | | { |
| | | id: 1, |
| | | date: '2016-05-02', |
| | | name: 'wangxiaohu', |
| | | }, |
| | | { |
| | | id: 2, |
| | | date: '2016-05-04', |
| | | name: 'wangxiaohu', |
| | | }, |
| | | { |
| | | id: 3, |
| | | date: '2016-05-01', |
| | | name: 'wangxiaohu', |
| | | children: [ |
| | | { |
| | | id: 31, |
| | | date: '2016-05-01', |
| | | name: 'wangxiaohu', |
| | | children: [ |
| | | { |
| | | id: 35, |
| | | date: '2016-05-01', |
| | | name: 'wangxiaohu', |
| | | }, |
| | | { |
| | | id: 36, |
| | | date: '2016-05-01', |
| | | name: 'wangxiaohu', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 32, |
| | | date: '2016-05-01', |
| | | name: 'wangxiaohu', |
| | | }, |
| | | ], |
| | | }, |
| | | { |
| | | id: 4, |
| | | date: '2016-05-03', |
| | | name: 'wangxiaohu', |
| | | }, |
| | | ]); |
| | | // 删除 |
| | | const Delete = (id: number) => { |
| | | facilityManagementApi() |
| | | .getequipmentTypeMngDelete(id) |
| | | .then((res) => { |
| | | if (res.data.code == 200) { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'success', |
| | | }); |
| | | listApi(); |
| | | } else { |
| | | ElMessage({ |
| | | showClose: true, |
| | | message: res.data.msg, |
| | | type: 'error', |
| | | }); |
| | | } |
| | | }); |
| | | }; |
| | | const add = () => { |
| | | listApi(); |
| | | }; |
| | | const tableData = ref(); |
| | | const propse = { |
| | | children: 'childList', |
| | | }; |
| | | const Show = ref(); |
| | | const openD = (title: string, id: number) => { |
| | | Show.value.openDailog(title, id); |
| | | }; |
| | | return { |
| | | propse, |
| | | add, |
| | | tableData, |
| | | Show, |
| | | Delete, |
| | | openD, |
| | | listApi, |
| | | Plus, |
| | | View, |
| | | EditPen, |
| | | Delete, |
| | | CirclePlus, |
| | | }; |
| | | }, |