Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
eb126928f2
@ -28,4 +28,33 @@ export function delRescueRoad(id) {
|
||||
})
|
||||
}
|
||||
|
||||
export function getDictStaff(ids) {
|
||||
return request({
|
||||
url: '/system/rescueInfo/getDictStaff/' + ids,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function getDrivers() {
|
||||
return request({
|
||||
url: '/system/rescueInfo/getDrivers',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function getManages() {
|
||||
return request({
|
||||
url: '/system/rescueInfo/getManages',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
export function bindDictStaff(data) {
|
||||
return request({
|
||||
url: '/system/rescueInfo/bindDictStaff',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" align="center" prop="sort" />
|
||||
<!-- <el-table-column label="排序" align="center" prop="sort" />-->
|
||||
|
||||
<el-table-column label="路段" align="center" prop="dictLabel">
|
||||
<template slot-scope="scope">
|
||||
@ -42,6 +42,8 @@
|
||||
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.label}}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label = "救援经理" align="center" prop="manageName" />
|
||||
<el-table-column label = "救援司机" align="center" prop="driverNames" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
@ -50,6 +52,12 @@
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-setting"
|
||||
@click="handleBind(scope.row)"
|
||||
>绑定人员</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@ -73,11 +81,56 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!-- 配置绑定路段人员 -->
|
||||
<el-dialog :title="bindTitle" :visible.sync="bindOpen" width="500px" append-to-body>
|
||||
<el-form ref="bindForm" :model="bindForm" :rules="bindRules" label-width="80px">
|
||||
<el-form-item label="救援路段" prop="dictLabel">
|
||||
{{bindForm.dictLabel}}
|
||||
</el-form-item>
|
||||
<el-form-item label="救援经理" prop="manageId">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
v-model="bindForm.manageId" placeholder="请选择救援经理"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in manages"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.userId"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="救援司机" prop="manageId">
|
||||
<el-select
|
||||
style="width: 100%"
|
||||
filterable
|
||||
clearable
|
||||
v-model="bindForm.driverIds" multiple placeholder="请选择救援司机"
|
||||
>
|
||||
<el-option
|
||||
v-for="(item, index) in drivers"
|
||||
:key="index"
|
||||
:label="item.name"
|
||||
:value="item.userId"
|
||||
>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="bindSubmitForm">确 定</el-button>
|
||||
<el-button @click="bindOpen = false">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getRescueRoad,addRescueRoad,delRescueRoad} from "./api/rescueRoad";
|
||||
import {bindDictStaff, getRescueRoad,addRescueRoad,delRescueRoad, getDictStaff, getDrivers, getManages} from "./api/rescueRoad";
|
||||
|
||||
export default {
|
||||
name: "Data",
|
||||
@ -149,7 +202,22 @@ export default {
|
||||
dictSort: [
|
||||
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
||||
]
|
||||
}
|
||||
},
|
||||
bindTitle: null,
|
||||
bindForm: {
|
||||
id: null,
|
||||
dictLabel: null,
|
||||
dictId: "",
|
||||
manageId: "",
|
||||
driverIds: ""
|
||||
},
|
||||
bindRules:{
|
||||
manageId: [{required: true, message: "救援经理不能为空", trigger: "blur"}],
|
||||
driverIds: [{required: true, message: "救援司机不能为空", trigger: "blur"}]
|
||||
},
|
||||
bindOpen: false,
|
||||
manages: [],
|
||||
drivers: [],
|
||||
};
|
||||
},
|
||||
created() {
|
||||
@ -157,12 +225,29 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
/** 查询字典数据列表 */
|
||||
getList() {
|
||||
async getList() {
|
||||
this.loading = true;
|
||||
getRescueRoad(this.queryParams).then(response => {
|
||||
console.log(response)
|
||||
try {
|
||||
const response = await getRescueRoad(this.queryParams);
|
||||
this.dataList = response.data;
|
||||
this.loading = false;
|
||||
const ids = this.dataList.map(item => item.id);
|
||||
await this.listDictStaff(ids);
|
||||
} finally {
|
||||
this.loading = false; // 确保即使有异常也关闭 loading
|
||||
}
|
||||
},
|
||||
async listDictStaff(ids){
|
||||
const res = await getDictStaff(ids);
|
||||
// 创建一个新数组以确保响应式更新
|
||||
this.dataList = this.dataList.map((item, index) => {
|
||||
const staffItem = res.data[index];
|
||||
return {
|
||||
...item,
|
||||
manageId: staffItem ? staffItem.manageId : null,
|
||||
driverIds: staffItem ? staffItem.driverIds : null,
|
||||
manageName: staffItem ? staffItem.manageName : null,
|
||||
driverNames: staffItem ? staffItem.driverNames : null
|
||||
};
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
@ -248,7 +333,47 @@ export default {
|
||||
this.download('system/dict/data/export', {
|
||||
...this.queryParams
|
||||
}, `data_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
},
|
||||
handleBind(row){
|
||||
this.bindTitle = "绑定人员"
|
||||
this.bindForm = {
|
||||
dictLabel: row.label,
|
||||
manageId: row.manageId,
|
||||
driverIds: row.driverIds ? row.driverIds.split(",").map(item => parseInt(item)) : null,
|
||||
dictId: row.id
|
||||
}
|
||||
getDictStaff(row.id).then(res => {
|
||||
if (res.data[0]){
|
||||
this.bindForm.id = res.data[0]
|
||||
}
|
||||
})
|
||||
this.listDrivers();
|
||||
this.listManages();
|
||||
this.bindOpen = true
|
||||
},
|
||||
listManages(){
|
||||
getManages().then(res => {
|
||||
this.manages = res.data
|
||||
})
|
||||
},
|
||||
listDrivers(){
|
||||
getDrivers().then(res => {
|
||||
this.drivers = res.data
|
||||
})
|
||||
},
|
||||
/** 提交按钮 */
|
||||
bindSubmitForm: function() {
|
||||
this.$refs["bindForm"].validate(valid => {
|
||||
if (valid) {
|
||||
this.bindForm.driverIds = this.bindForm.driverIds ? this.bindForm.driverIds.join(",") : null
|
||||
bindDictStaff(this.bindForm).then(response => {
|
||||
this.$modal.msgSuccess("绑定成功");
|
||||
this.bindOpen = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user