提交 cf895e49 作者: wk

原始模式迁移

父级 7bfec634
......@@ -229,6 +229,22 @@ const params = {
getNeedDo: {
url: "/plat/api/v1/common_check/check_object/my_form_list",
method: "get"
},
getAppDetail: {
url: "/plat/web/v1/common_check/check_tpl/tpl_detail",
method: "get"
},
getOriginAppDetail: {
url: "/plat/api/v1/common_check/check_tpl/tpl_detail",
method: "get"
},
getProjectList: {
url: "/plat/api/v1/project/project_list",
method: "get"
},
getObjList: {
url: "/plat/api/v1/common_check/check_object/obj_list",
method: "get"
}
}
......
......@@ -9,7 +9,7 @@ const http = (params) => {
data: params.data,
header: {
'access_token': uni.getStorageSync('token') || '',
"token": uni.getStorageSync('token') || ''
// "token": uni.getStorageSync('token') || ''
},
success(res) {
uni.hideLoading()
......
// 公共中心域名
export const consoleBaseUrl = 'https://dev-console-api.hzdingmao.com'
// export const consoleBaseUrl = 'https://test-console-api.hzdingmao.com'
//正式环境
// export const consoleBaseUrl = 'https://console-api.hibuilding.cn'
const $http = {
get: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "GET",
header: header,
success: function(res) {
// console.log("请求参数", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res);
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err);
}
})
})
},
consoleGet: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "GET",
header: header,
success: function(res) {
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res);
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err);
}
})
})
},
post: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
consolePost: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
deleteRequest: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "DELETE",
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
put: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "PUT",
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
consolePut: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "PUT",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
delete: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "DELETE",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
consoleDelete: function({
url,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}${url}`,
data: data,
method: "DELETE",
header: header,
success: function(res) {
console.log(data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
postJSON: function({
url,
data,
header
}) {
return new Promise(function(resolve, reject) {
uni.request({
url: `${consoleBaseUrl}/plat${url}`,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log(res);
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
reject(err)
}
})
})
},
consolePostJSON: function({
url,
data,
header
}) {
return new Promise(function(resolve, reject) {
uni.request({
url: consoleBaseUrl + url,
data: data,
method: "POST",
header: header,
success: function(res) {
console.log(res);
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
reject(err)
}
})
})
},
upImg: function({
imgUrl,
access_token
}) {
return new Promise(function(resolve, reject) {
uni.uploadFile({
url: consoleBaseUrl + "/api/v1/base/file/upload_file",
filePath: imgUrl,
name: 'pic_file_apk',
header: {
"access_token": access_token,
"Content-Type": "multipart/form-data"
},
success: function(uploadFileRes) {
resolve(uploadFileRes);
},
fail: function(err) {
reject(err)
}
});
})
},
upFile: function({
fileUrl,
access_token
}) {
return new Promise(function(resolve, reject) {
uni.uploadFile({
url: consoleBaseUrl + "/api/v1/base/file/upload_file",
filePath: fileUrl,
name: 'pic_file_apk',
header: {
"access_token": access_token,
"Content-Type": "multipart/form-data"
},
success: function(uploadFileRes) {
resolve(uploadFileRes);
},
fail: function(err) {
reject(err)
}
});
})
},
gcyRequest: function({
url,
method,
data,
header
}) {
uni.showLoading({
title: "请求中..."
})
return new Promise(function(resolve, reject) {
uni.request({
url: `${gcyBaseUrl}${url}`,
data: data,
method: method,
header: header,
success: function(res) {
console.log("data", data);
uni.hideLoading()
if (res.statusCode !== 200) {
reject(res)
} else {
resolve(res);
}
},
fail: function(err) {
uni.hideLoading()
reject(err)
}
})
})
},
}
export default $http
......@@ -7,9 +7,14 @@ import tabBar from 'components/uni-tabbar/uni-tabbar.vue'
import $toast from './common/toast.js'
import $config from './common/config.js'
import $mta from "api/mta.js"
import $http from './api/request.js'
Vue.prototype.$http = $http
Vue.prototype.$mta = $mta
Vue.prototype.$toast = $toast
Vue.prototype.$config = $config
Vue.prototype.getToken = function() {
return uni.getStorageSync("token")
}
Vue.component('tabBar', tabBar)
Vue.config.productionTip = false
App.mpType = 'app'
......
......@@ -363,7 +363,52 @@
}
}
],
,{
"path" : "pages/gallery/app/originalIndex/originalIndex",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/checkObjList/checkObjList",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/createCheck/createCheck",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/checkObjDetail/checkObjDetail",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/checkRecord/checkRecord",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "uni-app",
......
<template>
<view class="check-detail-home">
<!-- <navbar :title="title"></navbar> -->
<view class="check-detail-head">
<canvas canvas-id="qrcode" style="width: 100px;height: 100px;" />
<view class="check-detail-download">
<text style="font-size: 14px;font-weight: bold;color: #333333;">{{title}}</text>
<view class="detail-download" @click="downloadQrcode">
<text>下载二维码</text>
</view>
</view>
</view>
<view class="check-detail-list">
<view v-for="(item,index) in itemList" :key="index" @click="itemClick(index)">
<view class="check-detail-item">
<view class="check-detail-content">
<view class="check-detail-v-title">{{item.check_item_name}}</view>
<view class="check-detail-v-date">{{item.created_at}}</view>
</view>
<view class="check-detail-listcard-image">
<image src="../../static/ic_arrow_left.png"></image>
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import uQRCode from "../../../../common/Sansnn-uQRCode/uqrcode.js"
export default {
data() {
return {
title: "记录对象",
check_obj_id: "",
qrcodeSrc: '',
itemList: [],
size: 100,
check_item_id: ""
}
},
onLoad: function(option) {
this.title = option.obj_no;
this.check_obj_id = option.check_obj_id;
this.check_item_id = option.check_item_id
uni.setNavigationBarTitle({
title: option.obj_no
})
},
onReady() {
let text = `{"type":"platform-obj","text":"${this.title}"}`
setTimeout(() => {
this.make(text)
}, 100)
},
methods: {
itemClick(index) {
let checkItem = this.itemList[index]
uni.navigateTo({
url: `/pages/gallery/app/checkRecord/checkRecord?check_record_id=${checkItem.check_record_id}&check_item_id=${checkItem.check_item_id}&check_item_name=${checkItem.check_item_name}`
})
},
loadRecordList() {
let _this = this
uni.showLoading({
title: "加载中"
})
this.$http.get({
url: "/api/v1/common_check/check_record/item_list",
data: {
"project_id": uni.getStorageSync("project_id"),
"obj_no": _this.title,
"is_page": 0
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("检查对象详情", result);
let list = result.data.list
for (var i = 0; i < list.length; i++) {
if (list[i].check_item_id == _this.check_item_id) {
this.itemList.push(list[i])
}
}
})
},
make(text) {
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: text,
size: this.size,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
correctLevel: uQRCode.errorCorrectLevel.H,
success: res => {
console.log(res)
this.qrcodeSrc = res
this.loadRecordList()
},
fail: error => {
console.log(error)
this.loadRecordList()
}
})
},
downloadQrcode() {
// #ifndef H5
this.save(this.qrcodeSrc)
// #endif
// #ifdef H5
let _t = this;
uni.downloadFile({
url: this.qrcodeSrc,
success: (res) => {
if (res.statusCode === 200) {
let file = res.tempFilePath;
_t.save(file)
}
}
});
// #endif
},
save(url) {
let _this = this;
uni.saveImageToPhotosAlbum({
filePath: url,
success: () => {
uni.hideLoading();
uni.showToast({
title: "图片已保存到相册"
});
},
fail: () => {
uni.hideLoading();
uni.showToast({
title: "图片保存失败"
});
}
});
}
}
}
</script>
<style lang="scss">
.check-detail-home {
display: flex;
flex-direction: column;
.check-detail-head {
background-color: #F5F5F5;
flex-direction: row;
display: flex;
padding: 10px;
.check-detail-download {
display: flex;
margin-top: 10px;
margin-left: 10px;
flex-direction: column;
.detail-download {
display: flex;
flex-direction: column;
width: 86px;
margin-top: 10px;
height: 24px;
background-color: #1890FF;
color: #FFFFFF;
font-size: 14px;
align-items: center;
justify-content: center;
border-radius: 2px;
}
}
}
.check-detail-list {
display: flex;
flex-direction: column;
.check-detail-item {
display: flex;
padding: 10px;
justify-content: center;
align-items: center;
flex-direction: row;
border-bottom: 1px solid #f5f5f5;
.check-detail-content {
display: flex;
flex: 1;
flex-direction: column;
justify-content: center;
height: 50px;
overflow: hidden;
.check-detail-v-title {
font-size: 16px;
color: #333333;
overflow: hidden;
-o-text-overflow: ellipsis;
text-overflow: ellipsis;
white-space: normal;
display: block;
}
.check-detail-v-date {
margin-top: 5px;
font-size: 12px;
color: #000;
}
}
.check-detail-listcard-image {
width: 20px;
margin-right: 10px;
image {
width: 10px;
height: 15px;
}
}
}
}
}
</style>
<template>
<view class="home">
<!-- <navbar :title="title"></navbar> -->
<view class="uni-search">
<uni-search-bar placeholder="搜索" bgColor="#F5F5F5" @confirm="search" @input="search" />
</view>
<view class="content">
<view v-for="(item,index) in objList" :key="index" @click="itemClick(index)">
<list-card :item='item'></list-card>
</view>
<view class="loadmore" v-if="showLoadMore">{{loadTips}}</view>
</view>
<uni-fab horizontal="right" vertical="bottom" text="新增" :content="menu" @fabClick="add" :popMenu=popMenu
:pattern="pattern"></uni-fab>
</view>
</template>
<!-- 检查对象列表 -->
<script>
import Api from "../../../../api/api.js"
export default {
data() {
return {
objList: [],
menu: [],
loadTips: '正在加载...',
showLoadMore: false,
pattern: {
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF'
},
popMenu: false,
currPage: 1,
pageSize: 20,
title: "记录对象",
projectId: "",
checkItemId: "",
inputValue: "",
check_tpl_id: ""
}
},
onShow() {
this.initData()
},
onLoad: function(option) {
this.title = option.check_item_name
uni.setNavigationBarTitle({
title: option.check_item_name
})
this.check_tpl_id = option.check_tpl_id
this.checkItemId = option.check_item_id
this.projectId = uni.getStorageSync("project_id")
},
onPullDownRefresh() {
this.currPage = 1
this.objList = [];
this.showLoadMore = false
this.loadTips = '正在加载...'
console.log('onPullDownRefresh');
this.initData()
},
onReachBottom() {
this.showLoadMore = true;
this.currPage++;
this.loadMore()
},
methods: {
initData() {
this.loadData(true)
},
loadMore() {
this.loadData(false);
},
loadData(refresh) {
if (refresh) {
this.currPage = 1
}
this.getCheckList(refresh, 1)
},
add() {
uni.navigateTo({
url: `/pages/gallery/app/createCheck/createCheck?check_item_id=${this.checkItemId}&title=${this.title}&check_tpl_id=${this.check_tpl_id}`,
})
},
search(val) {
this.inputValue = val.value
this.currPage = 1
console.log(val.value);
let length = this.objList.length
this.objList.splice(0, length)
this.getCheckList(true, 0)
},
itemClick(index) {
let obj_no = this.objList[index].obj_no
let check_obj_id = this.objList[index].check_obj_id
uni.navigateTo({
url: `/pages/gallery/app/checkObjDetail/checkObjDetail?check_item_id=${this.checkItemId}&obj_no=${obj_no}&check_obj_id=${check_obj_id}`
})
},
getCheckList(refresh, is_page) {
uni.showLoading({
title: "加载中"
})
Api.getObjList({
data: {
"project_id": this.projectId,
"check_item_id": this.checkItemId,
"obj_no": this.inputValue,
"is_page": is_page,
"page": this.currPage,
"page_size": this.pageSize
}
}).then((result) => {
console.log("检查对象列表:", result);
let list = result.data.list
if (refresh) {
uni.stopPullDownRefresh()
this.objList = list
} else {
if (list.length > 0) {
for (var i = 0; i < list.length; i++) {
this.objList.push(list[i])
}
} else {
uni.showToast({
title: "没有更多数据",
icon: 'none'
})
}
}
})
}
}
}
</script>
<style lang="scss">
.home {
display: flex;
flex: 1;
box-sizing: border-box;
flex-direction: column;
.loadmore {
display: flex;
justify-content: center;
align-items: center;
}
}
</style>
<template>
<view class="check-record-home">
<!-- <navbar :title="title"></navbar> -->
<view class="check-record-checker">
<view class="text_title_record">记录对象</view>
<view class="uni-record-value">{{check_no}}</view>
</view>
<view v-for="(item,index) in contentList" :key="item.content_id">
<!-- 图片 -->
<view style="padding: 10rpx 40rpx;background-color: #FFFFFF;"
v-if="item.control_type=='7'&&item.real_value.length>0">
<view style="display: flex;flex-direction: row;">
<view style="margin-left: 10rpx;color: #666666;font-size: 32rpx;font-weight: bold;">
{{item.content_name}}
</view>
</view>
<uni-grid :column="4">
<uni-grid-item v-for="(valueItem,vIndex) in item.real_value" :key="vIndex" :index="vIndex">
<view>
<image style="width: 144rpx;height: 144rpx;margin: 20rpx 0 0 20rpx;" :src="valueItem"
@click="clickBig(item,vIndex)"></image>
</view>
</uni-grid-item>
</uni-grid>
</view>
<!-- 弹窗选择单选 -->
<view class="uni-record-item" v-if="item.control_type==='3'&&item.real_value.length>0">
<view class="uni-record-item-title">
{{item.content_name}}
</view>
<view class="uni-record-value">
{{item.real_value[0]}}
</view>
</view>
<!-- 弹窗选择多选 -->
<view class="uni-record-item" v-if="item.control_type=='15'&&item.real_value.length>0">
<view class="uni-record-item-title">
{{item.content_name||""}}
</view>
<view class="uni-record-value">
{{item.real_value[0]}}
</view>
</view>
<!-- 单选 -->
<view v-if="item.control_type==='6'&&item.real_value.length>0" class="uni-record-item">
<view class="uni-record-item-title">
{{item.content_name||""}}
</view>
<view class="uni-record-value">
{{item.real_value[0].value=="0"?'不合格':item.real_value[0].value=="1"?'合格':""}}
</view>
</view>
<!-- 单文本 -->
<view v-if="item.control_type==='1'&&item.real_value.length>0" class="uni-record-item">
<view class="uni-record-item-title">
{{item.content_name||""}}
</view>
<view class="uni-record-value">
{{item.real_value[0].value||""}}
</view>
</view>
<!-- 多文本 -->
<view v-if="item.control_type==='2'&&item.real_value.length>0" class="uni-record-item">
<view class="uni-record-item-title">
{{item.content_name||""}}
</view>
<view class="uni-record-value">
{{item.real_value[0].value||""}}
</view>
</view>
<view v-if="item.control_type==='9'&&item.real_value.length>0" class="uni-record-item">
<view v-for="(valueItem,i) in item.real_value" :key="i">
<view class="uni-record-item-title">
{{item.content_name||""}}
</view>
<view class="uni-scan-item-content-left">
<view class="uni-scan-item-content-name">
<view class="uni-scan-item-name">{{info.name||"姓名"}}</view>
</view>
<view class="uni-scan-item-content-post">
<text>{{info.post||"职务"}}</text>
</view>
<view class="uni-scan-item-content-phone">
<text>{{info.phone||"手机号码"}}</text>
</view>
</view>
</view>
</view>
<view v-if="item.control_type==='12'&&item.real_value.length>0" class="uni-record-item">
<view class="uni-record-item-title">
{{item.content_name||""}}
</view>
<view v-for="(valueItem,i) in item.real_value" :key="i">
<view class="uni-record-value-mul">
<view class="multi-input-group-item">
<view class="multi-input-group-item-desc">
<text>姓名</text>
</view>
<view class="multi-input-group-item-input">
{{valueItem.name}}
</view>
</view>
<view class="multi-input-group-item">
<view class="multi-input-group-item-desc">
<text>单位</text>
</view>
<view class="multi-input-group-item-input">
{{valueItem.company}}
</view>
</view>
<view class="multi-input-group-item">
<view class="multi-input-group-item-desc">
<text>手机号</text>
</view>
<view class="multi-input-group-item-input">
{{valueItem.phone}}
</view>
</view>
</view>
</view>
</view>
<view v-if="item.control_type==='10'&&item.real_value.length>0">
<view v-for="(valueItem,i) in item.real_value" :key="i" class="check-record-item">
<view class="check-record-item-title">{{item.content_name}}</view>
<view class="check-record-item-value">{{valueItem.value}}</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: "检查结果",
check_no: "",
contentList: []
}
},
onLoad: function(option) {
this.title = option.check_item_name
uni.setNavigationBarTitle({
title: option.check_item_name
})
this.getRecordCotent(option.check_record_id)
},
methods: {
clickBig(item, index) {
console.log("被点击了");
let images = []
for (var i = 0; i < item.real_value.length; i++) {
images.push(item.real_value[i])
}
uni.previewImage({
urls: images,
current: index
})
},
change() {},
getRecordCotent(check_record_id) {
let _this = this
this.$http.get({
url: "/api/v1/common_check/check_record/item_content_list",
data: {
"check_record_id": check_record_id
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data.data
console.log(result);
// this.contentList = result.list
this.title = result.check_item_name
this.check_no = result.obj_no
for (let i = 0; i < result.content_detail.length; i++) {
let component = result.content_detail[i]
if (component.control_type == "3") { //下拉框
//下拉框的值要做处理
//判断数据来源
// if (component.origin_type == '2') { //暂时假设2 固定数据 1 标准码 3 url
// _this.components.push(component)
// } else if (component.origin_type == '1') {
// //先获取标准码的type
// _this.getCodeValue(component, i)
// } else if (component.origin_type == '3') {
// _this.getValueByUrl(component, i)
// }
let values = component.real_value
if (values != null && values.length > 0) {
component.real_value = []
for (var k = 0; k < component.origin_data.length; k++) {
if (values[0] == component.origin_data[k].key) {
component.real_value.push(component.origin_data[k].val)
}
}
}
_this.contentList.push(component)
} else {
_this.contentList.push(component)
}
}
})
},
getValueByUrl(component, index) {
let _this = this
uni.request({
url: component.origin_data[0].val,
data: {},
method: "GET",
header: {
"access_token": this.getToken()
},
success: function(res) {
uni.hideLoading()
if (res.statusCode !== 200) {} else {
console.log("URL数据:", res.data);
let result = res.data
if (result.code == 0) {
let list = result.data.list
component.origin_data = []
for (var i = 0; i < list.length; i++) {
component.origin_data.push({
"key": list[i].key,
"val": list[i].val
})
}
let values = component.real_value
if (values != null && values.length > 0) {
component.real_value = []
for (var i = 0; i < component.origin_data.length; i++) {
if (values[0] == component.origin_data[i].key) {
component.real_value.push(component.origin_data[i].value)
}
}
}
_this.$set(_this.components, index, component)
} else {
component.origin_data = []
}
}
},
fail: function(err) {
uni.hideLoading()
}
})
},
getCodeValue(component, index) {
let _this = this
this.$http.consolePost({
url: "/api/v1/config/code/get_codes_list_no_token",
data: {
"code_type": component.origin_data[0].val,
"no_token": "1"
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("标准码数据:", res.data);
let result = res.data
if (result.code == 0) {
let list = result.data[0].sub_data
component.origin_data = []
for (var i = 0; i < list.length; i++) {
component.origin_data.push({
"key": list[i].value,
"val": list[i].name
})
}
let values = component.real_value
if (values != null && values.length > 0) {
component.real_value = []
for (var i = 0; i < component.origin_data.length; i++) {
if (values[0] == component.origin_data[i].key) {
component.real_value.push(component.origin_data[i].value)
}
}
}
_this.$set(_this.components, index, component)
} else {
component.origin_data = []
}
})
},
}
}
</script>
<style lang="scss">
page {
background-color: #FFFFFF;
}
.check-record-home {
display: flex;
flex-direction: column;
background-color: #F5F5F5;
.check-record-checker {
background-color: #FFFFFF;
padding: 32rpx 32rpx 0 32rpx;
margin-top: 20rpx;
font-size: 36rpx;
color: #333333;
}
}
.text_title_record {
font-size: 32rpx;
color: #333333;
font-weight: bold;
}
.check-record-image-list {
background-color: #FFFFFF;
padding: 110rpx;
flex-direction: column;
display: flex;
}
.check-record-item {
display: flex;
flex-direction: row;
background-color: #FFFFFF;
justify-content: right;
padding: 10rpx 20rpx;
}
.check-record-supervision-item {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
padding: 10rpx 20rpx;
}
.check-record-item-title {
width: 160rpx;
color: #999999;
font-size: 32rpx;
text-align: right;
}
.check-record-item-value {
color: #333333;
margin-left: 20rpx;
font-size: 32rpx;
}
.check-record-item-desc {
color: #333333;
font-size: 32rpx;
}
.supervision-content {
display: flex;
padding: 10rpx;
flex-direction: row;
background-color: #FFFFFF;
}
.uni-upload-image-record {
display: flex;
align-items: center;
margin: 20rpx 20rpx 0px 0px;
}
.uni-record-value {
display: flex;
font-size: 32rpx;
color: #333333;
padding-left: 10rpx;
margin-top: 10px;
height: 80rpx;
background-color: #F5F7FA;
align-items: center;
flex-direction: row;
}
.uni-record-item {
padding: 32rpx 32rpx 0 32rpx;
background-color: #FFFFFF;
}
.uni-record-item-title {
margin-left: 10rpx;
color: #333333;
font-weight: bold;
font-size: 32rpx;
}
.uni-record-value-mul {
display: flex;
font-size: 32rpx;
color: #333333;
margin-top: 10px;
height: 248rpx;
background-color: #F5F7FA;
flex-direction: column;
}
.multi-input-group-item {
flex-direction: row;
padding: 10rpx;
align-items: center;
// width: 80%;
background-color: #F5F7FA;
display: flex;
.multi-input-group-item-desc {
font-size: 14px;
width: 120rpx;
text-align: right;
color: #333333;
}
.multi-input-group-item-input {
margin-left: 10px;
border-radius: 5px;
width: 80%;
padding: 5px;
// border: 1px solid rgba(0, 0, 0, 0.25098039215686274);
}
}
.uni-scan-item-content-left {
display: flex;
flex: 1;
-webkit-flex: 1;
padding: 5px 0px;
flex-direction: row;
background-color: #F5F7FA;
// border: 1px solid rgba(0, 0, 0, 0.25098039215686274);
border-radius: 5px;
.uni-scan-item-content-name {
display: flex;
width: 20%;
padding-left: 24rpx;
align-items: center;
// border-right: 1px solid rgba(0, 0, 0, 0.25098039215686274);
font-size: 14px;
color: #666666;
}
.uni-scan-item-content-post {
width: 30%;
display: flex;
padding-left: 10rpx;
align-items: center;
// border-right: 1px solid rgba(0, 0, 0, 0.25098039215686274);
font-size: 14px;
color: #666666;
}
.uni-scan-item-content-phone {
width: 50%;
padding-left: 10rpx;
display: flex;
align-items: center;
font-size: 14px;
color: #666666;
}
}
</style>
<template>
<view class="create-check-home">
<!-- <navbar :title="title"></navbar> -->
<scroll-view class="create-check-scroll">
<view class="create-check-checker">
<view class="create-check-checker-title">
<view class="create-check-checker-title-sign" style="color: #FF0000;">*</view>
<view class="create-check-checker-title-desc"
style="font-size: 16px;color: #333333;margin-left: 10rpx;flex: 1;font-weight: bold;">记录对象</view>
<image src="../../static/icon_scan.png" style="width: 40rpx;height: 40rpx;" @click="clickScan">
</image>
</view>
<picker @change="itemSelect" :range="checkerNos">
<label>
<view class="create-check-checker-input">
<input placeholder="输入记录对象"
style="flex: 1;font-size: 14px;color: #333333;margin-left: 10px;" v-model="inputValue"
@click.stop="" />
<image src="../../static/icon_down_arrow.png"></image>
</view>
</label>
</picker>
</view>
<view class="create-check-component-list">
<view class="create-check-component" v-for="(item,index) in components" :key="index">
<!-- 图片 -->
<view style="padding: 10rpx 40rpx;" v-if="item.control_type=='7'">
<view style="display: flex;flex-direction: row;">
<view style="color: #ff0000;font-size: 28rpx;" v-if="item.validate_type==='2'">*</view>
<view style="margin-left: 10rpx;color: #333333;font-size: 32rpx;font-weight: bold;">
{{item.content_name}}(最多上传{{item.max_length}}张)
</view>
</view>
<uni-grid :column="4">
<uni-grid-item v-for="(valueItem,vIndex) in item.real_value" :key="vIndex" :index="vIndex">
<view class="uni-upload-image">
<image style="width: 144rpx;height: 144rpx;position: absolute;left: 0;bottom: 0;"
:src="valueItem"></image>
<image style="width: 40rpx;height: 40rpx;position: absolute;right: 0;top: 0;"
src="../../static/close-btn.png" @click="deleteImage(item,vIndex)"></image>
</view>
</uni-grid-item>
<image style="width: 144rpx;height: 144rpx;margin: 20rpx;"
src="../../static/icon_take_photo.png" @click="selectImage(index)"></image>
</uni-grid>
</view>
<!-- 弹窗选择单选 -->
<view style="padding: 10rpx 20rpx;" v-if="item.control_type==='3'">
<view style="display: flex;flex-direction: row;padding: 10rpx 32rpx;">
<view style="color: #ff0000;font-size: 28rpx;" v-if="item.validate_type==='2'">*</view>
<view style="margin-left: 10rpx;color: #333333;font-size: 32rpx;font-weight: bold;">
{{item.content_name}}
</view>
</view>
<picker @change="singleSelect" :range="item.origin_data" :range-key="'val'" mode="selector"
:id="index">
<label>
<view class="create-check-checker-input">
<view style="flex: 1;font-size: 14px;color: #333333;margin-left: 10px;">
{{item.current_value||""}}
</view>
<image src="../../static/icon_down_arrow.png"></image>
</view>
</label>
</picker>
</view>
<!-- 弹窗选择多选 -->
<view style="padding: 10rpx 20rpx;" v-if="item.control_type=='15'">
<view style="display: flex;flex-direction: row;padding: 10rpx 32rpx;">
<view style="color: #ff0000;font-size: 28rpx;" v-if="item.validate_type=='2'">*</view>
<view style="margin-left: 10rpx;color: #333333;font-size: 32rpx;font-weight: bold;">
{{item.content_name||""}}(多选)
</view>
</view>
<view class="create-check-checker-input" @click="toSelect(index)">
<view style="flex: 1;font-size: 14px;color: #333333;margin-left: 10px;">
{{item.current_value||""}}
</view>
<image src="../../static/icon_down_arrow.png"></image>
</view>
</view>
<custom-component-item :checkContent="item" :index="index" @dataChange="dataChange" v-else>
</custom-component-item>
</view>
<view style="height: 110rpx;"></view>
</view>
</scroll-view>
<view class="create-check-submit">
<button @click="submit">提交</button>
</view>
<uni-popup ref="uniPopup" type="bottom">
<view style="height: 600rpx;background-color: #FFFFFF;display: flex;flex-direction: column;">
<view style="flex-direction: row;display: flex;justify-content: space-between;padding: 32rpx;">
<text class="text-grey-black" @click="cancelSeclect">取消</text>
<text class="text-blue" @click="sureSeclect">确定</text>
</view>
<checkbox-group @change="checkChange"
style="flex-direction: column;display: flex;flex-wrap: wrap;justify-content: space-between;">
<view v-for="(item,index) in popupData" :key="index" style="padding: 10rpx 32rpx;">
<checkbox :value="item.key" :checked="item.isChecked">{{item.val}}</checkbox>
</view>
</checkbox-group>
</view>
</uni-popup>
</view>
</template>
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import Api from "../../../../api/api.js"
export default {
components: {
uniPopup
},
data() {
return {
title: "检查项名称",
checkers: [],
checkerNos: [],
components: [],
inputValue: "",
checkItemId: "",
defaultUrl: "../../static/icon_take_photo.png",
imageList: [],
windowHeight: "400px",
popupData: [],
curIndex: -1, //当前操作的控件索引
check_tpl_id: ""
}
},
methods: {
singleSelect(e) {
console.log("单选结果", e);
let index = parseInt(e.target.id)
let selectIndex = parseInt(e.detail.value)
this.components[index].currentValues = this.components[index].origin_data[selectIndex]
this.components[index].canSubmit = true
this.components[index].current_value = this.components[index].origin_data[selectIndex].val
//防止不存在
this.components[index].real_value = []
this.components[index].real_value.push(this.components[index].origin_data[selectIndex].key)
},
checkChange(e) {
//选取key的数组
console.log("多选结果", e.detail.value);
let selects = e.detail.value
//单选多选
let data = this.components[this.curIndex].origin_data
let selectList = []
for (var K = 0; K < data.length; K++) {
let isSelect = false
for (var i = 0; i < selects.length; i++) {
if (selects[i] == data[K].key) {
isSelect = true
}
}
if (isSelect) {
data[K].isChecked = true
selectList.push(data[K])
} else {
data[K].isChecked = false
}
}
this.components[this.curIndex].origin_data = data
this.components[this.curIndex].currentValues = selectList
},
cancelSeclect() {
this.$refs.uniPopup.close();
},
sureSeclect() {
let data = this.components[this.curIndex].origin_data
let selectList = this.components[this.curIndex].currentValues
let values = ""
//选中值的key
let selects = []
if (selectList.length > 0) {
for (var i = 0; i < selectList.length; i++) {
selects.push(selectList[i].key)
if (i == selectList.length - 1) {
values += `${selectList[i].val}`
} else {
values += `${selectList[i].val},`
}
}
this.components[this.curIndex].current_value = values
} else {
this.components[this.curIndex].current_value = ""
}
this.components[this.curIndex].real_value = []
this.components[this.curIndex].real_value.push(values)
//是否可上传
if (selects.length > 0) {
this.components[this.curIndex].canSubmit = true
} else {
this.components[this.curIndex].canSubmit = false
}
this.$set(this.components, this.curIndex, this.components[this.curIndex])
console.log("确定选中", values);
this.$refs.uniPopup.close();
},
//打开弹窗
toSelect(index) {
this.curIndex = index
this.popupData = this.components[index].origin_data
this.$refs.uniPopup.open();
},
itemSelect(e) {
this.inputValue = this.checkerNos[e.detail.value]
},
selectImage(index) {
let images = this.components[index].real_value
if (!images) {
images = []
}
let maxLength = parseInt(this.components[index].max_length)
if (images.length == maxLength) {
uni.showToast({
title: "上传图片已达上限",
icon: 'none'
})
return
}
let _this = this
uni.chooseImage({
sourceType: ['camera'],
count: maxLength - images.length,
sizeType: ['compressed '],
success: (res) => {
console.log(res.tempFilePaths.length);
for (var i = 0; i < res.tempFilePaths.length; i++) {
_this.uploadFile(res.tempFilePaths[i], index)
}
},
fail: (error) => {
uni.showToast({
title: error,
icon: 'none'
})
}
})
},
uploadFile(temfile, index) {
let _this = this
this.$http.upImg({
imgUrl: temfile,
access_token: _this.getToken()
}).then((res) => {
let result = JSON.parse(res.data)
console.log(result);
if (result.code === 0) {
let path = result.data.file_path
let imagePath = ""
if (path) {
let array = path.split("://")
if (array[0] === "http") {
array[0] = "https"
imagePath = array[0] + "://" + array[1]
} else {
imagePath = path
}
}
_this.components[index].real_value.push(imagePath)
_this.components[index].canSubmit = true
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
})
},
deleteImage(item, vIndex) {
item.real_value.splice(vIndex, 1)
if (item.real_value.length > 0) {
item.canSubmit = true
} else {
item.canSubmit = false
}
},
getComponentList() {
let _this = this
this.$http.get({
url: "/api/v1/common_check/check_record/item_content_list",
data: {
"check_item_id": this.checkItemId
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("组件列表:", result);
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
if (result.action === 'Laravel_public_permission_fail') {
that.toLogin()
}
return
}
let list = result.data.list
for (let i = 0; i < list.length; i++) {
let component = list[i]
if (list[i].control_type === "7") {
component.real_value = []
_this.components.push(component)
} else if (list[i].control_type == "3" || list[i].control_type == "15") { //下拉框
//下拉框的值要做处理
component.current_value = ""
component.currentValues = []
_this.components.push(component)
//判断数据来源
if (list[i].origin_type == '2') { //暂时假设2 固定数据 1 标准码 3 url
} else if (list[i].origin_type == '1') {
//先获取标准码的type
_this.getCodeValue(list[i], i)
} else if (list[i].origin_type == '3') {
_this.getValueByUrl(list[i], i)
}
} else {
_this.components.push(component)
}
}
})
console.log("组件集合", this.components);
},
getValueByUrl(component, index) {
let _this = this
uni.request({
url: component.origin_data[0].val,
data: {},
method: "GET",
header: {
"access_token": this.getToken()
},
success: function(res) {
uni.hideLoading()
if (res.statusCode !== 200) {} else {
console.log("URL数据:", res.data);
let result = res.data
if (result.code == 0) {
let list = result.data.list
component.origin_data = []
for (var i = 0; i < list.length; i++) {
component.origin_data.push({
"key": list[i].key,
"val": list[i].val
})
}
_this.$set(_this.components, index, component)
} else {
component.origin_data = []
}
}
},
fail: function(err) {
uni.hideLoading()
}
})
},
getCodeValue(component, index) {
let _this = this
this.$http.consolePost({
url: "/api/v1/config/code/get_codes_list_no_token",
data: {
"code_type": component.origin_data[0].val,
"no_token": "1"
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("标准码数据:", res.data);
let result = res.data
if (result.code == 0) {
let list = result.data[0].sub_data
component.origin_data = []
for (var i = 0; i < list.length; i++) {
component.origin_data.push({
"key": list[i].value,
"val": list[i].name
})
}
_this.$set(_this.components, index, component)
} else {
component.origin_data = []
}
})
},
getCheckObjList() {
this.$http.get({
url: "/api/v1/common_check/check_object/obj_list",
data: {
"project_id": uni.getStorageSync("project_id"),
"is_page": 0
// "check_item_id": this.checkItemId
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("检查对象列表:", result);
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
if (result.action === 'Laravel_public_permission_fail') {
that.toLogin()
}
return
}
this.checkers = result.data.list
for (var i = 0; i < this.checkers.length; i++) {
this.checkerNos.push(this.checkers[i].obj_no)
}
})
},
dataChange(content, index) {
console.log(content);
this.components[index] = content
// if (content.control_type === '7') {
// this.imageList = content.real_value
// }
},
clickScan() {
let _this = this
uni.scanCode({
scanType: ['qrcode'],
success: (res) => {
let result = JSON.parse(res.result)
if (result.type === "platform-obj") {
_this.inputValue = result.text
} else {
uni.showToast({
title: res.result,
icon: 'none'
})
}
},
fail: (error) => {
}
})
},
submit() {
console.log("提交数据", this.components);
if (this.inputValue === "") {
uni.showToast({
title: "检查对象不能为空",
icon: 'none'
})
return
}
let canSubmit = true
for (var i = 0; i < this.components.length; i++) {
let component = this.components[i]
if (component.validate_type === '2') {
if (component.real_value && component.real_value.length > 0) {
if (!component.canSubmit) {
canSubmit = false
uni.showToast({
title: `${component.content_name}内容不能为空`,
icon: 'none'
})
break
}
} else {
uni.showToast({
title: `${component.content_name}内容不能为空`,
icon: 'none'
})
canSubmit = false
break
}
}
}
if (!canSubmit) {
return
}
uni.showLoading({
title: "数据提交中..."
})
this.$http.post({
url: "/api/v1/common_check/check_record/create",
data: {
"check_tpl_id": this.check_tpl_id,
"check_item_id": this.checkItemId,
"project_id": uni.getStorageSync("project_id"),
"obj_no": this.inputValue,
"content_detail": this.components
},
header: {
"Content-Type": "application/json",
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log(result);
if (result.code === 0) {
uni.showToast({
title: "提交成功",
icon: 'none'
})
uni.navigateBack({
delta: 1
})
}
})
}
},
onLoad: function(option) {
uni.getSystemInfo({
success: (res) => {
this.windowHeight = res.windowHeight + "px";
}
})
this.title = option.title
this.check_tpl_id = option.check_tpl_id
this.checkItemId = option.check_item_id
uni.setNavigationBarTitle({
title: option.title
})
this.getComponentList()
this.getCheckObjList()
}
}
</script>
<style lang="scss">
page {
background-color: #FFFFFF;
}
.create-check-home {
display: flex;
flex-direction: column;
align-items: center;
.create-check-scroll {
width: 100%;
display: flex;
flex-direction: column;
// margin-bottom: 110rpx;
.create-check-checker {
display: flex;
margin-top: 10px;
// width: 100%;
background-color: #FFFFFF;
flex-direction: column;
padding: 10px;
overflow: hidden;
.create-check-checker-title {
display: flex;
flex-direction: row;
margin: 0px 10px;
height: 40px;
align-items: center;
}
}
.create-check-component-list {
display: flex;
flex-direction: column;
width: 100%;
background-color: #FFFFFF;
}
}
.create-check-submit {
height: 92rpx;
background-color: #FFFFFF;
padding: 5px 10px;
position: fixed;
bottom: 0;
z-index: 99;
width: 90%;
button {
background-color: #1890FF;
color: #FFFFFF;
font-size: 16px;
}
}
}
.create-check-checker-input {
display: flex;
height: 80rpx;
align-items: center;
flex-direction: row;
margin: 10rpx 20rpx;
border-radius: 5px;
background-color: #F5F7FA;
// border: 1px solid rgba(0, 0, 0, 0.25098039215686274);
image {
padding: 10px;
width: 20px;
height: 20px;
}
}
.uni-upload-image {
display: flex;
position: relative;
align-items: center;
margin: 20rpx 20rpx 0px 0px;
height: 160rpx;
width: 160rpx;
}
</style>
<template>
<view class="index-content">
<!-- <navbar :showBack="false" :title="title"></navbar> -->
<picker @change="itemSelect" :range="projectNames">
<label>
<view class="index-uni-project">
<text>{{projectSelect}}</text>
<image src="../../../../static/icon_down_select.png"></image>
</view>
</label>
</picker>
<auto-banner class="index-uni-banner" :homeSlide="banners"></auto-banner>
<view class="index-grid-box">
<uni-grid :column="column" @change="change">
<uni-grid-item v-for="(item, index) in list" :index="index" :key="index">
<view class="index-grid-item-box">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+item.menu_icon+'.png'"
class="image" />
<text class="index-text">{{item.check_item_name}}</text>
</view>
</uni-grid-item>
</uni-grid>
</view>
</view>
</template>
<script>
import Api from "../../../../api/api.js"
export default {
data() {
return {
title: '',
column: 3,
projectList: [],
projectNames: [],
banners: [],
tplConfig: [],
list: [],
projectSelect: "示例项目",
projectId: "",
pattern: {
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF'
},
menu: [],
appId: ""
}
},
onLoad(option) {
this.appId = option.check_tpl_id
this.title = option.title
uni.setNavigationBarTitle({
title: this.title
})
this.loadProject()
this.loadData()
},
methods: {
loadProject(access_token) {
Api.getProjectList({
data: {
is_all: 1
}
}).then((result) => {
console.log("项目列表:", result);
if (result.code === 0) {
this.projectList = result.data.list
for (var i = 0; i < this.projectList.length; i++) {
this.projectNames[i] = this.projectList[i].project_name
}
if (this.projectList.length > 0) {
console.log("项目ID:", );
let curId = uni.getStorageSync("project_id")
if (curId.length == 0) {
this.projectSelect = this.projectList[0].project_name
uni.setStorageSync("project_id", this.projectList[0].project_id)
uni.setStorageSync("project_name", this.projectList[0].project_name)
} else {
this.projectSelect = uni.getStorageSync("project_name")
}
}
} else {
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
return
}
}
})
},
loadData() {
Api.getOriginAppDetail({
data: {
"check_tpl_id": this.appId,
"show_status": 1
}
}).then((result) => {
console.log("检查项菜单:", result);
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
return
}
if (result.data.line_menu_num) {
if (result.data.line_menu_num !== "") {
this.column = parseInt(result.data.line_menu_num)
} else {
this.column = 3
}
} else {
this.column = 3
}
console.log(this.column);
this.banners = result.data.home_pic
console.log("轮播图:", this.banners);
this.tplConfig = result.data.tpl_config
console.log("检查项列表:", this.tplConfig);
if (this.tplConfig) {
if (this.tplConfig.length > 0) {
this.list = this.tplConfig[0].module_config
}
}
this.title = result.data.tpl_name
uni.setStorageSync("version", result.data.version)
uni.setStorageSync("application_name", result.data.application_name)
uni.setStorageSync("version_pic", result.data.version_pic)
})
},
change(e) {
let {
index
} = e.detail
let item = this.list[index]
uni.navigateTo({
url: `/pages/gallery/app/checkObjList/checkObjList?check_item_name=${item.check_item_name}&check_item_id=${item.check_item_id}&check_tpl_id=${this.appId}`,
})
},
itemSelect(e) {
console.log(e);
let index = parseInt(e.detail.value)
this.projectSelect = this.projectList[index].project_name
uni.setStorageSync("project_id", this.projectList[index].project_id)
uni.setStorageSync("project_name", this.projectList[index].project_name)
},
}
}
</script>
<style lang="scss">
.index-content {
display: flex;
flex-direction: column;
background-color: #F5F5F5;
box-sizing: border-box;
position: relative;
.index-uni-project {
height: 80rpx;
background-color: #FFFFFF;
display: flex;
flex-direction: row;
width: 100%;
align-items: center;
justify-content: center;
text {
font-size: 32rpx;
color: #333333;
max-width: 400rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
image {
width: 40rpx;
height: 40rpx;
}
}
.index-uni-banner {
background-color: #FFFFFF;
border: 2rpx solid #F5F5F5;
border-radius: 10rpx;
margin: 30rpx;
}
.index-grid-box {
flex-direction: row;
padding: 30rpx;
background-color: #FFFFFF;
.index-grid-item-box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-start;
padding: 30rpx 10rpx;
image {
width: 80rpx;
height: 80rpx;
}
text {
text-align: center;
margin-top: 10rpx;
font-size: 24rpx;
color: #333333;
}
}
}
}
.index-content::after {
content: "";
display: block;
}
.back-icon {
width: 100rpx;
height: 100rpx;
border-radius: 50%;
position: absolute;
right: 30rpx;
bottom: -320rpx;
background-color: rgb(0, 122, 255);
box-shadow: 0 0 10rpx 4rpx rgba(0, 0, 0, 0.2);
display: flex;
align-items: center;
justify-content: center;
image {
width: 80rpx;
height: 80rpx;
}
}
</style>
......@@ -34,16 +34,17 @@
<view class="app-content">
<v-tabs :tabs="tabs" :scroll="true" :value="current" @change="tabChange"></v-tabs>
<view class="app-group-content">
<view class="app-group-item" v-for="(item,index) in apps" :key="index">
<view class="app-group-item" v-for="(item,index) in apps[current].list" :key="index">
<view class="title">{{item.group_name||"其他"}}</view>
<uni-grid column="4" class="grid-container">
<uni-grid-item class="grid-item" v-for="(model,modelIndex) in item.data" :key="modelIndex"
@click="toIndex(model)">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+model.logo+'.png'"
class="image" />
<view class="single-text" style="color: #666666;font-size: 28rpx;margin-top: 10rpx;">
{{model.app_name}}
<uni-grid-item class="grid-item" v-for="(model,modelIndex) in item.data" :key="modelIndex">
<view class="item" @click="toIndex(model)">
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+model.logo+'.png'"
class="image" />
<view class="single-text" style="color: #666666;font-size: 28rpx;margin-top: 10rpx;">
{{nameLengthDeal(model.app_name)}}
</view>
</view>
</uni-grid-item>
</uni-grid>
......@@ -56,6 +57,7 @@
<script>
import Api from "../../api/api.js"
import StringUtils from "../../common/stringUtils.js"
export default {
data() {
return {
......@@ -64,7 +66,16 @@
messageCount: 0,
needDoCount: 0,
groups: [],
apps: [],
apps: [{
app_menu: 1,
list: []
}, {
app_menu: 2,
list: []
}, {
app_menu: 3,
list: []
}],
current: 0,
tabs: ["生活服务", "综合办公", "岗位工作"],
requestParam: {
......@@ -88,6 +99,45 @@
this.getNeedDo()
},
methods: {
toIndex(model) {
this.$mta(model.app_id)
this.getAppDetail(model)
},
getAppDetail(model) {
Api.getAppDetail({
data: {
"check_tpl_id": model.source_id
}
}).then((result) => {
console.log("应用信息", result);
uni.setStorageSync("business_name", result.data.tpl_name)
if (result.code == 0) {
if (!result.data.business_type) {
uni.navigateTo({
url: `/pages/gallery/app/originalIndex/originalIndex?check_tpl_id=${model.source_id}&title=${result.data.tpl_name}`
})
} else if (result.data.business_type ==
2) { //独立模式 需要获取模块数量 如果只有一个模块 自动跳转表单页面 "体验嘛 呵呵"
that.toAlone(model, result.data)
} else if (result.data.business_type == 3 || result.data.business_type == 4) { //流程模式
this.models = result.data.tpl_config
uni.navigateTo({
url: `../model-form-list-page/model-form-list-page?check_tpl_id=${model.source_id}&business_type=${result.data.business_type}&title=${result.data.tpl_name}&showCfg=${JSON.stringify(this.models[0].show_cfg)}`
})
} else if (result.data.business_type == 5) {
this.currentModel = result.data.tpl_config[0]
console.log(this.currentModel);
this.$refs.bottomDialog.handleShow()
} else { //之前的默认
uni.navigateTo({
url: `../index/index?check_tpl_id=${model.source_id}&title=${result.data.tpl_name}`
})
}
} else {
this.$toast.showToast(result.msg)
}
})
},
tabChange(e) {
this.current = e
},
......@@ -140,6 +190,7 @@
"code_type": "applicationGroup"
}
}).then((result) => {
console.log("应用分组", result);
if (result.code == 0) {
let list = result.data[0].sub_data
this.groups = []
......@@ -165,31 +216,33 @@
})
},
getAppList: function() {
let that = this
Api.getAppList({
data: this.requestParam
data: this.requestParam,
header: {
'access_token': uni.getStorageSync('token') || ''
}
}).then((result) => {
if (result.code === 0) {
let list = result.data.list
that.apps = that.sortGroup(list)
console.log(that.apps);
if (that.groups.length > 0) {
for (var i = 0; i < that.apps.length; i++) {
for (var j = 0; j < that.groups.length; j++) {
if (that.groups[j].key == that.apps[i].app_group) {
that.apps[i].group_name = that.groups[j].val
//先根据菜单分组
this.apps = this.menuSort(list)
//再根据类型分组
this.apps.forEach((item) => {
item.list = this.sortGroup(item.list)
if (this.groups.length > 0) {
for (var i = 0; i < item.list.length; i++) {
for (var j = 0; j < this.groups.length; j++) {
if (this.groups[j].key == item.list[i].app_group) {
item.list[i].group_name = this.groups[j].val
}
}
}
}
}
}
})
console.log("应用分组之后", this.apps);
} else {
if (result.code === -1) {
this.$toast.showToast(result.msg)
if (result.action === 'Laravel_public_permission_fail') {
that.refreshToken()
}
}
this.$toast.showToast(result.msg)
}
})
},
......@@ -201,7 +254,8 @@
if (!map[app.app_group]) {
dest.push({
app_group: app.app_group,
data: [app]
data: [app],
app
});
map[app.app_group] = app;
} else {
......@@ -216,6 +270,32 @@
}
return dest
},
menuSort(arr) {
var map = {},
dest = [];
for (var i = 0; i < arr.length; i++) {
var app = arr[i];
if (!map[app.app_menu]) {
dest.push({
app_menu: app.app_menu,
list: [app]
});
map[app.app_menu] = app;
} else {
for (var j = 0; j < dest.length; j++) {
var dj = dest[j];
if (dj.app_menu == app.app_menu) {
dj.list.push(app);
break;
}
}
}
}
return dest
},
nameLengthDeal(name) {
return StringUtils.stringLength(name, 4)
}
}
}
</script>
......@@ -378,22 +458,25 @@
margin-top: 30rpx;
.grid-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
image {
width: 50rpx;
height: 50rpx;
}
.item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text {
margin-top: 10rpx;
font-weight: 400;
font-size: 24rpx;
color: #333;
image {
width: 50rpx;
height: 50rpx;
}
text {
margin-top: 20rpx;
font-weight: 400;
font-size: 24rpx;
color: #333;
}
}
}
}
......
......@@ -70,9 +70,28 @@
})
},
sureConfig() {
uni.$emit("refreshApp")
uni.navigateBack({
delta: 1
if (thsi.selList.length == 0) {
this.$toast.showToast("请设置常用应用")
return
}
let apps = []
this.selList.forEach((item) => {
apps.push(item.app_id)
})
Api.saveAppConfig({
data: {
apps: apps
}
}).then((result) => {
if (result.code == 0) {
this.$toast.showToast("常用应用设置成功")
uni.$emit("refreshApp")
uni.navigateBack({
delta: 1
})
} else {
this.$toast.showToast(result.msg)
}
})
},
toAdd(item) {
......
......@@ -51,7 +51,8 @@
<uni-grid-item v-for="(app,index) in appList" :key="index">
<view class="app-item" @click="toLink(app)">
<view :class="isLineVisil(index)?'app-name-left':'app-name-right'">
{{nameLengthDeal(app.app_name)}}</view>
{{nameLengthDeal(app.app_name)}}
</view>
<image class="app-logo" src="../../static/ic-score-logo.png"></image>
<view class="line" v-if="isLineVisil(index)"></view>
</view>
......@@ -744,17 +745,19 @@
font-family: "PingFang SC Medium";
font-weight: 700;
margin-left: 30rpx;
flex: 1;
font-size: 28rpx;
text-align: center;
text-align: left;
color: #333;
}
.app-name-right {
font-family: "PingFang SC Medium";
font-weight: 700;
flex: 1;
margin-left: 60rpx;
font-size: 28rpx;
text-align: center;
text-align: left;
color: #333;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment