Compare commits
2 Commits
d04ac251fe
...
20c6070868
Author | SHA1 | Date | |
---|---|---|---|
![]() |
20c6070868 | ||
![]() |
e9ecc30ed5 |
@ -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>
|
<span>{{ scope.$index + 1 }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<el-table-column label="路段" align="center" prop="dictLabel">
|
||||||
<template slot-scope="scope">
|
<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>
|
<el-tag v-else :type="scope.row.listClass == 'primary' ? '' : scope.row.listClass">{{scope.row.label}}</el-tag>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</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">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-button
|
<el-button
|
||||||
@ -50,6 +52,12 @@
|
|||||||
icon="el-icon-delete"
|
icon="el-icon-delete"
|
||||||
@click="handleDelete(scope.row)"
|
@click="handleDelete(scope.row)"
|
||||||
>删除</el-button>
|
>删除</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-setting"
|
||||||
|
@click="handleBind(scope.row)"
|
||||||
|
>绑定人员</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -73,11 +81,56 @@
|
|||||||
<el-button @click="cancel">取 消</el-button>
|
<el-button @click="cancel">取 消</el-button>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</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>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {getRescueRoad,addRescueRoad,delRescueRoad} from "./api/rescueRoad";
|
import {bindDictStaff, getRescueRoad,addRescueRoad,delRescueRoad, getDictStaff, getDrivers, getManages} from "./api/rescueRoad";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Data",
|
name: "Data",
|
||||||
@ -149,7 +202,22 @@ export default {
|
|||||||
dictSort: [
|
dictSort: [
|
||||||
{ required: true, message: "数据顺序不能为空", trigger: "blur" }
|
{ 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() {
|
created() {
|
||||||
@ -157,12 +225,29 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/** 查询字典数据列表 */
|
/** 查询字典数据列表 */
|
||||||
getList() {
|
async getList() {
|
||||||
this.loading = true;
|
this.loading = true;
|
||||||
getRescueRoad(this.queryParams).then(response => {
|
try {
|
||||||
console.log(response)
|
const response = await getRescueRoad(this.queryParams);
|
||||||
this.dataList = response.data;
|
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.download('system/dict/data/export', {
|
||||||
...this.queryParams
|
...this.queryParams
|
||||||
}, `data_${new Date().getTime()}.xlsx`)
|
}, `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>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user