提交 c2a3aedb 作者: wk

应用迁移

父级 cf895e49
......@@ -245,6 +245,10 @@ const params = {
getObjList: {
url: "/plat/api/v1/common_check/check_object/obj_list",
method: "get"
},
getOrgTree: {
url: "/api/v1/org/node/get_org_tree",
method: "post"
}
}
......
......@@ -81,7 +81,7 @@
<script>
import uniPopup from '@/components/uni-popup/uni-popup.vue';
import OSSUtil from '../../common/oss/ossUtil.js';
import OSSUtil from "../../common/oss/ossUtil.js"
export default {
components: {
uniPopup
......@@ -281,7 +281,7 @@
},
videoItem: function(video) {
uni.navigateTo({
url: `../../pages/play-video-page/play-video-page?url=${video.url}`
url: `/pages/gallery/playVideo/playVideo?url=${video.url}`
})
},
uploadVideo: async function(video) {
......
......@@ -265,8 +265,7 @@
"path": "pages/gallery/nextProcessPage/nextProcessPage",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
"enablePullDownRefresh": false
}
}, {
......@@ -362,9 +361,72 @@
"navigationStyle": "custom"
}
}, {
"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
}
}, {
"path": "pages/gallery/app/modeFormList/modeFormList",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/gallery/app/addBusinessData/addBusinessData",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/gallery/app/addForm/addForm",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}, {
"path": "pages/gallery/app/qrcodeList/qrcodeList",
"style": {
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
,{
"path" : "pages/gallery/app/originalIndex/originalIndex",
"path" : "pages/gallery/app/modeList/modeList",
"style" :
{
"navigationBarTitleText": "",
......@@ -373,7 +435,7 @@
}
,{
"path" : "pages/gallery/app/checkObjList/checkObjList",
"path" : "pages/gallery/app/processFormDetail/processFormDetail",
"style" :
{
"navigationBarTitleText": "",
......@@ -382,7 +444,17 @@
}
,{
"path" : "pages/gallery/app/createCheck/createCheck",
"path" : "pages/mine/changeOrg/changeOrg",
"style" :
{
"navigationBarTitleText": "",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
}
,{
"path" : "pages/gallery/app/editAloneForm/editAloneForm",
"style" :
{
"navigationBarTitleText": "",
......@@ -391,7 +463,7 @@
}
,{
"path" : "pages/gallery/app/checkObjDetail/checkObjDetail",
"path" : "pages/gallery/app/editRecordDetail/editRecordDetail",
"style" :
{
"navigationBarTitleText": "",
......@@ -400,7 +472,7 @@
}
,{
"path" : "pages/gallery/app/checkRecord/checkRecord",
"path" : "pages/gallery/app/selectUserPage/selectUserPage",
"style" :
{
"navigationBarTitleText": "",
......@@ -412,8 +484,8 @@
"globalStyle": {
"navigationBarTextStyle": "white",
"navigationBarTitleText": "uni-app",
"navigationBarBackgroundColor": "#59A3FE",
"backgroundColor": "#59A3FE"
"navigationBarBackgroundColor": "#3B73FE",
"backgroundColor": "#3B73FE"
},
"uniIdRouter": {},
"tabBar": {
......
<template>
<view class="solder-parent">
<view class="solder-item-list">
<view v-for="(item,index) in itemList" :key="index">
<gi-time-select v-if="item.control_type==19" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @change="timeChange" :realValue="item.real_value">
</gi-time-select>
<gi-select v-if="item.control_type==21" :title="item.content_name" :isMust="item.validate_type==1"
:field_name="item.real_field" :project_id="project_id" :index="index" :config="item.control_cfg"
@change="selectChange" :ent_id="ent_id" :selected="item.real_value">
</gi-select>
<gi-upload v-if="item.control_type==22&&item.control_cfg.up_type!=5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="fileChange"
:realValue="item.real_value">
</gi-upload>
<gi-note v-if="item.control_type==24" :value="item.control_cfg.content" :item="item"
:image="item.control_cfg.content_img"></gi-note>
<!-- 数据可变控件 -->
<gi-common-value-variable v-if="item.control_type==29" :item="item" :index="index"
@inputChange="inputChange">
</gi-common-value-variable>
<!-- 数据不可变控件 -->
<gi-common-value-unvariable v-if="item.control_type==30" :item="item" :index="index">
</gi-common-value-unvariable>
<!-- 业务选择控件 -->
<gi-business-select v-if="item.control_type==31" :item="item" :index="index" :project_id="project_id">
</gi-business-select>
<gi-custom-data :item="item" v-if="item.control_type==36" :selectValue="item.real_value" :index="index">
</gi-custom-data>
</view>
</view>
<view style="height: 144rpx;"></view>
<view class="uni-group-button">
<view class="uni-grey-button" @click="toSave">暂存</view>
<view class="uni-blue-button" @click="toNext">下一步</view>
</view>
</view>
</template>
<!-- 1、获取控件列表 -->
<script>
export default {
data() {
return {
project_id: "",
business_type: 4,
check_tpl_id: "",
ent_id: "",
checkModuleId: "",
itemList: [],
primary_key_id: "",
title: ""
}
},
onLoad: function(options) {
this.check_tpl_id = options.check_tpl_id
this.checkModuleId = options.check_module_id
this.project_id = options.project_id
this.title = options.title
uni.setNavigationBarTitle({
title: options.title
})
this.getFormList()
this.getWelderNo()
},
onShow: function() {
uni.$once("businessSelect", res => {
let params = JSON.parse(res)
let index = params.index
this.primary_key_id = params.primary_key_id
// let itemList = params.itemList
let result = params.result
// this.itemList[index] = itemList
// this.$set(this.itemList, index, this.itemList[index])
this.refreshBusinessData(result)
})
//选择控件页面跳转返回
uni.$once("change", res => {
console.log("单复选变化", index + "-----" + JSON.parse(res.selected));
let index = parseInt(res.index)
this.itemList[index].real_value = JSON.parse(res.selected)
this.$set(this.itemList, index, this.itemList[index])
})
uni.$once("getCustomData", res => {
let index = parseInt(res.index)
let value = parseInt(res.value)
let item = this.itemList[index]
item.real_value = value
this.$set(this.itemList, index, item)
})
},
methods: {
getWelderNo: function() {
this.$http.consoleGet({
url: "/intecons/api/v1/weld/middle_user/group_welder_list",
data: {
project_id: this.project_id
},
header: {
access_token: this.getToken()
}
}).then((res) => {
let result = res.data
if (result.code == 0) {
let list = result.data.list
let groupIds = ""
if (list && list.length > 0) {
uni.setStorageSync("welder_no", list[0].welder_no)
uni.setStorageSync("group_id", list[0].group_id)
for (var i = 0; i < list.length; i++) {
if (i != list.length - 1) {
groupIds += `${list[i].group_id},`
} else {
groupIds += list[i].group_id
}
}
}
}
})
},
timeChange: function(index, values) {
console.log("时间选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
selectChange: function(index, values) {
console.log("下拉选择变化", index + "-----" + JSON.stringify(values));
this.itemList[index].real_value = values
uni.setStorageSync(`${this.bussinessType}${this.checkModuleId}${index}`, JSON.stringify(values))
},
fileChange: function(index, values) {
console.log("附件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
//可变数据控件
inputChange: function(value, index) {
this.itemList[index].real_value = []
this.itemList[index].real_value.push({
"value": value
})
},
// 根据选择的焊口区域和管线号 获取业务数据信息刷新控件
refreshBusinessData: function(result) {
//所有控件字段
let list = result.fields
console.log(list);
if (list && list.length > 0) {
let items = []
for (var i = 0; i < this.itemList.length; i++) {
let item = this.itemList[i]
for (var j = 0; j < list.length; j++) {
let valueData = list[j]
if (item.real_field == valueData.field) {
if (item.control_type == 21 || item.control_type == 29) {
if (valueData.value != null) {
item.real_value = [{
"value": valueData.value
}]
}
} else { //时间还按之前的
if (valueData.value != null) {
item.real_value = [valueData.value]
}
}
}
}
items.push(item)
}
this.itemList = items
}
},
getFormList: function() {
let data = {
business_type: this.business_type,
project_id: this.project_id,
check_tpl_id: this.check_tpl_id
}
console.log(data);
this.$http.get({
url: "/api/v1/common_check/check_record/item_detail",
data: data,
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("表单列表", result);
if (result.code == 0) {
this.dealData(result.data.list)
} else {
this.$toast.showToast(result.msg)
}
})
},
dealData: function(data) {
// 独立模式是一个工单
if (data.length > 0) {
this.form = data[0]
this.ent_id = this.form.ent_id
//遍历出来焊工号显示
for (var i = 0; i < this.form.content_detail.length; i++) {
let item = this.form.content_detail[i]
let real_field = item.real_field
if ("welder_no" == real_field) { //焊工号默认值
let welder_no = uni.getStorageSync("welder_no")
if (welder_no && welder_no != null) {
item.real_value = [{
"value": welder_no
}]
}
}
this.itemList.push(item)
}
}
},
toSave: function() {
let that = this
setTimeout(function() {
console.log("暂存的内容", that.itemList);
that.form.content_detail = that.itemList
that.form.project_id = that.project_id
that.form.obj_no = that.objNo
that.form.is_tmp = 1
if ("焊口检查" == uni.getStorageSync("business_name")) {
that.form.primary_key_id = that.primary_key_id
}
if (!that.form._id || that.form._id == '') {
that.form.check_record_id = that.check_record_id
} else {
that.form.check_record_id = that.form._id
}
that.$http.post({
url: "/api/v1/common_check/check_record/save",
data: that.form,
header: {
"access_token": that.getToken()
}
}).then((res) => {
console.log("暂存成功", res.data);
let result = res.data
if (result.code == 0) {
that.objNo = result.data.obj_no
that.check_record_id = result.data.check_record_id
uni.$emit("refresh")
that.$toast.showToast("暂存成功")
} else {
that.$toast.showToast(result.msg)
}
}, 1000)
})
},
toNext: function() {
let that = this
setTimeout(function() {
if (!that.checkNull()) {
that.$toast.showToast("*必填项未填写")
return
}
that.form.content_detail = that.itemList
that.form.project_id = that.project_id
that.form.obj_no = that.objNo
if ("焊口检查" == uni.getStorageSync("business_name")) {
that.form.primary_key_id = that.primary_key_id
}
console.log("提交的内容", that.form);
uni.setStorageSync(that.form.check_item_id, JSON.stringify(that.form))
uni.navigateTo({
url: `/pages/gallery/nextProcessPage/nextProcessPage?check_tpl_id=${that.check_tpl_id}&project_id=${that.project_id}&formId=${that.form.check_item_id}`
})
}, 500)
},
checkNull: function() {
let canSubmit = true
for (var i = 0; i < this.itemList.length; i++) {
let item = this.itemList[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (item.control_type == 26) {
console.log(item);
let b = false
for (var k = 0; k < item.control_children.length; k++) {
if (item.control_children[k].status && item.control_children[k].status == "已填写") {
b = true
break
}
}
console.log(b);
if (!b) {
canSubmit = false
break
}
} else {
if (!values || values.length == 0) {
canSubmit = false
break
}
}
}
}
return canSubmit
},
checkChildNull: function(list) {
let canSubmit = true
for (var i = 0; i < list.length; i++) {
let item = list[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (!values || values.length == 0) {
canSubmit = false
break
}
} else {
continue
}
}
return canSubmit
},
},
}
</script>
<style>
.solder-parent {
display: flex;
flex-direction: column;
margin-top: 32rpx;
}
.solder-item-list {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
padding-left: 10rpx;
}
</style>
<template>
<view class="add-form-parent">
<view class="add-form-item-list">
<view v-for="(item,index) in itemList" :key="index">
<gi-input v-if="item.control_type==16" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="inputChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-input>
<gi-textarea v-if="item.control_type==17" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="textareaChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-textarea>
<gi-number-input v-if="item.control_type==18" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="numberChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-number-input>
<gi-time-select v-if="item.control_type==19" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @change="timeChange" :realValue="item.real_value">
</gi-time-select>
<gi-label-select v-if="item.control_type==20" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @change="labelChange" :selected="item.real_value">
</gi-label-select>
<gi-select v-if="item.control_type==21" :title="item.content_name" :isMust="item.validate_type==1"
:project_id="projectId" :index="index" :config="item.control_cfg" @change="selectChange"
:selected="item.real_value" :business_type="bussinessType " :checkModuleId="id">
</gi-select>
<gi-upload v-if="item.control_type==22&&item.control_cfg.up_type!=5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="fileChange"
:realValue="item.real_value" @localChange="localChange">
</gi-upload>
<gi-record v-if="item.control_type==22&&item.control_cfg.up_type==5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="audioChange"
:realValue="item.real_value" @addAudio="addAudio" :state="recordSate"></gi-record>
<gi-scan v-if="item.control_type==23" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" :isCopy="item.is_copy"></gi-scan>
<gi-note v-if="item.control_type==24" :item="item"></gi-note>
<gi-compute v-if="item.control_type==25" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" :form="item"></gi-compute>
<gi-component-group v-if="item.control_type==26" :index="index" :component="item"
@groupChange="groupChange"></gi-component-group>
<gi-location v-if="item.control_type==27" :config="item.control_cfg" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" @change="locationChange"></gi-location>
<gi-select-user v-if="item.control_type==28" :title="item.content_name" :isMust="item.validate_type==1"
:selectPost="item.selectPost" :index="index" :projectId="projectId" :realValue="item.real_value"
:config="item.control_cfg">
</gi-select-user>
<gi-sign v-if="item.control_type==33" :item="item" :index="index" @signChange="signChange"></gi-sign>
<gi-weather v-if="item.control_type==34" @change="weatherChange" :real_value="item.real_value"
:index="index">
</gi-weather>
<gi-signin v-if="item.control_type==35" :users="item.real_value" :record_id="form.check_record_id">
</gi-signin>
<gi-custom-data :item="item" v-if="item.control_type==36" :selectValue="item.real_value[0]"
:project_id="projectId" @inputFinish="inputFinish()" :index="index">
</gi-custom-data>
</view>
</view>
<view style="height: 144rpx;"></view>
<view class="uni-group-button" v-if="bussinessType==2">
<view class="uni-grey-button" @click="toSave">暂存</view>
<view class="uni-blue-button" @click="toSubmit">提交</view>
</view>
<view class="uni-group-button" v-if="bussinessType==3||bussinessType==4">
<view class="uni-grey-button" @click="toSave">暂存</view>
<view class="uni-blue-button" @click="toNext">下一步</view>
</view>
<view class="model-view" :style="showModal?'':'display:none;'">
<view class="model-out-box">
<view class="text-black-normal">提示</view>
<view class="model-content">
<image src="../../../../static/successful.png" style="width: 100rpx;height: 100rpx;"></image>
</view>
<view class="text-black-normal" style="margin-bottom: 32rpx;">提交成功</view>
<view style="display: flex;flex-direction: row;width: 100%;">
<view class="btn-dialog-grey" @click="cancel">取消</view>
<view class="btn-dialog-blue" @click="toDetail">查看表单</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bussinessType: 2,
projectId: "",
checkTplId: "5fe1a6c8b66600001e003117",
checkModuleId: "8h9048q3dolkegrr1jkc86b89j",
objNo: "",
form: {},
itemList: [],
showModal: false,
is_tmp: 0,
check_record_id: "",
recordSate: "开始录音", //1开始录音 2录音中 3录音结束
recordIndex: -1,
id: "",
test: "",
needGcy: [],
gcyToken: "",
gcySignToken: "",
txtIds: [],
title: ""
}
},
onLoad: function(option) {
this.checkTplId = option.check_tpl_id
this.checkModuleId = option.check_module_id
this.bussinessType = option.bussness_type
this.projectId = option.project_id
console.log("bussinessType", this.bussinessType);
this.title = option.title
uni.setNavigationBarTitle({
title: option.title
})
this.getFormList()
if (this.bussinessType == 2) {
this.id = this.checkModuleId
} else if (this.bussinessType == 3) {
this.id = this.checkTplId
}
},
onShow: function() {
//选择控件页面跳转返回
uni.$once("change", res => {
console.log("单复选变化", index + "-----" + JSON.parse(res.selected));
let index = parseInt(res.index)
this.itemList[index].real_value = JSON.parse(res.selected)
this.$set(this.itemList, index, this.itemList[index])
})
//计分控件页面跳转返回
uni.$once("computeResult", res => {
let index = parseInt(res.index)
this.itemList[index] = JSON.parse(res.form)
this.$set(this.itemList, index, this.itemList[index])
})
//组合控件页面跳帧返回
uni.$once("groupEdit", res => {
let index = parseInt(res.index)
let childIndex = parseInt(res.childIndex)
this.itemList[index].control_children[childIndex] = JSON.parse(res.children)
this.$set(this.itemList, index, this.itemList[index])
console.log(this.itemList[index]);
})
//层级控件页面跳转返回
uni.$once("levelSelect", res => {
let index = parseInt(res.index)
this.itemList[index].real_value = JSON.parse(res.selects)
this.$set(this.itemList, index, this.itemList[index])
console.log(this.itemList[index]);
})
//人员选择页面跳转返回
uni.$once("selectUser", res => {
let index = parseInt(res.index)
let type = parseInt(res.type)
if (type == 0) {
this.itemList[index].real_value = res.selected
this.itemList[index].selectPost = res.selectPost
this.$set(this.itemList, index, this.itemList[index])
}
})
//如果businessType==4 需要根据选择的区域和管线号请求相关业务数据
uni.$once("getBusinessData", res => {
this.getBusinessData()
})
uni.$once("getCustomData", res => {
console.log("res", res);
let index = parseInt(res.index)
let value = res.value
let item = this.itemList[index]
item.real_value = [value]
this.$set(this.itemList, index, item)
})
},
onReady: function() {
uni.hideKeyboard();
},
methods: {
inputFinish: function(e) {
let index = parseInt(e.index)
let value = e.value
let item = this.itemList[index]
item.real_value = [value]
this.$set(this.itemList, index, item)
},
signChange: function(index, url) {
let item = this.itemList[index]
item.real_value = [url]
this.$set(this.itemList, index, item)
},
getBusinessData: function(params) {
this.$http.consoleGet({
url: "/api/v1/data/rpt_b_entity_field/real_box_list",
data: params,
header: {
access_token: this.getToken()
}
}).then((res) => {
//遍历控件组显示控件默认的值
})
},
groupChange: function(index, children) {
this.itemList[index].control_children = children
},
//单文本值变化
inputChange: function(index, values) {
console.log("单文本值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
locationChange: function(index, value) {
this.itemList[index].real_value = []
this.itemList[index].real_value.push(value)
},
textareaChange: function(index, values) {
console.log("多行文本值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
numberChange: function(index, values) {
console.log("数字框值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
timeChange: function(index, values) {
console.log("时间选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
labelChange: function(index, values) {
console.log("标签选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
selectChange: function(index, values) {
console.log("下拉选择变化", index + "-----" + JSON.stringify(values));
this.itemList[index].real_value = values
uni.setStorageSync(`${this.bussinessType}${this.id}${index}`, JSON.stringify(values))
console.log("保存key", `${this.bussinessType}${this.id}${index}`);
},
fileChange: function(index, values) {
console.log("附件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
localChange(index, values) {
console.log("本地文件", index + "-----" + values);
this.itemList[index].localFile = values
},
audioChange: function(index, values) {
console.log("录音文件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
weatherChange: function(index, value) {
this.itemList[index].real_value = value
},
getFormList: function() {
this.$http.get({
url: "/api/v1/common_check/check_record/item_detail",
data: {
"project_id": this.projectId,
"check_tpl_id": this.checkTplId,
"check_module_id": this.checkModuleId,
"business_type": this.bussinessType
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("表单列表", result);
if (result.code == 0) {
this.dealData(result.data.list)
} else {
this.$toast.showToast(result.msg)
}
})
},
dealData: function(data) {
// 独立模式是一个工单
if (data.length > 0) {
this.form = data[0]
this.itemList = this.form.content_detail
}
},
toClose: function() {
uni.navigateBack({
delta: 1
})
},
checkNull: function() {
let canSubmit = true
this.needGcy = []
for (var i = 0; i < this.itemList.length; i++) {
let item = this.itemList[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
//上传附件检查是否工程云认证需要
if (item.control_type == 22 && item.control_cfg.use_engin_cloud == 1) {
this.needGcy.push(i)
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (item.control_type == 26) {
console.log(item);
let b = false
for (var k = 0; k < item.control_children.length; k++) {
if (item.control_children[k].status && item.control_children[k].status == "已填写") {
b = true
break
}
}
console.log(b);
if (!b) {
canSubmit = false
break
}
} else {
if (!values || values.length == 0) {
canSubmit = false
break
}
}
}
}
return canSubmit
},
checkChildNull: function(list) {
let canSubmit = true
for (var i = 0; i < list.length; i++) {
let item = list[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (!values || values.length == 0) {
canSubmit = false
break
}
} else {
continue
}
}
return canSubmit
},
toSave: function() {
let that = this
setTimeout(function() {
console.log("暂存的内容", that.itemList);
that.form.content_detail = that.itemList
that.form.project_id = that.projectId
that.form.obj_no = that.objNo
that.form.is_tmp = 1
if (!that.form._id || that.form._id == '') {
that.form.check_record_id = that.check_record_id
} else {
that.form.check_record_id = that.form._id
}
that.$http.post({
url: "/api/v1/common_check/check_record/save",
data: that.form,
header: {
"access_token": that.getToken()
}
}).then((res) => {
console.log("暂存成功", res.data);
let result = res.data
if (result.code == 0) {
that.objNo = result.data.obj_no
that.check_record_id = result.data.check_record_id
uni.$emit("refresh")
uni.showToast({
title: "暂存成功",
icon: 'none'
})
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, 1000)
})
},
toSubmit: function() {
console.log("提交的内容", this.itemList);
if (!this.checkNull()) {
uni.showToast({
title: "*必填项未填写",
icon: 'none'
})
return
}
if (this.needGcy.length > 0) {
this.getGcyToken()
} else {
this.submit()
}
},
submit() {
uni.showModal({
title: "提示",
content: "是否确认提交",
showCancel: true,
confirmText: "提交",
confirmColor: '#1890FF',
success: (res) => {
if (res.confirm) {
this.form.content_detail = this.itemList
this.form.project_id = this.projectId
this.form.obj_no = this.objNo
this.form.is_tmp = 0
this.$http.post({
url: "/api/v1/common_check/check_record/save",
data: this.form,
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("提交成功", res.data);
let result = res.data
if (result.code == 0) {
this.objNo = result.data.obj_no
this.showSuccess()
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
})
}
}
})
},
toNext: function() {
let that = this
setTimeout(function() {
if (!that.checkNull()) {
uni.showToast({
title: "*必填项未填写",
icon: 'none'
})
return
}
that.form.content_detail = that.itemList
that.form.project_id = that.projectId
that.form.obj_no = that.objNo
console.log("提交的内容", that.form);
uni.setStorageSync(that.form.check_item_id, JSON.stringify(that.form))
uni.navigateTo({
url: `/pages/gallery/nextProcessPage/nextProcessPage?check_tpl_id=${that.checkTplId}&project_id=${that.projectId}&formId=${that.form.check_item_id}&title=${that.title}`
})
}, 500)
},
showSuccess: function() {
this.showModal = true
},
cancel: function() {
this.showModal = false
uni.$emit("refresh")
uni.navigateBack({
delta: 1
})
},
toDetail: function() {
uni.$emit("refresh")
uni.navigateBack({
delta: 1
})
uni.navigateTo({
url: `/pages/gallery/formDetailPage/formDetailPage?obj_no=${this.objNo}`
})
},
computeClick: function(index) {
let form = JSON.stringify(this.itemList[index])
uni.navigateTo({
url: `/pages/gallery/computePage/computePage?form=${form}&index=${index}`
})
},
getGcyToken() {
this.$http.get({
url: "/api/v1/third_party/gcy_get_token",
header: {
"access_token": this.getToken()
}
}).then(res => {
let result = res.data
console.log("工程云token:", result);
if (result.code === 0) {
this.gcyToken = result.data.token
this.gcySignToken = result.data.signed_token
this.gcyRZ()
} else {
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
if (result.action === 'Laravel_public_permission_fail') {
this.toLogin()
this.setToken("")
}
}
}
})
},
async gcyRZ() {
for (var i = 0; i < this.needGcy.length; i++) {
var index = this.needGcy[i]
var list = this.itemList[index].localFile
this.txtIds = []
if (list) {
for (var j = 0; j < list.length; j++) {
await this.uploadGcy(list, j, this.itemList[index])
}
var controlCfg = this.itemList[index].control_cfg
controlCfg.gcyRzResult = this.txtIds
console.log("txtIds", this.txtIds);
this.$set(this.itemList[index], "control_cfg", controlCfg)
}
}
this.submit()
},
getFileName(path) {
if (path && path != "") {
var result = path.split("/")
return result[result.length - 1]
} else {
return ""
}
},
uploadGcy(list, index, item) {
let _this = this
uni.showLoading({
title: "认证中..."
})
return new Promise((resolve) => {
var rawBA = {
"BMId": _this.checkTplId,
"BInsId": _this.projectId,
"BAId": new Date().getTime(),
"sysId": "43928b6cc1817f8a167da2bfdddb8035",
"version": 1,
"modMark": false,
"payload": [{
"type": "publicSection",
"version": 1,
"data": {
"attachment": [{
"name": this.getFileName(list[index].path)
}]
}
}]
}
console.log("rawBA参数", rawBA);
uni.uploadFile({
url: getApp().globalData.gcyUrl + "/api/sjsn/gcy/cz",
filePath: list[index].path,
name: "files",
formData: {
// "file": this.title + this.getFileName(list[index].path),
"token": _this.gcyToken,
"signedToken": _this.gcySignToken,
"sysId": "43928b6cc1817f8a167da2bfdddb8035",
"rawBA": JSON.stringify(rawBA)
},
// header: {
// "Content-Type": "multipart/form-data"
// },
success: function(uploadFileRes) {
uni.hideLoading()
console.log("上传结果", uploadFileRes);
if (uploadFileRes.statusCode == 200) {
var result = JSON.parse(uploadFileRes.data).txIds
console.log("上传id", uploadFileRes.data);
_this.txtIds = _this.txtIds.concat(result)
resolve(uploadFileRes);
}
},
fail: function(err) {
uni.hideLoading()
console.log("上传失败", err);
}
});
})
},
uploadFileGcy(path) {
let _this = this
return new Promise(function(resolve, reject) {
uni.uploadFile({
url: "http://122.224.74.82:31524/api/sjsn/gcy/easy-cz",
filePath: path,
name: 'pic_file',
header: {
"Content-Type": "multipart/form-data"
},
success: function(uploadFileRes) {
console.log("上传结果", uploadFileRes);
if (uploadFileRes.statusCode == 200) {
var result = uploadFileRes.data.txIds
_this.txtIds = _this.txtIds.concat(result)
}
},
fail: function(err) {
console.log("上传失败", uploadFileRes);
}
})
})
}
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.add-form-parent {
display: flex;
flex-direction: column;
margin-top: 32rpx;
}
.add-form-item-list {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
padding-left: 10rpx;
}
.model-view {
position: fixed;
top: 0;
z-index: 999;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
background-color: rgba(0, 0, 0, 0.4);
}
.model-out-box {
width: 600rpx;
height: 400rpx;
background-color: #FFFFFF;
border-radius: 20rpx;
margin-top: 45%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 32rpx 0 0 0;
align-items: center;
}
.model-content {
width: 400rpx;
height: 200rpx;
border-radius: 10rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.btn-dialog-grey {
display: flex;
flex: 1;
height: 100rpx;
font-size: 32rpx;
color: #333333;
align-items: center;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
border-right: 2rpx solid rgba(0, 0, 0, 0.1);
justify-content: center;
}
.btn-dialog-blue {
display: flex;
flex: 1;
height: 100rpx;
font-size: 32rpx;
color: #1890FF;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
align-items: center;
justify-content: center;
}
</style>
......@@ -149,5 +149,9 @@
justify-content: center;
align-items: center;
}
.content {
background-color: #fff;
}
}
</style>
......@@ -7,7 +7,8 @@
<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 src="../../../../static/icon_scan.png" style="width: 40rpx;height: 40rpx;"
@click="clickScan">
</image>
</view>
......@@ -17,7 +18,7 @@
<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>
<image src="../../../../static/icon_down_arrow.png"></image>
</view>
</label>
</picker>
......@@ -42,7 +43,7 @@
</view>
</uni-grid-item>
<image style="width: 144rpx;height: 144rpx;margin: 20rpx;"
src="../../static/icon_take_photo.png" @click="selectImage(index)"></image>
src="../../../../static/icon_take_photo.png" @click="selectImage(index)"></image>
</uni-grid>
</view>
<!-- 弹窗选择单选 -->
......@@ -60,7 +61,7 @@
<view style="flex: 1;font-size: 14px;color: #333333;margin-left: 10px;">
{{item.current_value||""}}
</view>
<image src="../../static/icon_down_arrow.png"></image>
<image src="../../../../sstatic/icon_down_arrow.png"></image>
</view>
</label>
</picker>
......@@ -121,7 +122,7 @@
components: [],
inputValue: "",
checkItemId: "",
defaultUrl: "../../static/icon_take_photo.png",
defaultUrl: "../../../../static/icon_take_photo.png",
imageList: [],
windowHeight: "400px",
popupData: [],
......
<!-- 暂存功能的独立模式 -->
<template>
<view class="add-form-parent">
<view class="add-form-item-list">
<view v-for="(item,index) in itemList" :key="index">
<gi-input v-if="item.control_type==16" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="inputChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-input>
<gi-textarea v-if="item.control_type==17" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="textareaChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-textarea>
<gi-number-input v-if="item.control_type==18" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="numberChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-number-input>
<gi-time-select v-if="item.control_type==19" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @change="timeChange" :realValue="item.real_value">
</gi-time-select>
<gi-label-select v-if="item.control_type==20" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @change="labelChange" :selected="item.real_value">
</gi-label-select>
<gi-select v-if="item.control_type==21" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @change="selectChange" :selected="item.real_value">
</gi-select>
<gi-upload v-if="item.control_type==22&&item.control_cfg.up_type!=5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="fileChange"
:realValue="item.real_value">
</gi-upload>
<gi-record v-if="item.control_type==22&&item.control_cfg.up_type==5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="audioChange"
:realValue="item.real_value" @addAudio="addAudio" :state="recordSate"></gi-record>
<gi-scan v-if="item.control_type==23" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" :isCopy="item.is_copy"></gi-scan>
<gi-note v-if="item.control_type==24" :value="item.control_cfg.content" :item="item"></gi-note>
<gi-compute v-if="item.control_type==25" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" :form="item"></gi-compute>
<gi-component-group v-if="item.control_type==26" :index="index" :component="item"
@groupChange="groupChange"></gi-component-group>
<gi-location v-if="item.control_type==27" :config="item.control_cfg" :title="item.content_name"
:value="item.real_value[0]" :isMust="item.validate_type==1" :index="index" @change="locationChange">
</gi-location>
<gi-select-user v-if="item.control_type==28" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :projectId="projectId" :realValue="item.real_value"></gi-select-user>
<gi-sign v-if="item.control_type==33" :item="item" :index="index" @signChange="signChange"></gi-sign>
<gi-weather v-if="item.control_type==34" @change="weatherChange" :real_value="item.real_value"
:index="index">
</gi-weather>
<gi-signin v-if="item.control_type==35" :users="item.real_value" :record_id="item.check_record_id">
</gi-signin>
<gi-custom-data :item="item" v-if="item.control_type==36" :selectValue="item.real_value[0]"
:project_id="projectId" :index="index" @inputFinish="inputFinish()">
</gi-custom-data>
</view>
</view>
<view style="height: 144rpx;"></view>
<view class="uni-group-button" v-if="bussinessType==2">
<button class="uni-grey-button" @click="toSave">暂存</button>
<button class="uni-blue-button" @click="toSubmit">提交</button>
</view>
<view class="uni-group-button" v-if="bussinessType==3">
<button class="uni-grey-button" @click="toSave">暂存</button>
<button class="uni-blue-button" @click="toNext">下一步</button>
</view>
<view class="model-view" :style="showModal?'':'display:none;'">
<view class="model-out-box">
<view class="text-black-normal">提示</view>
<view class="model-content">
<image src="../../static/successful.png" style="width: 100rpx;height: 100rpx;"></image>
</view>
<view class="text-black-normal" style="margin-bottom: 32rpx;">提交成功</view>
<view style="display: flex;flex-direction: row;width: 100%;">
<view class="btn-dialog-grey" @click="cancel">取消</view>
<view class="btn-dialog-blue" @click="toDetail">查看表单</view>
</view>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
bussinessType: 2,
projectId: "",
checkTplId: "5fe1a6c8b66600001e003117",
checkModuleId: "8h9048q3dolkegrr1jkc86b89j",
objNo: "",
form: {},
itemList: [],
showModal: false,
is_tmp: 0,
check_record_id: ""
}
},
onLoad: function(option) {
this.objNo = option.obj_no
this.checkTplId = option.check_tpl_id
this.checkModuleId = option.check_module_id
this.bussinessType = option.bussness_type
this.projectId = option.project_id
this.getFormList()
},
onShow: function() {
//选择控件页面跳转返回
uni.$once("change", res => {
console.log("单复选变化", index + "-----" + JSON.parse(res.selected));
let index = parseInt(res.index)
this.itemList[index].real_value = JSON.parse(res.selected)
this.$set(this.itemList, index, this.itemList[index])
})
//计分控件页面跳转返回
uni.$once("computeResult", res => {
let index = parseInt(res.index)
this.itemList[index] = JSON.parse(res.form)
this.$set(this.itemList, index, this.itemList[index])
})
//组合控件页面跳帧返回
uni.$once("groupEdit", res => {
let index = parseInt(res.index)
let childIndex = parseInt(res.childIndex)
this.itemList[index].control_children[childIndex] = JSON.parse(res.children)
this.$set(this.itemList, index, this.itemList[index])
console.log(this.itemList[index]);
})
//层级控件页面跳转返回
uni.$once("levelSelect", res => {
let index = parseInt(res.index)
this.itemList[index].real_value = JSON.parse(res.selects)
this.$set(this.itemList, index, this.itemList[index])
console.log(this.itemList[index]);
})
uni.$once("getCustomData", res => {
let index = parseInt(res.index)
let value = res.value
let item = this.itemList[index]
item.real_value = [value]
this.$set(this.itemList, index, item)
})
},
onReady: function() {
uni.hideKeyboard();
},
methods: {
inputFinish: function(e) {
let index = parseInt(e.index)
let value = e.value
let item = this.itemList[index]
item.real_value = [value]
this.$set(this.itemList, index, item)
},
weatherChange: function(index, value) {
this.itemList[index].real_value = value
},
signChange: function(index, url) {
let item = this.itemList[index]
item.real_value = [url]
this.$set(this.itemList, index, item)
},
groupChange: function(index, children) {
this.itemList[index].control_children = children
},
//单文本值变化
inputChange: function(index, values) {
console.log("单文本值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
locationChange: function(index, value) {
this.itemList[index].real_value = []
this.itemList[index].real_value.push(value)
},
textareaChange: function(index, values) {
console.log("多行文本值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
numberChange: function(index, values) {
console.log("数字框值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
timeChange: function(index, values) {
console.log("时间选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
labelChange: function(index, values) {
console.log("标签选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
selectChange: function(index, values) {
console.log("下拉选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
fileChange: function(index, values) {
console.log("图片附件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
audioChange: function(index, values) {
console.log("录音文件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
getFormList: function() {
let _this = this
this.$http.get({
url: "/api/v1/common_check/check_record/form_detail_list",
data: {
"obj_no": this.objNo
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("表单详情", result);
if (result.code == 0) {
_this.form = result.data.list[0]
_this.itemList = _this.form.content_detail
uni.setNavigationBarTitle({
title: _this.form.check_item_name
})
} else {
_this.showFail(result.msg)
}
})
},
showFail: function(text) {
uni.showToast({
title: text,
icon: 'none'
})
},
dealData: function(data) {
// 独立模式是一个工单
if (data.length > 0) {
this.form = data[0]
this.itemList = this.form.content_detail
}
},
toClose: function() {
uni.navigateBack({
delta: 1
})
},
checkNull: function() {
let canSubmit = true
for (var i = 0; i < this.itemList.length; i++) {
let item = this.itemList[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (item.control_type == 26) {
console.log(item);
let b = false
for (var k = 0; k < item.control_children.length; k++) {
if (item.control_children[k].status && item.control_children[k].status == "已填写") {
b = true
break
}
}
console.log(b);
if (!b) {
canSubmit = false
break
}
} else {
if (!values || values.length == 0) {
canSubmit = false
break
}
}
}
}
return canSubmit
},
checkChildNull: function(list) {
let canSubmit = true
for (var i = 0; i < list.length; i++) {
let item = list[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (!values || values.length == 0) {
canSubmit = false
break
}
} else {
continue
}
}
return canSubmit
},
toSave: function() {
let that = this
setTimeout(function() {
console.log("暂存的内容", that.itemList);
that.form.content_detail = that.itemList
that.form.project_id = that.projectId
that.form.obj_no = that.objNo
that.form.check_module_id = that.checkModuleId
that.form.is_tmp = 1
if (!that.form._id || that.form._id == '') {
that.form.check_record_id = that.check_record_id
} else {
that.form.check_record_id = that.form._id
}
that.$http.post({
url: "/api/v1/common_check/check_record/save",
data: that.form,
header: {
"access_token": that.getToken()
}
}).then((res) => {
console.log("暂存成功", res.data);
let result = res.data
if (result.code == 0) {
that.objNo = result.data.obj_no
that.check_record_id = result.data.check_record_id
uni.$emit("refresh")
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, 1000)
})
},
toSubmit: function() {
let that = this
setTimeout(function() {
console.log("提交的内容", that.itemList);
if (!that.checkNull()) {
uni.showToast({
title: "*必填项未填写",
icon: 'none'
})
return
}
that.form.content_detail = that.itemList
that.form.project_id = that.projectId
that.form.obj_no = that.objNo
that.form.is_tmp = 0
that.form.check_module_id = that.checkModuleId
that.$http.post({
url: "/api/v1/common_check/check_record/save",
data: that.form,
header: {
"access_token": that.getToken()
}
}).then((res) => {
console.log("提交成功", res.data);
let result = res.data
if (result.code == 0) {
that.objNo = result.data.obj_no
that.showSuccess()
uni.$emit("refresh")
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
}, 1000)
})
},
toNext: function() {
let that = this
setTimeout(function() {
if (!that.checkNull()) {
uni.showToast({
title: "*必填项未填写",
icon: 'none'
})
return
}
that.form.content_detail = that.itemList
that.form.project_id = that.projectId
that.form.obj_no = that.objNo
console.log("提交的内容", that.form);
uni.setStorageSync(that.form.check_item_id, JSON.stringify(that.form))
uni.navigateTo({
url: `/pages/gallery/nextProcessPage/nextProcessPage?check_tpl_id=${that.checkTplId}&project_id=${that.projectId}&formId=${that.form.check_item_id}`
})
}, 500)
},
showSuccess: function() {
this.showModal = true
},
cancel: function() {
this.showModal = false
uni.navigateBack({
delta: 1
})
},
toDetail: function() {
uni.navigateBack({
delta: 1
})
uni.navigateTo({
url: `/pages/gallery/formDetailPage/formDetailPage?obj_no=${this.objNo}`
})
},
computeClick: function(index) {
let form = JSON.stringify(this.itemList[index])
uni.navigateTo({
url: `/pages/gallery/computePage/computePage?form=${form}&index=${index}`
})
},
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.add-form-parent {
display: flex;
flex-direction: column;
margin-top: 32rpx;
}
.add-form-item-list {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
padding-left: 10rpx;
}
.model-view {
position: fixed;
top: 0;
z-index: 999;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
background-color: rgba(0, 0, 0, 0.4);
}
.model-out-box {
width: 600rpx;
height: 400rpx;
background-color: #FFFFFF;
border-radius: 20rpx;
margin-top: 45%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 32rpx 0 0 0;
align-items: center;
}
.model-content {
width: 400rpx;
height: 200rpx;
border-radius: 10rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.btn-dialog-grey {
display: flex;
flex: 1;
height: 100rpx;
font-size: 32rpx;
color: #333333;
align-items: center;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
border-right: 2rpx solid rgba(0, 0, 0, 0.1);
justify-content: center;
}
.btn-dialog-blue {
display: flex;
flex: 1;
height: 100rpx;
font-size: 32rpx;
color: #1890FF;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
align-items: center;
justify-content: center;
}
</style>
<template>
<view style="display: flex;flex-direction: column;padding: 32rpx;background-color: #FFFFFF;">
<view v-for="(item,index) in mRecords" :key="index"
style="margin: 20rpx 0;display: flex;flex-direction: column;">
<text class="text-black-normal">{{item.user_name}}</text>
<text class="text-black-normal" style="margin-top: 20rpx;">{{item.edit_at}}</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
obj_no: "",
check_record_id: "",
mRecords: []
}
},
onLoad: function(options) {
this.obj_no = options.obj_no
console.log("检查对象编码", this.obj_no);
this.getFormDetail()
},
methods: {
getFormDetail: function() {
this.$http.get({
url: "/api/v1/common_check/check_record/form_detail_list",
data: {
"obj_no": this.obj_no
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("表单详情", result);
if (result.code == 0) {
this.check_record_id = result.data.list[0].check_record_id
uni.setNavigationBarTitle({
title: result.data.list[0].check_item_name
})
this.getRecordDetail()
} else {
this.showFail(result.msg)
}
})
},
getRecordDetail: function() {
this.$http.post({
url: "/api/v1/common_check/check_record/get_editors",
data: {
ids: [{
"id": this.check_record_id
}]
},
header: {
access_token: this.getToken()
}
}).then((res) => {
let result = res.data
console.log("修改人记录", result);
if (result.code == 0) {
this.mRecords = result.data[0].editors
} else {
this.$toast.showToast(result.msg)
}
})
}
}
}
</script>
<style>
</style>
<template>
<view>
<view style="position: sticky;left: 0;top: 0;z-index: 9999;">
<view class="search-form-parent">
<view class="search-form">
<image src="../../../../static/search-icon.png" style="width: 40rpx;height: 40rpx;"></image>
<input placeholder="搜索" placeholder-class="search-placeholder" class="search-input" v-model="key"
@input="search" />
</view>
<view style="display: flex;flex-direction: row;align-items: center;" @click="toQrcode"
v-if="businessType==2">
<image src="../../../../static/qrcode-white.png" class="qrcode-style"></image>
</view>
<view style="color: #FFFFFF;font-size: 32rpx;margin-left: 20rpx;" @click="selectItem">
{{isSelectState?'取消':'选择'}}
</view>
<picker @change="statusSelect" :range="statusList" range-key="status_name" v-if="businessType==3">
<label>
<text style="color: #FFFFFF;font-size: 32rpx;margin-left: 20rpx;">筛选</text>
</label>
</picker>
</view>
<picker @change="projectSelected" :range="projectNames">
<label>
<view class="form-select-project">
<text>{{projectSelect}}</text>
<image src="../../../../static/icon_down_select.png"></image>
</view>
</label>
</picker>
<view v-if="businessType==3">
<v-tabs v-model="tabIndex" :tabs="tabList" @change="changeTab" :scroll="false" :lineHeight="5+'rpx'"
:fixed="true"></v-tabs>
</view>
</view>
<view style="padding-top: 20rpx;" v-if="showCfg.show_type==1">
<view v-for="(item,index) in formList" :key="index" class="list-card-item">
<view
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view class="item-time-creater-text">
<view class="item-time-text">{{item.end_opt_time}}</view>
<view class="item-creater-text" v-if="item.created_by_job">
{{item.created_by_name}}({{item.created_by_job}})
</view>
<view class="item-creater-text" v-else>{{item.created_by_name}}</view>
</view>
<!-- <view class="list-card-v-title">{{item.show_obj_name}}</view> -->
<!-- show_obj_list -->
<view v-for="(obj,objIndex) in item.show_obj_list" :key="objIndex"
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="obj.is_show==1" @click="selectClick(item,index)">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="isImage(obj)">
<view v-for="(image,imageIndex) in dealValue(obj.real_value)" :key="imageIndex">
<image :src="image" style="width: 680rpx;height: 160rpx;"></image>
</view>
</view>
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-else-if="isValueEmpty(obj)">
<view class="text-black-normal">
{{obj.show_obj_name}}:
</view>
<view class="text-black">
{{obj.real_value}}
</view>
</view>
</view>
</view>
<view class="line-grey" style="margin-top: 20rpx;"></view>
<view class="item-status-btn-text">
<image
:src="item.isSelected?'../../../../static/cb-big-sel.png':'../../../../static/cb-big.png'"
style="width: 36rpx;height: 36rpx;margin-right: 5px;" @click="selectClick(item,index)"
v-if="isSelectState"></image>
<view class="item-status-text" v-if="item.is_tmp==1">未提交</view>
<view class="item-status-text" v-else>{{item.status_name}}</view>
<view style="color: #999999;font-size: 24rpx;">{{item.remain_time}}</view>
<view style="display: flex;flex-direction: row;" v-if="item.is_tmp==1">
<view class="item-edit-text" @click="toEdit('normal',index)">编辑</view>
<view class="item-delete-text" @click="toDelete('normal',index)" v-if="canDelete(item)">删除
</view>
</view>
<view style="display: flex;flex-direction: row;" v-else>
<view class="item-edit-text" @click="toEditDetail('normal',index)"
v-if="businessType==2&&isModelEdit==1">详情</view>
<view class="item-edit-text" @click="toDetail('normal',index)"
v-if="businessType==2&&isModelEdit==1">查看
</view>
<view class="item-edit-text" @click="toEdit('normal',index)" v-if="canEdit(item)">编辑</view>
<view class="item-edit-text" @click="toDetail('normal',index)" v-else>查看</view>
<view class="item-delete-text" @click="toDelete('normal',index)"
v-if="canDelete(item)&&item.node_type<999&&businessType==3">删除</view>
</view>
<button class="share-button" open-type="share"
:id="item.obj_no+','+item.project_id+','+item.check_module_id">分享</button>
</view>
</view>
</view>
</view>
<!-- 瀑布流 -->
<view style="padding-top: 20rpx;display: flex;flex-direction: row;" v-if="showCfg.show_type==2">
<view style="display: flex;flex-direction: column;flex: 1;margin-left: 20rpx;">
<view v-for="(item,index) in leftList" :key="index"
:class="index==0?'water-list-item-first':'water-list-item'">
<view
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view style="display: flex;flex-direction: column;padding: 20rpx 0;">
<view class="item-time-text">{{item.end_opt_time}}</view>
<view class="item-creater-text" style="margin-top: 20rpx;" v-if="item.created_by_job">
{{item.created_by_name}}({{item.created_by_job}})
</view>
<view class="item-creater-text" v-else>{{item.created_by_name}}</view>
</view>
<!-- <view class="list-card-v-title">{{item.show_obj_name}}</view> -->
<!-- show_obj_list -->
<view v-for="(obj,objIndex) in item.show_obj_list" :key="objIndex"
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="obj.is_show==1" @click="selectClick(item,index)">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="isImage(obj)">
<view v-for="(image,imageIndex) in dealValue(obj.real_value)" :key="imageIndex">
<image :src="image" style="width: 280rpx;height: 160rpx;" mode="scaleToFill">
</image>
</view>
</view>
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-else-if="isValueEmpty(obj)">
<view class="text-black-normal">
{{obj.show_obj_name}}:
</view>
<view class="text-black">
{{obj.real_value}}
</view>
</view>
</view>
</view>
<view class="line-grey" style="margin-top: 20rpx;"></view>
<view style="display: flex;flex-direction: row;">
<image
:src="item.isSelected?'../../../../static/cb-big-sel.png':'../../../../static/cb-big.png'"
style="width: 36rpx;height: 36rpx;margin-right: 5px;" @click="selectClick(item,index)"
v-if="isSelectState"></image>
<view class="item-status-text" v-if="item.is_tmp==1">未提交</view>
<view class="item-status-text" v-else>{{item.status_name}}</view>
</view>
<view style="color: #999999;font-size: 24rpx;">{{item.remain_time}}</view>
<view class="item-status-btn-text">
<view style="display: flex;flex-direction: row;" v-if="item.is_tmp==1">
<view class="item-edit-text" @click="toEdit('left',index)">编辑</view>
<view class="item-delete-text" @click="toDelete('left',index)" v-if="canDelete(item)">删除
</view>
</view>
<view style="display: flex;flex-direction: row;" v-else>
<view class="item-edit-text" @click="toEditDetail('left',index)"
v-if="businessType==2&&isModelEdit==1">详情</view>
<view class="item-edit-text" @click="toDetail('left',index)"
v-if="businessType==2&&isModelEdit==1">查看
</view>
<view class="item-edit-text" @click="toEdit('left',index)" v-if="canEdit(item)">编辑
</view>
<view class="item-edit-text" @click="toDetail('left',index)" v-else>查看</view>
<view class="item-delete-text" @click="toDelete('left',index)"
v-if="canDelete(item)&&item.node_type<999&&businessType==3">删除</view>
</view>
</view>
<button class="share-button" open-type="share"
:id="item.obj_no+','+item.project_id+','+item.check_module_id">分享</button>
</view>
</view>
</view>
<view style="display: flex;flex-direction: column;flex: 1;margin: 0 20rpx;">
<view v-for="(item,index) in rightList" :key="index" class="water-list-item">
<view
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view style="display: flex;flex-direction: column;padding: 20rpx 0;">
<view class="item-time-text">{{item.end_opt_time}}</view>
<view class="item-creater-text" style="margin-top: 20rpx;" v-if="item.created_by_job">
{{item.created_by_name}}({{item.created_by_job}})
</view>
<view class="item-creater-text" v-else>{{item.created_by_name}}</view>
</view>
<!-- <view class="list-card-v-title">{{item.show_obj_name}}</view> -->
<!-- show_obj_list -->
<view v-for="(obj,objIndex) in item.show_obj_list" :key="objIndex"
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="obj.is_show==1" @click="selectClick(item,index)">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="isImage(obj)">
<view v-for="(image,imageIndex) in dealValue(obj.real_value)" :key="imageIndex">
<image :src="image" style="width: 280rpx;height: 160rpx;" mode="scaleToFill">
</image>
</view>
</view>
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-else-if="isValueEmpty(obj)">
<view class="text-black-normal">
{{obj.show_obj_name}}:
</view>
<view class="text-black">
{{obj.real_value}}
</view>
</view>
</view>
</view>
<view class="line-grey" style="margin-top: 20rpx;"></view>
<view style="display: flex;flex-direction: row;">
<image
:src="item.isSelected?'../../../../static/cb-big-sel.png':'../../../../static/cb-big.png'"
style="width: 36rpx;height: 36rpx;margin-right: 5px;" @click="selectClick(item,index)"
v-if="isSelectState"></image>
<view class="item-status-text" v-if="item.is_tmp==1">未提交</view>
<view class="item-status-text" v-else>{{item.status_name}}</view>
</view>
<view style="color: #999999;font-size: 24rpx;">{{item.remain_time}}</view>
<view class="item-status-btn-text">
<view style="display: flex;flex-direction: row;" v-if="item.is_tmp==1">
<view class="item-edit-text" @click="toEdit('right',index)">编辑</view>
<view class="item-delete-text" @click="toDelete('right',index)" v-if="canDelete(item)">
删除</view>
</view>
<view style="display: flex;flex-direction: row;" v-else>
<view class="item-edit-text" @click="toEditDetail('right',index)"
v-if="businessType==2&&isModelEdit==1">详情</view>
<view class="item-edit-text" @click="toDetail('right',index)"
v-if="businessType==2&&isModelEdit==1">查看
</view>
<view class="item-edit-text" @click="toEdit('right',index)" v-if="canEdit(item)">编辑
</view>
<view class="item-edit-text" @click="toDetail('right',index)" v-else>查看</view>
<view class="item-delete-text" @click="toDelete('right',index)"
v-if="canDelete(item)&&item.node_type<999&&businessType==3">删除</view>
</view>
<button class="share-button" open-type="share"
:id="item.obj_no+','+item.project_id+','+item.check_module_id">分享</button>
</view>
</view>
</view>
</view>
</view>
<!-- 可收缩列表 -->
<view style="padding-top: 20rpx;display: flex;flex-direction: column;" v-if="showCfg.show_type==3">
<view v-for="(item,index) in formList" :key="index" class="list-card-item">
<view class="item-time-creater-text" @click="itemExpand(index)">
<view class="item-time-text">{{item.end_opt_time}}</view>
<view class="item-creater-text" v-if="item.created_by_job">
{{item.created_by_name}}({{item.created_by_job}})
</view>
<view class="item-creater-text" v-else>{{item.created_by_name}}</view>
<image src="../../../../static/icon_drop_arrow.png"
style="width: 32rpx;height: 16rpx;margin-left: 20rpx;"></image>
</view>
<view class="list-card-v-title" v-if="isImageShow(item)" style="margin-bottom: 20rpx;">
{{item.show_obj_list[0].show_obj_name}}:{{item.show_obj_list[0].real_value}}
</view>
<view
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'"
v-if="item.isExpand">
<!-- show_obj_list -->
<view v-for="(obj,objIndex) in item.show_obj_list" :key="objIndex"
:class="showCfg.align_type=='left'?'item-content-left':showCfg.align_type=='middle'?'item-content-center':'item-content-right'">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="obj.is_show==1&&objIndex!=0" @click="selectClick(item,index)">
<view
:class="showCfg.align_type=='left'?'obj-list-item-left':showCfg.align_type=='middle'?'obj-list-item-center':'obj-list-item-right'"
v-if="isValueEmpty(obj)&&!isImage(obj)">
<view class="text-black-normal">
{{obj.show_obj_name}}:
</view>
<view class="text-black">
{{obj.real_value}}
</view>
</view>
</view>
</view>
<view class="line-grey" style="margin-top: 20rpx;"></view>
<view class="item-status-btn-text">
<image
:src="item.isSelected?'../../../../static/cb-big-sel.png':'../../../../static/cb-big.png'"
style="width: 36rpx;height: 36rpx;margin-right: 5px;" @click="selectClick(item,index)"
v-if="isSelectState"></image>
<view class="item-status-text" v-if="item.is_tmp==1">未提交</view>
<view class="item-status-text" v-else>{{item.status_name}}</view>
<view style="color: #999999;font-size: 24rpx;">{{item.remain_time}}</view>
<view style="display: flex;flex-direction: row;" v-if="item.is_tmp==1">
<view class="item-edit-text" @click="toEdit('normal',index)">编辑</view>
<view class="item-delete-text" @click="toDelete('normal',index)" v-if="canDelete(item)">删除
</view>
</view>
<view style="display: flex;flex-direction: row;" v-else>
<view class="item-edit-text" @click="toEditDetail('normal',index)"
v-if="businessType==2&&isModelEdit==1">详情</view>
<view class="item-edit-text" @click="toDetail('normal',index)"
v-if="businessType==2&&isModelEdit==1">查看
</view>
<view class="item-edit-text" @click="toEdit('normal',index)" v-if="canEdit(item)">编辑</view>
<view class="item-edit-text" @click="toDetail('normal',index)" v-else>查看</view>
<view class="item-delete-text" @click="toDelete('normal',index)"
v-if="canDelete(item)&&item.node_type<999&&businessType==3">删除</view>
</view>
<button class="share-button" open-type="share"
:id="item.obj_no+','+item.project_id+','+item.check_module_id">分享</button>
</view>
</view>
</view>
</view>
<view style="height: 144rpx;" v-if="isSelectState"></view>
<view class="uni-group-button" v-if="isSelectState">
<view
style="width: 500rpx;border: 2rpx solid #E5E5E5;height: 80rpx;align-items: center;justify-content: center;display: flex;margin-left: 32rpx;border-radius: 10rpx;">
已选择{{selectItems.length}}条记录</view>
<image src="../../../../static/ic_rubbish.png" style="width: 48rpx;height: 48rpx;margin-left: 32rpx;"
@click="onDelete"></image>
</view>
<uni-fab horizontal="right" vertical="bottom" text="新增" @fabClick="add" :popMenu=popMenu :pattern="pattern"
v-if="!isSelectState">
</uni-fab>
</view>
</template>
<script>
export default {
data() {
return {
leftList: [],
rightList: [],
formList: [],
pattern: {
color: '#7A7E83',
backgroundColor: '#fff',
selectedColor: '#007AFF',
buttonColor: '#007AFF'
},
popMenu: false,
//项目
projectList: [],
projectNames: [],
projectSelect: "",
projectId: "",
//状态属性
statusList: [],
key: "",
businessType: "2",
appId: "",
checkModuleId: "",
nodeNo: "",
//分页属性
page: 1,
pageSize: 20,
isPage: 1,
totalPage: 1,
title: "",
tabList: ["全部", "待办"],
tabIndex: 0,
is_assign: 0,
isModelEdit: 0,
showCfg: {
"show_type": "1", //布局样式,1:卡片式,2:瀑布流,3:list列表
"search_obj_id": "", //搜索条件字段对应id,同show_obj_list中show_obj一致
"order_field": "check_record_id", //排序字段
"order_type": "desc", //排序类型,可选参数【'asc','desc'】
"align_type": "left" //对齐方式,可选参数:【'left','middle','right'】=》【'左对齐', '居中对齐', '右对齐'】
},
isSelectState: false, //是否选择状态
selectItems: [] //选中记录的recordId
}
},
onLoad: function(option) {
this.showCfg = JSON.parse(option.showCfg)
console.log("列表类型", JSON.stringify(this.showCfg));
this.businessType = option.business_type
this.checkModuleId = option.check_module_id
this.appId = option.check_tpl_id
this.isModelEdit = option.is_edit
this.loadProject()
if (this.businessType == 3) {
this.getStatusList()
}
this.title = option.title
uni.setNavigationBarTitle({
title: option.title
})
},
onShow: function() {
uni.$once("refresh", res => {
this.getFormList()
})
},
onPullDownRefresh: function() {
this.page = 1
this.nodeNo = ""
this.getFormList()
},
onReachBottom: function() {
if (this.page < this.totalPage) {
this.page++
this.getFormList()
}
},
onShareAppMessage(res) {
console.log(res);
let id = res.target.id
return {
title: '',
path: `pages/index/index?page=edit&obj_no=${id}`
}
},
methods: {
onDelete() {
if (this.selectItems.length == 0) {
this.$toast.showToast("请选择需删除的记录")
return
}
let _this = this
uni.showModal({
title: '提示',
content: '确定要删除选择表单?',
showCancel: true,
confirmText: "删除",
confirmColor: '#FF0000',
success: res => {
if (res.confirm) {
_this.deleteItems()
}
}
})
},
deleteItems() {
let objNos = ""
this.selectItems.forEach((item) => {
objNos += `${item},`
})
this.$http.delete({
url: "/api/v1/common_check/check_record/batch_delete",
data: {
obj_no: objNos
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
if (result.code == 0) {
this.page = 1
this.nodeNo = ""
this.selectItems = []
this.getFormList()
} else {
this.$toast.showToast(result.msg)
}
})
},
selectClick(item, index) {
let selected = this.selectItems.indexOf(item.obj_no)
if (selected != -1) {
this.selectItems.splice(selected, 1)
item.isSelected = false
} else {
this.selectItems.push(item.obj_no)
item.isSelected = true
}
this.$set(this.formList, index, item)
},
selectItem() {
this.isSelectState = !this.isSelectState
},
isImageShow: function(form) {
return form.show_obj_list.length > 0 && form.show_obj_list[0].control_type != 22
},
dealValue: function(value) {
let values = []
if (value.indexOf(",") != -1) {
values = value.split(",")
} else {
values.push(value)
}
return values
},
isValueEmpty: function(obj) {
return obj.real_value && obj.real_value != null && obj.real_value != ""
},
isImage: function(obj) {
return obj.control_type == 22 && obj.real_value && obj.real_value != null && obj.real_value != "" &&
obj.real_value.indexOf("http") != -1
},
itemExpand: function(index) {
let form = this.formList[index]
form.isExpand = !form.isExpand
this.$set(this.formList, index, form)
},
changeTab: function(index) {
if (this.tabIndex !== index) {
this.tabIndex = index
this.is_assign = this.tabIndex
this.getFormList()
}
},
search: function() {
this.getFormList()
},
add: function() {
if (this.businessType == 4) {
uni.navigateTo({
url: `/pages/gallery/app/addBusinessData/addBusinessData?check_tpl_id=${this.appId}&check_module_id=${this.checkModuleId}&bussness_type=${this.businessType}&project_id=${this.projectId}&title=${this.title}`
})
return
}
uni.navigateTo({
url: `/pages/gallery/app/addForm/addForm?check_tpl_id=${this.appId}&check_module_id=${this.checkModuleId}&bussness_type=${this.businessType}&project_id=${this.projectId}&title=${this.title}`
})
},
toQrcode: function() {
uni.navigateTo({
url: `/pages/gallery/app/qrcodeList/qrcodeList?check_tpl_id=${this.appId}&check_module_id=${this.checkModuleId}&project_id=${this.projectId}&title=${this.title}`
})
},
statusSelect: function(e) {
console.log(e);
this.page = 1
let index = parseInt(e.detail.value)
this.nodeNo = this.statusList[index].node_no
this.getFormList()
},
projectSelected: function(e) {
console.log(e);
let index = parseInt(e.detail.value)
this.page = 1
this.projectSelect = this.projectList[index].project_name
this.projectId = this.projectList[index].project_id
this.getFormList()
},
toEdit: function(type, index) {
let form = {}
if (type == "left") {
form = this.leftList[index]
} else if (type == "right") {
form = this.rightList[index]
} else {
form = this.formList[index]
}
if (this.businessType == 2) {
uni.navigateTo({
url: `/pages/gallery/app/editAloneForm/editAloneForm?obj_no=${form.obj_no}&project_id=${this.projectId}&check_module_id=${form.check_module_id}`
})
} else if (this.businessType == 3 || this.businessType == 4) {
uni.navigateTo({
url: `/pages/gallery/processFormDetailPage/processFormDetailPage?obj_no=${form.obj_no}&check_module_id=${form.check_module_id}&check_tpl_id=${this.appId}&project_id=${this.projectId}&title=${this.title}&is_edit=1&status=${form.status_name}`
})
}
},
toEditDetail: function(type, index) {
let form = {}
if (type == "left") {
form = this.leftList[index]
} else if (type == "right") {
form = this.rightList[index]
} else {
form = this.formList[index]
}
uni.navigateTo({
url: `/pages/gallery/app/editRecordDetail/editRecordDetail?obj_no=${form.obj_no}`
})
},
toDelete: function(type, index) {
uni.showModal({
title: '提示',
content: '确定删除该内容?',
showCancel: true,
confirmText: "删除",
confirmColor: '#D1372C',
success: (res) => {
if (res.confirm) {
this.deleteItem(type, index)
}
}
})
},
deleteItem: function(type, index) {
let form = {}
if (type == "left") {
form = this.leftList[index]
} else if (type == "right") {
form = this.rightList[index]
} else {
form = this.formList[index]
}
this.$http.deleteRequest({
url: "/api/v1/common_check/check_object/delete",
data: {
"obj_no": form.obj_no
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
this.formList.splice(index, 1)
uni.showToast({
title: "删除成功",
icon: 'none'
})
})
},
toDetail: function(type, index) {
let form = {}
if (type == "left") {
form = this.leftList[index]
} else if (type == "right") {
form = this.rightList[index]
} else {
form = this.formList[index]
}
if (this.businessType == 2) {
uni.navigateTo({
url: `/pages/gallery/formDetailPage/formDetailPage?obj_no=${form.obj_no}`
})
} else if (this.businessType == 3 || this.businessType == 4) {
//判断是否可编辑 未结束前的执行人可编辑
let isEdit = this.canEdit(form)
uni.navigateTo({
url: `/pages/gallery/processFormDetailPage/processFormDetailPage?obj_no=${form.obj_no}&check_module_id=${form.check_module_id}&check_tpl_id=${this.appId}&project_id=${this.projectId}&title=${this.title}&is_edit=${isEdit?1:0}&status=${form.status_name}`
})
}
},
canDelete: function(form) {
let userInfo = uni.getStorageSync("user_info")
let userId = userInfo.user_id
return userId == form.created_by_id
},
canEdit: function(form) {
let isEdit = true
if (this.businessType == 2) { //独立模式无脑可编辑
return this.isModelEdit == 1
} else {
if (this.is_assign != 1) {
let isDo = false
let userInfo = uni.getStorageSync("user_info")
let userId = userInfo.user_id
let executors = form.cur_executors
for (var i = 0; i < executors.length; i++) {
if (executors[i].user_id == userId) { //是当前用户
isDo = true
}
}
if (form.node_type == 999) { //已结束
isEdit = false
} else {
if (isDo) {
isEdit = true
} else {
isEdit = false
}
}
console.log(isDo);
}
}
return isEdit
},
getFormList: function() {
this.$http.get({
url: "/api/v1/common_check/check_object/form_list",
data: {
"project_id": this.projectId,
"business_type": this.businessType,
"check_tpl_id": this.appId,
"search_word": this.key,
"check_module_id": this.checkModuleId,
"is_page": this.isPage,
"page": this.page,
"page_size": this.pageSize,
"node_no": this.nodeNo,
"is_assign": this.is_assign
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
uni.stopPullDownRefresh()
console.log("表单列表", res.data.data);
this.totalPage = res.data.data.total_page
//过滤掉不是本人的暂存
if (this.showCfg.show_type == 1) {
if (this.page == 1) {
this.formList = res.data.data.list
} else {
for (var i = 0; i < res.data.data.list.length; i++) {
this.formList.push(res.data.data.list[i])
}
console.log("加载更多", this.formList);
}
} else if (this.showCfg.show_type == 2) {
if (this.page == 1) {
this.leftList = []
this.rightList = []
}
for (var i = 0; i < res.data.data.list.length; i++) {
let form = res.data.data.list[i]
console.log("i%2", i % 2);
if (i % 2 == 0) {
this.leftList.push(form)
} else {
this.rightList.push(form)
}
}
} else if (this.showCfg.show_type == 3) {
if (this.page == 1) {
this.formList = []
}
for (var i = 0; i < res.data.data.list.length; i++) {
let form = res.data.data.list[i]
form.isExpand = false
this.formList.push(form)
}
}
})
},
filterForm: function(list) {
let userInfo = uni.getStorageSync("user_info")
let userId = userInfo.user_id
let result = []
if (list && list.length > 0) {
for (var i = 0; i < list.length; i++) {
let isTmp = list[i].is_tmp
let createId = list[i].created_by_id
if (isTmp == 1 && userId != createId) {
} else {
result.push(list[i])
}
}
}
return result
},
getStatusList: function() {
this.$http.get({
url: "/web/v1/common_check/check_tpl/tpl_detail",
data: {
"check_tpl_id": this.appId
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("应用信息", res.data);
this.appInfo = res.data.data
this.statusList = res.data.data.tpl_config
this.statusList.push({
"node_no": "",
"status_name": "全部"
})
})
},
toLogin: function() {
// #ifdef MP-WEIXIN
uni.reLaunch({
url: "../wxlogin/wxlogin"
})
// #endif
// #ifndef MP-WEIXIN
uni.reLaunch({
url: "../login/login"
})
// #endif
},
loadProject: function() {
let that = this
this.$http.get({
url: "/api/v1/project/project_list",
data: {
is_all: 1
},
header: {
"access_token": this.getToken()
}
}).then(res => {
let result = res.data
console.log("项目列表:", result);
if (result.code === 0) {
that.projectList = result.data.list
if (that.projectList.length > 0) {
for (var i = 0; i < that.projectList.length; i++) {
that.projectNames[i] = that.projectList[i].project_name
}
that.projectSelect = that.projectList[0].project_name
that.projectId = that.projectList[0].project_id
that.getFormList()
}
} else {
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
if (result.action === 'Laravel_public_permission_fail') {
that.toLogin()
that.setToken("")
}
return
}
}
})
}
}
}
</script>
<style lang="scss">
page {
background-color: #F5F5F5;
}
.search-form-parent {
display: flex;
flex-direction: row;
align-items: center;
padding: 20rpx 32rpx;
background-color: #3B73FE;
}
.search-form {
display: flex;
flex-direction: row;
padding: 20rpx 32rpx;
flex: 1;
align-items: center;
background-color: #FFFFFF;
border-radius: 10rpx;
}
.search-input {
font-size: 32rpx;
color: #333333;
margin-left: 20rpx;
}
.search-placeholder {
font-size: 32rpx;
margin-left: 20rpx;
color: #999999;
}
.form-select-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;
}
}
.qrcode-style {
width: 60rpx;
height: 60rpx;
margin-left: 20rpx;
}
.list-card-item {
display: flex;
padding: 0rpx 32rpx;
background-color: #FFFFFF;
flex-direction: column;
margin-bottom: 20rpx;
}
.item-time-creater-text {
display: flex;
flex-direction: row;
padding: 20rpx 0;
align-items: center;
}
.item-time-creater-text-water {
display: flex;
flex-direction: row;
padding: 20rpx 0;
padding-top: 20rpx;
align-items: center;
}
.item-time-text {
flex: 1;
color: #999999;
font-size: 24rpx;
}
.item-creater-text {
color: #999999;
font-size: 24rpx;
}
.item-obj-text {
display: flex;
flex-wrap: wrap;
color: #333333;
font-size: 32rpx;
}
.item-status-btn-text {
display: flex;
width: 100%;
align-items: center;
justify-content: flex-end;
flex-direction: row;
padding: 20rpx 0;
}
// .item-status-btn-text {
// display: flex;
// justify-content: center;
// align-items: center;
// flex-wrap: wrap;
// flex-direction: row;
// padding: 20rpx 0;
// }
.item-status-btn-text-left {
display: flex;
justify-content: flex-start;
align-items: center;
flex-wrap: wrap;
flex-direction: row;
padding: 20rpx 0;
}
.item-status-btn-text-right {
display: flex;
justify-content: flex-end;
align-items: center;
flex-wrap: wrap;
flex-direction: row;
padding: 20rpx 0;
}
// .item-status-text {
// color: #999999;
// font-size: 24rpx;
// }
.item-status-text {
color: #999999;
flex: 1;
font-size: 24rpx;
}
.item-edit-text {
color: #1890FF;
font-size: 28rpx;
margin: 0rpx 32rpx;
}
.item-delete-text {
color: #D1372C;
font-size: 28rpx;
margin: 0rpx 32rpx;
}
.water-list-item-first {
display: flex;
padding: 20rpx 32rpx;
background-color: #FFFFFF;
flex-direction: column;
margin-bottom: 20rpx;
}
.water-list-item {
display: flex;
padding: 0rpx 32rpx;
background-color: #FFFFFF;
flex-direction: column;
margin-bottom: 20rpx;
}
.item-content-left {
display: flex;
flex-direction: column;
align-items: flex-start;
}
.item-content-center {
display: flex;
flex-direction: column;
align-items: center;
}
.item-content-right {
display: flex;
flex-direction: column;
align-items: flex-end;
}
.obj-list-item-left {
display: flex;
flex-direction: row;
margin-top: 10rpx;
flex-wrap: wrap;
align-items: center;
justify-content: flex-start;
}
.obj-list-item-center {
display: flex;
flex-direction: row;
margin-top: 10rpx;
flex-wrap: wrap;
align-items: center;
justify-content: center;
}
.obj-list-item-right {
display: flex;
flex-direction: row;
flex-wrap: wrap;
margin-top: 10rpx;
align-items: center;
justify-content: flex-end;
}
.share-button {
font-size: 14px;
color: #1890FF;
background-color: #fff;
border-radius: 0;
white-space: nowrap;
}
.share-button::after {
border: none;
}
</style>
<template>
<view style="margin-top: 32rpx;">
<view v-for="(item,index) in models" :key="index" class="model-item" @click="itemClick(index)">
<view class="model-item-title">
{{item.module_name}}
</view>
<image src="../../static/right-arrow-ic.png" style="width: 20rpx;height: 36rpx;"></image>
</view>
</view>
</template>
<script>
export default {
data() {
return {
appId: "",
models: [],
appInfo: {}
}
},
onLoad(option) {
this.appId = option.check_tpl_id
uni.setNavigationBarTitle({
title: option.title
})
this.getModelList()
},
methods: {
getModelList() {
this.$http.get({
url: "/web/v1/common_check/check_tpl/tpl_detail",
data: {
"check_tpl_id": this.appId
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("应用信息", res.data);
this.appInfo = res.data.data
this.models = res.data.data.tpl_config
})
},
itemClick(index) {
uni.navigateTo({
url: `/pages/gallery/app/modeFormList/modeFormList?business_type=${this.appInfo.business_type}&check_tpl_id=${this.appId}&check_module_id=${this.models[index].check_module_id}&title=${this.models[index].module_name}&is_edit=${this.models[index].is_edit}&showCfg=${JSON.stringify(this.models[index].show_cfg)}`
})
}
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.model-item {
display: flex;
flex-direction: row;
align-items: center;
background-color: #FFFFFF;
padding: 32rpx;
margin-bottom: 2rpx;
}
.model-item-title {
font-size: 32rpx;
color: #333333;
flex: 1;
}
</style>
<template>
<view class="process-form-parent">
<view style="display: flex;flex-direction: column;padding: 32rpx;">
<view class="executor-text">发起时间:{{forms[0].created_at}}</view>
<view class="executor-text">发起人:{{forms[0].created_by_name}}</view>
<view class="executor-text">目前状态:{{status}}</view>
<view class="executor-text">
目前执行人:{{forms[forms.length-1].executorStr}}
</view>
</view>
<view v-for="(form,n) in forms" :key="n" style="margin-bottom: 20rpx;">
<!-- 标题 灰背景 -->
<view class="detail-title">
<view style="display: flex;flex-direction: row;align-items: center;">
<text class="text-black-normal" style="flex: 1;">{{form.check_item_name}}</text>
<text class="text-blue-normal" v-if="form.business_type==4&&n==0&&isEditShow()"
@click="toEdit(n)">编辑</text>
<image :src="form.open?'../../static/icon_up_arrow.png':'../../static/icon_drop_arrow.png'"
style="width: 40rpx;height: 20rpx;margin-left: 40rpx;" @click="upOrDown(form)"></image>
</view>
<view class="executor-text" v-if="n!=0">
执行人:{{form.executorStr}}
</view>
<view class="executor-text" v-else>
发起人:{{form.created_by_name}}
</view>
</view>
<view v-for="(item,index) in form.content_detail" :key="index" v-if="form.open">
<view v-if="isEdit==1&&(n==forms.length-1)" class="edit-form-item-list">
<gi-input v-if="item.control_type==16" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="inputChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-input>
<gi-textarea v-if="item.control_type==17" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" @inputChange="textareaChange" :isCopy="item.is_copy"
:vals="item.real_value">
</gi-textarea>
<gi-number-input v-if="item.control_type==18" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg"
@inputChange="numberChange" :isCopy="item.is_copy" :vals="item.real_value">
</gi-number-input>
<gi-time-select v-if="item.control_type==19" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="timeChange"
:realValue="item.real_value">
</gi-time-select>
<gi-label-select v-if="item.control_type==20" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="labelChange"
:selected="item.real_value">
</gi-label-select>
<gi-select v-if="item.control_type==21" :title="item.content_name" :isMust="item.validate_type==1"
:project_id="project_id" :index="index" :config="item.control_cfg" @change="selectChange"
:selected="item.real_value">
</gi-select>
<gi-upload v-if="item.control_type==22&&item.control_cfg.up_type!=5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="fileChange"
:realValue="item.real_value">
</gi-upload>
<gi-record v-if="item.control_type==22&&item.control_cfg.up_type==5" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" :config="item.control_cfg" @change="audioChange"
:realValue="item.real_value" @addAudio="addAudio" :state="recordSate"></gi-record>
<gi-scan v-if="item.control_type==23" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" :isCopy="item.is_copy"></gi-scan>
<gi-note v-if="item.control_type==24" :item="item"></gi-note>
<gi-compute v-if="item.control_type==25" :title="item.content_name" :isMust="item.validate_type==1"
:index="index" :config="item.control_cfg" :form="item"></gi-compute>
<gi-component-group v-if="item.control_type==26" :index="index" :component="item"
@groupChange="groupChange"></gi-component-group>
<gi-location v-if="item.control_type==27" :config="item.control_cfg" :title="item.content_name"
:isMust="item.validate_type==1" :index="index" @change="locationChange"></gi-location>
<gi-select-user v-if="item.control_type==28" :title="item.content_name" :config="item.control_cfg"
:isMust="item.validate_type==1" :index="index" :projectId="project_id"
:realValue="item.real_value"></gi-select-user>
<!-- 数据可变控件 -->
<gi-common-value-variable v-if="item.control_type==29" :item="item" :index="index"
@inputChange="inputChangeVariable">
</gi-common-value-variable>
<!-- 数据不可变控件 -->
<gi-common-value-unvariable v-if="item.control_type==30" :item="item" :index="index">
</gi-common-value-unvariable>
<!-- 业务选择控件 -->
<gi-business-select v-if="item.control_type==31" :item="item" :index="index"
:project_id="project_id"></gi-business-select>
<gi-sign v-if="item.control_type==33" :item="item" :index="index" @signChange="signChange">
</gi-sign>
<gi-weather v-if="item.control_type==34" @change="weatherChange" :real_value="item.real_value"
:index="index">
</gi-weather>
<gi-signin v-if="item.control_type==35" :users="item.real_value" :record_id="form.check_record_id">
</gi-signin>
<gi-custom-data :item="item" v-if="item.control_type==36" :selectValue="item.real_value[0]"
:index="index">
</gi-custom-data>
</view>
<view class="form-detail-content" v-else>
<view class="form-detail-item" v-if="item.control_type==16">
<view class="normal-text-grey">{{item.content_name}}</view>
<view v-if="item.control_cfg.value_type==2" class="detail-text">
{{item.control_cfg.textVal}}
</view>
<view v-else>
<view v-for="(value,i) in item.real_value" :key="i" class="detail-text">
{{value||""}}
</view>
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item" v-if="item.control_type==17">
<view class="normal-text-grey">{{item.content_name}}</view>
<view v-if="item.control_cfg.value_type==2" class="detail-text">
{{item.control_cfg.textVal}}
</view>
<view v-else>
<view v-for="(value,i) in item.real_value" :key="i" class="detail-text">
{{value||""}}
</view>
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==18&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view v-for="(value,i) in item.real_value" :key="i" class="detail-text">
{{value||""}}
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==19&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view class="detail-text" v-if="item.control_cfg.date_type==1">
{{item.real_value[0]||""}}
</view>
<view class="detail-text" v-if="item.control_cfg.date_type==2">
{{item.real_value[0]||""}}——{{item.real_value[1]||""}}
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==30&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view class="detail-text">{{item.real_value[0]||""}}</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==29&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view class="detail-text">{{item.real_value[0].value||""}}</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==20&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view v-for="(value,i) in item.real_value" :key="i" class="detail-text">
<text class="text-black-normal">{{value.value}}</text>
<text class="text-black-normal" v-if="!(i==item.real_value.length-1)">,</text>
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==21&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view style="display: flex;flex-direction: row;">
<view v-for="(value,i) in item.real_value" :key="i" class="detail-text">
<text class="text-black-normal">{{value.value}}</text>
<text class="text-black-normal" v-if="!(i==item.real_value.length-1)">,</text>
</view>
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item"
v-if="item.control_type==22&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<uni-grid :column="4" v-if="item.control_cfg.up_type==2&&item.control_cfg.use_engin_cloud!=1">
<uni-grid-item v-for="(image,k) in item.real_value" :key="k" :index="k">
<image style="width: 144rpx;height: 144rpx;margin: 20rpx;" :src="image"
@click="imageClick(item,k)"></image>
</uni-grid-item>
</uni-grid>
<view style="display: flex;flex-direction: column;"
v-if="item.control_cfg.up_type==2&&item.control_cfg.use_engin_cloud==1">
<view style="display: flex;flex-direction: row;align-items: center;"
v-for="(image,k) in item.real_value" :key="k" :index="k">
<image style="width: 144rpx;height: 144rpx;margin: 20rpx;" :src="image"
@click="imageClick(item,k)"></image>
<view style="display: flex;flex-direction: row;align-items: center;margin-left: 32rpx;"
@click="toRzResult(item,k)"
v-if="item.control_cfg.up_type==2&&item.control_cfg.use_engin_cloud==1">
<view style="font-size: 28rpx;color: #1890ff;margin-left: 10rpx;">二级认证结果</view>
</view>
</view>
</view>
<view style="display: flex;flex-direction: column;padding: 32rpx 0 0 32rpx;"
v-if="item.control_cfg.up_type==1">
<view class="gi-upload-file-item" v-for="(file,k) in item.real_value" :key="k">
<image src="../../static/doc-icon.png" style="width: 80rpx;height: 80rpx;"></image>
<view class="gi-file-info-item" @click="fileClick(item,k)">
<text class="text-black-normal">{{file.name}}</text>
<text class="text-grey" style="margin-top: 10rpx;">{{file.size}}</text>
</view>
</view>
</view>
<uni-grid :column="4" v-if="item.control_cfg.up_type==4">
<uni-grid-item v-for="(video,k) in item.real_value" :key="k" :index="k">
<view class="uni-upload-image">
<view class="video-item" @click="videoItem(video)">
<image :src='video.url+"?x-oss-process=video/snapshot,t_700,w_600,h_600,m_fast"'
style="width: 144rpx;height: 144rpx;"></image>
</view>
</view>
</uni-grid-item>
</uni-grid>
<uni-grid :column="4" v-if="item.control_cfg.up_type==5">
<uni-grid-item v-for="(audio,k) in item.real_value" :key="k" :index="k">
<view class="uni-upload-image">
<view class="record-item" @click="playAudio(audio,k,index,n)">
<image :src="dealIcon(audio)" style="width: 48rpx;height: 48rpx;">
</image>
<view class="text-grey">{{audio.duration/1000}}s</view>
</view>
</view>
</uni-grid-item>
</uni-grid>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item" v-if="item.control_type==24">
<gi-note :item="item"></gi-note>
</view>
<gi-weather v-if="item.control_type==34" :real_value="item.real_value"></gi-weather>
<view class="form-detail-item"
v-if="item.control_type==25&&item.real_value&&item.real_value.length>0">
<view class="normal-text-grey">{{item.content_name}}</view>
<view style="display: flex;flex-direction: row;align-items: center;padding: 20rpx 0 0 0rpx;">
<view class="text-black-normal" style="flex: 1;">实得分数</view>
<view class="text-grey-black-normal">{{item.real_value[0].real_value}}</view>
</view>
<view class="margin-top-line"></view>
</view>
<detail-text-item :title="item.content_name" :content="item.real_value"
v-if="item.control_type==23||item.control_type==27" class="form-detail-item"></detail-text-item>
<gi-group-detail v-if="item.control_type==26" :item="item"></gi-group-detail>
<view class="form-detail-item" v-if="item.control_type==28">
<view class="normal-text-grey">{{item.content_name}}</view>
<view style="display: flex;flex-direction: row;flex-wrap: wrap;">
<view v-for="(value,i) in item.real_value" :key="i"
style="display: flex;flex-direction: row;">
<text class="text-black-normal">{{value.user_name}}</text>
<text class="text-black-normal" v-if="!(i==item.real_value.length-1)">,</text>
</view>
</view>
<view class="margin-top-line"></view>
</view>
<view class="form-detail-item" v-if="item.control_type==33">
<image style="height: 400rpx;width: 100%;" v-if="item.real_value&&item.real_value!=''"
:src="item.real_value"></image>
<view class="margin-top-line"></view>
</view>
<gi-signin v-if="item.control_type==35" :users="item.real_value" :record_id="form.check_record_id">
</gi-signin>
<view class="form-detail-item" v-if="item.control_type==36">
<view class="normal-text-grey">{{item.content_name}}</view>
<view class="detail-text">{{item.real_value[0]||""}}</view>
<view class="margin-top-line"></view>
</view>
</view>
</view>
</view>
<view style="height: 144rpx;" v-if="isEdit==1"></view>
<view class="uni-group-button" v-if="isEdit==1">
<button class="uni-grey-button" @click="toSave">暂存</button>
<button class="uni-blue-button" @click="toNext">下一步</button>
</view>
</view>
</template>
<script>
import uniCollapse from '@/components/uni-collapse/uni-collapse.vue'
import uniCollapseItem from '@/components/uni-collapse-item/uni-collapse-item.vue'
export default {
components: {
uniCollapse,
uniCollapseItem
},
data() {
return {
forms: [],
obj_no: "",
form: {},
itemList: [],
check_module_id: "",
check_tpl_id: "",
project_id: "",
node_no: "",
isEdit: 0,
status: "",
check_record_id: "",
curIndex: -1,
playIndex: -1,
isCheck: false
}
},
onLoad: function(option) {
this.status = option.status
this.obj_no = option.obj_no
this.check_module_id = option.check_module_id
this.check_tpl_id = option.check_tpl_id
this.project_id = option.project_id
this.node_no = option.node_no
this.isEdit = option.is_edit
this.isVis = option.is_edit
console.log(this.obj_no);
uni.setNavigationBarTitle({
title: option.title
})
let business_name = uni.getStorageSync("business_name")
this.isCheck = "焊口检查" == business_name
this.getFormList()
},
onShow: function() {
uni.$once("change", res => {
console.log("单复选变化", index + "-----" + JSON.parse(res.selected));
let index = parseInt(res.index)
this.itemList[index].real_value = JSON.parse(res.selected)
this.$set(this.itemList, index, this.itemList[index])
})
uni.$once("computeResult", res => {
let index = parseInt(res.index)
this.itemList[index] = JSON.parse(res.form)
this.$set(this.itemList, index, this.itemList[index])
})
uni.$once("groupEdit", res => {
let index = parseInt(res.index)
let childIndex = parseInt(res.childIndex)
this.itemList[index].control_children[childIndex] = JSON.parse(res.children)
this.$set(this.itemList, index, this.itemList[index])
console.log(this.itemList[index]);
})
//人员选择页面跳转返回
uni.$once("selectUser", res => {
let index = parseInt(res.index)
let type = parseInt(res.type)
if (type == 0) {
this.itemList[index].real_value = res.selected
this.$set(this.itemList, index, this.itemList[index])
console.log(this.itemList[index]);
}
})
uni.$once("refreshDetail", res => {
let data = uni.getStorageSync("params")
let result = JSON.parse(res)
let index = parseInt(result.index)
let form = JSON.parse(data)
this.$set(this.forms, index, form)
})
uni.$once("businessSelect", res => {
let params = JSON.parse(res)
let index = params.index
let itemList = params.itemList
let result = params.result
this.refreshBusinessData(result)
})
uni.$once("getCustomData", res => {
let index = parseInt(res.index)
let value = parseInt(res.value)
let item = this.itemList[index]
item.real_value = [value]
this.$set(this.itemList, index, item)
})
},
methods: {
toRzResult(item, index) {
var txtId = item.control_cfg.gcyRzResult[index].second
var channel = item.control_cfg.gcyRzResult[index].first
uni.navigateTo({
url: "/pages/cert-info-engin-documents/cert-info-engin-documents?id=" + txtId + "&channel=" +
channel
})
},
weatherChange: function(index, value) {
this.itemList[index].real_value = value
},
isEditShow: function() {
return this.isCheck && this.isEdit == 1
},
signChange: function(index, url) {
let item = this.itemList[index]
item.real_value = [url]
this.$set(this.itemList, index, item)
},
refreshBusinessData: function(result) {
//所有控件字段
let list = result.fields
if (list && list.length > 0) {
let items = []
for (var i = 0; i < this.itemList.length; i++) {
let item = this.itemList[i]
for (var j = 0; j < list.length; j++) {
let valueData = list[j]
if (item.real_field == valueData.field) {
if (item.control_type == 21 || item.control_type == 29) {
if (valueData.value != null) {
item.real_value = [{
"value": valueData.value
}]
}
} else { //时间还按之前的
if (valueData.value != null) {
item.real_value = [valueData.value]
}
}
}
}
items.push(item)
}
this.itemList = items
}
},
inputChangeVariable: function(value, index) {
this.itemList[index].real_value = value
},
fileClick: function(item, index) {
uni.downloadFile({
url: item.real_value[index].url,
success: (res) => {
if (res.statusCode === 200) {
uni.saveFile({
tempFilePath: res.tempFilePath, //临时路径
success: function(res) {
uni.showToast({
icon: 'none',
mask: true,
title: '文件已保存:' + res.savedFilePath, //保存路径
duration: 3000,
});
setTimeout(() => {
//打开文档查看
uni.openDocument({
filePath: res.savedFilePath,
success: function(res) {
// console.log('打开文档成功');
}
});
}, 1000)
}
});
}
}
})
},
dealIcon: function(audio) {
if (audio.icon) {
return audio.icon
} else {
return "../../static/record-ic.png"
}
},
playAudio: function(audio, k, index, m) {
const innerAudioContext = uni.createInnerAudioContext();
let form = this.forms[m]
if (this.playIndex == index && index == this.curIndex) {
innerAudioContext.stop()
audio.icon = "../../static/record-ic.png"
form.content_detail[index].real_value[k] = audio
this.playIndex = -1
this.curIndex = -1
} else {
innerAudioContext.stop()
this.playIndex = k
this.curIndex = index
innerAudioContext.src = audio.url;
innerAudioContext.play()
let list = []
for (var i = 0; i < form.content_detail[index].real_value.length; i++) {
let item = form.content_detail[index].real_value[i]
if (i == k) {
item.icon = "../../static/icon_play.png"
} else {
item.icon = "../../static/record-ic.png"
}
list.push(item)
}
form.content_detail[index].real_value = list
}
this.$set(this.forms, m, form)
innerAudioContext.onPlay((res) => {
console.log('开始播放', res);
uni.showToast({
title: "开始播放录音",
icon: 'none'
})
});
innerAudioContext.onPause(function() {
console.log('暂停播放');
});
innerAudioContext.onEnded(() => {
console.log('播放结束');
audio.icon = "../../static/record-ic.png"
form.content_detail[index].real_value[k] = audio
this.playIndex = -1
this.curIndex = -1
uni.showToast({
title: "录音播放结束",
icon: 'none'
})
});
innerAudioContext.onTimeUpdate(() => {});
innerAudioContext.onError((res) => {
console.log(res.errMsg);
console.log(res.errCode);
uni.showToast({
icon: 'none',
title: res.errMsg
})
});
},
videoItem: function(video) {
uni.navigateTo({
url: `/pages/gallery/playVideo/playVideo?url=${video.url}`
})
},
imageClick: function(item, index) {
uni.previewImage({
current: index,
urls: item.real_value
})
},
upOrDown: function(form) {
form.open = !form.open
},
groupChange: function(index, children) {
this.itemList[index].control_children = children
},
//单文本值变化
inputChange: function(index, values) {
console.log("单文本值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
locationChange: function(index, value) {
this.itemList[index].real_value = []
this.itemList[index].real_value.push(value)
},
textareaChange: function(index, values) {
console.log("多行文本值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
numberChange: function(index, values) {
console.log("数字框值变化", index + "-----" + values);
this.itemList[index].real_value = values
},
timeChange: function(index, values) {
console.log("时间选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
labelChange: function(index, values) {
console.log("标签选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
selectChange: function(index, values) {
console.log("下拉选择变化", index + "-----" + values);
this.itemList[index].real_value = values
},
fileChange: function(index, values) {
console.log("附件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
audioChange: function(index, values) {
console.log("录音文件变化", index + "-----" + values);
this.itemList[index].real_value = values
},
getFormList: function() {
let _this = this
this.$http.get({
url: "/api/v1/common_check/check_record/form_detail_list",
data: {
"obj_no": this.obj_no
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("表单详情", result);
if (result.code == 0) {
let list = result.data.list
for (var i = 0; i < list.length; i++) {
let form = list[i]
if (i == list.length - 1) {
form.open = true
} else {
form.open = false
}
form.executorStr = _this.dealExecutors(form.executors)
_this.forms.push(form)
}
_this.form = _this.forms[_this.forms.length - 1]
_this.itemList = _this.form.content_detail
} else {
_this.showFail(result.msg)
}
})
},
dealExecutors: function(executors) {
let executorStr = ""
if (executors) {
executors.forEach((item) => {
if (item.job_name) {
executorStr += `${item.user_name}(${item.job_name}) `
} else {
if (this.isCheck) {
executorStr += item.user_group_name
} else {
executorStr += item.user_name
}
}
})
return executorStr
}
return ""
},
showFail: function(text) {
uni.showToast({
title: text,
icon: 'none'
})
},
checkNull: function() {
let canSubmit = true
for (var i = 0; i < this.itemList.length; i++) {
let item = this.itemList[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (item.control_type == 26) {
console.log(item);
let b = false
for (var k = 0; k < item.control_children.length; k++) {
if (item.control_children[k].status && item.control_children[k].status == "已填写") {
b = true
break
}
}
console.log(b);
if (!b) {
canSubmit = false
break
}
} else {
if (!values || values.length == 0) {
canSubmit = false
break
}
}
}
}
return canSubmit
},
checkChildNull: function(list) {
let canSubmit = true
for (var i = 0; i < list.length; i++) {
let item = list[i]
if (item.control_type == 24) {
continue
}
if (item.control_type == 16 && item.control_cfg.value_type == 2) {
continue
}
let type = item.control_type
let isMust = item.validate_type
let values = item.real_value
if (isMust == 1) {
if (!values || values.length == 0) {
canSubmit = false
break
}
} else {
continue
}
}
return canSubmit
},
toSave: function() {
this.form.is_tmp = 1
this.form.check_module_id = this.form.cur_check_module_id
if (!this.form._id || this.form._id == '') {
this.form.check_record_id = this.check_record_id
} else {
this.form.check_record_id = this.form._id
}
this.$http.post({
url: "/api/v1/common_check/check_record/save",
data: this.form,
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("提交成功", res.data);
let result = res.data
if (result.code == 0) {
this.obj_no = result.data.obj_no
this.form.obj_no = result.data.obj_no
this.check_record_id = result.data.check_record_id
uni.showToast({
title: "暂存成功",
icon: 'none'
})
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
})
},
toNext: function() {
let that = this
setTimeout(function() {
if (!that.checkNull()) {
uni.showToast({
title: "*必填项未填写",
icon: 'none'
})
return
}
that.form.content_detail = that.itemList
that.form.project_id = that.project_id
that.form.check_module_id = that.check_module_id
that.form.check_tpl_id = that.check_tpl_id
that.form.node_no = that.form.cur_node_no
console.log("提交的内容", that.form);
uni.setStorageSync(that.form.check_item_id, JSON.stringify(that.form))
uni.navigateTo({
url: `../next-process-page/next-process-page?check_tpl_id=${that.check_tpl_id}&project_id=${that.project_id}&formId=${that.form.check_item_id}`
})
}, 500)
},
toClose: function() {
uni.navigateBack({
delta: 1
})
},
computeClick: function(index) {
let form = JSON.stringify(this.itemList[index])
uni.navigateTo({
url: `../gi-compute-page/gi-compute-page?form=${form}&index=${index}`
})
},
toEdit: function(index) {
let form = JSON.stringify(this.forms[index])
uni.setStorageSync("params", form)
uni.navigateTo({
url: `../edit-form-page/edit-form-page?index=${index}&form=${form}`
})
}
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.detail-title {
background-color: #FFFFFF;
display: flex;
flex-direction: column;
padding: 32rpx;
}
.uni-group-button {
display: flex;
flex-direction: row;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
padding: 0px 32rpx;
height: 144rpx;
background-color: #FFFFFF;
align-items: center;
position: fixed;
z-index: 1;
right: 0;
left: 0;
bottom: 0;
}
.edit-form-item-list {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
padding-left: 10rpx;
}
.form-detail-content {
display: flex;
flex-direction: column;
background-color: #FFFFFF;
padding: 0 32rpx;
}
.form-detail-item {
padding: 20rpx 0;
display: flex;
flex-direction: column;
}
.uni-upload-image {
display: flex;
position: relative;
align-items: center;
margin: 20rpx 20rpx 0px 32rpx;
height: 160rpx;
width: 160rpx;
}
.gi-upload-file-item {
display: flex;
flex-direction: row;
align-items: center;
}
.gi-file-info-item {
display: flex;
flex-direction: column;
margin-left: 32rpx;
margin-right: 32rpx;
flex: 1;
}
.detail-text {
color: #333333;
font-size: 32rpx;
padding: 20rpx 0;
flex-wrap: wrap;
}
.executor-text {
color: #999999;
font-size: 28rpx;
margin-top: 10rpx;
flex-wrap: wrap;
}
</style>
<template>
<view style="margin-top: 32rpx;">
<view v-for="(item,index) in formList" :key="index" class="qrcode-item">
<view class="qrcode-item-title single-text">
{{item.show_obj_list[0].show_obj_name}}:{{item.show_obj_list[0].real_value}}
</view>
<view style="display: flex;flex-direction: row;align-items: center;" @click="showQrcode(index)">
<image src="../../static/qrcode-blue.png" style="width: 30rpx;height: 30rpx;"></image>
<view class="text-blue" style="margin-left: 20rpx;">查看</view>
</view>
</view>
<view class="model-view" :style="showModal?'':'display:none;'">
<view class="model-out-box">
<view class="text-black-normal">{{curTitle}}</view>
<view class="model-content">
<canvas canvas-id="qrcode" style="margin: 40rpx;"></canvas>
</view>
<view style="display: flex;flex-direction: row;width: 100%;">
<view class="btn-dialog-grey" @click="cancel">取消</view>
<view class="btn-dialog-blue" @click="saveQrcode">保存图片</view>
</view>
</view>
</view>
</view>
</template>
<script>
import uQRCode from "../../../../components/tki-qrcode/qrcode.js"
export default {
data() {
return {
projectId: "",
appId: "",
checkModuleId: "",
formList: [],
showModal: false,
curTitle: "",
curIndex: -1,
qrcodeSrc: "",
//分页属性
page: 1,
pageSize: 20,
isPage: 1,
totalPage: 1
}
},
onLoad: function(option) {
this.projectId = option.project_id
this.checkModuleId = option.check_module_id
this.appId = option.check_tpl_id
uni.setNavigationBarTitle({
title: option.title
})
this.getFormList()
},
onPullDownRefresh: function() {
this.page = 1
this.getFormList()
},
onReachBottom: function() {
if (this.page < this.totalPage) {
this.page++
this.getFormList()
}
},
methods: {
getFormList: function() {
this.$http.get({
url: "/api/v1/common_check/check_object/form_list",
data: {
"project_id": this.projectId,
"business_type": 2,
"check_tpl_id": this.appId,
"check_module_id": this.checkModuleId,
"is_page": this.isPage,
"page": this.page,
"page_size": this.pageSize,
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
uni.stopPullDownRefresh()
console.log("表单列表", res.data.data);
this.formList = res.data.data.list
this.totalPage = res.data.data.total_page
})
},
showQrcode(index) {
this.curTitle = this.formList[index].show_obj_name
this.curIndex = index
this.showModal = true
this.$nextTick(function() {
this.cancvsQrcode(this.formList[index].obj_no)
})
},
cancvsQrcode(text) {
uQRCode.make({
canvasId: 'qrcode',
componentInstance: this,
text: text,
size: 160,
margin: 10,
backgroundColor: '#ffffff',
foregroundColor: '#000000',
fileType: 'jpg',
correctLevel: uQRCode.errorCorrectLevel.H,
success: res => {
console.log(res)
this.qrcodeSrc = res
},
fail: error => {
console.log(error)
}
})
},
cancel() {
this.curTitle = ""
this.curIndex = -1
this.showModal = false
},
saveQrcode() {
// #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>
page {
background-color: #F5F5F5;
}
.qrcode-item {
display: flex;
flex-direction: row;
align-items: center;
background-color: #FFFFFF;
padding: 32rpx;
margin-bottom: 2rpx;
}
.qrcode-item-title {
font-size: 32rpx;
color: #333333;
flex: 1;
}
.model-view {
position: fixed;
top: 0;
z-index: 1;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
background-color: rgba(0, 0, 0, 0.4);
}
.model-out-box {
width: 600rpx;
height: 600rpx;
background-color: #FFFFFF;
border-radius: 20rpx;
margin-top: 45%;
display: flex;
flex-direction: column;
justify-content: space-between;
padding: 32rpx 0 0 0;
align-items: center;
}
.model-content {
width: 400rpx;
height: 400rpx;
border-radius: 10rpx;
background: #fff;
display: flex;
align-items: center;
justify-content: center;
}
.btn-dialog-grey {
display: flex;
flex: 1;
height: 100rpx;
font-size: 32rpx;
color: #333333;
align-items: center;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
border-right: 2rpx solid rgba(0, 0, 0, 0.1);
justify-content: center;
}
.btn-dialog-blue {
display: flex;
flex: 1;
height: 100rpx;
font-size: 32rpx;
color: #1890FF;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
align-items: center;
justify-content: center;
}
</style>
<template>
<view>
<view class="search-form-parent">
<view class="search-form">
<image src="../../static/search-icon.png" style="width: 40rpx;height: 40rpx;"></image>
<input placeholder="搜索人员" placeholder-class="search-placeholder" class="search-input" v-model="key"
@input="search" />
</view>
</view>
<view class="text-grey-black-normal"
style="align-items: center;display: flex;flex-direction: row;padding: 32rpx;">已选中{{selectIds.length}}
</view>
<view class="text-grey-black-normal"
style="align-items: center;display: flex;flex-direction: row;padding: 32rpx;" v-if="user_way==1">按岗位选择
</view>
<ly-tree :ready="ready" :treeData="treeData" nodeKey="unique_id" :props="options" :showCheckbox="ready"
:defaultCheckedKeys="selectPost" :checkOnClickNode="ready" :checkOnlyLeaf="ready"
@node-click="handleNodeClick" ref="LyTree" v-if="user_way==1">
</ly-tree>
<view class="text-grey-black-normal"
style="align-items: center;display: flex;flex-direction: row;padding: 32rpx;" v-if="user_way==1">按人员选择
</view>
<view style="display: flex;padding: 32rpx;background-color: #FFFFFF;flex-direction: column;">
<view v-for="(user,index) in users" :key="index">
<view class="select-user-item" @click="itemClick(index)">
<view class="user-item" v-if="isSpecial()">
{{user.user_group_name}}
</view>
<view class="user-item" v-else>{{user.user_name}}({{user.job_name||""}})</view>
<image
:src="selectIds.indexOf(user.user_id)!=-1?'../../static/cb-big-sel.png':'../../static/cb-big.png'"
style="width: 48rpx;height: 48rpx;"></image>
</view>
</view>
</view>
<view style="height:150rpx;"></view>
<view class="uni-group-button">
<button class="uni-blue-button" @click="toSubmit">确认</button>
</view>
</view>
</template>
<script>
import LyTree from '@/components/ly-tree/ly-tree.vue'
export default {
components: {
LyTree
},
data() {
return {
user_way: 2, //2按项目 1 按公司 3按班组选
total: 0,
users: [],
projectId: "",
companyId: uni.getStorageSync("user_info").comp_id,
selected: [],
selectIds: [], //标记选中
selectPost: [], //记录选中的岗位id
type: 1,
key: "",
index: -1,
treeData: [],
ready: false,
options: {
// 这里的label就可以使用函数进行自定义的渲染了
label: 'name',
children: 'children_list', // 指把数据中的‘childs’当做children当做子节点数据
id: 'id'
},
nodes: {
label: 'group_name',
children: 'children_list', // 指把数据中的‘childs’当做children当做子节点数据
id: 'group_id'
}
}
},
onLoad: function(option) {
this.user_way = option.user_way
this.selectPost = JSON.parse(option.selectPost)
this.selected = JSON.parse(option.selected)
this.projectId = option.project_id
console.log("选中人员", this.selected);
this.type = option.type
//控件时候需要
this.index = option.index
if (this.selected && this.selected.length > 0) {
for (var i = 0; i < this.selected.length; i++) {
if (this.selectIds.indexOf(this.selected[i].user_id) == -1) {
this.selectIds.push(this.selected[i].user_id)
}
}
}
},
onShow: function() {
if (this.user_way == 1) {
this.getObsTree()
//获取公司人员
this.getCompanyUserList()
} else {
if ("焊口检查" == uni.getStorageSync("business_name")) {
this.getGroupUser()
} else {
this.getUserList()
}
}
},
methods: {
isSpecial: function() {
return '焊口检查' == uni.getStorageSync("business_name")
},
getGroupUser: function() {
this.$http.consoleGet({
url: "/intecons/api/v1/weld/middle_user/box_list",
data: {
"group_id": uni.getStorageSync("group_id"),
"project_id": this.projectId
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("人员列表", res.data.data);
this.users = res.data.data.list
})
},
handleNodeClick: function(e) {
console.log(e);
if (e.checked) {
this.selectPost.push(e.key)
//确定的时候获取岗位下的人
this.getJobUser(e, 1)
} else {
let index = this.selectPost.indexOf(e.key)
if (index != -1) {
this.selectPost.splice(index, 1)
//删除选中
this.getJobUser(e, 2)
}
}
},
getNodeType: function(unique_id) {
if (unique_id.indexOf('-') != -1) {
let array = unique_id.split("-")
return array[1]
}
return unique_id
},
getJobUser: function(e, type) {
this.$http.consoleGet({
url: "/adminc/v1/organization_manage/p_job_user/get_job_user_list",
data: {
"company_id": this.companyId,
"node_type": 3,
"job_id": this.getNodeType(e.key),
"is_page": 0
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("岗位人员", res.data.data);
let users = res.data.data.list
if (users && users.length > 0) {
if (type == 1) {
for (var i = 0; i < users.length; i++) {
let index = this.selectIds.indexOf(users[i].user_id)
if (index == -1) {
this.selectIds.push(users[i].user_id)
}
}
} else {
let indexs = []
for (var i = 0; i < users.length; i++) {
let index = this.selectIds.indexOf(users[i].user_id)
if (index != -1) {
this.selectIds.splice(index, 1)
}
}
}
} else {
uni.showToast({
title: "该岗位下没有人员",
icon: "none"
})
}
})
},
getCompanyUserList: function() {
this.$http.consolePost({
url: "/api/v1/user/user/get_dept_job_user_list_by_ids",
data: {
"ids": this.companyId,
"type": 4,
"is_page": 0
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("公司人员列表", res.data.data);
this.users = res.data.data.list
// this.isSelected()
})
},
getObsTree: function() {
this.$http.consoleGet({
url: "/adminc/v1/organization_manage/o_org/get_obs_tree",
data: {
"company_id": this.companyId,
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("岗位树形", res.data.data);
this.treeData = res.data.data
this.ready = true;
})
},
search: function(e) {
this.getUserList()
},
isSelected: function() {
if (this.users && this.users.length > 0) {
for (var i = 0; i < this.users.length; i++) {
let user = this.users[i]
let checked = false
for (var i = 0; i < this.selected.length; i++) {
if (this.selected[i].user_id == user.user_id) {
checked = true
}
}
user.checked = checked
this.$set(this.users, i, user)
}
}
},
getUserList: function() {
this.$http.get({
url: "/api/v1/project/project_user_list",
data: {
"project_id": this.projectId,
"user_name": this.key
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("人员列表", res.data.data);
this.users = res.data.data.list
})
},
itemClick: function(index) {
let user = this.users[index]
let keyIndex = this.selectIds.indexOf(user.user_id)
if (keyIndex != -1) {
this.selectIds.splice(keyIndex, 1)
} else {
this.selectIds.push(user.user_id)
}
if (user.checked) {
this.selectIds.splice()
user.checked = false
this.total--
} else {
user.checked = true
this.total++
}
this.$set(this.users, index, user)
},
toSubmit: function() {
this.selected = []
for (var i = 0; i < this.users.length; i++) {
let user = this.users[i]
if (this.selectIds.indexOf(user.user_id) != -1) {
let checked = false
for (var j = 0; j < this.selected.length; j++) {
if (this.selected[j].user_id == user.user_id) {
checked = true
}
}
if (!checked) {
this.selected.push(user)
}
}
}
console.log(this.selected);
uni.$emit("selectUser", {
type: this.type,
index: this.index,
selected: this.selected,
selectPost: this.selectPost
})
uni.navigateBack({
delta: 1
})
}
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.select-user-parent {
display: flex;
margin-top: 32rpx;
padding: 32rpx;
flex-direction: column;
background-color: #FFFFFF;
}
.select-user-item {
display: flex;
flex-direction: row;
padding: 20rpx 0;
align-items: center;
}
.user-item {
font-size: 28rpx;
color: #333333;
flex: 1;
}
.uni-group-button {
display: flex;
flex-direction: row;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
padding: 0px 32rpx;
height: 144rpx;
background-color: #FFFFFF;
align-items: center;
position: fixed;
z-index: 998;
right: 0;
left: 0;
bottom: 0;
}
</style>
......@@ -118,11 +118,11 @@
})
} else if (result.data.business_type ==
2) { //独立模式 需要获取模块数量 如果只有一个模块 自动跳转表单页面 "体验嘛 呵呵"
that.toAlone(model, result.data)
this.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)}`
url: `/pages/gallery/app/modeFormList/modeFormList?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]
......@@ -130,7 +130,7 @@
this.$refs.bottomDialog.handleShow()
} else { //之前的默认
uni.navigateTo({
url: `../index/index?check_tpl_id=${model.source_id}&title=${result.data.tpl_name}`
url: `/pages/gallery/app/originalIndex/originalIndex?check_tpl_id=${model.source_id}&title=${result.data.tpl_name}`
})
}
} else {
......@@ -138,6 +138,19 @@
}
})
},
toAlone(model, info) {
this.models = info.tpl_config
if (this.models.length == 1) {
let is_model_edit = this.models[0].is_edit
uni.navigateTo({
url: `/pages/gallery/app/modeFormList/modeFormList?business_type=2&check_tpl_id=${model.source_id}&check_module_id=${this.models[0].check_module_id}&title=${this.models[0].module_name}&is_edit=${is_model_edit}&showCfg=${JSON.stringify(this.models[0].show_cfg)}`
})
} else {
uni.navigateTo({
url: `/pages/gallery/app/modeList/modeList?check_tpl_id=${model.source_id}&title=${info.tpl_name}`
})
}
},
tabChange(e) {
this.current = e
},
......
<template>
<view>
<view class="next-process-parent">
<view class="process-centent">
<view class="text-black-normal">请选择下一步工作</view>
<view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;">
<view v-for="(item,index) in labels" :key="index" :index="index" @click="clickItem(index)">
<view class="label-item-select" v-if="selectIndex==index">{{item.module_name}}</view>
<view class="label-item" v-else>{{item.module_name}}</view>
</view>
</view>
</view>
<view class="process-centent">
<view style="display: flex;flex-direction: row;align-items: center;" v-if="isShow">
<view class="text-black-normal" style="flex: 1;">请选择执行人</view>
<image src="../../static/add-ic.png" style="width: 40rpx;height: 40rpx;" @click="toSelectExecutor">
</image>
</view>
<view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;">
<view v-for="(item,index) in executors" :key="index" :index="index" @click="clickItem(index)">
<view class="label-item">
<text>{{item.user_name}}</text>
<image src="../../static/close-btn.png" style="width: 40rpx;height: 40rpx;margin-left: 20rpx;"
@click="deleteExe(index)"></image>
</view>
</view>
</view>
<!-- <radio style="margin-top: 32rpx;" checked="isExecut" @click="executChange">发送提醒</radio> -->
</view>
<view class="process-notice-centent">
<view style="display: flex;flex-direction: row;align-items: center;">
<view class="text-black-normal" style="flex: 1;">请选择通知人</view>
<image src="../../static/add-ic.png" style="width: 40rpx;height: 40rpx;" @click="toSelectNotifier">
</image>
</view>
<view style="display: flex;flex-direction: row;flex-wrap: wrap;margin-top: 20rpx;">
<view v-for="(item,index) in notifiers" :key="index" :index="index" @click="clickItem(index)">
<view class="label-item">
<text>{{item.user_name}}</text>
<image src="../../static/close-btn.png" style="width: 40rpx;height: 40rpx;margin-left: 20rpx;"
@click="deleteNot(index)"></image>
</view>
</view>
</view>
<radio style="margin-top: 32rpx;" :checked="isNotice" @click="noticeChange">发送提醒</radio>
</view>
<view class="finish-time" v-if="isShow">
<view style="color: #333333;font-size: 32rpx;">期望完成时间:</view>
<view
style="color: #999999;font-size: 32rpx;flex: 1;text-align: center;border: 2rpx solid #E5E5E5;height: 80rpx;margin-left: 10rpx;text-align: center;line-height: 80rpx;border-radius: 6rpx;"
@click="selectTimeShow()">{{selectTime}}</view>
</view>
<e-picker-plus ref="picker" @confirm="confirm" :startRule="startRule" :endRule="endRule" :mode="mode" />
<view style="height: 144rpx;"></view>
<view class="uni-group-button">
<view class="uni-grey-button" @click="toBefore">上一步</view>
<view class="uni-blue-button" @click="toSubmit">提交</view>
</view>
</view>
</template>
......@@ -8,15 +62,401 @@
export default {
data() {
return {
labels: [],
appInfo: {},
projectId: "",
checkTplId: "5fe1a7d6b66600001e00311a",
selectIndex: -1,
executors: [],
notifiers: [],
isNotice: false,
obj_no: "",
check_record_id: "",
formData: {},
isShow: true,
selectTime: "",
startRule: "",
endRule: "",
mode: "YMDh",
selectPost: [],
needGcy: [],
gcyToken: "",
gcySignToken: "",
txtIds: [],
title: ""
}
},
onLoad: function(option) {
this.check_record_id = option.check_record_id
this.obj_no = option.obj_no
this.checkTplId = option.check_tpl_id
this.projectId = option.project_id
this.formData = JSON.parse(uni.getStorageSync(option.formId))
this.title = option.title
uni.setStorageSync(option.formId, "")
this.getProcessList()
},
onShow: function() {
uni.$on("selectUser", res => {
console.log("选中人员", res);
let type = res.type
this.selectPost = res.selectPost
if (type == 1) {
this.executors = res.selected
} else {
this.notifiers = res.selected
}
})
},
methods: {
confirm: function(e) {
console.log(e);
this.selectTime = `${e.result}:00:00`
},
selectTimeShow: function() {
this.$refs.picker.show()
},
deleteExe: function(index) {
this.executors.splice(index, 1)
},
deleteNot: function(index) {
this.notifiers.splice(index, 1)
},
noticeChange: function() {
this.isNotice = !this.isNotice
},
getProcessList: function() {
this.$http.get({
url: "/web/v1/common_check/check_tpl/tpl_detail",
data: {
"check_tpl_id": this.checkTplId
},
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("应用信息", res.data);
this.appInfo = res.data.data
let list = res.data.data.tpl_config
for (var i = 0; i < list.length; i++) {
if (i != 0) {
this.labels.push(list[i])
}
}
uni.setNavigationBarTitle({
title: this.appInfo.tpl_name
})
})
},
clickItem: function(index) {
this.selectIndex = index
if (this.labels[this.selectIndex].node_type == 999 && this.formData.business_type != 4) {
this.isShow = false
} else {
this.isShow = true
}
},
toSelectExecutor: function() {
uni.navigateTo({
url: `/pages/gallery/app/selectUserPage/selectUserPage?selected=${JSON.stringify(this.executors)}&type=1&project_id=${this.projectId}&user_way=2&selectPost=${JSON.stringify(this.selectPost)}`
})
},
toSelectNotifier: function() {
uni.navigateTo({
url: `/pages/gallery/app/selectUserPage/selectUserPage?selected=${JSON.stringify(this.notifiers)}&type=2&project_id=${this.projectId}&user_way=2&selectPost=${JSON.stringify(this.selectPost)}`
})
},
toBefore: function() {
uni.navigateBack({
delta: 1
})
},
toSubmit: function() {
let that = this
if (this.selectIndex == -1) {
uni.showToast({
title: "请选择下一步流程",
icon: 'none'
})
return
}
if (this.labels[this.selectIndex].node_type != 999 && this.executors.length == 0) {
uni.showToast({
title: "请选择执行人",
icon: 'none'
})
return
}
//是否需要认证
this.checkGcy()
if (this.needGcy.length > 0) {
this.getGcyToken()
} else {
this.submitForObjNo()
}
},
checkGcy() {
var itemList = this.formData.content_detail
this.needGcy = []
for (var i = 0; i < itemList.length; i++) {
let item = itemList[i]
//上传附件检查是否工程云认证需要
if (item.control_type == 22 && item.control_cfg.use_engin_cloud == 1) {
this.needGcy.push(i)
}
}
},
submitForObjNo() {
let that = this
that.formData.is_tmp = 0
that.formData.check_module_id = that.formData.cur_check_module_id
console.log(JSON.stringify(that.formData));
uni.showLoading({
title: "数据提交中..."
})
that.$http.post({
url: "/api/v1/common_check/check_record/save",
data: that.formData,
header: {
"access_token": this.getToken()
}
}).then((res) => {
console.log("提交成功", res.data);
let result = res.data
if (result.code == 0) {
that.submit(result.data.obj_no, result.data.check_record_id)
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
})
},
submit: function(obj_no, check_record_id) {
let data = {
"obj_no": obj_no,
"check_tpl_id": this.checkTplId,
"node_no": this.labels[this.selectIndex].node_no,
"node_type": this.labels[this.selectIndex].node_type,
"check_module_id": this.labels[this.selectIndex].check_module_id,
"executors": this.executors,
"is_warn": this.isNotice ? '1' : '0',
"notifiers": this.notifiers,
"expect_end_date": this.selectTime,
"check_record_id": check_record_id
}
console.log(JSON.stringify(data));
this.$http.post({
url: "/api/v1/common_check/check_object/save",
data: data,
header: {
"access_token": this.getToken()
}
}).then((res) => {
let result = res.data
console.log("提交成功", result);
if (result.code == 0) {
uni.$emit("refresh")
uni.navigateBack({
delta: 2
})
} else {
uni.showToast({
title: result.msg,
icon: 'none'
})
}
})
},
getGcyToken() {
this.$http.get({
url: "/api/v1/third_party/gcy_get_token",
header: {
"access_token": this.getToken()
}
}).then(res => {
let result = res.data
console.log("工程云token:", result);
if (result.code === 0) {
this.gcyToken = result.data.token
this.gcySignToken = result.data.gcySignToken
this.gcyRZ()
} else {
if (result.code === -1) {
uni.showToast({
title: result.msg,
icon: 'none'
})
if (result.action === 'Laravel_public_permission_fail') {
this.toLogin()
this.setToken("")
}
}
}
})
},
async gcyRZ() {
var itemList = this.formData.content_detail
for (var i = 0; i < this.needGcy.length; i++) {
var list = itemList[this.needGcy[i]].localFile
this.txtIds = []
for (var j = 0; j < list.length; j++) {
await this.uploadGcy(list, j, itemList[this.needGcy[i]])
}
var controlCfg = itemList[this.needGcy[i]].control_cfg
controlCfg.gcyRzResult = this.txtIds
console.log("txtIds", this.txtIds);
this.$set(itemList[this.needGcy[i]], "control_cfg", controlCfg)
this.$set(this.formData, "content_detail", itemList)
}
this.submitForObjNo()
},
getFileName(path) {
if (path && path != "") {
var result = path.split("/")
return result[result.length - 1]
} else {
return ""
}
},
uploadGcy(list, index, item) {
let _this = this
uni.showLoading({
title: "认证中..."
})
return new Promise((resolve) => {
var rawBA = {
"BMId": _this.checkTplId,
"BInsId": _this.projectId,
"BAId": new Date().getTime(),
"sysId": "43928b6cc1817f8a167da2bfdddb8035",
"version": 1,
"modMark": false,
"payload": [{
"type": "publicSection",
"version": 1,
"data": {
"attachment": [{
"name": this.getFileName(list[index].path)
}]
}
}]
}
uni.uploadFile({
url: getApp().globalData.gcyUrl + "/api/sjsn/gcy/cz",
filePath: list[index].path,
name: "files",
formData: {
"token": _this.gcyToken,
"signedToken": _this.gcySignToken,
"sysId": "43928b6cc1817f8a167da2bfdddb8035",
"rawBA": JSON.stringify(rawBA)
},
header: {
"Content-Type": "multipart/form-data"
},
success: function(uploadFileRes) {
uni.hideLoading()
console.log("上传结果", uploadFileRes);
if (uploadFileRes.statusCode == 200) {
var result = JSON.parse(uploadFileRes.data).txIds
console.log("上传id", uploadFileRes.data);
_this.txtIds = _this.txtIds.concat(result)
resolve(uploadFileRes);
}
},
fail: function(err) {
uni.hideLoading()
console.log("上传失败", uploadFileRes);
}
});
})
},
}
}
</script>
<style>
page {
background-color: #F5F5F5;
}
.next-process-parent {
display: flex;
flex-direction: column;
}
.process-centent {
padding: 32rpx;
display: flex;
background-color: #FFFFFF;
flex-direction: column;
margin-top: 32rpx;
}
.finish-time {
padding: 32rpx;
display: flex;
flex-direction: row;
background-color: #FFFFFF;
align-items: center;
}
.process-notice-centent {
padding: 32rpx;
display: flex;
background-color: #FFFFFF;
flex-direction: column;
}
.label-item {
display: inline-block;
margin: 10rpx 0rpx 10rpx 22rpx;
border: 2rpx solid #BFBFBF;
padding: 10rpx 32rpx;
align-items: center;
flex-direction: row;
border-radius: 36rpx;
font-size: 28rpx;
color: #333333;
}
.label-item-select {
display: inline-block;
margin: 10rpx 0rpx 10rpx 22rpx;
border: 2rpx solid #1890FF;
color: #1890FF;
padding: 10rpx 32rpx;
border-radius: 36rpx;
font-size: 28rpx;
}
.label-item-user {
margin: 20rpx;
border: 2rpx solid #BFBFBF;
padding: 10rpx 32rpx;
align-items: center;
flex-direction: row;
border-radius: 36rpx;
font-size: 28rpx;
color: #333333;
}
/* .uni-group-button {
display: flex;
flex-direction: row;
border-top: 2rpx solid rgba(0, 0, 0, 0.1);
height: 144rpx;
background-color: #FFFFFF;
align-items: center;
position: fixed;
z-index: 998;
right: 0;
left: 0;
bottom: 0;
} */
</style>
......@@ -450,7 +450,7 @@
if (audio.icon) {
return audio.icon
} else {
return "../../static/record-ic.png"
return "../../../static/record-ic.png"
}
},
playAudio: function(audio, k, index, m) {
......
......@@ -13,25 +13,30 @@
<view class="app-list">
<view class="menu-item" v-for="(item,index) in selList" :key="index">
<view class="logo-content">
<image src="../../../static/ic-sjzg.png" class="logo"></image>
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+item.logo+'.png'"
class="logo"></image>
<image src="../../../static/delete-ic.png" class="del" @click="toDel(index)"></image>
</view>
<view class="text">积分商城</view>
<view class="text">{{nameLengthDeal(item.app_name)}}</view>
</view>
</view>
</view>
</view>
<v-tabs :tabs="tabs" :scroll="true" :value="current" @change="tabChange"></v-tabs>
<view class="app-list-content">
<view class="app-content" v-for="(item,index) in appList">
<view class="app-content" v-for="(item,index) in apps[current].list">
<view class="title">便捷服务</view>
<view class="app-list">
<view class="menu-item" v-for="(app,appIndex) in selList" :key="appIndex">
<view class="menu-item" v-for="(app,appIndex) in item.data" :key="appIndex">
<view class="logo-content">
<image src="../../../static/ic-sjzg.png" class="logo"></image>
<image src="../../../static/add-ic.png" class="del" @click="toAdd(item)"></image>
<image
:src="'https://release-console.oss-cn-hangzhou.aliyuncs.com/intecons/uniimage/'+app.logo+'.png'"
class="logo"></image>
<image src="../../../static/add-ic.png" class="del" @click="toAdd(app,index,appIndex)">
</image>
</view>
<view class="text">积分商城</view>
<view class="text">{{nameLengthDeal(app.app_name)}}</view>
</view>
</view>
</view>
......@@ -41,20 +46,39 @@
<script>
import Api from "../../../api/api.js"
import StringUtils from "../../../common/stringUtils.js"
export default {
data() {
return {
selList: [{}],
appList: [{}],
groups: [],
appList: [], //过滤已选中
apps: [{
app_menu: 1,
list: []
}, {
app_menu: 2,
list: []
}, {
app_menu: 3,
list: []
}],
current: 0,
tabs: ["生活服务", "综合办公", "岗位工作"],
groups: []
requestParam: {
page: 1,
per_page: 500,
authed: 1,
showed: 1,
app_endpoint: 2,
is_publish: 1,
app_sort: 1
},
}
},
onLoad() {
//获取当前设置常用应用
this.getDefaultApp()
//获取所有的应用
},
methods: {
tabChange(e) {
......@@ -67,10 +91,12 @@
} else {
this.$toast.showToast(result.msg)
}
//获取所有的应用
this.getAppGroup()
})
},
sureConfig() {
if (thsi.selList.length == 0) {
if (this.selList.length == 0) {
this.$toast.showToast("请设置常用应用")
return
}
......@@ -94,15 +120,18 @@
}
})
},
toAdd(item) {
toAdd(item, index, appIndex) {
if (this.selList.length == 4) {
this.$toast.showToast("常用应用最多设置4个")
} else {
item.ydt_logo = item.logo
this.selList.push(item)
this.apps[this.current].list[index].data.splice(appIndex, 1)
}
},
toDel(index) {
this.selList.splice(index, 1)
this.getAppGroup()
},
toDef() {
this.getDefaultApp()
......@@ -113,6 +142,7 @@
"code_type": "applicationGroup"
}
}).then((result) => {
console.log("应用分组", result);
if (result.code == 0) {
let list = result.data[0].sub_data
this.groups = []
......@@ -138,31 +168,40 @@
})
},
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
list.forEach((item, index) => {
this.selList.forEach((sel) => {
if (item.app_id == sel.app_id) {
list.splice(index, 1)
}
})
})
//先根据菜单分组
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()
}
}
}
})
},
......@@ -174,7 +213,8 @@
if (!map[app.app_group]) {
dest.push({
app_group: app.app_group,
data: [app]
data: [app],
app
});
map[app.app_group] = app;
} else {
......@@ -189,6 +229,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>
......
......@@ -53,7 +53,8 @@
<view :class="isLineVisil(index)?'app-name-left':'app-name-right'">
{{nameLengthDeal(app.app_name)}}
</view>
<image class="app-logo" src="../../static/ic-score-logo.png"></image>
<image class="app-logo" src="../../static/ic-score-logo.png">
</image>
<view class="line" v-if="isLineVisil(index)"></view>
</view>
</uni-grid-item>
......
<template>
<view class="content">
<titleBar title="切换组织"></titleBar>
</view>
</template>
<script>
import Api from "../../../api/api.js"
export default {
data() {
return {
}
},
onLoad() {
this.getOrgTree()
},
methods: {
getOrgTree() {
Api.getOrgTree().then((result) => {
console.log("组织树", result);
})
}
}
}
</script>
<style lang="scss">
.content {
display: flex;
flex-direction: column;
}
</style>
......@@ -40,7 +40,7 @@
<view class="version-content">
<text class="text">当前版本:v1.0.0</text>
</view>
<view class="btn-org">
<view class="btn-org" @click="linkTo('/pages/mine/changeOrg/changeOrg')">
<text class="text">切换组织</text>
</view>
<view class="btn-logout" @click="toLinkLogin">
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
Please register or to comment