| | |
| | | v-loading="loading" |
| | | :data="deptList" |
| | | row-key="deptId" |
| | | :default-expand-all="isExpandAll" |
| | | :default-expand-all="false" |
| | | :expand-row-keys="expandRowKeys" |
| | | :tree-props="{children: 'children', hasChildren: 'hasChildren'}" |
| | | > |
| | | <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column> |
| | | <el-table-column prop="orderNum" label="排序" width="200"></el-table-column> |
| | | <el-table-column prop="departmentId" label="SQL Server部门ID" width="150" align="center"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.departmentId">{{ scope.row.departmentId }}</span> |
| | | <span v-else style="color: #909399;">-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="serviceOrderClass" label="服务单编码" width="120" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.serviceOrderClass" type="success" size="mini">{{ scope.row.serviceOrderClass }}</el-tag> |
| | | <span v-else style="color: #909399;">-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="dispatchOrderClass" label="调度单编码" width="120" align="center"> |
| | | <template slot-scope="scope"> |
| | | <el-tag v-if="scope.row.dispatchOrderClass" type="warning" size="mini">{{ scope.row.dispatchOrderClass }}</el-tag> |
| | | <span v-else style="color: #909399;">-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column prop="orderNum" label="排序" width="150"></el-table-column> |
| | | <el-table-column prop="status" label="状态" width="100"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="显示排序" prop="orderNum"> |
| | | <el-input-number v-model="form.orderNum" controls-position="right" :min="0" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="SQL Server部门ID" prop="departmentId"> |
| | | <el-input v-model="form.departmentId" placeholder="SQL Server中的部门ID" :disabled="true" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-col :span="12"> |
| | | <el-form-item label="服务单编码" prop="serviceOrderClass"> |
| | | <el-input v-model="form.serviceOrderClass" placeholder="请输入服务单编码" maxlength="20" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="调度单编码" prop="dispatchOrderClass"> |
| | | <el-input v-model="form.dispatchOrderClass" placeholder="请输入调度单编码" maxlength="20" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | // 是否显示弹出层 |
| | | open: false, |
| | | // 是否展开,默认全部展开 |
| | | isExpandAll: true, |
| | | isExpandAll: false, |
| | | // 默认展开的行 |
| | | expandRowKeys: [], |
| | | // 重新渲染表格状态 |
| | | refreshTable: true, |
| | | // 查询参数 |
| | |
| | | this.loading = true; |
| | | listDept(this.queryParams).then(response => { |
| | | this.deptList = this.handleTree(response.data, "deptId"); |
| | | // 默认只展开第一层(总公司及其直接子部门) |
| | | this.expandRowKeys = this.deptList.map(item => item.deptId); |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | |
| | | deptId: undefined, |
| | | parentId: undefined, |
| | | deptName: undefined, |
| | | departmentId: undefined, |
| | | serviceOrderClass: undefined, |
| | | dispatchOrderClass: undefined, |
| | | orderNum: undefined, |
| | | leader: undefined, |
| | | phone: undefined, |
| | |
| | | toggleExpandAll() { |
| | | this.refreshTable = false; |
| | | this.isExpandAll = !this.isExpandAll; |
| | | if (this.isExpandAll) { |
| | | // 展开全部:收集所有部门ID |
| | | this.expandRowKeys = this.getAllDeptIds(this.deptList); |
| | | } else { |
| | | // 收起:只展开第一层 |
| | | this.expandRowKeys = this.deptList.map(item => item.deptId); |
| | | } |
| | | this.$nextTick(() => { |
| | | this.refreshTable = true; |
| | | }); |
| | | }, |
| | | /** 获取所有部门ID(递归) */ |
| | | getAllDeptIds(depts) { |
| | | let ids = []; |
| | | depts.forEach(dept => { |
| | | ids.push(dept.deptId); |
| | | if (dept.children && dept.children.length > 0) { |
| | | ids = ids.concat(this.getAllDeptIds(dept.children)); |
| | | } |
| | | }); |
| | | return ids; |
| | | }, |
| | | /** 修改按钮操作 */ |
| | | handleUpdate(row) { |
| | | this.reset(); |