add:飞书接口

This commit is contained in:
zhangzhiqiang
2023-11-06 09:23:04 +08:00
parent ffb118be74
commit 4c0128e1e7
3 changed files with 1058 additions and 0 deletions

View File

@@ -0,0 +1,306 @@
<template>
<el-dialog
title="设备选择"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="100%"
@close="close"
>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="设备">
<el-input
v-model="query.device_code"
clearable
size="mini"
placeholder="编码、名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
@current-change="clickChange"
>
<el-table-column v-if="!isSingle" type="selection" width="55" />
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i /></el-radio>
</template>
</el-table-column>
<el-table-column prop="device_code" label="设备编码" min-width="130" show-overflow-tooltip />
<el-table-column prop="device_name" label="设备名称" min-width="130" show-overflow-tooltip />
<el-table-column prop="workprocedure_name" label="工序" />
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit"> </el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import crudDevicemaintenanceplanmst from '@/views/wms/device_manage/upkeep/devicemaintenanceplan/devicemaintenanceplanmst'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudDept from '@/views/system/dept/dept'
export default {
name: 'Device',
components: { rrOperation, pagination, Treeselect },
cruds() {
return CRUD({
title: '设备',
url: 'api/devicemaintenanceplanmst/queryDevice2',
crudMethod: { ...crudDevicemaintenanceplanmst }, optShow: {}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: true
}
},
data() {
return {
dialogVisible: false,
tableRadio: null,
checkrow: null,
class_idStr: null,
depts: [],
rows: [],
XLList: []
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
created() {
this.deptTree()
},
methods: {
clickChange(item) {
this.tableRadio = item
},
formatTypeName(row, cloum) {
if (row.device_type === '01') {
return '资产'
} else if (row.device_type === '02') {
return '普通设备'
} else if (row.device_type === '03') {
return '其他'
}
},
handleSelectionChange(val, row) {
if (this.isSingle) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged2', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选设备')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged2', this.rows)
},
// 获取弹窗内部门数据
loadDepts({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudDept.getDeptvo({ is_used: true, pid: parentNode.dept_id }).then(res => {
parentNode.children = res.content.map(function(obj) {
obj.children = null
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
deptTree() {
setTimeout(() => {
crudDept.getDeptTree().then(res => {
this.depts = res.content
})
}, 100)
},
normalizer(node) {
return {
id: node.dept_id,
label: node.name,
children: node.children
}
},
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep {
.vue-treeselect__menu {
overflow-x: auto !important;
width: 300px;
max-height: 300px !important;
}
.vue-treeselect__label {
overflow: unset;
text-overflow: unset;
}
.vue-treeselect__control {
height: 20px !important;
}
.vue-treeselect__multi-value-item-container,
.vue-treeselect--has-value .vue-treeselect__multi-value {
height: 30px;
line-height: 24px;
padding: 0;
}
.vue-treeselect__limit-tip,
.vue-treeselect--searchable.vue-treeselect--multi.vue-treeselect--has-value
.vue-treeselect__input-container {
padding-top: 0;
}
.vue-treeselect--has-value .vue-treeselect__multi-value {
// margin-bottom: 15px;
}
.vue-treeselect__placeholder,
.vue-treeselect__single-value {
height: 28px;
line-height: 32px;
font-size: small;
color: "#CCCFD6";
}
.vue-treeselect--has-value .vue-treeselect__input {
height: 18px !important;
line-height: 18px !important;
}
.vue-treeselect div,
.vue-treeselect span {
box-sizing: content-box;
}
// 选中后的溢出隐藏
.vue-treeselect__multi-value-label {
display: block;
width: 140px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.vue-treeselect__value-container {
display: block;
height: 32px;
}
}
</style>

View File

@@ -0,0 +1,366 @@
<template>
<el-dialog
title="故障类型"
append-to-body
:visible.sync="dialogVisible"
destroy-on-close
width="100%"
@close="close"
@open="open"
>
<el-form
:inline="true"
class="demo-form-inline"
label-position="right"
label-width="80px"
label-suffix=":"
>
<el-form-item label="模糊搜索">
<el-input
v-model="query.device_faultclass_code"
clearable
size="mini"
placeholder="请输入编码或者名称"
@keyup.enter.native="crud.toQuery"
/>
</el-form-item>
<el-form-item label="故障标签">
<treeselect
v-model="query.faultclass_type_id"
:load-options="loadClass"
:options="classes2"
style="width: 200px;"
placeholder="请选择"
/>
</el-form-item>
<rrOperation />
</el-form>
<!--表格渲染-->
<el-table
ref="table"
v-loading="crud.loading"
:data="crud.data"
style="width: 100%;"
size="mini"
border
:header-cell-style="{background:'#f5f7fa',color:'#606266'}"
@select="handleSelectionChange"
@select-all="onSelectAll"
@current-change="clickChange"
>
<el-table-column v-if="isSingle" label="选择" width="55">
<template slot-scope="scope">
<el-radio v-model="tableRadio" :label="scope.row"><i/></el-radio>
</template>
</el-table-column>
<!-- <el-table-column type="selection" width="55" />-->
<el-table-column prop="class_name" label="设备类别" :min-width="flexWidth('class_name',crud.data,'设备类别')"/>
<el-table-column prop="device_faultclass_name" label="设备故障名称" :min-width="flexWidth('device_faultclass_name',crud.data,'设备故障名称')" />
</el-table>
<!--分页组件-->
<pagination />
<span slot="footer" class="dialog-footer">
<el-button @click="dialogVisible = false"> </el-button>
<el-button type="primary" @click="submit">确认</el-button>
</span>
</el-dialog>
</template>
<script>
import CRUD, { header, presenter } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import pagination from '@crud/Pagination'
import crudDevicemaintenanceplanmst from '@/views/wms/device_manage/upkeep/devicemaintenanceplan/devicemaintenanceplanmst'
import Treeselect, { LOAD_CHILDREN_OPTIONS } from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import crudMaterialbase from '@/api/wms/basedata/master/materialbase'
// import crudDevicebom from '@/api/wms/basedata/em/devicebom'
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
export default {
name: 'Device',
components: { rrOperation, pagination, Treeselect },
cruds() {
return CRUD({
title: '故障分类',
url: 'api/devicefaultclass',
crudMethod: { ...crudDevicemaintenanceplanmst }, optShow: {}})
},
mixins: [presenter(), header()],
props: {
dialogShow: {
type: Boolean,
default: false
},
isSingle: {
type: Boolean,
default: true
},
openParam: {
type: Object
}
},
data() {
return {
dialogVisible: false,
tableRadio: null,
checkrow: null,
classes: [],
classes2: [],
class_idStr: null,
materOpt_code: '23',
materOpt_code_2: '26',
classBj_id: null,
rows: [],
XLList: []
}
},
watch: {
dialogShow: {
handler(newValue) {
this.dialogVisible = newValue
}
}
},
created() {
const param = {
'materOpt_code': this.materOpt_code
}
crudMaterialbase.getMaterOptType(param).then(res => {
this.class_idStr = res.class_idStr
this.crud.query.class_idStr = this.class_idStr
this.queryClassId()
this.queryClassId2()
})
const data = {
'materOpt_code': this.materOpt_code_2
}
crudDevicebom.getBjId(data).then(res => {
this.classBj_id = res.class_idStr
})
},
methods: {
open() {
this.query.material_type_id = this.openParam.material_type_id
this.crud.query.class_idStr = this.class_idStr
this.queryClassId()
this.queryClassId2()
this.crud.toQuery()
},
clickChange(item) {
this.tableRadio = item
},
handleSelectionChange(val, row) {
if (this.isSingle) {
if (val.length > 1) {
this.$refs.table.clearSelection()
this.$refs.table.toggleRowSelection(val.pop())
} else {
this.checkrow = row
}
}
},
onSelectAll() {
this.$refs.table.clearSelection()
},
close() {
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
},
submit() {
// 处理单选
if (this.isSingle && this.tableRadio) {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.tableRadio)
return
}
this.rows = this.$refs.table.selection
if (this.rows.length <= 0) {
this.$message('请先勾选设备')
return
}
this.crud.resetQuery(false)
this.$emit('update:dialogShow', false)
this.$emit('tableChanged', this.rows)
},
loadClass({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
queryClassId() {
const data = {}
data.id = this.openParam.material_type_id
data.parent_id = '2'
this.getSubTypes(data)
},
queryClassId2() {
const param = {
'class_idStr': '3'
}
crudClassstandard.queryClassById(param).then(res => {
this.classes2 = res.content.map(obj => {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
getSubTypes(id) {
crudClassstandard.getClassSuperior2(id).then(res => {
const date = res.content
this.buildClass(date)
this.classes = date
})
},
getSubTypes2(id) {
crudClassstandard.getClassSuperior2(id).then(res => {
const date = res.content
this.buildClass(date)
this.classes2 = date
})
},
buildClass(classes) {
classes.forEach(data => {
if (data.children) {
this.buildClass(data.children)
}
if (data.hasChildren && !data.children) {
data.children = null
}
})
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep .el-dialog__body {
padding-top: 0px;
}
</style>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep {
.vue-treeselect__menu {
overflow-x: auto !important;
width: 300px;
max-height: 300px !important;
}
.vue-treeselect__label {
overflow: unset;
text-overflow: unset;
}
.vue-treeselect__control {
height: 20px !important;
}
.vue-treeselect__multi-value-item-container,
.vue-treeselect--has-value .vue-treeselect__multi-value {
height: 30px;
line-height: 24px;
padding: 0;
}
.vue-treeselect__limit-tip,
.vue-treeselect--searchable.vue-treeselect--multi.vue-treeselect--has-value
.vue-treeselect__input-container {
padding-top: 0;
}
.vue-treeselect--has-value .vue-treeselect__multi-value {
// margin-bottom: 15px;
}
.vue-treeselect__placeholder,
.vue-treeselect__single-value {
height: 28px;
line-height: 32px;
font-size: small;
color: "#CCCFD6";
}
.vue-treeselect--has-value .vue-treeselect__input {
height: 18px !important;
line-height: 18px !important;
}
.vue-treeselect div,
.vue-treeselect span {
box-sizing: content-box;
}
// 选中后的溢出隐藏
.vue-treeselect__multi-value-label {
display: block;
width: 140px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.vue-treeselect__value-container {
display: block;
height: 32px;
}
}
</style>

View File

@@ -0,0 +1,386 @@
<template>
<div class="app-container">
<!--工具栏-->
<div class="head-container">
<div width="100%">
<el-form ref="form" :model="form" size="mini" >
<el-row>
<el-col >
<el-form-item label="设备" prop="devicerecord_id">
<el-input v-model.trim="form.device_code" style="width: 100%">
<el-button slot="append" icon="el-icon-plus" @click="putDevice" />
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="故障类型" prop="device_faultclass_id">
<el-input v-model.trim="form.device_faultclass_name" style="width: 100%">
<el-button slot="append" icon="el-icon-plus" @click="putFault" />
</el-input>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="故障等级:" prop="fault_level">
<el-select
v-model="form.fault_level"
size="mini"
style="width: 100%"
placeholder="请选择"
:disabled="crud.status.view > 0"
class="filter-item"
>
<el-option
v-for="item in dict.EM_FAULT_LEVEL"
:label="item.label"
:value="item.value"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="班组配合人:" prop="product_person_name">
<el-input v-model.trim="form.product_person_name" style="width: 100%" :disabled="crud.status.view > 0" />
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col>
<el-form-item label="故障描述:" prop="fault_desc">
<el-input v-model.trim="form.fault_desc" style="width: 100%" rows="2" type="textarea" />
</el-form-item>
</el-col>
</el-row>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="text" @click="crud.cancelCU">取消</el-button>
<el-button type="primary" @click="submitCU">确认</el-button>
</div>
</div>
</div>
<DeviceDialog :dialog-show.sync="deviceDialog" :is-single="true" @tableChanged2="tableChanged2" />
<FaultDialog :dialog-show.sync="faultDialog" :is-single="true" :open-param="openParam" @tableChanged="tableChanged" />
</div>
</template>
<script>
import crudDevicerepairrequest from '@/views/wms/device_manage/repair/devicevprs/devicerepairrequest'
import CRUD, { presenter, header, form, crud } from '@crud/crud'
import rrOperation from '@crud/RR.operation'
import crudOperation from '@crud/CRUD.operation'
import udOperation from '@crud/UD.operation'
import pagination from '@crud/Pagination'
import DateRangePicker from '@/components/DateRangePicker'
import crudClassstandard from '@/api/wms/basedata/master/classstandard'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import PicDialog from '@/views/wms/device_manage/repair/devicevprs/PicDialog'
import DeviceDialog from '@/views/wms/device_manage/repair/devicevprs/H5DeviceDialog'
import FaultDialog from '@/views/wms/device_manage/repair/devicevprs/H5FaultDialog'
import { mapGetters } from 'vuex'
import { getToken } from '@/utils/auth'
const defaultForm = { material_type_id: null, product_person_name: null, device_faultclass_name: null, device_code: null, request_id: null, request_code: null, devicerecord_id: null, fault_time: null, device_faultclass_id: null, fault_desc: null, fault_level: null, remark: null, status: null, create_id: null, create_name: null, create_time: null, is_passed: null, process_id: null, process_name: null, process_time: null, finish_id: null, finish_name: null, finish_time: null, is_delete: null, sysdeptid: null, syscompanyid: null }
export default {
name: 'Devicevprs',
dicts: ['EM_FAULT_LEVEL'],
components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, PicDialog, DeviceDialog, FaultDialog },
mixins: [presenter(), header(), form(defaultForm), crud()],
cruds() {
return CRUD({
title: '设备报修',
url: 'api/devicerepairrequest/query2',
idField: 'request_id',
sort: 'request_id,desc',
crudMethod: { ...crudDevicerepairrequest },
optShow: {
add: true,
edit: false,
del: false,
download: false,
reset: true
}
})
},
data() {
return {
openParam: null,
request_id: '',
deviceDialog: false,
faultDialog: false,
dialogVisible: false,
classes: [],
class_idStr: null,
checkrows: [],
materOpt_code: '23',
headers: { 'Authorization': getToken() },
statusList: [
{ 'label': '生成', 'value': '01' },
{ 'label': '维修中', 'value': '02' },
{ 'label': '完毕', 'value': '03' }
],
PicDialog: false,
permission: {
},
rules: {
devicerecord_id: [
{ required: true, message: '设备不能为空', trigger: 'blur' }
],
device_faultclass_id: [
{ required: true, message: '故障类型不能为空', trigger: 'blur' }
],
fault_level: [
{ required: true, message: '故障等级不能为空', trigger: 'blur' }
],
product_person_name: [
{ required: true, message: '班组配合人不能为空', trigger: 'blur' }
],
fault_desc: [
{ required: true, message: '故障描述不能为空', trigger: 'blur' }
]
}
}
},
computed: {
...mapGetters([
'baseApi',
'fileUploadApi'
])
},
created() {
},
methods: {
hand(value) {
this.crud.toQuery()
},
submitCU(){
this.crud.doAdd()
},
loadClass({ action, parentNode, callback }) {
if (action === LOAD_CHILDREN_OPTIONS) {
crudClassstandard.getClass({ pid: parentNode.id }).then(res => {
parentNode.children = res.content.map(function(obj) {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
setTimeout(() => {
callback()
}, 100)
})
}
},
queryClassId() {
const param = {
'class_idStr': '2'
}
crudClassstandard.queryClassById(param).then(res => {
this.classes = res.content.map(obj => {
if (obj.hasChildren) {
obj.children = null
}
return obj
})
})
},
formaLevelName(row, cloum) {
return this.dict.label.EM_FAULT_LEVEL[row.fault_level]
},
formatStatusName(row, cloum) {
if (row.status === '01') {
return '生成'
} else if (row.status === '02') {
return '维修中'
} else if (row.status === '99') {
return '完毕'
}
},
formatPassedName(row, cloum) {
if (row.is_passed === '0') {
return '否'
} else if (row.is_passed === '1') {
return '是'
}
},
putDevice() {
this.deviceDialog = true
},
tableChanged2(row) {
this.form.devicerecord_id = row.devicerecord_id
this.form.material_type_id = row.material_type_id
this.form.device_code = row.device_name + '-' + row.device_code
},
putFault() {
this.openParam = this.form
this.faultDialog = true
},
tableChanged(row) {
this.form.device_faultclass_id = row.device_faultclass_id
this.form.device_faultclass_name = row.device_faultclass_name
},
uploadImage() {
const _selectData = this.$refs.table.selection
if (_selectData.length === 0 || _selectData.length > 1) {
this.crud.notify('请选择一条记录', CRUD.NOTIFICATION_TYPE.INFO)
return false
}
const data = _selectData[0]
this.request_id = data.request_id
this.dialogVisible = true
},
handleClose() {
this.dialogVisible = false
},
beforeUpload(file) {
let isLt2M = true
isLt2M = file.size / 1024 / 1024 < 50
if (!isLt2M) {
this.loading = false
this.$message.error('上传文件大小不能超过 50MB!')
}
return isLt2M
},
handleExceed(files, fileList) {
this.crud.notify('当前限制最多能选择 1 个文件', CRUD.NOTIFICATION_TYPE.WARNING)
},
handleSuccess(files, fileList) {
this.crud.notify('上传成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
this.$refs.upload.clearFiles()
this.dialogVisible = false
this.crud.toQuery()
},
handleError(e, file, fileList) {
const msg = JSON.parse(e.message)
this.$notify({
title: msg.message,
type: 'error',
duration: 2500
})
this.loading = false
},
submitUpload() {
const flag = this.$refs.upload.submit()
}
}
}
</script>
<style rel="stylesheet/scss" lang="scss" scoped>
::v-deep {
.vue-treeselect__menu {
overflow-x: auto !important;
width: 300px;
max-height: 300px !important;
}
.vue-treeselect__label {
overflow: unset;
text-overflow: unset;
}
.vue-treeselect__control {
height: 20px !important;
}
.vue-treeselect__multi-value-item-container,
.vue-treeselect--has-value .vue-treeselect__multi-value {
height: 30px;
line-height: 24px;
padding: 0;
}
.vue-treeselect__limit-tip,
.vue-treeselect--searchable.vue-treeselect--multi.vue-treeselect--has-value
.vue-treeselect__input-container {
padding-top: 0;
}
.vue-treeselect--has-value .vue-treeselect__multi-value {
// margin-bottom: 15px;
}
.vue-treeselect__placeholder,
.vue-treeselect__single-value {
height: 28px;
line-height: 32px;
font-size: small;
color: "#CCCFD6";
}
.vue-treeselect--has-value .vue-treeselect__input {
height: 18px !important;
line-height: 18px !important;
}
.vue-treeselect div,
.vue-treeselect span {
box-sizing: content-box;
}
// 选中后的溢出隐藏
.vue-treeselect__multi-value-label {
display: block;
width: 140px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.vue-treeselect__value-container {
display: block;
height: 32px;
}
}
</style>