Commit 9f47bdf4 by zhangzhen

新功能模块添加

parent 2a197304
...@@ -111,34 +111,3 @@ export const updateSubmitStatus = (data) => { ...@@ -111,34 +111,3 @@ export const updateSubmitStatus = (data) => {
let d = setResultData(data); let d = setResultData(data);
return http.post(url, d) return http.post(url, d)
} }
export const getSubList = (params,pageData) => {
let url = `/service/S_QT_RK_02`
let d = setParamsData(params,pageData)
return http.post(url, d)
}
export const getInventRecord = (params,pageData) => {
let url = `/service/S_QT_RK_03`
let d = setParamsData(params,pageData)
return http.post(url, d)
}
export const getInventInfo = (params,pageData) => {
let url = `/service/S_QT_RK_04`
let d = setParamsData(params,pageData)
return http.post(url, d)
}
export const saveSubList = (data) => {
let url = `/service/S_QT_RK_05`
let d = setResultData(data);
return http.post(url, d)
}
export const deleteSubInfo = (data) => {
let url = `/service/S_QT_RK_09`
let d = setResultData(data);
return http.post(url, d)
}
\ No newline at end of file
...@@ -68,6 +68,21 @@ const setResultData = (data={}) => { ...@@ -68,6 +68,21 @@ const setResultData = (data={}) => {
"__version__": "2.0", "__version__": "2.0",
"__sys__": {}, "__sys__": {},
"__blocks__": { "__blocks__": {
inqu_status:{
attr: {},
meta:{
attr: {},
columns:[
{
name:"purchaseDate",
pos:0
}
]
},
rows:[
[""]
]
},
"result": { "result": {
"attr": {}, "attr": {},
"meta": { "meta": {
...@@ -94,3 +109,22 @@ export const getList = (params,pageData) => { ...@@ -94,3 +109,22 @@ export const getList = (params,pageData) => {
return http.post(url, d) return http.post(url, d)
} }
export const updateInfo = (data) => {
let url = `/service/S_SB_TZ_02`
let d = setResultData(data);
return http.post(url, d)
}
export const deleteInfo = (data) => {
let url = `/service/S_SB_TZ_03`
let d = setResultData(data);
return http.post(url, d)
}
export const updateSubmitStatus = (data) => {
let url = `/service/S_SB_TZ_04`
let d = setResultData(data);
return http.post(url, d)
}
...@@ -122,6 +122,24 @@ export const fileDownLoad = (data) => { ...@@ -122,6 +122,24 @@ export const fileDownLoad = (data) => {
} }
export const getDict = (data) => {
let url = `/service/S_ED_02`;
return http.post(url, data)
}
export const getOrgByCompanyCode = (data) => {
let url = `/service/S_HGMT_SC05_15`;
let d = setParamsData(data)
return http.post(url, d)
}
export const getUserByCompanyCode = (data) => {
let url = `/service/S_HG_XS_002`;
let d = setParamsData(data)
return http.post(url, d)
}
//上传文件 //上传文件
export const uploadFile = (data) => { export const uploadFile = (data) => {
......
...@@ -422,6 +422,28 @@ ...@@ -422,6 +422,28 @@
"navigationStyle": "custom", "navigationStyle": "custom",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
},
{
"path" : "pages/device-manager/list",
"style" :
{
"navigationBarTitleText" : "设备台账",
"navigationBarBackgroundColor": "#0072fc",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"enablePullDownRefresh" : false
}
},
{
"path" : "pages/device-manager/add",
"style" :
{
"navigationBarTitleText" : "新增",
"navigationBarBackgroundColor": "#0072fc",
"navigationBarTextStyle": "white",
"navigationStyle": "custom",
"enablePullDownRefresh" : false
}
} }
], ],
"globalStyle": { "globalStyle": {
......
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
} from "@/api/apply-for-maintenance.js"; } from "@/api/apply-for-maintenance.js";
import { import {
getList as getDeviceList getList as getDeviceList
} from "@/api/device.js"; } from "@/api/device-manager.js";
export default { export default {
data() { data() {
......
<template>
<view>
<cu-custom bgColor="bg-blue" :isBack="true">
<block slot="backText">
<view class="list-icon" @tap="onBack">
<text class="cuIcon-back text-white text-bold text-xl"></text>
</view>
</block>
<block slot="content">
<text class="text-white">{{textTitle}}</text>
</block>
</cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
</view>
<view class="flex-col content-part-1">
<view class="flex-row header">
<image src="../../static/icon10.png" mode="widthFix"></image>
<text class="text-lg text-bold text-black">详情</text>
</view>
<view class="form-content-box">
<form>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>公司名称:</text>
</view>
<view class="text-blue">
<picker @change="onChange" :value="factoryIndex" :range="factoryList" range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ factoryIndex>=0 ? factoryList[factoryIndex].label:'请选择公司'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>设备区域:</text>
</view>
<view class="text-blue">
<picker @change="onChange3" :value="groupRecordIndex" :range="groupRecordList"
range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ groupRecordIndex>=0 ? groupRecordList[groupRecordIndex].label:'请选择设备区域'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>设备类型:</text>
</view>
<view class="text-blue">
<picker @change="onChange2" :value="deviceTypeIndex" :range="deviceTypeList"
range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ deviceTypeIndex>=0 ? deviceTypeList[deviceTypeIndex].label:'请选择设备类型'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text v-if="!orderInfo.id" class="text-xl text-red">*</text>
<text>购置日期:</text>
</view>
<view v-if="orderInfo.id" class="">
<text>{{orderInfo.purchaseDate}}</text>
</view>
<view v-else class="text-blue" @tap="onOpenCalendar('purchaseDate')">
<text>{{orderInfo.purchaseDate}}</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>设备名称:</text>
</view>
<view class="text-blue">
<u-input v-model="orderInfo.deviceName" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入设备名称" />
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>设备编码:</text>
</view>
<view class="text-blue">
<u-input v-model="orderInfo.deviceCode" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入设备编码" />
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>设备型号:</text>
</view>
<view class="text-blue">
<u-input v-model="orderInfo.deviceModel" color="#0081ff" inputAlign="right" type="text"
:border="border" placeholder="请输入设备型号" />
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>保养日期:</text>
</view>
<view class="text-blue" @tap="onOpenCalendar('maintainDate')">
<text>{{orderInfo.maintainDate}}</text>
<text class="cuIcon-right"></text>
</view>
</view>
<view class="cu-form-group">
<view class="title">
<text class="text-xl text-red">*</text>
<text>负责人:</text>
</view>
<view class="text-blue">
<picker @change="onChange4" :value="userIndex" :range="userList"
range-key="label">
<view class="uni-input">
<text
class="text-blue">{{ userIndex>=0 ? userList[userIndex].label:'请选择设备负责人'}}</text>
<text class="cuIcon-right"></text>
</view>
</picker>
</view>
</view>
<view v-if="orderInfo.id" class="cu-form-group">
<view class="title">
<text>状态:</text>
</view>
<view class="">
<text>{{statusEnum[orderInfo.deviceStatus]}}</text>
</view>
</view>
</form>
</view>
</view>
<view v-if="!orderInfo.id || orderInfo.status != 2" class="footer-box">
<button class="cu-btn block bg-blue" @tap="onSubmit(1)">提 交</button>
<button v-if="orderInfo.id" class="cu-btn block bg-red" @tap="onSubmit(2)">删 除</button>
</view>
<u-calendar :show="show2" mode="single" :defaultDate="orderInfo.applyDate" :minDate="minDate" :monthNum='4'
@confirm="onConfirm" @close="onCancel"></u-calendar>
<u-modal :show="show" title="提示" :content='content' :showCancelButton="true" @confirm="onSave"
@cancel="onCancel" :asyncClose="true"></u-modal>
</view>
</template>
<script>
import {
toJsonData
} from "@/utils/tools.js";
import moment from "@/common/moment.js";
import {
getParamsList
} from "@/api/product-warehousing.js";
import {
updateInfo,
getList,
deleteInfo
} from "@/api/device-manager.js";
import {
getDict,getOrgByCompanyCode,getUserByCompanyCode
} from "@/api/index.js";
export default {
data() {
return {
userInfor: uni.getStorageSync("userInfor"),
textTitle: "维保详情",
show: false,
show2: false,
border: "none",
minDate: moment().subtract(2, 'M').format("YYYY-MM-DD"),
content: "请确认是否进行提交操作?",
addStatus: false,
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
status: 'nomore ',
showText: false,
target: 60,
modelVale: 100,
current: 0,
value: 0,
orderInfo: {
id: undefined,
purchaseDate: moment().format("YYYY-MM-DD"),
maintainDate: moment().format("YYYY-MM-DD")
},
form: {},
factoryIndex: -1,
factoryList: [],
delInfo: {},
factoryEnum: {},
projectList: [],
projectIndex: -1,
pageData: {
showCount: "true",
limit: 5,
offset: 0
},
statusEnum: {
0: '已停用',
1: "启用中"
},
submitType: 1,
deviceTypeList: [],
deviceTypeIndex: -1,
dateStr:'',
groupRecordList:[],
groupRecordIndex:-1,
userList:[],
userIndex:-1
};
},
onLoad(option) {
console.log(uni.getStorageSync("userInfor"))
this.onLoading();
if (option && option.id) {
this.textTitle = "设备台账"
this.orderInfo.id = option.id;
this.onGetList();
} else {
this.textTitle = "新增设备"
}
},
methods: {
onSubmit(t) {
this.submitType = t;
this.content = t == 1 ? "请确认是否进行提交操作?" : "请确认是否进行删除操作?";
this.show = true
},
onOpenCalendar(val) {
this.dateStr = val;
this.show2 = true;
},
onCancel() {
this.show = false;
this.show2 = false;
},
onConfirm(e) {
this.orderInfo[this.dateStr] = e[0];
this.onCancel();
},
onSave() {
this.show = false;
if (this.submitType == 1) {
if (this.factoryIndex < 0) {
uni.showToast({
icon: "none",
title: "请选择公司"
})
return
}
if (this.groupRecordIndex < 0) {
uni.showToast({
icon: "none",
title: "请选择设备区域"
})
return
}
if (this.deviceTypeIndex < 0) {
uni.showToast({
icon: "none",
title: "请选择设备类型"
})
return
}
if(!this.orderInfo.deviceName){
uni.showToast({
icon: "none",
title: "请输入设备名称"
})
return
}
if(!this.orderInfo.deviceCode){
uni.showToast({
icon: "none",
title: "请输入设备编码"
})
return
}
if(!this.orderInfo.deviceCode){
uni.showToast({
icon: "none",
title: "请输入设备型号"
})
return
}
uni.showLoading({
title: "加载中..."
})
updateInfo({
...this.orderInfo,
companyCode: this.factoryList[this.factoryIndex].value,
companyName: this.factoryList[this.factoryIndex].label,
deviceUserId: this.userList[this.userIndex].value,
purchaseDate: moment(this.orderInfo.purchaseDate).format("YYYYMMDD"),
maintainDate: moment(this.orderInfo.maintainDate).format("YYYYMMDD"),
deviceStatus: this.orderInfo.id ? this.orderInfo.deviceStatus : "0",
groupCode: this.groupRecordList[this.groupRecordIndex].value,
groupName: this.groupRecordList[this.groupRecordIndex].label,
deviceType: this.deviceTypeList[this.deviceTypeIndex].value
}).then(res => {
uni.hideLoading();
if (res.data.__sys__.status === 0) {
uni.showToast({
icon: "success",
title: this.orderInfo.id ? '修改成功' : "新增成功"
})
setTimeout(() => {
this.onBack();
}, 1500)
}
})
} else {
deleteInfo(this.orderInfo).then(res => {
if (res.data.__sys__.status === 1) {
uni.showToast({
icon: "success",
title: "删除成功"
})
setTimeout(() => {
this.onBack();
}, 1500)
}
})
}
},
onChange(e) {
let index = Number(e.target.value);
if (this.factoryIndex === index) return
this.factoryIndex = index;
this.groupRecordIndex = -1;
this.userIndex = -1;
this.onGetOrgByCompanyCode();
this.onGetUserByCompanyCode()
},
onChange2(e) {
let index = Number(e.target.value);
if (this.deviceTypeIndex === index) return
this.deviceTypeIndex = index;
},
onChange3(e){
let index = Number(e.target.value);
if (this.groupRecordIndex === index) return
this.groupRecordIndex = index;
},
onChange4(e){
let index = Number(e.target.value);
if (this.userIndex === index) return
this.userIndex = index;
},
onProjectChange(e) {
let index = Number(e.target.value);
if (this.projectIndex === index) return
this.projectIndex = index;
},
onBack() {
uni.redirectTo({
url: "/pages/device-manager/list"
})
},
onLoading() {
getDict({
codeset: 'hpjx.hpsb.deviceType'
}).then(res => {
this.deviceTypeList = res.data.list;
})
getParamsList().then(res => {
this.factoryList = res.data.map(item => {
this.factoryEnum[item.companyCode] = item.companyName
return {
label: item.companyName,
value: item.companyCode
}
})
})
},
onGetOrgByCompanyCode(){
getOrgByCompanyCode({
parentOrgId: this.factoryList[this.factoryIndex].value
}).then(res => {
console.log(res,9999)
this.groupRecordList = toJsonData(res.data.__blocks__.group_record_block_id.rows, res.data.__blocks__.group_record_block_id.meta.columns).map(item=>{
return {
value: item.valueField,
label: item.textField.split("[")[0],
}
});
if(this.orderInfo.id && this.groupRecordIndex<0){
this.groupRecordIndex = this.groupRecordList.findIndex(item => item.value === this.orderInfo.groupCode);
}
})
},
onGetUserByCompanyCode(){
getUserByCompanyCode({
companyCode: this.factoryList[this.factoryIndex].value
}).then(res => {
console.log(res,9999)
this.userList = toJsonData(res.data.__blocks__.user_block_id.rows, res.data.__blocks__.user_block_id.meta.columns).map(item=>{
return {
value: item.valueField,
label: item.textField,
}
});
if(this.orderInfo.id && this.userIndex<0){
this.userIndex = this.userList.findIndex(item => item.value === this.orderInfo.deviceUserId);
}
})
},
onGetList() {
uni.showLoading({
title: "加载中"
})
getList({
id: this.orderInfo.id,
purchaseDate: ''
}, this.pageData).then(res => {
uni.hideLoading();
let list = toJsonData(res.data.__blocks__.result.rows, res.data.__blocks__.result.meta.columns)
if (list && list.length) {
list = list.map(item => {
return {
...item,
purchaseDate: moment(item.purchaseDate).format("YYYY-MM-DD"),
maintainDate: moment(item.maintainDate).format("YYYY-MM-DD")
}
})
this.orderInfo = list[0];
if (this.orderInfo.id) {
this.factoryIndex = this.factoryList.findIndex(item => item.value === this.orderInfo.companyCode);
this.deviceTypeIndex = this.deviceTypeList.findIndex(item => item.value === this.orderInfo.deviceType);
this.onGetOrgByCompanyCode();
this.onGetUserByCompanyCode();
}
}
})
}
}
}
</script>
<style>
page {
background-color: #f1f1f1;
}
</style>
<style lang="scss" scoped>
.cu-form-group {
picker {
padding-right: 0;
}
}
.header-title {
display: flex;
flex-direction: row;
width: 90%;
align-items: center;
margin: 30upx auto 12upx;
.flex-between {
display: flex;
flex: 1;
justify-content: center;
align-items: center;
border-radius: 20upx;
padding: 16upx 20upx;
background-color: rgba(246, 246, 248, 1);
.image {
width: 34upx;
margin-right: 8upx;
max-height: 42upx;
}
.text-blue {
color: #4a93f8;
font-weight: bold;
}
}
}
.u-tabs-box {
width: 70%;
margin: 0 auto;
}
.data-content {
display: flex;
flex-direction: column;
margin: 0 auto 30upx;
width: 96%;
.circle-par {
display: flex;
justify-content: center;
align-items: center;
}
.header {
border-radius: 12upx 12upx 0 0;
background-color: #eef2fe;
color: #101010;
font-size: 30upx;
border: 1px solid #d1dcfd;
padding: 14upx 24upx;
}
.content {
border-radius: 0 0 12upx 12upx;
background-color: #ffffff;
color: #101010;
font-size: 30upx;
border: 1px solid #cecece;
border-top: none;
}
}
.flex-content {
display: flex;
width: 100%;
justify-content: center;
}
.part-3 {
flex-direction: column;
padding-bottom: 120upx;
.content-item {
display: flex;
flex-direction: column;
width: 90%;
margin: 24upx auto 8upx;
padding-bottom: 24upx;
.header-title {
position: relative;
width: 100%;
margin: 0;
image {
width: 100%;
max-height: 100upx;
}
.flex-between {
position: absolute;
top: 0;
left: 12%;
width: 88%;
height: 70%;
padding: 0;
justify-content: space-between;
background-color: transparent;
}
}
.content-box {
position: relative;
z-index: 2;
box-shadow: 0 0 12upx rgba(0, 0, 0, 0.34);
border-radius: 12upx;
margin-top: -20upx;
background-color: #ffffff;
padding: 24upx;
.flex-wrap {
display: flex;
flex-wrap: wrap;
.margin-sm {
margin: 10upx;
}
}
}
}
.content-item:last-child {
border-bottom: none;
}
}
.flex-center {
display: flex;
align-items: center;
}
.line-progress {
align-items: center;
}
.u-page__item__slot-icon {
width: 24px;
height: 24px;
}
.part-left {
align-items: center;
}
.circle-center {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.margin-top-sm {
margin-top: 10upx;
}
.flex-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
}
.icon {
width: 36upx;
max-height: 50upx;
margin-right: 6upx;
}
.flex-row-center {
display: flex;
flex-direction: row;
align-items: center;
}
.content-part-1 {
display: flex;
flex-direction: column;
align-items: center;
.header {
display: flex;
flex-direction: row;
align-items: center;
width: 92%;
padding: 30upx 0;
image {
width: 20px;
height: 20px;
margin-right: 6upx;
}
}
.form-content-box {
display: flex;
flex-direction: column;
width: 100%;
padding: 12upx 0;
border-radius: 4upx;
// box-shadow: 0 0 8upx rgba(0, 0, 0, 0.34);
background-color: #ffffff;
.cu-form-group {
height: 32px;
min-height: 32px;
.title {
display: flex;
flex-direction: row;
width: 200upx;
align-items: center;
}
.text-blue {
white-space: normal;
}
}
.action-box {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
}
.footer-content {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 120upx;
margin-bottom: 100upx;
.btn-box {
width: 80%;
}
}
}
.order-content-box {
display: flex;
flex-direction: column;
width: 100%;
background-color: #ffffff;
.header {
display: flex;
flex-direction: row;
align-items: center;
width: 100%;
padding: 24upx;
image {
width: 20px;
height: 20px;
margin-right: 6upx;
}
}
.content-box {
position: relative;
z-index: 2;
padding: 0 24upx 24upx;
.flex-row {
margin: 6upx 0;
.text-title {
font-size: 30upx;
}
.part-1 {
font-size: 32upx;
width: 140upx;
text-align-last: justify;
}
.part-2 {
margin-right: 24upx;
}
}
.btn-box {
position: absolute;
right: 24upx;
bottom: 16upx;
}
}
}
.footer-box {
position: fixed;
left: 0;
bottom: 0;
display: flex;
flex-direction: row;
width: 100%;
padding: 24upx 36upx;
background-color: #ffffff;
z-index: 8;
.cu-btn {
display: flex;
flex: 1;
margin: 0 20upx;
}
}
.content-part-2 {
.form-content-box {
display: flex;
background-color: transparent;
justify-content: center;
}
.form-content-box:last-child {
margin-bottom: 120upx;
}
}
.sub-item-box {
display: flex;
flex-direction: column;
width: 94%;
margin: 0 auto 8upx;
padding-bottom: 24upx;
.item-form {
position: relative;
z-index: 2;
border-radius: 12upx;
background-color: #ffffff;
box-shadow: 0 0 6upx rgba(0, 0, 0, 0.34);
margin-top: -20upx;
padding: 24upx;
}
.header-title {
position: relative;
width: 100%;
margin: 0;
image {
width: 100%;
max-height: 100upx;
}
.flex-between {
position: absolute;
top: 0;
left: 12%;
width: 88%;
height: 70%;
padding: 0;
justify-content: space-between;
background-color: transparent;
}
}
}
.cu-form-group uni-picker::after {
color: transparent;
}
</style>
\ No newline at end of file
<template>
<view :class="floatBoxStatus? 'page-content-box':'' ">
<cu-custom bgColor="bg-blue" :isBack="true">
<block slot="backText">
<view class="list-icon" @tap="onBack">
<text class="cuIcon-back text-white text-bold text-xl"></text>
</view>
</block>
<block slot="content">
<text class="text-white">设备台账</text>
</block>
<block slot="right">
<view class="margin-right" @tap="onNavToOrderInfo()">
<text class="text-white">新增</text>
</view>
</block>
</cu-custom>
<view v-if="statusBarHeight>0" class="content-black" :style="{height:statusBarHeight+45+'px'}">
</view>
<view class="flex-col data-content" >
<view class="flex-row header-title">
<picker mode="selector" :range="factoryList" v-model="factoryIndex" range-key="label" @change="onFactoryChange">
<view class="flex-row-center factory-name">
<text class="factory-title">{{factoryList.length? factoryList[factoryIndex].label:'厂别'}}</text>
<text class="cuIcon-unfold text-sm"></text>
</view>
</picker>
<view class="flex-1 margin-left-sm">
<u--input placeholder="请输入设备名称" v-model="queryData.deviceName" suffixIcon="search"
suffixIconStyle="color: #909399" :customStyle="{padding:'3px 6px'}" :fontSize="13" confirmType="search" @blur="onSearchByName"></u--input>
</view>
</view>
<view class="flex-col part-3">
<view v-for="(item,k) in projectDataList" :key="k" class="content-item">
<view class="header-title" @tap="onNavToOrderInfo(item)">
<image src="../../static/icon5.png" mode="widthFix"></image>
<view class="flex-between">
<text class="text-black text-bold">{{item.deviceName}}-{{item.deviceCode}}</text>
<view class="margin-right text-blue">
<text class="">详情</text>
<text class="cuIcon-right"></text>
</view>
</view>
</view>
<view class="flex-col content-box">
<view class="flex-row">
<text class="text-gray part-1">公司名称</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.companyName}}</text>
</view>
<!-- <view class="flex-row">
<text class="text-gray part-1">工厂名称</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.factoryName}}</text>
</view> -->
<view class="flex-row">
<text class="text-gray part-1">所在区域</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.groupName}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">设备类型</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{deviceTypeEnum[item.deviceType]}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">设备型号</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.deviceCode}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">申请日期</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.applyDate}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">责任人</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{userEnum[item.deviceUserId]}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">创建时间</text>
<text class="text-gray part-2">:</text>
<text class="text-title">{{item.createdTime}}</text>
</view>
<view class="flex-row">
<text class="text-gray part-1">状态</text>
<text class="text-gray part-2">:</text>
<view class="flex-1 flex-between">
<text class="text-title">{{statusEnum[item.deviceStatus]}}</text>
<button class="cu-btn block bg-blue" @tap="onSubmit(k)">{{item.deviceStatus == 1? '停用':'启用'}}</button>
</view>
</view>
</view>
</view>
<view v-if="projectDataList.length" style="padding: 12px 6% 0;">
<u-loadmore :status="status" :icon="true" :line='true' :loading-text="loadingText"
:loadmore-text="loadmoreText" :nomore-text="nomoreText" />
</view>
<view v-if="projectDataList.length <= 0" class="empty-box">
<u-empty text="暂无数据" textColor='#C1C1C1' width="120">
</u-empty>
</view>
</view>
</view>
<u-modal :show="show" title="提示" :content='content' :showCancelButton="true" @confirm="onSave"
@cancel="onCancel" :asyncClose="true"></u-modal>
</view>
</template>
<script>
import {
pathToBase64,
base64ToPath
} from '@/utils/index.js'
import {
toJsonData
} from "@/utils/tools.js";
import moment from "@/common/moment.js";
import { getParamsList } from "@/api/product-warehousing.js";
import { getList,updateSubmitStatus } from "@/api/device-manager.js";
import { getDict,getUserByCompanyCode } from "@/api/index.js";
export default {
data() {
return {
content:"请确认是否进行审批通过操作?",
show: false,
projectDataList:[],
statusBarHeight: uni.getStorageSync("statusHeight") || 0,
status: 'nomore ',
loadingText: '努力加载中',
loadmoreText: '上划加载',
nomoreText: '到底啦',
showText: false,
target: 60,
modelVale: 100,
value: 0,
eChartData: [],
current:0,
formData: {},
//不良品类
form: {},
factoryIndex:0,
factoryList:[],
floatTop:"",
floatLeft: "",
floatBoxStatus: false,
innerHeight: window.innerHeight,
innerWidth: window.innerWidth,
startTimeStamp:0,
endTimeStamp:0,
factoryEnum:{},
queryData: {
purchaseDate:'',
companyCode:""
},
pageData:{
showCount: "true",
limit:5,
offset:0
},
statusEnum:{
0: '已停用',
1: "启用中"
},
submitIndex:"",
deviceTypeEnum:{},
userList:[],
userEnum:{}
};
},
onLoad(option) {
this.onLoading();
},
onReachBottom() {
if (this.status == 'loadmore') {
this.pageData.offset += 1;
this.onGetList();
}
},
methods: {
onGetUserByCompanyCode(){
getUserByCompanyCode({
companyCode: this.factoryList[this.factoryIndex].value
}).then(res => {
this.userList = toJsonData(res.data.__blocks__.user_block_id.rows, res.data.__blocks__.user_block_id.meta.columns).map(item=>{
this.userEnum[item.valueField] = item.textField;
return {
value: item.valueField,
label: item.textField,
}
});
this.onGetList();
})
},
onCancel(){
this.show = false;
},
onSubmit(val){
this.submitIndex = val;
this.content = this.projectDataList[this.submitIndex].deviceStatus == '1'?'请确认是否停用当前设备?':'请确认是否启用当前设备?'
this.show = true
},
onSave(){
this.show = false;
uni.showLoading({
title:"加载中..."
})
let status = this.projectDataList[this.submitIndex].deviceStatus == '1'? "0":"1";
updateSubmitStatus({
id: this.projectDataList[this.submitIndex].id,
deviceStatus: status
}).then(res => {
uni.hideLoading();
console.log(res);
this.projectDataList[this.submitIndex].deviceStatus = status;
this.$forceUpdate();
})
},
onFactoryChange(e){
this.factoryIndex = e.target.value;
this.pageData.offset = 0;
this.onGetUserByCompanyCode();
},
onBack(){
uni.redirectTo({
url:"/"
})
},
onLoading() {
getDict({
codeset:'hpjx.hpsb.deviceType'
}).then(res => {
res.data.list.forEach(item => {
this.deviceTypeEnum[item.value] = item.label
})
})
getParamsList().then(res=>{
this.factoryList = res.data.map(item=>{
this.factoryEnum[item.companyCode] = item.companyName
return {
label: item.companyName,
value: item.companyCode
}
})
this.$forceUpdate();
this.onGetUserByCompanyCode();
})
},
onGetList() {
uni.showLoading({
title: "加载中"
})
getList({
...this.queryData,
companyCode:this.factoryList[this.factoryIndex].value
},this.pageData).then(res => {
uni.hideLoading();
let list = toJsonData(res.data.__blocks__.result.rows,res.data.__blocks__.result.meta.columns)
if(list && list.length){
list = list.map(item=>{
let updatedTime =item.createdTime? item.createdTime.split(''):[];
return {
...item,
applyDate:moment(item.applyDate).format("YYYY-MM-DD"),
createdTime:updatedTime.length>=13? `${updatedTime[0]}${updatedTime[1]}${updatedTime[2]}${updatedTime[3]}/${updatedTime[4]}${updatedTime[5]}/${updatedTime[6]}${updatedTime[7]} ${updatedTime[8]}${updatedTime[9]}:${updatedTime[10]}${updatedTime[11]}:${updatedTime[12]}${updatedTime[13]}` :''
}
})
}
if (this.pageData.offset == 0) {
this.projectDataList = list
} else {
this.projectDataList = [...this.projectDataList, ...list]
}
if (this.projectDataList.length < res.data.__blocks__.result.attr.count) {
this.status = "loadmore"
} else {
this.status = 'nomore'
}
})
},
onSearchByName() {
this.pageData.offset = 0;
this.onGetList();
},
onNavToOrderInfo(val = undefined){
let id = val? val.id:'';
uni.navigateTo({
url:`/pages/device-manager/add?id=${id}`
})
}
}
}
</script>
<style>
page {
background-color: #ffffff;
}
</style>
<style lang="scss" scoped>
.page-content-box{
width: 100vw;
height: 100vh;
overflow: hidden;
}
.cu-form-group {
picker {
padding-right: 0;
}
}
.header-title {
display: flex;
flex-direction: row;
width: 96%;
align-items: center;
margin: 30upx auto 12upx;
.flex-between {
display: flex;
flex: 1;
justify-content: center;
align-items: center;
border-radius: 20upx;
padding: 16upx 20upx;
background-color: rgba(246, 246, 248, 1);
.image {
width: 34upx;
margin-right: 8upx;
max-height: 42upx;
}
.text-blue {
color: #4a93f8;
font-weight: bold;
}
}
}
.u-tabs-box {
width: 100%;
margin: 0 auto;
}
.data-content {
display: flex;
flex-direction: column;
margin: 0 auto 30upx;
width: 96%;
.circle-par {
display: flex;
justify-content: center;
align-items: center;
}
.header {
border-radius: 12upx 12upx 0 0;
background-color: #eef2fe;
color: #101010;
font-size: 30upx;
border: 1px solid #d1dcfd;
padding: 14upx 24upx;
}
.content {
border-radius: 0 0 12upx 12upx;
background-color: #ffffff;
color: #101010;
font-size: 30upx;
border: 1px solid #cecece;
border-top: none;
}
}
.flex-content {
display: flex;
width: 100%;
justify-content: center;
}
.part-3 {
flex-direction: column;
padding-bottom: 120upx;
.content-item {
display: flex;
flex-direction: column;
width: 94%;
margin: 24upx auto 8upx;
padding-bottom: 24upx;
.header-title {
position: relative;
width: 100%;
margin: 0;
image {
width: 100%;
max-height: 100upx;
}
.flex-between {
position: absolute;
top: 0;
left: 12%;
width: 88%;
height: 70%;
padding: 0;
justify-content: space-between;
background-color: transparent;
}
}
.content-box {
position: relative;
z-index: 2;
box-shadow: 0 0 12upx rgba(0, 0, 0, 0.34);
border-radius: 12upx;
margin-top: -20upx;
background-color: #ffffff;
padding: 24upx;
.flex-row{
margin: 6upx 0;
align-items: center;
.part-1{
width: 120upx;
text-align-last: justify;
}
.part-2{
margin-right: 24upx;
}
.flex-between{
align-items: center;
}
}
}
}
.content-item:last-child {
border-bottom: none;
}
}
.flex-center {
display: flex;
align-items: center;
}
.line-progress {
align-items: center;
}
.u-page__item__slot-icon {
width: 24px;
height: 24px;
}
.part-left {
align-items: center;
}
.circle-center {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.margin-top-sm {
margin-top: 10upx;
}
.flex-row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
}
}
.icon {
width: 36upx;
max-height: 50upx;
margin-right: 6upx;
}
.flex-row-center {
display: flex;
flex-direction: row;
align-items: center;
}
.content-part-1 {
display: flex;
flex-direction: column;
align-items: center;
.header {
display: flex;
flex-direction: row;
align-items: center;
width: 92%;
padding: 30upx 0;
image {
width: 20px;
height: 20px;
margin-right: 6upx;
}
}
.form-content-box {
width: 92%;
padding: 12upx 0;
border-radius: 12upx;
box-shadow: 0 0 8upx rgba(0, 0, 0, 0.34);
background-color: #ffffff;
.cu-form-group {
.title {
display: flex;
flex-direction: row;
width: 240upx;
align-items: center;
}
}
}
.footer-content {
display: flex;
justify-content: center;
align-items: center;
width: 100vw;
height: 120upx;
margin-bottom: 100upx;
.btn-box {
width: 80%;
}
}
}
.float-box{
position: fixed;
display: flex;
justify-content: center;
align-items: center;
width: 50px;
height: 50px;
border-radius: 25px;
background-color: #4a93f8;
color: #ffffff;
box-shadow: 0 0 16upx rgba(74, 147, 248, 0.34),0 0 12upx rgba(74, 147, 248, 0.34) inset;
z-index: 99;
font-size: 32upx;
}
.factory-name{
max-width: 360upx;
.factory-title{
// width: 360upx;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
}
</style>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment