Merge branch 'version_equipment_20200901' into version_report
This commit is contained in:
commit
8acb3c42cd
@ -34,3 +34,99 @@ export const apiFindStaffDevice = data => {
|
||||
return http({ url: `/lz_management/api/findUsersEquipmentsByName`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 获取类型信息
|
||||
export const apiGetDeviceTypes = data => {
|
||||
return http({ url: `/lz_management/modules/type/equipmentTypeList`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 获取规格信息
|
||||
export const apiGetDeviceSpecs = data => {
|
||||
return http({ url: `/lz_management/modules/specs/equipmentSpecsList`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 获取品牌信息
|
||||
export const apiGetDeviceBrands = data => {
|
||||
return http({ url: `/lz_management/modules/specs/brandList`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 获取品牌信息列表
|
||||
export const apiGetDeviceBrandList = data => {
|
||||
return http({ url: `/lz_management/modules/brand/equipmentBrandList`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 编辑规格信息
|
||||
export const apiEditDeviceSpecs = data => {
|
||||
return http({ url: `/lz_management/modules/specs/equipmentSpecsEdit`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 添加规格信息
|
||||
export const apiAddDeviceSpecs = data => {
|
||||
return http({ url: `/lz_management/modules/specs/equipmentSpecsAdd`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 删除规格信息
|
||||
export const apiDelDeviceSpecs = data => {
|
||||
return http({ url: `/lz_management/modules/specs/equipmentSpecsDelete`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 编辑规格信息
|
||||
export const apiEditDeviceTypes = data => {
|
||||
return http({ url: `/lz_management/modules/type/equipmentTypeEdit`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 添加规格信息
|
||||
export const apiAddDeviceTypes = data => {
|
||||
return http({ url: `/lz_management/modules/type/equipmentTypeAdd`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 删除规格信息
|
||||
export const apiDelDeviceTypes = data => {
|
||||
return http({ url: `/lz_management/modules/type/equipmentTypeDelete`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 编辑品牌信息
|
||||
export const apiEditDeviceBrands = data => {
|
||||
return http({ url: `/lz_management/modules/brand/equipmentBrandEdit`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 添加品牌信息
|
||||
export const apiAddDeviceBrands = data => {
|
||||
return http({ url: `/lz_management/modules/brand/equipmentBrandAdd`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 删除品牌信息
|
||||
export const apiDelDeviceBrands = data => {
|
||||
return http({ url: `/lz_management/modules/brand/equipmentBrandDelete`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 获取使用设备列表
|
||||
export const apiGetUseDeviceList = data => {
|
||||
return http({ url: `/lz_management/modules/usereq/equipmentInfoList`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 编辑使用设备信息
|
||||
export const apiEditUseDevice = data => {
|
||||
return http({ url: `/lz_management/modules/usereq/equipmentInfoEdit`, method: 'post', data })
|
||||
}
|
||||
|
||||
|
||||
// 删除使用设备信息
|
||||
export const apiDelUseDevice = data => {
|
||||
return http({ url: `/lz_management/modules/usereq/equipmentInfoDelete`, method: 'post', data })
|
||||
}
|
||||
|
||||
// 打印编码
|
||||
export const apiGetRePrintCode = (data, code) => {
|
||||
return http({ url: `/lz_management/oneCode/re/print?code=${code}`, method: 'get', data })
|
||||
}
|
||||
|
||||
// 批量生成制定数量的编码
|
||||
export const apiGetNewPrintCodes = (data, count) => {
|
||||
return http({ url: `/lz_management/oneCode/new/prints?counts=${count}`, method: 'get', data })
|
||||
}
|
||||
|
||||
// 获取编码
|
||||
export const apiGetCodes = data => {
|
||||
return http({ url: `/lz_management/oneCode/get/getPrints`, method: 'post', data })
|
||||
}
|
||||
|
||||
|
||||
BIN
src/assets/img/equipment/ding_sao_yi_sao.png
Normal file
BIN
src/assets/img/equipment/ding_sao_yi_sao.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
@ -9,9 +9,9 @@ import Router from 'vue-router'
|
||||
import { apiGetMenuNav } from '@/api/api_menu'
|
||||
import { isURL } from '@/utils/validate'
|
||||
import {clearLoginInfo} from '@/utils'
|
||||
//import VConsole from 'vconsole'
|
||||
import VConsole from 'vconsole'
|
||||
|
||||
//let vConsole = new VConsole()
|
||||
let vConsole = new VConsole()
|
||||
Vue.use(Router)
|
||||
|
||||
// 开发环境不使用懒加载, 因为懒加载页面太多的话会造成webpack热更新太慢, 所以只有生产环境使用懒加载
|
||||
@ -33,6 +33,7 @@ const dingtalkRoutes=[
|
||||
{ path: '/devicemark', component: _import('modules/device/device-mark'), name: 'devicemark', meta: { title: '设备备注' } },
|
||||
{ path: '/devicestaff', component: _import('modules/device/device-staff-device'), name: 'devicestaff', meta: { title: '人员资产信息' } },
|
||||
{ path: '/devicestaffdepat', component: _import('modules/device/device-staff-depat'), name: 'devicestaffdepat', meta: { title: '搜索人员' } },
|
||||
|
||||
{ path: '/devicedetail', component: _import('modules/device/device-detail'), name: 'devicedetail', meta: { title: '资产盘点设备详情页' } }
|
||||
]
|
||||
|
||||
|
||||
151
src/views/modules/device-manage/device-brand-detail.vue
Normal file
151
src/views/modules/device-manage/device-brand-detail.vue
Normal file
@ -0,0 +1,151 @@
|
||||
<template>
|
||||
<el-dialog :title="!id ? '新增品牌' : '编辑品牌'" :close-on-click-modal="false" :visible.sync="visible"
|
||||
>
|
||||
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="类型">
|
||||
<el-select
|
||||
v-model="specReq.typeId"
|
||||
:disabled="departmentReaderOnly"
|
||||
@change="changeType"
|
||||
>
|
||||
<el-option v-for="item in types" :key="item.id" :label="item.type" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="品牌">
|
||||
<el-input v-model="brand" placeholder="品牌名称" clearable>{{brand}}</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input v-model="rank" placeholder="请输入数字" clearable>{{rank}}</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="warning" @click="save(0)">取消</el-button>
|
||||
<el-button type="primary" @click="save(1)">保存</el-button>
|
||||
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { apiEditDeviceBrands, apiAddDeviceBrands } from "@/api/api_equipment";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
types: [],
|
||||
id: null,
|
||||
typeId: null,
|
||||
type:null,
|
||||
brand:null,
|
||||
rank: 0, //排序
|
||||
departmentReaderOnly: false,
|
||||
isAdd: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
brand: null,
|
||||
typeId: null,
|
||||
rank: null, //排序
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {},
|
||||
methods: {
|
||||
init(
|
||||
obj,
|
||||
types
|
||||
) {
|
||||
console.log("device-brand-detail init")
|
||||
this.specReq.typeId = obj.typeId
|
||||
this.typeId = obj.typeId
|
||||
this.id = obj.id
|
||||
this.type = obj.type
|
||||
this.rank = obj.rank
|
||||
this.brand = obj.brand
|
||||
this.types = JSON.parse(JSON.stringify(types))//拷贝一份
|
||||
this.types.splice(0, 1)//去掉全部
|
||||
this.visible = true
|
||||
if(!this.id){
|
||||
|
||||
this.isAdd = true
|
||||
}else{
|
||||
this.isAdd = false
|
||||
}
|
||||
},
|
||||
changeType(val){
|
||||
console.log(val)
|
||||
this.getBrands()
|
||||
|
||||
},
|
||||
changeBrand(val){
|
||||
console.log(val)
|
||||
|
||||
},
|
||||
save(val){
|
||||
if(val == 0){
|
||||
this.visible = false
|
||||
return
|
||||
}
|
||||
if(this.specReq.typeId == null){
|
||||
this.$message.error('请选择类型')
|
||||
return
|
||||
}
|
||||
|
||||
if(this.brand == null || this.brand.length == 0){
|
||||
this.$message.error('请输入品牌名称')
|
||||
return
|
||||
}
|
||||
|
||||
if((!this.rank && this.rank != 0) || this.rank.length == 0){
|
||||
this.$message.error('请设置排序')
|
||||
return
|
||||
}
|
||||
|
||||
this.specReq.rank = this.rank
|
||||
this.specReq.brand = this.brand
|
||||
|
||||
this.specReq.id = this.id
|
||||
this.editSpecs()
|
||||
},
|
||||
editSpecs(){
|
||||
console.log('editSpecs')
|
||||
if(this.isAdd){
|
||||
apiAddDeviceBrands(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false
|
||||
this.$message('添加成功')
|
||||
this.$emit('refreshDataList')
|
||||
} else {
|
||||
this.$$message.error(data.msg)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
apiEditDeviceBrands(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false
|
||||
this.$message('更新成功')
|
||||
this.$emit('refreshDataList')
|
||||
} else {
|
||||
this.$$message.error(data.msg)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
258
src/views/modules/device-manage/device-brand.vue
Normal file
258
src/views/modules/device-manage/device-brand.vue
Normal file
@ -0,0 +1,258 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
|
||||
<el-form-item label="类型" >
|
||||
<el-select v-model="specReq.typeId" :disabled="departmentReaderOnly" @change="changeDepartment(1)">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item label="品牌">
|
||||
<el-input v-model="specReq.brand" placeholder="品牌信息" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getData()">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="success" @click="addNewSpec()">新增品牌</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="dataListLoading" :data="data" style="width: 100%" @row-click="rowClick">
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="typeName" header-align="center" align="center" label="类型"></el-table-column>
|
||||
<el-table-column prop="brand" header-align="center" align="center" label="品牌"></el-table-column>
|
||||
<el-table-column prop="rank" header-align="center" align="center" label="排序"></el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="180" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleAddOrUpdate(scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="specReq.page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="specReq.rows"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<device-brand-detail v-if="isShowDetail" ref="deviceBrandDetail" @refreshDataList="getData"></device-brand-detail>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { apiGetDeviceBrandList, apiDelDeviceBrands } from "@/api/api_equipment";
|
||||
import DeviceBrandDetail from './device-brand-detail.vue'
|
||||
export default {
|
||||
components: {
|
||||
DeviceBrandDetail
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
isShowSearch: true,
|
||||
data: [],
|
||||
types: [],
|
||||
name: "",
|
||||
categorys: "",
|
||||
input: "",
|
||||
dataListLoading: false,
|
||||
typeIndex: 0, //0现在是1级 1二级2三级
|
||||
showHeader: false,
|
||||
totalPage: 1,
|
||||
departmentReaderOnly: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
brand: null,
|
||||
typeId: null,
|
||||
rank: null, //排序
|
||||
},
|
||||
isShowDetail: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.handleGetImgCaptcha()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
|
||||
addNewSpec(){
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
var val = {id: null, typeId: null, brand: null, rank: 0}
|
||||
this.$refs.deviceBrandDetail.init(val, this.types)
|
||||
}, 500)
|
||||
this.isShowDetail = true
|
||||
|
||||
},
|
||||
changeDepartment(type) {
|
||||
this.specReq.page = 1
|
||||
this.getData()
|
||||
|
||||
},
|
||||
sizeChangeHandle(val) {
|
||||
this.specReq.page = 1
|
||||
this.specReq.rows = val
|
||||
this.getData();
|
||||
},
|
||||
currentChangeHandle(val) {
|
||||
this.specReq.page = val
|
||||
this.getData();
|
||||
},
|
||||
// 新增 / 编辑
|
||||
handleAddOrUpdate (val) {
|
||||
console.log(val)
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
console.log(val)
|
||||
this.$refs.deviceBrandDetail.init(val, this.types)
|
||||
}, 500)
|
||||
this.isShowDetail = true
|
||||
},
|
||||
// 删除
|
||||
handleDelete (val) {
|
||||
|
||||
this.$confirm('确定删除“' + val.brand + '”吗?删除后该品牌将无法使用', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.delDeviceSpecs(val.id)
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
delDeviceSpecs(id){
|
||||
apiDelDeviceBrands({page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: id,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
brand: null,
|
||||
typeId: null,
|
||||
rank: null,
|
||||
}).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.$message('删除成功')
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error('删除失败' + data.msg)
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
console.log("获取数据")
|
||||
console.log(this.name)
|
||||
console.log(this.categorys)
|
||||
this.dataListLoading = true
|
||||
apiGetDeviceBrandList(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.data = data.rows;
|
||||
this.totalPage = data.total
|
||||
this.types = data.types
|
||||
} else {
|
||||
this.data = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
btnSearch() {
|
||||
this.specReq.page = 1
|
||||
this.getData();
|
||||
},
|
||||
|
||||
rowClick(row, event, column) {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
.bg-purple-light {
|
||||
background: #e5f2f1;
|
||||
}
|
||||
.grid-content {
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
.row-bg {
|
||||
padding: 10px 0;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
.div_height {
|
||||
height: 38px;
|
||||
}
|
||||
.div_width {
|
||||
width: 100%;
|
||||
}
|
||||
.width_100 {
|
||||
width: 100px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding: 1em;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid;
|
||||
}
|
||||
.flex_son {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0x solid;
|
||||
}
|
||||
</style>
|
||||
40
src/views/modules/device-manage/device-list-add.vue
Normal file
40
src/views/modules/device-manage/device-list-add.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<el-dialog :title="'新增绑定信息'" :close-on-click-modal="false" :visible.sync="visible">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="使用钉钉扫一扫">
|
||||
<el-image
|
||||
style="width: 200px; height: 200px"
|
||||
:src="url"
|
||||
:fit="fit"></el-image>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="save">关闭</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
url: require('@/assets/img/equipment/ding_sao_yi_sao.png')
|
||||
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {},
|
||||
methods: {
|
||||
async init(obj, types, brands) {
|
||||
console.log('device-list-add init')
|
||||
this.visible = true;
|
||||
},
|
||||
|
||||
save() {
|
||||
|
||||
this.visible = false
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
212
src/views/modules/device-manage/device-list-detail.vue
Normal file
212
src/views/modules/device-manage/device-list-detail.vue
Normal file
@ -0,0 +1,212 @@
|
||||
<template>
|
||||
<el-dialog :title="!id ? '新增' : '编辑设备信息'" :close-on-click-modal="false" :visible.sync="visible">
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="类型">
|
||||
<el-select v-model="type" :disabled="departmentReaderOnly" @change="changeType"></el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="品牌">
|
||||
<el-select
|
||||
v-model="brandName"
|
||||
:disabled="departmentReaderOnly"
|
||||
placeholder="请选择"
|
||||
@change="changeBrand"
|
||||
></el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form>
|
||||
<el-form-item label="规格">
|
||||
<el-select style="width:500px"
|
||||
v-model="specType"
|
||||
:disabled="departmentReaderOnly"
|
||||
@change="changeType"
|
||||
|
||||
></el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="使用方">
|
||||
<el-input v-model="user" placeholder="使用方" clearable :disabled="departmentReaderOnly"></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="现有标识">
|
||||
<el-input v-model="code" placeholder="现有编码" clearable :disabled="departmentReaderOnly"></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="状态">
|
||||
<el-select v-model="equipmentState" :disabled="departmentReaderOnly" @change="changeType">
|
||||
<el-option
|
||||
v-for="item in stateList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="自带标识">
|
||||
<el-input v-model="originalCode" placeholder="设备自带标识" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="出库时间">
|
||||
<el-date-picker
|
||||
v-model="outTime"
|
||||
value-format="yyyy-MM-dd HH:mm:ss"
|
||||
type="datetime"
|
||||
default-time="outTime"
|
||||
placeholder="选择日期时间"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="入库时间">
|
||||
<el-date-picker v-model="inTime" type="datetime" default-time="inTime" placeholder="选择日期时间" value-format="yyyy-MM-dd HH:mm:ss"></el-date-picker>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="mark" placeholder="备注信息" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="买入金额">
|
||||
<el-input v-model="buyAmount" placeholder="采购金额" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="出售金额">
|
||||
<el-input v-model="saleAmount" placeholder="出售时金额" clearable></el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="审批编号">
|
||||
<el-input v-model="no" placeholder="购买审批编号" clearable></el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="warning" @click="save(0)">取消</el-button>
|
||||
<el-button type="primary" @click="save(1)">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { apiEditUseDevice } from "@/api/api_equipment";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
types: [],
|
||||
brands: [],
|
||||
specs: [],
|
||||
id: null,
|
||||
type: null,
|
||||
brandName: null,
|
||||
inTime: null, //入库时间
|
||||
outTime: null, //出库时间
|
||||
specType: null,
|
||||
num: 1, //
|
||||
user: null, //
|
||||
mark: null, //备注
|
||||
code: null,
|
||||
equipmentState: null, //状态
|
||||
buyAmount: null, //买入金额
|
||||
saleAmount: null, //出售金额
|
||||
departmentReaderOnly: true,
|
||||
originalCode: null,
|
||||
no: null, //审批流水
|
||||
isAdd: false,
|
||||
stateList: [
|
||||
{ value: 0, label: "入库" },
|
||||
{ value: 1, label: "售出" },
|
||||
{ value: 2, label: "不可用" },
|
||||
{ value: 3, label: "调拨" },
|
||||
{ value: 4, label: "申领" },
|
||||
],
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
specType: null,
|
||||
type: null,
|
||||
num: null,
|
||||
unit: null, //单位 件/台
|
||||
user: null, //使用者
|
||||
owner: null, //所有者
|
||||
qr: null, //设备本身标识
|
||||
originalCode: null, //设备原有标识,老标识
|
||||
code: null, //设备现有标识
|
||||
mark: null, //备注
|
||||
gmtOutbound: null, // 最后一次出库时间
|
||||
gmtInbound: null, //第一次入库时间
|
||||
equipmentState: null, //状态
|
||||
buyAmount: null, //买入金额
|
||||
saleAmount: null, //出售金额
|
||||
no: null, //审批流水
|
||||
brandId: null,
|
||||
typeId: null,
|
||||
gmtInStartTime: null,
|
||||
gmtInEndTime: null,
|
||||
gmtOutStartTime: null,
|
||||
gmtOutEndTime: null,
|
||||
count: null,
|
||||
other: null,
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {},
|
||||
methods: {
|
||||
async init(obj, types, brands) {
|
||||
console.log("device-list-detail init");
|
||||
console.log(obj);
|
||||
this.id = obj.id;
|
||||
this.brandName = obj.brandName;
|
||||
this.code = obj.code;
|
||||
this.equipmentState = obj.equipmentState;
|
||||
this.mark = obj.mark;
|
||||
this.no = obj.no;
|
||||
this.num = obj.num;
|
||||
this.originalCode = obj.originalCode;
|
||||
this.saleAmount = obj.saleAmount;
|
||||
this.buyAmount = obj.buyAmount;
|
||||
this.specType = obj.specType;
|
||||
this.type = obj.type;
|
||||
this.user = obj.user;
|
||||
this.inTime = obj.gmtInbound;
|
||||
this.outTime = obj.gmtOutbound;
|
||||
this.visible = true;
|
||||
},
|
||||
|
||||
save(val) {
|
||||
if(val == 0){
|
||||
this.visible = false
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
this.specReq.id = this.id
|
||||
this.specReq.buyAmount = this.buyAmount;
|
||||
this.specReq.saleAmount = this.saleAmount;
|
||||
this.specReq.gmtInbound = this.inTime;
|
||||
this.specReq.gmtOutbound = this.outTime;
|
||||
this.specReq.mark = this.mark;
|
||||
this.specReq.originalCode = this.originalCode;
|
||||
this.specReq.no = this.no;
|
||||
this.editSpecs();
|
||||
|
||||
},
|
||||
editSpecs() {
|
||||
console.log("editSpecs");
|
||||
apiEditUseDevice(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false;
|
||||
this.$message("更新成功");
|
||||
this.$emit("refreshDataList");
|
||||
} else {
|
||||
this.$$message.error(data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
522
src/views/modules/device-manage/device-list.vue
Normal file
522
src/views/modules/device-manage/device-list.vue
Normal file
@ -0,0 +1,522 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
<el-form-item label="第几次盘点">
|
||||
<el-select
|
||||
v-model="specReq.count"
|
||||
:disabled="departmentReaderOnly"
|
||||
@change="changeDepartment(0)"
|
||||
>
|
||||
<el-option v-for="item in tCounts" :key="item.num" :label="item.num" :value="item.num"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="类型">
|
||||
<el-select
|
||||
v-model="specReq.typeId"
|
||||
:disabled="departmentReaderOnly"
|
||||
@change="changeDepartment(1)"
|
||||
>
|
||||
<el-option v-for="item in types" :key="item.id" :label="item.type" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="品牌">
|
||||
<el-select
|
||||
v-model="specReq.brandId"
|
||||
:disabled="departmentReaderOnly"
|
||||
placeholder="请选择"
|
||||
@change="changeDepartment(2)"
|
||||
>
|
||||
<el-option v-for="item in brands" :key="item.id" :label="item.brand" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="状态">
|
||||
<el-select
|
||||
v-model="specReq.equipmentState"
|
||||
:disabled="departmentReaderOnly"
|
||||
placeholder="请选择"
|
||||
@change="changeDepartment(3)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in stateList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="其他">
|
||||
<el-select
|
||||
v-model="specReq.other"
|
||||
:disabled="departmentReaderOnly"
|
||||
placeholder="请选择"
|
||||
@change="changeDepartment(4)"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in otherList"
|
||||
:key="item.value"
|
||||
:label="item.label"
|
||||
:value="item.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`出库日期`">
|
||||
<el-date-picker
|
||||
v-model="outTime"
|
||||
type="daterange"
|
||||
align="right"
|
||||
value-format="yyyy-MM-dd 00:00:00"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@change="changeOutData"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item :label="`入库日期`">
|
||||
<el-date-picker
|
||||
v-model="inTime"
|
||||
type="daterange"
|
||||
align="right"
|
||||
value-format="yyyy-MM-dd 00:00:00"
|
||||
range-separator="-"
|
||||
start-placeholder="开始日期"
|
||||
end-placeholder="结束日期"
|
||||
@change="changeInData"
|
||||
></el-date-picker>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="specReq.specType" placeholder="规格信息" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="使用人">
|
||||
<el-input v-model="specReq.user" placeholder="使用人信息" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="现有编码">
|
||||
<el-input v-model="specReq.code" placeholder="现有编码" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="自带标识">
|
||||
<el-input v-model="specReq.qr" placeholder="设备自带标识" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="specReq.mark" placeholder="备注" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getData()">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="warning" @click="clearGet()">清空筛选</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="success" @click="addNew()">新增</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="dataListLoading" :data="data" style="width: 100%" @row-click="rowClick">
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="type" header-align="center" align="center" label="类型"></el-table-column>
|
||||
<el-table-column prop="brandName" header-align="center" align="center" label="品牌"></el-table-column>
|
||||
<el-table-column prop="specType" header-align="center" align="center" label="规格"></el-table-column>
|
||||
<el-table-column prop="user" header-align="center" align="center" label="使用方"></el-table-column>
|
||||
|
||||
<el-table-column prop="code" header-align="center" align="center" label="现有编码"></el-table-column>
|
||||
|
||||
<el-table-column prop="originalCode" header-align="center" align="center" label="自带标识"></el-table-column>
|
||||
<el-table-column prop header-align="center" align="center" label="状态">
|
||||
<template slot-scope="scope">
|
||||
<div class="conatnt-name">
|
||||
<span>{{ getStatusStr(scope.row.equipmentState) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="mark" header-align="center" align="center" label="备注"></el-table-column>
|
||||
<el-table-column prop="gmtOutbound" header-align="center" align="center" label="出库时间"></el-table-column>
|
||||
<el-table-column prop="gmtInbound" header-align="center" align="center" label="入库时间"></el-table-column>
|
||||
|
||||
<el-table-column prop="buyAmount" header-align="center" align="center" label="买入金额"></el-table-column>
|
||||
<el-table-column prop="saleAmount" header-align="center" align="center" label="出售金额"></el-table-column>
|
||||
<el-table-column prop="no" header-align="center" align="center" label="审批编号"></el-table-column>
|
||||
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="100" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="text" size="mini" @click="handleAddOrUpdate(scope.row)">编辑</el-button>
|
||||
<el-button type="text" size="mini" @click="handleDelete(scope.row)">删除</el-button>
|
||||
<el-button type="text" size="mini" @click="handlePrint(scope.row)">打印标识</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="specReq.page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="specReq.rows"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<device-list-detail v-if="isShowDetail" ref="deviceListDetail" @refreshDataList="getData"></device-list-detail>
|
||||
<device-list-add v-if="isShowAdd" ref="deviceListAdd" @refreshDataList="getData"></device-list-add>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
apiGetUseDeviceList,
|
||||
apiGetDeviceBrands,
|
||||
apiDelDeviceSpecs,
|
||||
apiGetRePrintCode,
|
||||
apiDelUseDevice,
|
||||
} from "@/api/api_equipment";
|
||||
import * as dd from "dingtalk-jsapi";
|
||||
import DeviceListDetail from "./device-list-detail.vue";
|
||||
import DeviceListAdd from "./device-list-add.vue";
|
||||
export default {
|
||||
components: {
|
||||
DeviceListDetail,
|
||||
DeviceListAdd,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isShowSearch: true,
|
||||
isShowAdd: true,
|
||||
data: [],
|
||||
types: [],
|
||||
brands: [],
|
||||
tCounts: [],
|
||||
outTime: [],
|
||||
inTime: [],
|
||||
name: "",
|
||||
categorys: "",
|
||||
input: "",
|
||||
dataListLoading: false,
|
||||
typeIndex: 0, //0现在是1级 1二级2三级
|
||||
showHeader: false,
|
||||
totalPage: 1,
|
||||
departmentReaderOnly: false,
|
||||
statusType: -1,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
specType: null,
|
||||
type: null,
|
||||
num: null,
|
||||
unit: null, //单位 件/台
|
||||
user: null, //使用者
|
||||
owner: null, //所有者
|
||||
qr: null, //设备本身标识
|
||||
originalCode: null, //设备原有标识,老标识
|
||||
code: null, //设备现有标识
|
||||
mark: null, //备注
|
||||
gmtOutbound: null, // 最后一次出库时间
|
||||
gmtInbound: null, //第一次入库时间
|
||||
equipmentState: null, //状态
|
||||
buyAmount: null, //买入金额
|
||||
saleAmount: null, //出售金额
|
||||
no: null, //审批流水
|
||||
brandId: null,
|
||||
typeId: null,
|
||||
gmtInStartTime: null,
|
||||
gmtInEndTime: null,
|
||||
gmtOutStartTime: null,
|
||||
gmtOutEndTime: null,
|
||||
count: null,
|
||||
other: null,
|
||||
},
|
||||
otherList: [
|
||||
{ value: null, label: "全部" },
|
||||
{ value: 1, label: "有备注" },
|
||||
{ value: 2, label: "未盘点" },
|
||||
],
|
||||
stateList: [
|
||||
{ value: null, label: "全部" },
|
||||
{ value: 0, label: "入库" },
|
||||
{ value: 1, label: "售出" },
|
||||
{ value: 2, label: "不可用" },
|
||||
{ value: 3, label: "调拨" },
|
||||
{ value: 4, label: "申领" },
|
||||
],
|
||||
isShowDetail: false,
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
// this.handleGetImgCaptcha()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
getStatusStr(status) {
|
||||
if (status < 5) {
|
||||
return this.stateList[status + 1].label;
|
||||
}
|
||||
return status;
|
||||
},
|
||||
addNew() {
|
||||
setTimeout(() => {
|
||||
this.$refs.deviceListAdd.init(null, this.types, this.brands);
|
||||
}, 500);
|
||||
this.isShowDetail = true;
|
||||
},
|
||||
|
||||
changeOutData(val) {
|
||||
console.log(val)
|
||||
if(val){
|
||||
this.specReq.gmtOutStartTime = val[0]
|
||||
this.specReq.gmtOutEndTime = val[1]
|
||||
}else{
|
||||
this.specReq.gmtOutStartTime = null
|
||||
this.specReq.gmtOutEndTime = null
|
||||
}
|
||||
|
||||
this.btnSearch()
|
||||
},
|
||||
changeInData(val) {
|
||||
console.log(val)
|
||||
if(val){
|
||||
this.specReq.gmtInStartTime = val[0]
|
||||
this.specReq.gmtInEndTime = val[1]
|
||||
}else{
|
||||
this.specReq.gmtInStartTime = null
|
||||
this.specReq.gmtInEndTime = null
|
||||
}
|
||||
|
||||
this.btnSearch()
|
||||
},
|
||||
changeDepartment(type) {
|
||||
this.specReq.page = 1;
|
||||
if (type == 1) {
|
||||
//获取品牌
|
||||
this.getBrands();
|
||||
this.specReq.brandId = null;
|
||||
} else {
|
||||
this.btnSearch()
|
||||
}
|
||||
},
|
||||
sizeChangeHandle(val) {
|
||||
this.specReq.rows = val;
|
||||
this.btnSearch()
|
||||
},
|
||||
getData() {
|
||||
console.log("获取数据");
|
||||
console.log(this.name);
|
||||
console.log(this.categorys);
|
||||
this.dataListLoading = true;
|
||||
apiGetUseDeviceList(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.data = data.rows;
|
||||
this.totalPage = data.total;
|
||||
this.types = data.types;
|
||||
this.tCounts = data.tCounts;
|
||||
this.specReq.count = data.curCount;
|
||||
} else {
|
||||
this.data = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getBrands() {
|
||||
apiGetDeviceBrands(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.brands = data.brands;
|
||||
this.btnSearch()
|
||||
} else {
|
||||
this.brands = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
currentChangeHandle(val) {
|
||||
this.btnSearch()
|
||||
},
|
||||
// 新增 / 编辑
|
||||
handleAddOrUpdate(val) {
|
||||
console.log(val);
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
this.$refs.deviceListDetail.init(val, this.types, this.brands);
|
||||
}, 500);
|
||||
this.isShowDetail = true;
|
||||
},
|
||||
// 删除
|
||||
handleDelete(val) {
|
||||
this.$confirm(
|
||||
"确定删除“" + val.user + "的" + val.specType + "”吗?删除后该条设备信息将无法使用",
|
||||
"提示",
|
||||
{
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消",
|
||||
type: "warning",
|
||||
}
|
||||
)
|
||||
.then(() => {
|
||||
this.delUserDevices(val.id);
|
||||
})
|
||||
.catch(() => {});
|
||||
},
|
||||
handlePrint(val) {
|
||||
apiGetRePrintCode({}, val.code).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.$message("发送打印请求成功");
|
||||
} else {
|
||||
this.$message.error("发送打印请求失败!" + data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
delUserDevices(id) {
|
||||
apiDelUseDevice({
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: id,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
specType: null,
|
||||
type: null,
|
||||
num: null,
|
||||
unit: null, //单位 件/台
|
||||
user: null, //使用者
|
||||
owner: null, //所有者
|
||||
qr: null, //设备本身标识
|
||||
originalCode: null, //设备原有标识,老标识
|
||||
code: null, //设备现有标识
|
||||
mark: null, //备注
|
||||
gmtOutbound: null, // 最后一次出库时间
|
||||
gmtInbound: null, //第一次入库时间
|
||||
equipmentState: null, //状态
|
||||
buyAmount: null, //买入金额
|
||||
saleAmount: null, //出售金额
|
||||
no: null, //审批流水
|
||||
brandId: null,
|
||||
typeId: null,
|
||||
gmtInStartTime: null,
|
||||
gmtInEndTime: null,
|
||||
gmtOutStartTime: null,
|
||||
gmtOutEndTime: null,
|
||||
count: null,
|
||||
other: null
|
||||
}).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.$message("删除成功");
|
||||
this.getData();
|
||||
} else {
|
||||
this.$message.error("删除失败" + data.msg);
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
clearGet() {
|
||||
this.specReq.page = 1
|
||||
this.specReq.sort = null
|
||||
this.specReq.order = null
|
||||
this.specReq.id = null
|
||||
this.specReq.gmtCreate = null
|
||||
this.specReq.gmtModified = null
|
||||
this.specReq.specType = null
|
||||
this.specReq.type = null
|
||||
this.specReq.num = null
|
||||
this.specReq.qr = null
|
||||
this.specReq.unit = null
|
||||
this.specReq.user = null
|
||||
this.specReq.owner = null
|
||||
this.specReq.originalCode = null
|
||||
this.specReq.code = null
|
||||
this.specReq.mark = null
|
||||
this.specReq.gmtOutbound = null
|
||||
this.specReq.gmtInbound = null
|
||||
this.specReq.equipmentState = null
|
||||
this.specReq.buyAmount = null
|
||||
this.specReq.saleAmount = null
|
||||
this.specReq.no = null
|
||||
this.specReq.brandId = null
|
||||
this.specReq.typeId = null
|
||||
this.specReq.gmtInStartTime = null
|
||||
this.specReq.gmtInEndTime = null
|
||||
this.specReq.gmtOutStartTime = null
|
||||
this.specReq.gmtOutEndTime = null
|
||||
this.specReq.other = null
|
||||
this.inTime = null
|
||||
this.outTime = null
|
||||
this.getData()
|
||||
},
|
||||
|
||||
btnSearch() {
|
||||
this.specReq.page = 1
|
||||
this.getData();
|
||||
},
|
||||
|
||||
rowClick(row, event, column) {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
.bg-purple-light {
|
||||
background: #e5f2f1;
|
||||
}
|
||||
.grid-content {
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
.row-bg {
|
||||
padding: 10px 0;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
.div_height {
|
||||
height: 38px;
|
||||
}
|
||||
.div_width {
|
||||
width: 100%;
|
||||
}
|
||||
.width_100 {
|
||||
width: 100px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding: 1em;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid;
|
||||
}
|
||||
.flex_son {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0x solid;
|
||||
}
|
||||
</style>
|
||||
237
src/views/modules/device-manage/device-onecode.vue
Normal file
237
src/views/modules/device-manage/device-onecode.vue
Normal file
@ -0,0 +1,237 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
|
||||
<el-form-item label="打印状态">
|
||||
<el-select
|
||||
v-model="specReq.isPrint"
|
||||
:disabled="departmentReaderOnly"
|
||||
@change="changeDepartment()"
|
||||
>
|
||||
<el-option v-for="item in stateList" :key="item.value" :label="item.label" :value="item.value"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="编码">
|
||||
<el-input v-model="specReq.code" placeholder="请输入编码" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getData()">查询</el-button>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="新打印数量">
|
||||
<el-input v-model="newCount" placeholder="请输入要新打印机编码数量" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="success" @click="printNewCodes()">新打印</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="dataListLoading" :data="data" style="width: 100%" @row-click="rowClick">
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="code" header-align="center" align="center" label="编码"></el-table-column>
|
||||
<el-table-column prop="isPrint" header-align="center" align="center" label="是否打印">
|
||||
<template slot-scope="scope">
|
||||
<div class="conatnt-name">
|
||||
<span>{{ getStatusStr(scope.row.isPrint) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="180" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handlePrint(scope.row)"
|
||||
>重新打印
|
||||
</el-button>
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="specReq.page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="specReq.rows"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<device-type-detail v-if="isShowDetail" ref="deviceTypeDetail" @refreshDataList="getData"></device-type-detail>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { apiGetNewPrintCodes, apiGetCodes, apiGetRePrintCode } from "@/api/api_equipment";
|
||||
import DeviceTypeDetail from './device-type-detail.vue'
|
||||
export default {
|
||||
components: {
|
||||
DeviceTypeDetail
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
isShowSearch: true,
|
||||
data: [],
|
||||
dataListLoading: false,
|
||||
newCount: null,
|
||||
showHeader: false,
|
||||
totalPage: 1,
|
||||
departmentReaderOnly: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
isPrint: null,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
code: null,
|
||||
},
|
||||
stateList:[
|
||||
{value: null, label: '全部'},
|
||||
{value: 0, label: '未打印'},
|
||||
{value: 1, label: '已打印'},
|
||||
],
|
||||
isShowDetail: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.handleGetImgCaptcha()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
printNewCodes(){
|
||||
if(!this.newCount || this.newCount == 0){
|
||||
this.$message.error('请输入大于0的打印数量')
|
||||
return
|
||||
}
|
||||
apiGetNewPrintCodes({}, this.newCount).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.getData()
|
||||
this.$message("发送打印请求成功");
|
||||
|
||||
} else {
|
||||
this.$message.error("发送打印请求失败!" + data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
changeDepartment(){
|
||||
this.specReq.page = 1;
|
||||
this.getData()
|
||||
},
|
||||
sizeChangeHandle(val) {
|
||||
this.specReq.page = 1
|
||||
this.specReq.rows = val
|
||||
this.getData();
|
||||
},
|
||||
currentChangeHandle(val) {
|
||||
this.specReq.page = val
|
||||
this.getData();
|
||||
},
|
||||
getStatusStr(status) {
|
||||
if (status < 2) {
|
||||
return this.stateList[status + 1].label;
|
||||
}
|
||||
return status;
|
||||
},
|
||||
handlePrint(val) {
|
||||
apiGetRePrintCode({}, val.code).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.getData()
|
||||
this.$message("发送打印请求成功");
|
||||
|
||||
} else {
|
||||
this.$message.error("发送打印请求失败!" + data.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getData() {
|
||||
console.log("获取数据")
|
||||
console.log(this.name)
|
||||
console.log(this.categorys)
|
||||
this.dataListLoading = true
|
||||
apiGetCodes(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.data = data.codes.list;
|
||||
this.totalPage = data.codes.totalCount
|
||||
} else {
|
||||
this.data = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
|
||||
btnSearch() {
|
||||
this.specReq.page = 1
|
||||
this.getData();
|
||||
},
|
||||
|
||||
rowClick(row, event, column) {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
.bg-purple-light {
|
||||
background: #e5f2f1;
|
||||
}
|
||||
.grid-content {
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
.row-bg {
|
||||
padding: 10px 0;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
.div_height {
|
||||
height: 38px;
|
||||
}
|
||||
.div_width {
|
||||
width: 100%;
|
||||
}
|
||||
.width_100 {
|
||||
width: 100px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding: 1em;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid;
|
||||
}
|
||||
.flex_son {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0x solid;
|
||||
}
|
||||
</style>
|
||||
220
src/views/modules/device-manage/device-spec-detail.vue
Normal file
220
src/views/modules/device-manage/device-spec-detail.vue
Normal file
@ -0,0 +1,220 @@
|
||||
<template>
|
||||
<el-dialog :title="!id ? '新增规格' : '编辑规格'" :close-on-click-modal="false" :visible.sync="visible"
|
||||
>
|
||||
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="类型">
|
||||
<el-select
|
||||
v-model="specReq.typeId"
|
||||
:disabled="departmentReaderOnly"
|
||||
@change="changeType"
|
||||
>
|
||||
<el-option v-for="item in types" :key="item.id" :label="item.type" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="品牌">
|
||||
<el-select
|
||||
v-model="specReq.brandId"
|
||||
:disabled="departmentReaderOnly"
|
||||
placeholder="请选择"
|
||||
@change="changeBrand"
|
||||
>
|
||||
<el-option v-for="item in brands" :key="item.id" :label="item.brand" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="specs" placeholder="规格名称" clearable>{{specs}}</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input v-model="rank" placeholder="请输入数字" clearable>{{rank}}</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="库存">
|
||||
<el-input v-model="skus" placeholder="库存数量" clearable>{{skus}}</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="已使用">
|
||||
<el-input v-model="used" placeholder="已使用数量" clearable>{{used}}</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="备注">
|
||||
<el-input v-model="remark" placeholder="备注" clearable>{{remark}}</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="warning" @click="save(0)">取消</el-button>
|
||||
<el-button type="primary" @click="save(1)">保存</el-button>
|
||||
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { apiGetDeviceBrands, apiEditDeviceSpecs, apiAddDeviceSpecs } from "@/api/api_equipment";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
types: [],
|
||||
brands: [],
|
||||
id: null,
|
||||
typeId: null,
|
||||
brandId: null,
|
||||
type:null,
|
||||
brand:null,
|
||||
specs: "",
|
||||
skus: 0, //库存
|
||||
rank: 0, //排序
|
||||
used: 0, //使用
|
||||
remark: "", //备注
|
||||
departmentReaderOnly: false,
|
||||
isAdd: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
specs: null,
|
||||
brandId: null,
|
||||
typeId: null,
|
||||
rank: null, //排序
|
||||
skus: null, //库存
|
||||
remark: null,
|
||||
used: 0, //是否在
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {},
|
||||
methods: {
|
||||
async init(
|
||||
obj,
|
||||
types,
|
||||
brands
|
||||
) {
|
||||
console.log("device-spec-detail init")
|
||||
this.specReq.typeId = obj.typeId
|
||||
this.typeId = obj.typeId
|
||||
this.specReq.brandId = obj.brandId
|
||||
this.brandId = obj.brandId
|
||||
this.id = obj.id
|
||||
this.type = obj.type
|
||||
this.brand = obj.brand
|
||||
this.specs = obj.specs
|
||||
this.skus = obj.skus
|
||||
this.rank = obj.rank
|
||||
this.used = obj.used
|
||||
this.remark = obj.remark
|
||||
this.brand = obj.brand
|
||||
this.types = JSON.parse(JSON.stringify(types))//拷贝一份
|
||||
this.types.splice(0, 1)//去掉全部
|
||||
this.brands = JSON.parse(JSON.stringify(brands))//拷贝一份
|
||||
this.brands.splice(0, 1)//去掉全部
|
||||
this.visible = true
|
||||
if(!this.id){
|
||||
this.isAdd = true
|
||||
}else{
|
||||
this.isAdd = false
|
||||
}
|
||||
if(this.typeId){
|
||||
this.getBrands()
|
||||
}
|
||||
|
||||
},
|
||||
changeType(val){
|
||||
console.log(val)
|
||||
this.specReq.brandId = null
|
||||
this.getBrands()
|
||||
|
||||
},
|
||||
changeBrand(val){
|
||||
console.log(val)
|
||||
|
||||
},
|
||||
getBrands(){
|
||||
apiGetDeviceBrands(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.brands = data.brands
|
||||
this.brands.splice(0, 1);
|
||||
} else {
|
||||
this.brands = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
save(val){
|
||||
if(val == 0){
|
||||
this.visible = false
|
||||
return
|
||||
}
|
||||
if(this.specReq.typeId == null){
|
||||
this.$message.error('请选择类型')
|
||||
return
|
||||
}
|
||||
console.log(this.specReq.brandId)
|
||||
if(this.specReq.brandId == null){
|
||||
this.$message.error('请选择品牌')
|
||||
return
|
||||
}
|
||||
if(this.specs == null || this.specs.length == 0){
|
||||
this.$message.error('请输入规格名称')
|
||||
return
|
||||
}
|
||||
if(!this.skus || this.skus.length == 0){
|
||||
this.$message.error('请设置库存数量')
|
||||
return
|
||||
}
|
||||
if((!this.rank && this.rank != 0) || this.rank.length == 0){
|
||||
this.$message.error('请设置排序')
|
||||
return
|
||||
}
|
||||
if((!this.used && this.used != 0) || this.used.length == 0){
|
||||
this.$message.error('请设置已使用数量')
|
||||
return
|
||||
}
|
||||
this.specReq.specs = this.specs
|
||||
this.specReq.skus = this.skus
|
||||
this.specReq.rank = this.rank
|
||||
this.specReq.remark = this.remark
|
||||
this.specReq.used = this.used
|
||||
this.specReq.id = this.id
|
||||
this.editSpecs()
|
||||
},
|
||||
editSpecs(){
|
||||
console.log('editSpecs')
|
||||
if(this.isAdd){
|
||||
apiAddDeviceSpecs(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false
|
||||
this.$message('添加成功')
|
||||
this.$emit('refreshDataList')
|
||||
} else {
|
||||
this.$$message.error(data.msg)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
apiEditDeviceSpecs(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false
|
||||
this.$message('更新成功')
|
||||
this.$emit('refreshDataList')
|
||||
} else {
|
||||
this.$$message.error(data.msg)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
299
src/views/modules/device-manage/device-spec.vue
Normal file
299
src/views/modules/device-manage/device-spec.vue
Normal file
@ -0,0 +1,299 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
|
||||
<el-form-item label="类型" >
|
||||
<el-select v-model="specReq.typeId" :disabled="departmentReaderOnly" @change="changeDepartment(1)">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item.id"
|
||||
:label="item.type"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="品牌">
|
||||
<el-select v-model="specReq.brandId" :disabled="departmentReaderOnly" placeholder="请选择" @change="changeDepartment(2)">
|
||||
<el-option
|
||||
v-for="item in brands"
|
||||
:key="item.id"
|
||||
:label="item.brand"
|
||||
:value="item.id"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="规格">
|
||||
<el-input v-model="specReq.specs" placeholder="规格信息" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getData()">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="success" @click="addNewSpec()">新增规格</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="dataListLoading" :data="data" style="width: 100%" @row-click="rowClick">
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="type" header-align="center" align="center" label="类型"></el-table-column>
|
||||
<el-table-column prop="brand" header-align="center" align="center" label="品牌"></el-table-column>
|
||||
<el-table-column prop="specs" header-align="center" align="center" label="规格"></el-table-column>
|
||||
<el-table-column prop="rank" header-align="center" align="center" label="排序"></el-table-column>
|
||||
<el-table-column prop="skus" header-align="center" align="center" label="库存"></el-table-column>
|
||||
<el-table-column prop="used" header-align="center" align="center" label="已使用"></el-table-column>
|
||||
<el-table-column prop="remark" header-align="center" align="center" label="备注"></el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="180" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleAddOrUpdate(scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="specReq.page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="specReq.rows"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<device-spec-detail v-if="isShowDetail" ref="deviceSpecDetail" @refreshDataList="getData"></device-spec-detail>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { apiGetDeviceSpecs, apiGetDeviceBrands, apiDelDeviceSpecs } from "@/api/api_equipment";
|
||||
import * as dd from "dingtalk-jsapi";
|
||||
import DeviceSpecDetail from './device-spec-detail.vue'
|
||||
export default {
|
||||
components: {
|
||||
DeviceSpecDetail
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
isShowSearch: true,
|
||||
data: [],
|
||||
types: [],
|
||||
brands: [],
|
||||
name: "",
|
||||
categorys: "",
|
||||
input: "",
|
||||
dataListLoading: false,
|
||||
typeIndex: 0, //0现在是1级 1二级2三级
|
||||
showHeader: false,
|
||||
totalPage: 1,
|
||||
departmentReaderOnly: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
specs: null,
|
||||
brandId: null,
|
||||
typeId: null,
|
||||
rank: null, //排序
|
||||
skus: null, //库存
|
||||
remark: null,
|
||||
used: 0, //是否在
|
||||
|
||||
},
|
||||
isShowDetail: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.handleGetImgCaptcha()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
|
||||
addNewSpec(){
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
var val = {id: null, typeId: null, type: null, brandId: null, brand: null, specs: null, skus: null, rank: 0, used: 0, remark: null}
|
||||
this.$refs.deviceSpecDetail.init(val, this.types, this.brands)
|
||||
}, 500)
|
||||
this.isShowDetail = true
|
||||
|
||||
},
|
||||
changeDepartment(type) {
|
||||
if(type == 1){
|
||||
//获取品牌
|
||||
this.getBrands()
|
||||
this.specReq.brandId = null
|
||||
}else{
|
||||
this.specReq.page = 1
|
||||
this.getData()
|
||||
}
|
||||
},
|
||||
sizeChangeHandle(val) {
|
||||
this.specReq.page = 1
|
||||
this.specReq.rows = val
|
||||
this.getData();
|
||||
},
|
||||
currentChangeHandle(val) {
|
||||
this.specReq.page = val
|
||||
this.getData();
|
||||
},
|
||||
// 新增 / 编辑
|
||||
handleAddOrUpdate (val) {
|
||||
console.log(val)
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
|
||||
this.$refs.deviceSpecDetail.init(val, this.types, this.brands)
|
||||
}, 500)
|
||||
this.isShowDetail = true
|
||||
},
|
||||
// 删除
|
||||
handleDelete (val) {
|
||||
|
||||
this.$confirm('确定删除“' + val.specs + '”吗?删除后该规格将无法使用', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.delDeviceSpecs(val.id)
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
delDeviceSpecs(id){
|
||||
apiDelDeviceSpecs({page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: id,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
specs: null,
|
||||
brandId: null,
|
||||
typeId: null,
|
||||
rank: null, //排序
|
||||
skus: null, //库存
|
||||
remark: null,
|
||||
used: 0}).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.$message('删除成功')
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error('删除失败' + data.msg)
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
console.log("获取数据")
|
||||
console.log(this.name)
|
||||
console.log(this.categorys)
|
||||
this.dataListLoading = true
|
||||
apiGetDeviceSpecs(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.data = data.rows;
|
||||
this.totalPage = data.total
|
||||
this.types = data.types
|
||||
} else {
|
||||
this.data = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getBrands(){
|
||||
apiGetDeviceBrands(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.brands = data.brands
|
||||
this.specReq.page = 1
|
||||
this.getData()
|
||||
} else {
|
||||
this.brands = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
btnSearch() {
|
||||
this.specReq.page = 1
|
||||
this.getData();
|
||||
},
|
||||
|
||||
rowClick(row, event, column) {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
.bg-purple-light {
|
||||
background: #e5f2f1;
|
||||
}
|
||||
.grid-content {
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
.row-bg {
|
||||
padding: 10px 0;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
.div_height {
|
||||
height: 38px;
|
||||
}
|
||||
.div_width {
|
||||
width: 100%;
|
||||
}
|
||||
.width_100 {
|
||||
width: 100px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding: 1em;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid;
|
||||
}
|
||||
.flex_son {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0x solid;
|
||||
}
|
||||
</style>
|
||||
124
src/views/modules/device-manage/device-type-detail.vue
Normal file
124
src/views/modules/device-manage/device-type-detail.vue
Normal file
@ -0,0 +1,124 @@
|
||||
<template>
|
||||
<el-dialog :title="!id ? '新增类型' : '编辑类型'" :close-on-click-modal="false" :visible.sync="visible"
|
||||
>
|
||||
|
||||
|
||||
<el-form :inline="true">
|
||||
<el-form-item label="类型">
|
||||
<el-input v-model="type" placeholder="类型名称" clearable>{{type}}</el-input>
|
||||
</el-form-item>
|
||||
<el-form-item label="排序">
|
||||
<el-input v-model="rank" placeholder="请输入数字" clearable>{{rank}}</el-input>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="warning" @click="save(0)">取消</el-button>
|
||||
<el-button type="primary" @click="save(1)">保存</el-button>
|
||||
|
||||
</span>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script>
|
||||
import { apiEditDeviceTypes, apiAddDeviceTypes } from "@/api/api_equipment";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
visible: false,
|
||||
id: null,
|
||||
type:null,
|
||||
brand:null,
|
||||
rank: 0, //排序
|
||||
departmentReaderOnly: false,
|
||||
isAdd: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
spetypecs: null,
|
||||
describe: null,
|
||||
rank: null, //排序
|
||||
},
|
||||
};
|
||||
},
|
||||
mounted() {},
|
||||
computed: {},
|
||||
methods: {
|
||||
async init(obj) {
|
||||
console.log("device-type-detail init")
|
||||
this.specReq.id = obj.id
|
||||
this.id = obj.id
|
||||
this.type = obj.type
|
||||
this.rank = obj.rank
|
||||
|
||||
|
||||
this.visible = true
|
||||
if(!this.id){
|
||||
this.isAdd = true
|
||||
}else{
|
||||
this.isAdd = false
|
||||
}
|
||||
|
||||
},
|
||||
changeType(val){
|
||||
console.log(val)
|
||||
this.getBrands()
|
||||
|
||||
},
|
||||
changeBrand(val){
|
||||
console.log(val)
|
||||
|
||||
},
|
||||
|
||||
save(val){
|
||||
if(val == 0){
|
||||
this.visible = false
|
||||
return
|
||||
}
|
||||
if(!this.type || this.type.length == 0){
|
||||
this.$message.error('请输入类型名称')
|
||||
return
|
||||
}
|
||||
if((!this.rank && this.rank != 0) || this.rank.length == 0){
|
||||
this.$message.error('请设置排序')
|
||||
return
|
||||
}
|
||||
this.specReq.type = this.type
|
||||
this.specReq.rank = this.rank
|
||||
this.specReq.id = this.id
|
||||
this.editSpecs()
|
||||
},
|
||||
editSpecs(){
|
||||
console.log('editSpecs')
|
||||
if(this.isAdd){
|
||||
apiAddDeviceTypes(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false
|
||||
this.$message('添加成功')
|
||||
this.$emit('refreshDataList')
|
||||
} else {
|
||||
this.$$message.error(data.msg)
|
||||
}
|
||||
});
|
||||
} else {
|
||||
apiEditDeviceTypes(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.visible = false
|
||||
this.$message('更新成功')
|
||||
this.$emit('refreshDataList')
|
||||
} else {
|
||||
this.$$message.error(data.msg)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
};
|
||||
</script>
|
||||
262
src/views/modules/device-manage/device-type.vue
Normal file
262
src/views/modules/device-manage/device-type.vue
Normal file
@ -0,0 +1,262 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-form :inline="true" :model="dataForm" @keyup.enter.native="getDataList()">
|
||||
|
||||
|
||||
<el-form-item label="类型">
|
||||
<el-input v-model="specReq.type" placeholder="类型信息" clearable></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="getData()">查询</el-button>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="success" @click="addNewSpec()">新增类型</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-table v-loading="dataListLoading" :data="data" style="width: 100%" @row-click="rowClick">
|
||||
<el-table-column prop="id" header-align="center" align="center" label="ID"></el-table-column>
|
||||
<el-table-column prop="type" header-align="center" align="center" label="类型"></el-table-column>
|
||||
<el-table-column prop="rank" header-align="center" align="center" label="排序"></el-table-column>
|
||||
<el-table-column fixed="right" header-align="center" align="center" width="180" label="操作">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleAddOrUpdate(scope.row)"
|
||||
>编辑
|
||||
</el-button>
|
||||
<el-button
|
||||
type="text"
|
||||
size="mini"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除
|
||||
</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<el-pagination
|
||||
@size-change="sizeChangeHandle"
|
||||
@current-change="currentChangeHandle"
|
||||
:current-page="specReq.page"
|
||||
:page-sizes="[10, 20, 50, 100]"
|
||||
:page-size="specReq.rows"
|
||||
:total="totalPage"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
></el-pagination>
|
||||
<device-type-detail v-if="isShowDetail" ref="deviceTypeDetail" @refreshDataList="getData"></device-type-detail>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import { apiGetDeviceTypes, apiDelDeviceTypes } from "@/api/api_equipment";
|
||||
import DeviceTypeDetail from './device-type-detail.vue'
|
||||
export default {
|
||||
components: {
|
||||
DeviceTypeDetail
|
||||
},
|
||||
data() {
|
||||
|
||||
return {
|
||||
isShowSearch: true,
|
||||
data: [],
|
||||
name: "",
|
||||
categorys: "",
|
||||
input: "",
|
||||
dataListLoading: false,
|
||||
typeIndex: 0, //0现在是1级 1二级2三级
|
||||
showHeader: false,
|
||||
totalPage: 1,
|
||||
departmentReaderOnly: false,
|
||||
specReq: {
|
||||
page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: null,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
spetypecs: null,
|
||||
describe: null,
|
||||
rank: null, //排序
|
||||
},
|
||||
isShowDetail: false
|
||||
};
|
||||
},
|
||||
created() {
|
||||
// this.handleGetImgCaptcha()
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.getData();
|
||||
},
|
||||
methods: {
|
||||
|
||||
addNewSpec(){
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
var val = {id: null, type: null, rank: 0}
|
||||
this.$refs.deviceTypeDetail.init(val)
|
||||
}, 500)
|
||||
this.isShowDetail = true
|
||||
|
||||
},
|
||||
changeDepartment(type) {
|
||||
if(type == 1){
|
||||
//获取品牌
|
||||
this.getBrands()
|
||||
this.specReq.brandId = null
|
||||
}else{
|
||||
this.specReq.page = 1
|
||||
this.getData()
|
||||
}
|
||||
},
|
||||
sizeChangeHandle(val) {
|
||||
this.specReq.page = 1
|
||||
this.specReq.rows = val
|
||||
this.getData();
|
||||
},
|
||||
currentChangeHandle(val) {
|
||||
this.specReq.page = val
|
||||
this.getData();
|
||||
},
|
||||
// 新增 / 编辑
|
||||
handleAddOrUpdate (val) {
|
||||
console.log(val)
|
||||
//id, typeId, type, brandId, brand, specs, skus, rank, used, remark, types, brands
|
||||
setTimeout(() => {
|
||||
|
||||
this.$refs.deviceTypeDetail.init(val, this.types, this.brands)
|
||||
}, 500)
|
||||
this.isShowDetail = true
|
||||
},
|
||||
// 删除
|
||||
handleDelete (val) {
|
||||
|
||||
this.$confirm('确定删除“' + val.type + '”吗?删除后该类型将无法使用', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
this.delDeviceTTypeypes(val.id)
|
||||
}).catch(() => {
|
||||
})
|
||||
},
|
||||
delDeviceTTypeypes(id){
|
||||
apiDelDeviceTypes({page: 1,
|
||||
rows: 10,
|
||||
sort: null,
|
||||
order: null,
|
||||
id: id,
|
||||
isDelete: 0,
|
||||
gmtCreate: null,
|
||||
gmtModified: null,
|
||||
type: null,
|
||||
rank: null //排序
|
||||
}).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.$message('删除成功')
|
||||
this.getData()
|
||||
} else {
|
||||
this.$message.error('删除失败' + data.msg)
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getData() {
|
||||
console.log("获取数据")
|
||||
console.log(this.name)
|
||||
console.log(this.categorys)
|
||||
this.dataListLoading = true
|
||||
apiGetDeviceTypes(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.data = data.rows;
|
||||
this.totalPage = data.total
|
||||
this.types = data.types
|
||||
} else {
|
||||
this.data = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
getBrands(){
|
||||
apiGetDeviceBrands(this.specReq).then((data) => {
|
||||
console.log(data);
|
||||
if (data && data.code === 0) {
|
||||
this.brands = data.brands
|
||||
this.specReq.page = 1
|
||||
this.getData()
|
||||
} else {
|
||||
this.brands = [];
|
||||
}
|
||||
this.dataListLoading = false;
|
||||
});
|
||||
},
|
||||
btnSearch() {
|
||||
this.specReq.page = 1
|
||||
this.getData();
|
||||
},
|
||||
|
||||
rowClick(row, event, column) {},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 10px;
|
||||
}
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
.bg-purple-light {
|
||||
background: #e5f2f1;
|
||||
}
|
||||
.grid-content {
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
.row-bg {
|
||||
padding: 10px 0;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
.div_height {
|
||||
height: 38px;
|
||||
}
|
||||
.div_width {
|
||||
width: 100%;
|
||||
}
|
||||
.width_100 {
|
||||
width: 100px;
|
||||
}
|
||||
.center {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
|
||||
padding: 1em;
|
||||
}
|
||||
.flex {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 1px solid;
|
||||
}
|
||||
.flex_son {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
border: 0x solid;
|
||||
}
|
||||
</style>
|
||||
@ -1,159 +0,0 @@
|
||||
<template>
|
||||
<el-row>
|
||||
<el-col :span="24"><div class="grid-content bg-purple-dark"></div></el-col>
|
||||
</el-row>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { apiDingtalkLogin } from '@/api/api_staff'
|
||||
import {apiDingtalkJump } from '@/api/api_staff'
|
||||
import * as dd from 'dingtalk-jsapi'
|
||||
var dingCode = null
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
isloading: false,
|
||||
dataForm: {
|
||||
userName: '',
|
||||
password: '',
|
||||
uuid: '',
|
||||
// captcha: ''
|
||||
verify: '身份验证中...'
|
||||
},
|
||||
req: {
|
||||
code: ''
|
||||
},
|
||||
// captchaPath: '' // 图像验证码请求地址
|
||||
time: 0,
|
||||
timer: true,
|
||||
hasSendCode: true,
|
||||
tick: 1
|
||||
}
|
||||
},
|
||||
created () {
|
||||
// this.handleGetImgCaptcha()
|
||||
},
|
||||
mounted () {
|
||||
if(this.isDingtalk()){
|
||||
if(typeof this.$route.query.code == 'undefined'){
|
||||
console.log('走钉钉免登流程')
|
||||
this.dingtalkLogin()
|
||||
this.checkDingTalkLogin()
|
||||
} else {
|
||||
this.loginJump()
|
||||
}
|
||||
} else {
|
||||
|
||||
this.loginJump()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
loginJump () {
|
||||
this.dataForm.verify = '验证中'
|
||||
console.log(this.$route.query)
|
||||
this.req.code = this.$route.query.code
|
||||
apiDingtalkJump(this.req).then(res => {
|
||||
|
||||
console.log(res)
|
||||
if (res && res.code === 0) {
|
||||
console.log('获取token')
|
||||
this.$cookie.set('token', res.token)
|
||||
window.location.href=this.$route.query.url
|
||||
|
||||
//window.open(window.location.href + '&code=' + dingCode.code, "_blank")
|
||||
console.log('跳转')
|
||||
} else {
|
||||
this.dataForm.verify='身份验证失败' + res.msg
|
||||
this.$message.error(this.dataForm.verify)
|
||||
this.$router.replace({ name: 'login' })
|
||||
}
|
||||
this.hasSendCode = false;
|
||||
})
|
||||
},
|
||||
checkDingTalkLogin () {
|
||||
if(dingCode === null){
|
||||
if(this.tick < 30){
|
||||
this.isTick++
|
||||
setTimeout(() =>{
|
||||
this.checkDingTalkLogin()
|
||||
}, 300)
|
||||
}else{
|
||||
this.$message.error('登录失败,请用账户和密码登录')
|
||||
this.$router.replace({ name: 'login' })
|
||||
}
|
||||
|
||||
} else {
|
||||
this.loginWtihCode(dingCode)
|
||||
}
|
||||
},
|
||||
isDingtalk () {
|
||||
if (/(DingTalk)/i.test(navigator.userAgent)) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
dingtalkLogin () {
|
||||
dd.runtime.permission.requestAuthCode({
|
||||
corpId: 'ding267474e759bbca1c35c2f4657eb6378f',
|
||||
onSuccess(result){
|
||||
|
||||
dingCode = result
|
||||
|
||||
},
|
||||
onFail(err) {
|
||||
|
||||
console.log(err)
|
||||
dingCode = err
|
||||
}
|
||||
})
|
||||
},
|
||||
loginWtihCode (result) {
|
||||
console.log('免登流程')
|
||||
console.log(result)
|
||||
apiDingtalkLogin(result).then(res => {
|
||||
console.log('获取登录结果')
|
||||
console.log(res)
|
||||
this.hasSendCode = false
|
||||
if (res && res.code === 0) {
|
||||
console.log('获取token')
|
||||
this.$cookie.set('token', res.token)
|
||||
this.dataForm.verify='登录成功,跳转中...'
|
||||
window.open(window.location.href + '&code=' + dingCode.code, "_blank")
|
||||
console.log('跳转')
|
||||
} else {
|
||||
this.dataForm.verify='身份验证失败' + res.msg
|
||||
this.$message.error(this.dataForm.verify)
|
||||
this.$router.replace({ name: 'login' })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.el-row {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.el-col {
|
||||
border-radius: 4px;
|
||||
}
|
||||
.bg-purple-dark {
|
||||
background: #99a9bf;
|
||||
}
|
||||
.bg-purple {
|
||||
background: #d3dce6;
|
||||
}
|
||||
.bg-purple-light {
|
||||
background: #e5e9f2;
|
||||
}
|
||||
.grid-content {
|
||||
border-radius: 4px;
|
||||
min-height: 36px;
|
||||
}
|
||||
.row-bg {
|
||||
padding: 10px 0;
|
||||
background-color: #f9fafc;
|
||||
}
|
||||
</style>
|
||||
Loading…
x
Reference in New Issue
Block a user