安全帽管理
This commit is contained in:
parent
31e9b71362
commit
39c47025f9
|
|
@ -0,0 +1,37 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询工程成本列表
|
||||
export function getProjectCostList(data) {
|
||||
return request({
|
||||
url: '/background/back/area/getProCostList',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 新增工程成本
|
||||
export function addProjectCostItem(data) {
|
||||
return request({
|
||||
url: '/background/back/area/addCost',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 编辑工程成本
|
||||
export function updateProjectCostItem(data) {
|
||||
return request({
|
||||
url: '/background/back/area/updateCost',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除工程成本
|
||||
export function deleteProjectCostItem(data) {
|
||||
return request({
|
||||
url: '/background/back/area/deleteCost',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 查询安全帽
|
||||
export function getHelmet(data) {
|
||||
return request({
|
||||
url: '/background/back/personnel/getBindDetail',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改安全帽绑定
|
||||
export function updateHelmet(data) {
|
||||
return request({
|
||||
url: '/background/back/personnel/bindDev',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 绑定安全帽
|
||||
export function bindHelmet(data) {
|
||||
return request({
|
||||
url: '/background/back/personnel/bindDev',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
// 解绑安全帽
|
||||
export function unbindHelmet(data) {
|
||||
return request({
|
||||
url: '/background/back/personnel/delBind',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
||||
// 获取安全帽列表
|
||||
export function getHelmetList(data) {
|
||||
return request({
|
||||
url: '/background/back/device/getDeviceListByType',
|
||||
method: 'get',
|
||||
params: data
|
||||
})
|
||||
}
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
<template>
|
||||
<el-dialog title="成本管理" :visible.sync="visible" width="80%" append-to-body custom-class="custom-modal" @closed="handleClosed">
|
||||
<div class="app-container">
|
||||
<div class="filter-container">
|
||||
<el-input
|
||||
v-model="listQuery.keyWord"
|
||||
placeholder="关键字"
|
||||
style="width: 200px"
|
||||
class="filter-item"
|
||||
:maxlength="30"
|
||||
@keyup.enter.native="handleFilter"
|
||||
/>
|
||||
<el-button
|
||||
style="margin-left: 40px"
|
||||
class="filter-item"
|
||||
type="primary"
|
||||
@click="handleFilter"
|
||||
>
|
||||
查询
|
||||
</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px" type="primary" @click="handleCreate">
|
||||
新增
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
:key="tableKey"
|
||||
v-loading="listLoading"
|
||||
:data="list"
|
||||
border
|
||||
fit
|
||||
highlight-current-row
|
||||
style="width: 100%"
|
||||
:max-height="tableHeight"
|
||||
@selection-change="handleSelectionChange"
|
||||
>
|
||||
<el-table-column
|
||||
type="selection"
|
||||
width="55"
|
||||
/>
|
||||
<el-table-column label="序号" align="center" width="80" type="index">
|
||||
<template scope="scope">
|
||||
<span>{{ (listQuery.pageNum - 1) * 10 + scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="工程成本" align="center" prop="cost" />
|
||||
<el-table-column label="支出内容" align="center" prop="remark" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||
<template slot-scope="{ row, $index }">
|
||||
<el-button type="text" size="mini" @click="handleUpdate(row, $index)">编辑</el-button>
|
||||
<el-button type="text" size="mini" @click="handleDelete(row, $index)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total > 0"
|
||||
:total="total"
|
||||
:page.sync="listQuery.pageNum"
|
||||
:limit.sync="listQuery.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
</div>
|
||||
<el-dialog append-to-body :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="630px" @closed="handleClosedModal">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
:rules="rules"
|
||||
:model="temp"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="成本:" prop="cost">
|
||||
<el-input v-model="temp.cost" placeholder="成本" :maxlength="50" />
|
||||
</el-form-item>
|
||||
<el-form-item label="支出内容:" prop="remark">
|
||||
<el-input v-model="temp.remark" placeholder="支出内容" :maxlength="50" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false"> 关闭 </el-button>
|
||||
<el-button type="primary" @click="dialogStatus === 'create' ? createData() : updateData()">
|
||||
提交
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import Pagination from '@/components/Pagination'
|
||||
|
||||
import _ from 'lodash/fp'
|
||||
|
||||
import {
|
||||
addProjectCostItem,
|
||||
deleteProjectCostItem,
|
||||
getProjectCostList,
|
||||
updateProjectCostItem
|
||||
} from '@/api/basic/projectCost'
|
||||
|
||||
const defaultTmp = {
|
||||
remark: '',
|
||||
cost: '',
|
||||
bidCode: ''
|
||||
}
|
||||
export default {
|
||||
name: 'CostTable',
|
||||
components: { Pagination },
|
||||
props: ['currentId', 'componentVisible'],
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: [],
|
||||
typeList: [],
|
||||
multipleSelection: [],
|
||||
total: 0,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
keyword: '',
|
||||
bidCode: '',
|
||||
proType: ''
|
||||
},
|
||||
tableHeight: 650,
|
||||
showReviewer: false,
|
||||
temp: _.cloneDeep(defaultTmp),
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
downloadLoading: false,
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新增'
|
||||
},
|
||||
processModalVisible: false,
|
||||
rules: {
|
||||
gxName: [{ required: true, message: '请选择', trigger: 'change' }],
|
||||
planStartTime: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
planEndTime: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
gxWeight: [{ required: true, message: '不能为空', trigger: 'blur' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
visible: {
|
||||
get() {
|
||||
return this.componentVisible
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:componentVisible', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
visible(val) {
|
||||
if (val) {
|
||||
this.getList()
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
// this.getList()
|
||||
},
|
||||
methods: {
|
||||
handleSelectionChange(val) {
|
||||
this.multipleSelection = val
|
||||
},
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
this.listQuery.bidCode = this.currentId
|
||||
getProjectCostList(this.listQuery).then((response) => {
|
||||
this.list = response.rows
|
||||
this.total = response.total
|
||||
}).finally(() => {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
// 查询
|
||||
handleFilter() {
|
||||
this.listQuery.pageNum = 1
|
||||
this.getList()
|
||||
},
|
||||
// 新增
|
||||
handleCreate() {
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.temp.bidCode = this.currentId
|
||||
addProjectCostItem(this.temp).then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.dialogFormVisible = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 编辑
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
this.temp.bidCode = this.currentId
|
||||
updateProjectCostItem(this.temp).then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.dialogFormVisible = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
// 删除数据
|
||||
handleDelete(row, index) {
|
||||
this.$confirm(`确定要删除该数据吗?`, {
|
||||
type: 'warning',
|
||||
title: '操作提示',
|
||||
beforeClose: async(action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
deleteProjectCostItem({ id: row.id }).then((response) => {
|
||||
done()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
done()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
handleClosedModal() {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
this.temp = _.cloneDeep(defaultTmp)
|
||||
},
|
||||
handleClosed() {
|
||||
this.list = []
|
||||
this.multipleSelection = []
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -103,6 +103,7 @@
|
|||
<template slot-scope="{ row, $index }">
|
||||
<el-button v-if="row.status !== '完工'" v-waves type="text" size="mini" @click="handleUpdate(row, $index)">编辑</el-button>
|
||||
<el-button v-waves type="text" size="mini" @click="handleProcess(row, $index)">工序计划</el-button>
|
||||
<el-button v-waves type="text" size="mini" @click="handleCost(row, $index)">工程成本</el-button>
|
||||
<el-button v-if="row.proType === '线路'" v-waves type="text" size="mini" @click="handleGT(row, $index)">杆塔管理</el-button>
|
||||
<el-button v-if="row.status !== '完工'" v-waves type="text" size="mini" @click="handleComplete(row, $index)">完工</el-button>
|
||||
<el-button v-waves type="text" size="mini" @click="handleDelete(row, $index)">删除</el-button>
|
||||
|
|
@ -304,6 +305,8 @@
|
|||
<!--工序-->
|
||||
<ProcessTable :component-visible.sync="processModalVisible" :process-type="processType" :bid-code="bidCode" />
|
||||
|
||||
<CostTable :component-visible.sync="costModalVisible" :current-id="bidCode" />
|
||||
|
||||
<!--杆塔管理-->
|
||||
<GtTable :component-visible.sync="gtModalVisible" :current-id="bidCode" />
|
||||
</div>
|
||||
|
|
@ -325,6 +328,7 @@ import _ from 'lodash/fp'
|
|||
import { downloadFile } from '@/utils/download'
|
||||
import ProjectStatusSelect from '@/views/basic/project/components/ProjectStatusSelect.vue'
|
||||
import GtTable from '@/views/basic/project/components/GtTable.vue'
|
||||
import CostTable from '@/views/basic/project/components/CostTable.vue'
|
||||
|
||||
const defaultTmp = {
|
||||
org: '',
|
||||
|
|
@ -355,7 +359,7 @@ const defaultCompleteTmp = {
|
|||
}
|
||||
|
||||
export default {
|
||||
components: { GtTable, ProjectStatusSelect, Pagination, BuildSelect, ProcessTable },
|
||||
components: { CostTable, GtTable, ProjectStatusSelect, Pagination, BuildSelect, ProcessTable },
|
||||
directives: { waves },
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -390,6 +394,7 @@ export default {
|
|||
completeModalVisible: false,
|
||||
processModalVisible: false,
|
||||
gtModalVisible: false,
|
||||
costModalVisible: false,
|
||||
processType: '',
|
||||
bidCode: '',
|
||||
completeForm: _.cloneDeep(defaultCompleteTmp),
|
||||
|
|
@ -609,6 +614,10 @@ export default {
|
|||
this.bidCode = row.bidCode
|
||||
this.gtModalVisible = true
|
||||
},
|
||||
handleCost(row) {
|
||||
this.bidCode = row.bidCode
|
||||
this.costModalVisible = true
|
||||
},
|
||||
// 删除数据
|
||||
handleDelete(row, index) {
|
||||
this.$confirm(`确定要删除该数据吗?`, {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,56 @@
|
|||
<template>
|
||||
<el-select v-model="currentOption" placeholder="请选择" style="width: 100%" @change="handleChange">
|
||||
<el-option
|
||||
v-for="item in options"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
/>
|
||||
</el-select>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getQualityTeamList } from '@/api/basic/quality'
|
||||
import { getHelmetList } from '@/api/car-man/helmet'
|
||||
|
||||
export default {
|
||||
name: 'HelmetSelect',
|
||||
props: ['bindValue'],
|
||||
data() {
|
||||
return {
|
||||
options: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
currentOption: {
|
||||
get() {
|
||||
return this.bindValue
|
||||
},
|
||||
set(val) {
|
||||
this.$emit('update:bindValue', val)
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
getHelmetList().then(res => {
|
||||
this.options = res.data.map(item => {
|
||||
const { deviceId, deviceName } = item
|
||||
return {
|
||||
value: deviceId,
|
||||
label: deviceName
|
||||
}
|
||||
})
|
||||
})
|
||||
},
|
||||
handleChange(value) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang="less"></style>
|
||||
|
|
@ -73,6 +73,8 @@
|
|||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="160">
|
||||
<template slot-scope="{ row }">
|
||||
<el-button type="text" size="mini" @click="handleUpdate(row)">编辑</el-button>
|
||||
<el-button type="text" size="mini" @click="handleBind(row)">绑定安全帽</el-button>
|
||||
<el-button type="text" size="mini" @click="handleUnbind(row)">解绑安全帽</el-button>
|
||||
<el-button type="text" size="mini" @click="handleDelete(row)">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
@ -86,7 +88,7 @@
|
|||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 编辑模态框-->
|
||||
<!--编辑模态框-->
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible" width="630px" @closed="handleClosedModal">
|
||||
<el-form
|
||||
ref="dataForm"
|
||||
|
|
@ -151,7 +153,30 @@
|
|||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<!--记录模态框-->
|
||||
<AccessRecordTable :current-id="currentUserId" :component-visible.sync="dialogFormVisible2" />
|
||||
|
||||
<!--安全帽绑定模态框-->
|
||||
<el-dialog title="安全帽绑定" :visible.sync="bindVisible" width="630px" @closed="handleClosedBindModal">
|
||||
<el-form
|
||||
ref="dataForm2"
|
||||
:rules="rules2"
|
||||
:model="temp2"
|
||||
label-position="right"
|
||||
label-width="120px"
|
||||
>
|
||||
<el-form-item label="绑定安全帽:" prop="devId">
|
||||
<HelmetSelect :bind-value.sync="temp2.devId" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="bindVisible = false"> 关闭 </el-button>
|
||||
<el-button type="primary" @click="currentBindId === '' ? bindHelmet() : updateBindHelmet()">
|
||||
提交
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
@ -174,6 +199,8 @@ import {
|
|||
} from '@/api/car-man/staff'
|
||||
import ProfessionSelect from '@/views/man-car/staff/components/ProfessionSelect.vue'
|
||||
import AccessRecordTable from '@/views/man-car/staff/components/AccessRecordTable.vue'
|
||||
import HelmetSelect from '@/views/man-car/staff/components/HelmetSelect.vue'
|
||||
import { bindHelmet, getHelmet, unbindHelmet, updateHelmet } from '@/api/car-man/helmet'
|
||||
|
||||
const defaultTmp = {
|
||||
teamId: '',
|
||||
|
|
@ -183,8 +210,13 @@ const defaultTmp = {
|
|||
userType: '',
|
||||
userId: ''
|
||||
}
|
||||
|
||||
const defaultTmp2 = {
|
||||
devId: ''
|
||||
}
|
||||
|
||||
export default {
|
||||
components: { ProfessionSelect, TeamSelect, ProjectSelect, Pagination, AccessRecordTable },
|
||||
components: { HelmetSelect, ProfessionSelect, TeamSelect, ProjectSelect, Pagination, AccessRecordTable },
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
|
|
@ -203,13 +235,15 @@ export default {
|
|||
bidCode: ''
|
||||
},
|
||||
tableHeight: 650,
|
||||
showReviewer: false,
|
||||
temp: _.cloneDeep(defaultTmp),
|
||||
temp2: _.cloneDeep(defaultTmp2),
|
||||
dialogFormVisible: false,
|
||||
dialogFormVisible2: false,
|
||||
dialogStatus: '',
|
||||
downloadLoading: false,
|
||||
bindVisible: false,
|
||||
currentUserId: '',
|
||||
currentDevId: '',
|
||||
currentBindId: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新增'
|
||||
|
|
@ -222,6 +256,9 @@ export default {
|
|||
phone: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
userType: [{ required: true, message: '不能为空', trigger: 'blur' }],
|
||||
imageList: [{ required: true, validator: this.validateImageNum, message: '不能为空', trigger: 'change' }]
|
||||
},
|
||||
rules2: {
|
||||
devId: [{ required: true, message: '请选择', trigger: 'change' }]
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -393,6 +430,12 @@ export default {
|
|||
this.imageList = []
|
||||
this.delFiles = []
|
||||
},
|
||||
handleClosedBindModal() {
|
||||
this.$refs['dataForm2'].resetFields()
|
||||
this.temp2 = _.cloneDeep(defaultTmp2)
|
||||
this.currentDevId = ''
|
||||
this.currentBindId = ''
|
||||
},
|
||||
handleValidateField(name, type) {
|
||||
this.$refs[name].validateField(type)
|
||||
},
|
||||
|
|
@ -412,6 +455,81 @@ export default {
|
|||
}
|
||||
this.imageList = uploadFiles
|
||||
this.handleValidateField('dataForm', 'imageList')
|
||||
},
|
||||
handleBind(row) {
|
||||
this.temp2.userId = row.userId
|
||||
getHelmet({ userId: row.userId }).then(res => {
|
||||
this.temp2.devId = res.data.devId
|
||||
this.currentBindId = res.data.id
|
||||
this.currentDevId = res.data.devId
|
||||
this.bindVisible = true
|
||||
})
|
||||
},
|
||||
bindHelmet() {
|
||||
this.$refs['dataForm2'].validate((valid) => {
|
||||
if (valid) {
|
||||
bindHelmet({ userId: this.temp2.userId, devId: this.temp2.devId }).then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.bindVisible = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
updateBindHelmet() {
|
||||
this.$refs['dataForm2'].validate((valid) => {
|
||||
if (valid) {
|
||||
updateHelmet({ id: this.currentBindId, devId: this.temp2.devId }).then((response) => {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}).finally(() => {
|
||||
this.bindVisible = false
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUnbind(row) {
|
||||
this.$confirm(`确定要解绑安全帽吗?`, {
|
||||
type: 'warning',
|
||||
title: '操作提示',
|
||||
beforeClose: async(action, instance, done) => {
|
||||
if (action === 'confirm') {
|
||||
const { data } = await getHelmet({ userId: row.userId })
|
||||
if (!data) {
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: '暂未绑定安全帽',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
return
|
||||
}
|
||||
unbindHelmet({ userId: row.userId }).then((response) => {
|
||||
done()
|
||||
this.$message({
|
||||
showClose: true,
|
||||
message: response.msg,
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
})
|
||||
} else {
|
||||
done()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue