| | |
| | | <el-select v-model="queryParams.vehicleType" placeholder="请选择车辆类型" clearable size="small"> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_vehicle_type" |
| | | :key="dict.value" |
| | | :key="'vtype-' + dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | |
| | | <el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small"> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :key="'status-' + dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | |
| | | <el-select v-model="queryParams.platformCode" placeholder="请选择平台" clearable size="small"> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_platform" |
| | | :key="dict.value" |
| | | :key="'platform-' + dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | |
| | | <dict-tag :options="dict.type.sys_platform" :value="scope.row.platformCode"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="归属部门" align="center" prop="deptName" /> |
| | | <el-table-column label="归属分公司" align="center" prop="deptNames" width="200"> |
| | | <template slot-scope="scope"> |
| | | <span v-if="scope.row.deptNames && scope.row.deptNames.length > 0"> |
| | | {{ scope.row.deptNames.join('、') }} |
| | | </span> |
| | | <span v-else>-</span> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="状态" align="center" prop="status"> |
| | | <template slot-scope="scope"> |
| | | <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="归属部门" align="center" prop="deptName" /> |
| | | <el-table-column label="创建时间" align="center" prop="createTime" width="180"> |
| | | <template slot-scope="scope"> |
| | | <span>{{ parseTime(scope.row.createTime) }}</span> |
| | |
| | | <el-select v-model="form.vehicleType" placeholder="请选择车辆类型" clearable style="width: 100%"> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_vehicle_type" |
| | | :key="dict.value" |
| | | :key="'form-vtype-' + dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | |
| | | <el-select v-model="form.platformCode" placeholder="请选择平台" clearable> |
| | | <el-option |
| | | v-for="dict in dict.type.sys_platform" |
| | | :key="dict.value" |
| | | :key="'form-platform-' + dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label="归属部门" prop="deptId"> |
| | | <el-select v-model="form.deptId" placeholder="请选择部门" clearable> |
| | | <el-option |
| | | v-for="dept in deptOptions" |
| | | :key="dept.deptId" |
| | | :label="dept.deptName" |
| | | :value="dept.deptId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-radio-group v-model="form.status"> |
| | | <el-radio |
| | | v-for="dict in dict.type.sys_normal_disable" |
| | | :key="dict.value" |
| | | :key="'form-status-' + dict.value" |
| | | :label="dict.value" |
| | | >{{dict.label}}</el-radio> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | <el-form-item label="归属部门" prop="deptId"> |
| | | <el-select v-model="form.deptId" placeholder="请选择归属部门" clearable style="width: 100%"> |
| | | <el-form-item label="归属分公司" prop="deptIds"> |
| | | <el-select v-model="form.deptIds" placeholder="请选择归属分公司" multiple clearable style="width: 100%"> |
| | | <el-option |
| | | v-for="dept in deptList" |
| | | :key="dept.deptId" |
| | |
| | | status: "0", |
| | | remark: null, |
| | | platformCode: null, |
| | | deptId: null |
| | | deptId: null, |
| | | deptIds: [] // 多个分公司ID数组 |
| | | }, |
| | | // 表单校验 |
| | | rules: { |
| | |
| | | platformCode: [ |
| | | { required: true, message: "平台标识不能为空", trigger: "change" } |
| | | ], |
| | | deptId: [ |
| | | { required: true, message: "归属部门不能为空", trigger: "change" } |
| | | deptIds: [ |
| | | { required: true, message: "归属分公司不能为空", trigger: "change", type: 'array' } |
| | | ] |
| | | } |
| | | }; |
| | |
| | | /** 获取部门列表(只显示分公司:parent_id=100) */ |
| | | getDeptList() { |
| | | listDept({ parentId: 100 }).then(response => { |
| | | |
| | | // 过滤出分公司(parent_id=100的部门) |
| | | if (response.data) { |
| | | this.deptList = response.data.filter(dept => dept.parentId === 100); |
| | | |
| | | this.deptList = response.data.filter(dept => dept.parentId === "100"); |
| | | // console.log("deptList: ",this.deptList,response.data.filter(dept => dept.parentId === "100")); |
| | | } else { |
| | | this.deptList = []; |
| | | } |
| | |
| | | status: "0", |
| | | remark: null, |
| | | platformCode: null, |
| | | deptId: null |
| | | deptId: null, |
| | | deptIds: [] // 重置为空数组 |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | |
| | | const vehicleId = row.vehicleId || this.ids |
| | | getVehicle(vehicleId).then(response => { |
| | | this.form = response.data; |
| | | // 确保deptIds是一个数组 |
| | | if (!this.form.deptIds) { |
| | | this.form.deptIds = []; |
| | | } |
| | | // 如果deptIds为空数组,但deptId有值,则添加deptId到deptIds中 |
| | | if (this.form.deptIds.length === 0 && this.form.deptId) { |
| | | this.form.deptIds = [this.form.deptId]; |
| | | } |
| | | this.open = true; |
| | | this.title = "修改车辆信息"; |
| | | }); |
| | |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | // 如果选择了多个分公司,将第一个设置为deptId(主分公司) |
| | | if (this.form.deptIds && this.form.deptIds.length > 0) { |
| | | this.form.deptId = this.form.deptIds[0]; |
| | | } |
| | | |
| | | if (this.form.vehicleId != null) { |
| | | updateVehicle(this.form).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |