<template>
|
<view class="uni-task-dataobj-page">
|
<view class="uni-func-header">
|
<view class="uni-panel-search-container" v-if="queryAttr">
|
|
<view class="uni-panel-search-content">
|
<view class="uni-panel-search-left" @click="clickShowMenu">
|
<uni-icons color="#333" size="20" type="search" />
|
<text class="uni-down-arrow"></text>
|
</view>
|
<input class="uni-panel-search-input" type="text" confirm-type="search" v-model="searchtext"
|
@input="inputSearch" @confirm="inputSearch" :placeholder="searchInputTip" />
|
<text class="uni-panel-search-ico fs-delete_solid_circle" style="color: gray;" v-if="searchtext"
|
@click="cancelSearch"></text>
|
|
</view>
|
|
|
<!-- <uni-search-bar class="uni-panel-search" radius="5" v-model="searchtext" :placeholder="searchInputTip"
|
clearButton="auto" cancelButton="none" @input="inputSearch" @confirm="inputSearch"
|
@clear="cancelSearch">
|
<template v-slot:searchIcon>
|
<view class="uni-panel-search-left" @click="clickShowMenu">
|
<uni-icons color="#333" size="20" type="search" />
|
<text class="uni-down-arrow"></text>
|
</view>
|
</template>
|
</uni-search-bar> -->
|
</view>
|
<text button v-if="queryAttr" class="uni-func-header-ico fs-refresh_x" @click="onClickRefresh"></text>
|
<button class="uni-func-header-button" v-for="(item, index) in pageButons" :key="index"
|
@click="clickButton(item)">{{item.ShowName}}</button>
|
|
</view>
|
|
<scroll-view class="uni-panel-list" enable-flex scroll-y refresher-enabled="true"
|
:refresher-triggered="triggered" :scroll-top="scrollTop" :refresher-threshold="100"
|
@refresherpulling="onPulling" @refresherrefresh="onRefresh" @refresherrestore="onRestore"
|
@refresherabort="onAbort" @scroll="scrollView" @scrolltolower="scrollEnd">
|
<view v-if="emptyTip" class="uni-panel-center">
|
<text style="color: gray;display: flex;justify-content: center;">{{emptyTip}}</text>
|
<image mode="center" src="@/static/open-box.png"> </image>
|
</view>
|
<checkbox-group @change="checkboxChange">
|
<label class="uni-list-cell uni-list-cell-pd" v-for="(item, index) in listBody" :key="index">
|
<view class="uni-panel-item">
|
<checkbox class="uni-panel-left" :value="item.ObjID" :checked="item.checked" />
|
<dataObjItem style="flex:1" :rowButons="rowButons" :dataObj="item" @clickButton="clickRowButton"
|
@clickItem="triggerItem"></dataObjItem>
|
<view class="uni-panel-right" @click.prevent.stop="triggerItem(item)">
|
<uni-icons color="#000" type="forward" size="20" />
|
</view>
|
</view>
|
|
</label>
|
</checkbox-group>
|
<view class="uni-loadmore" v-if="showLoadMore">{{loadMoreText}}</view>
|
</scroll-view>
|
<view>
|
<!-- 普通菜单 -->
|
<uni-popup ref="popupMenu" background-color="transparent" maskBackgroundColor="rgba(0, 0, 0, 0.2)">
|
<view class="popup-content" @click="closeMenu">
|
<view class="popup-content-menu ">
|
<view v-for="(group) in queryAttr" :key="group.Name">
|
<view class="popup-content-menu-group" @click.prevent.stop="clickExpandQueryGroup(group)">
|
<view class="popup-content-menu-ico">
|
<uni-icons color="#333" size="20" :type="group.open ? 'bottom':'forward' " />
|
</view>
|
{{group.Name}}
|
</view>
|
<view v-if="group.open"> <button class="popup-content-menu-item"
|
v-for="(item,index) in group.Attr" :key="index" @click="menuSelChange(item,index)">
|
<view class="popup-content-menu-checked">
|
<uni-icons v-if="queryAttrKey==item.Name" color="#333" size="20"
|
type="checkmarkempty" />
|
</view>
|
{{item.DispName}}
|
</button></view>
|
</view>
|
</view>
|
</view>
|
</uni-popup>
|
|
</view>
|
</view>
|
</template>
|
|
<script>
|
import {
|
showModal,
|
showToast
|
} from "@/common/Page.js"
|
import extendUtil from "@/common/extend.js"
|
import dataObjItem from "@/components/dataobj-item.vue"
|
// import {
|
// attrQueryList,
|
// getDataObjList,
|
// delDataObj,
|
|
// } from "@/common/api/app.js"
|
import {
|
getClassInfo,
|
getClassUistyle,
|
getClassUistyleDefault
|
} from "@/api/data.js"
|
import {
|
getAppInfo
|
} from "@/api/mobox.js"
|
import {
|
Base64
|
} from 'js-base64';
|
|
export default {
|
name: "pageTaskDataObjList",
|
components: {
|
dataObjItem,
|
},
|
props: {
|
taskState: {
|
type: String,
|
default () {
|
return "";
|
}
|
},
|
taskId: {
|
type: String,
|
default () {
|
return "";
|
}
|
},
|
app: {
|
type: Object,
|
default () {
|
return {}
|
}
|
},
|
globalAttr: {
|
type: Object,
|
default () {
|
return {}
|
}
|
},
|
|
},
|
data() {
|
return {
|
queryAttr: [],
|
queryAttrKey: "",
|
searchInputTip: '查询',
|
searchtext: '',
|
oldsearchtext: '',
|
appInfo: {},
|
appParam: {},
|
pageButons: [],
|
rowButons: [],
|
cellAttr: [],
|
clsId: "",
|
where: "",
|
attrs: "",
|
clsInfo: {},
|
firstLoadData: true,
|
listChecked: [],
|
listBody: [],
|
session_id: "",
|
emptyTip: "",
|
loadMoreText: "加载中...",
|
showLoadMore: false,
|
triggered: false,
|
pindex: 0,
|
psize: 15,
|
order: "T_CREATE desc",
|
scrollTop: 0,
|
old: {
|
triggered: 0,
|
scrollTop: 0
|
},
|
viewShowStyle: [],
|
|
};
|
},
|
watch: {
|
taskState(val) {
|
if (val == "执行") {
|
this.setData({
|
pageButons: this.appParam?.button || [],
|
rowButons: this.appParam?.rowButon || []
|
})
|
} else {
|
this.setData({
|
pageButons: [],
|
rowButons: []
|
})
|
}
|
},
|
where: "updateData"
|
},
|
methods: {
|
setData: function(obj) {
|
let that = this;
|
let keys = [];
|
let val, data;
|
|
Object.keys(obj).forEach(function(key) {
|
keys = key.split(".");
|
val = obj[key];
|
data = that.$data;
|
keys.forEach(function(key2, index) {
|
if (index + 1 == keys.length) {
|
that.$set(data, key2, val);
|
} else {
|
if (!data[key2]) {
|
that.$set(data, key2, {});
|
}
|
}
|
data = data[key2];
|
});
|
});
|
},
|
|
async loadPageDataObjParam() {
|
var _this = this;
|
try {
|
_this.showLoadMore = false;
|
_this.pindex = 1
|
_this.order = "T_CREATE"
|
_this.setData({
|
pageButons: [],
|
rowButons: []
|
})
|
console.log("loadPageDataObjParam:", _this.taskState, _this.appParam)
|
if (_this.app?.id) {
|
const appList = await getAppInfo([_this.app.id]) || []
|
if (appList.length > 0) {
|
_this.appInfo = appList[0]
|
let param = "";
|
if (_this.appInfo.param) {
|
//mobox2的param是json字符串
|
param = _this.appInfo.param.replace(/\\/g, "");
|
//mobox3的param是base64字符串
|
if (!_this.appInfo.param.includes('"') )
|
param = Base64.decode( _this.appInfo.param );
|
}
|
_this.appParam = app.param ? this.parseJson(param) : {};
|
if (_this.appParam?.ClsID || _this.appParam?.ClsName) {
|
_this.clsInfo = await getClassInfo(_this.appParam.ClsID, _this.appParam.ClsName)
|
_this.clsId = _this.clsInfo?.id || ""
|
const info = await getClassUistyleDefault(_this.clsId, 1)
|
//console.log(`gridStyleInfo`, _this.appInfo, _this.appParam, info);
|
|
if (this.taskState == "执行") {
|
_this.setData({
|
pageButons: _this.appParam.button || [],
|
rowButons: _this.appParam.rowButon || []
|
})
|
}
|
|
var attrs = "data_obj_id;data_obj_name;N_ATTACH_COUNT"
|
if (info?.StyleDef?.Cell) {
|
_this.cellAttr = info?.StyleDef?.Cell || []
|
_this.cellAttr.forEach(function(item) {
|
attrs += ";"
|
attrs += item.Attr
|
})
|
} else {
|
_this.setData({
|
cellAttr: [],
|
|
})
|
}
|
const queryList = await attrQueryList(_this.clsId);
|
(queryList || []).forEach((group) => {
|
group.open = true
|
})
|
if (queryList.length > 0) {
|
_this.setData({
|
queryAttr: queryList,
|
queryAttrKey: queryList[0].Attr[0].Name,
|
searchInputTip: `${queryList[0].Attr[0].DispName}查询`
|
})
|
if (_this.cellAttr.length > 0) {
|
_this.setData({
|
queryAttr: queryList,
|
queryAttrKey: _this.cellAttr[0].Attr,
|
searchInputTip: `${ _this.cellAttr[0].ShowName}查询`
|
})
|
}
|
} else {
|
_this.setData({
|
queryAttr: []
|
})
|
}
|
_this.attrs = attrs
|
console.log(`装载扩展功能点参数`, info, this.queryAttr);
|
}
|
_this.loadPageDataObjList()
|
}
|
|
}
|
} catch (ex) {
|
console.log(`装载扩展功能点参数失败`, ex);
|
this.showError(ex)
|
}
|
},
|
async loadPageDataObjList() {
|
var _this = this;
|
uni.showLoading({
|
title: "加载中,请稍后..."
|
})
|
_this.showLoadMore = false;
|
this.pageDataObjQuery()
|
.then((resData) => {
|
|
console.log("loadPageDataObjList res", resData)
|
_this.scrollTop = _this.old.scrollTop
|
_this.$nextTick(function() {
|
_this.scrollTop = 0
|
});
|
_this.listBody = resData;
|
_this.setData({
|
listBody: _this.listBody,
|
})
|
uni.hideLoading()
|
if (_this.firstLoadData)
|
showToast('数据装载完毕', 'none')
|
else
|
showToast('列表已刷新', 'none')
|
_this.setData({
|
firstLoadData: false
|
})
|
_this.$forceUpdate();
|
}).catch((rej) => {
|
uni.hideLoading()
|
_this.setData({
|
listBody: [],
|
firstLoadData: false
|
})
|
_this.$forceUpdate();
|
})
|
},
|
updateData() {
|
this.loadPageDataObjList()
|
},
|
triggerItem(item) {
|
|
console.log("triggerItem", item, this.appParam)
|
if (this.appParam?.View_dlg?.Model == "small") {
|
if (this.appParam?.View_dlg?.Name) {
|
|
let url =
|
`/pages/data/dataObjPage?clsId=${this.clsId}&objId=${item.ObjID}&title=${this.app.list_name || this.app.name}&viewName=${this.appParam.View_dlg.Name}`
|
console.log("dataObjPage url", url)
|
uni.navigateTo({
|
url: url
|
})
|
}
|
} else {
|
showModal("目前浏览弹框只支持小窗口", "提示", false, false)
|
}
|
|
|
},
|
getCheckedItem() {
|
let listChecked = []
|
console.log("getCheckedItem", this.listBody)
|
this.listBody.forEach(function(item) {
|
if (item.checked)
|
listChecked.push(item)
|
})
|
console.log("getCheckedItem", listChecked)
|
return listChecked
|
},
|
checkboxChange: function(e) {
|
var items = this.listBody,
|
values = e.detail.value;
|
console.log("checkboxChange", values)
|
for (var i = 0, lenI = items.length; i < lenI; ++i) {
|
const item = items[i]
|
if (values.includes(item.ObjID)) {
|
item.checked = true
|
} else {
|
item.checked = false
|
}
|
}
|
},
|
addPageData() {
|
var _this = this;
|
_this.pindex += 1;
|
const where = [`(G_TASK_ID='${_this.taskId}')`]
|
if (this.where)
|
where.push(this.where)
|
return new Promise((resolve, reject) => {
|
getDataObjList(_this.session_id_this.clsId, where, this.attrs, _this.order, _this.psize,
|
_this.pindex)
|
.then((res) => {
|
//dataObjQuery2(_this.clsId, _this.session_id, _this.pindex).then((res) => {
|
console.log("dataObjList dataObjQuery2 res", res)
|
if (res?.ret?.code == "00000") {
|
const resData = res?.ret?.data || {}
|
let nRecords = 0
|
_this.totalcount = resData.Records
|
_this.ptotal = resData.TotalPages
|
if (resData.CurPage < resData.total) {
|
_this.loadMoreText = "加载更多"
|
nRecords = resData.PageSize
|
} else
|
nRecords = resData.Records - ((resData.CurPage - 1) * resData.PageSize)
|
if (nRecords > 0) {
|
showToast('加载了' + nRecords + '条数据', 'none')
|
_this.listBody = [..._this.listBody, ..._this.getDefaultData(resData
|
.ObjList)]
|
} else {
|
showToast('没有更多数据了', 'none')
|
resolve([])
|
}
|
} else {
|
const tip = res?.ret?.msg || ""
|
console.log("dataObjList pageGetList failed", tip)
|
_this.loadMoreText = "加载数据失败!"
|
reject(tip)
|
showModal(tip || '获取失败', '错误', false)
|
}
|
}).catch((rej) => {
|
console.log("dataObjList pageGetList failed", rej)
|
_this.loadMoreText = "加载数据失败!"
|
reject(rej)
|
this.showError(rej)
|
})
|
})
|
|
},
|
pageDataObjQuery() {
|
var _this = this;
|
_this.emptyTip = ''
|
return new Promise((resolve, reject) => {
|
if (!_this.clsId) {
|
resolve([])
|
return
|
}
|
_this.session_id = ""
|
const where = [`(G_TASK_ID='${_this.taskId}')`]
|
if (this.where)
|
where.push(this.where)
|
getDataObjList(_this.session_id, _this.clsId, where, this.attrs, _this.order, _this.psize,
|
_this.pindex)
|
.then((res) => {
|
|
if (res?.ret?.code == "00000") {
|
const resData = res?.ret?.data || {}
|
let nRecords = 0
|
_this.totalcount = resData.Records
|
_this.ptotal = resData.TotalPages
|
_this.session_id = resData.SessionID
|
if (resData.CurPage < "1") {
|
nRecords = resData.Records
|
} else {
|
if (resData.CurPage < resData.total) {
|
_this.loadMoreText = "加载更多"
|
nRecords = resData.PageSize
|
} else
|
nRecords = resData.Records - ((resData.CurPage - 1) * resData.PageSize)
|
}
|
if (nRecords > 0) {
|
showToast('加载了' + nRecords + '条数据', 'none')
|
resolve(_this.getDefaultData(resData.ObjList))
|
} else {
|
//_this.loadMoreText = "没有更多数据了!"
|
showToast('没有更多数据了', 'none')
|
resolve([])
|
}
|
|
} else {
|
const tip = res?.ret?.msg || ""
|
console.log("dataObjList pageGetList failed", tip)
|
_this.loadMoreText = "加载数据失败!"
|
reject(tip)
|
showModal(tip || '获取失败', '错误', false)
|
}
|
|
|
|
}).catch((rej) => {
|
console.log("dataObjList pageGetList failed", rej)
|
_this.loadMoreText = "加载数据失败!"
|
reject(rej)
|
showModal('获取失败', '错误', false)
|
})
|
})
|
},
|
getDefaultData(arr) {
|
let bodyList = []
|
for (let i = 0; i < arr.length; i++) {
|
if (Array.isArray(arr[i].ObjAttr)) {
|
let objData = arr[i]
|
console.log("ObjAttr", arr[i].ObjAttr)
|
let objDataNew = {
|
ObjID: arr[i].ObjID,
|
ObjAttr: []
|
};
|
|
(this.cellAttr || []).forEach(function(item) {
|
let attrData = {
|
Name: item.Attr,
|
Value: "",
|
Hidden: item.Hidden || ""
|
}
|
let curIndex = objData.ObjAttr.findIndex((obj, index, arr2) => {
|
return obj.Name == item.Attr;
|
})
|
if (curIndex > -1) {
|
attrData = objData.ObjAttr[curIndex]
|
attrData.Hidden = item.Hidden || ""
|
|
}
|
if (item.Attr == "SYS_ATTACH") //
|
{
|
let curIndex = objData.ObjAttr.findIndex((obj, index, arr2) => {
|
return obj.Name == "N_ATTACH_COUNT";
|
})
|
if (curIndex > -1) {
|
attrData.Value = objData.ObjAttr[curIndex].Value
|
}
|
|
}
|
objDataNew.ObjAttr.push(attrData)
|
})
|
bodyList.push(objDataNew)
|
}
|
}
|
console.log("bodyList", this.cellAttr, bodyList)
|
return bodyList
|
},
|
scrollView(e) { //nvue暂不支持滚动监听,可用bindingx代替
|
//console.log("scrollView:" + e.scrollTop);
|
this.old.scrollTop = e.detail.scrollTop
|
},
|
scrollEnd() {
|
var _this = this;
|
console.log("dataObjList scrollEnd:", _this.ptotal, _this.pindex);
|
_this.showLoadMore = true;
|
if (_this.ptotal <= _this.pindex) {
|
_this.loadMoreText = "没有更多数据了!"
|
return
|
}
|
_this.loadMoreText = "加载中..."
|
setTimeout(() => {
|
_this.addPageData();
|
}, 500)
|
|
},
|
onPulling(e) {
|
console.log("onPulling", e);
|
this.old.triggered = e.detail.triggered
|
},
|
onRefresh() {
|
var _this = this;
|
uni.showLoading({
|
title: "加载中,请稍后..."
|
})
|
_this.errmsg = '';
|
_this.pindex = 1;
|
_this.totalcount = 0;
|
_this.ptotal = 0;
|
_this.showLoadMore = false;
|
_this.pageDataObjQuery().then((resData) => {
|
console.log("onRefresh", resData);
|
_this.listBody = resData;
|
_this.triggered = _this.old.triggered
|
_this.$nextTick(function() {
|
_this.triggered = 'restore'; // 需要重置
|
});
|
_this.setData({
|
listBody: _this.listBody
|
})
|
_this.$forceUpdate();
|
uni.hideLoading()
|
showToast('列表已刷新', 'none')
|
}).catch(() => {
|
uni.hideLoading()
|
_this.setData({
|
listBody: []
|
})
|
_this.$forceUpdate();
|
});
|
|
},
|
onRestore() {
|
console.log("onRestore");
|
this.triggered = 'restore'; // 需要重置
|
},
|
onAbort() {
|
console.log("onAbort");
|
},
|
onClickRefresh() {
|
var _this = this;
|
uni.showLoading({
|
title: "加载中,请稍后..."
|
})
|
_this.errmsg = '';
|
_this.pindex = 1;
|
_this.totalcount = 0;
|
_this.ptotal = 0;
|
_this.showLoadMore = false;
|
_this.pageDataObjQuery().then((resData) => {
|
console.log("onRefresh", resData);
|
_this.listBody = resData;
|
_this.setData({
|
listBody: _this.listBody
|
})
|
uni.hideLoading()
|
showToast('列表已刷新', 'none')
|
}).catch(() => {
|
uni.hideLoading()
|
_this.setData({
|
listBody: []
|
})
|
});
|
|
},
|
|
cancelSearch() {
|
console.log("cancelSearch");
|
this.setData({
|
searchtext: "",
|
where: "",
|
oldsearchtext: "",
|
oldsearchtext: ""
|
})
|
},
|
inputSearch() {
|
|
var _this = this;
|
if (_this.timerSearch) {
|
clearTimeout(_this.timerSearch);
|
_this.timerSearch = null;
|
}
|
_this.timerSearch = setTimeout(() => {
|
|
let keyStr = _this.searchtext.trim()
|
console.log("inputSearch", _this.oldsearchtext, keyStr);
|
if (_this.oldsearchtext != keyStr) {
|
let whereStr = ""
|
if (keyStr) {
|
whereStr = `(${_this.queryAttrKey} like '%${keyStr}%')`
|
}
|
_this.setData({
|
where: whereStr,
|
oldsearchtext: keyStr
|
})
|
}
|
}, 1000)
|
},
|
clickShowMenu() {
|
if (this.queryAttr.length > 1)
|
this.$refs.popupMenu.open("top")
|
},
|
clickExpandQueryGroup(g) {
|
if (g.open)
|
g.open = false
|
else
|
g.open = true
|
},
|
menuSelChange(item, index) {
|
this.setData({
|
queryAttrKey: item.Name,
|
searchInputTip: `${item.DispName}查询`
|
})
|
|
this.$refs.popupMenu.close()
|
if (this.timerSearch) {
|
clearTimeout(this.timerSearch);
|
this.timerSearch = null;
|
}
|
this.setData({
|
searchtext: "",
|
where: ""
|
})
|
|
},
|
closeMenu() {
|
console.log("tasks closeMenu")
|
this.$refs.popupMenu.close()
|
},
|
clickRowButton(e) {
|
console.log("clickRowButton:", e)
|
|
if (e.button.FunCode == "Add") {
|
|
if (e.button?.Edit_dlg?.Model == "small") {
|
if (e.button?.Edit_dlg?.Name) {
|
const hasAttach = this.clsInfo.HasAttach ? true : false
|
|
const url =
|
`/pages/data/newDataObj?clsId=${this.clsId}&appId=${this.app?.id}&defCode=${this.appInfo.DefCode}&title=${e.button.ShowName}&editName=${e.button.Edit_dlg.Name}&hasAttach=${hasAttach}&button=row&buttonName=${e.button.ShowName}&globalAttr=${JSON.stringify(this.globalAttr)}`
|
uni.navigateTo({
|
url: url
|
})
|
}
|
} else {
|
showModal("目前编辑弹框只支持小窗口", "提示", false, false)
|
}
|
} else if (e.button.FunCode == "Modify") {
|
if (e.button?.Edit_dlg?.Model == "small") {
|
if (e.button?.Edit_dlg?.Name) {
|
const hasAttach = this.clsInfo.HasAttach ? true : false
|
const url =
|
`/pages/data/newDataObj?clsId=${this.clsId}&appId=${this.app?.id}&objId=${e.data.ObjID}&defCode=${this.appInfo.DefCode}&title=${e.button.ShowName}&editName=${e.button.Edit_dlg.Name}&hasAttach=${hasAttach}&button=row&buttonName=${e.button.ShowName}&globalAttr=${JSON.stringify(this.globalAttr)}`
|
uni.navigateTo({
|
url: url
|
})
|
}
|
} else {
|
showModal("目前编辑弹框只支持小窗口", "提示", false, false)
|
}
|
} else if (e.button.FunCode == "Delete") {
|
|
let sContent = `确定要该项${this.app.list_name || this.app.name}吗?`
|
showModal(sContent, "提醒").then((res) => {
|
if (res) {
|
this.delDataObjs([e.data.ObjID])
|
}
|
})
|
|
} else {
|
showToast("不支持此操作", 'none', 3000)
|
}
|
},
|
clickButton(item) {
|
var _this = this
|
console.log("clickButton:", item)
|
this.listChecked = this.getCheckedItem()
|
|
if (item.FunCode == "Add") {
|
|
if (item?.Edit_dlg?.Model == "small") {
|
if (item?.Edit_dlg?.Name) {
|
const hasAttach = this.clsInfo.HasAttach ? true : false
|
|
const url =
|
`/pages/data/newDataObj?clsId=${this.clsId}&appId=${this.app?.id}&defCode=${this.appInfo.DefCode}&title=${item.ShowName}&editName=${item.Edit_dlg.Name}&hasAttach=${hasAttach}&button=top&buttonName=${item.ShowName}&globalAttr=${JSON.stringify(this.globalAttr)}`
|
uni.navigateTo({
|
url: url
|
})
|
}
|
} else {
|
showModal("目前编辑弹框只支持小窗口", "提示", false, false)
|
}
|
} else if (item.FunCode == "Modify") {
|
if (item?.Edit_dlg?.Model == "small") {
|
if (item?.Edit_dlg?.Name) {
|
if (this.listChecked.length == 1) {
|
const obj = this.listChecked[0]
|
const hasAttach = this.clsInfo.HasAttach ? true : false
|
const url =
|
`/pages/data/newDataObj?clsId=${this.clsId}&appId=${this.app?.id}&objId=${obj.ObjID}&defCode=${this.appInfo.DefCode}&title=${item.ShowName}&editName=${item.Edit_dlg.Name}&hasAttach=${hasAttach}&button=top&buttonName=${item.ShowName}&globalAttr=${JSON.stringify(this.globalAttr)}`
|
uni.navigateTo({
|
url: url
|
})
|
} else if (this.listChecked.length > 1) {
|
showModal("未指定编辑项", "提示", false, false)
|
} else {
|
showModal("只能选择一项编辑", "提示", false, false)
|
}
|
|
}
|
} else {
|
showModal("目前编辑弹框只支持小窗口", "提示", false, false)
|
}
|
} else if (item.FunCode == "Delete") {
|
|
if (this.listChecked.length > 0) {
|
let sContent = `确定要${this.listChecked.length}项${this.app.list_name || this.app.name}吗?`
|
showModal(sContent, "提醒").then((res) => {
|
if (res) {
|
const list = []
|
this.listChecked.forEach((obj) => {
|
list.push(obj.ObjID)
|
})
|
this.delDataObjs(list)
|
}
|
})
|
} else {
|
showModal("未指定删除项", "提示", false, false)
|
}
|
} else {
|
showToast("不支持此操作", 'none', 3000)
|
}
|
|
|
|
},
|
async delDataObjs(listObjId) {
|
try {
|
await delDataObj(this.clsId, JSON.stringify(listObjId))
|
listObjId.forEach((id) => {
|
const list = this.listBody
|
let curIndex = list.findIndex((obj, index, arr2) => {
|
return obj.ObjID == id;
|
})
|
if (curIndex > -1) {
|
list.splice(curIndex, 1)
|
}
|
this.setData({
|
listBody: list
|
})
|
})
|
} catch (ex) {
|
console.log(`删除数据信息失败`, ex);
|
this.showError(ex)
|
}
|
},
|
|
dataObjChange(appId) {
|
if (this.app?.id == appId)
|
this.onClickRefresh()
|
},
|
showError(ex) {
|
let tip = typeof ex === 'string' ? ex :( ex.message || ex.err_msg || ex.errMsg || ex.err_info || "")
|
|
showModal(tip, "提示", false)
|
},
|
},
|
mounted() {
|
this.loadPageDataObjParam()
|
uni.$on('dataObjChange', this.dataObjChange)
|
},
|
destroyed() {
|
uni.$off('dataObjChange', this.dataObjChange)
|
}
|
}
|
</script>
|
|
<style lang="scss">
|
.uni-searchbar__text-placeholder {
|
white-space: nowrap !important;
|
overflow: hidden !important;
|
text-overflow: ellipsis !important;
|
}
|
|
.uni-task-dataobj-page {
|
display: flex;
|
background-color: #e5eaee;
|
width: 100%;
|
height: 100%;
|
flex-direction: column;
|
|
|
.uni-func-header {
|
display: flex;
|
padding: 0 5px;
|
flex-direction: row !important;
|
flex-wrap: wrap;
|
}
|
|
.uni-panel-search-container {
|
display: flex;
|
flex: 1;
|
height: 45px;
|
|
.uni-panel-search-content {
|
display: flex;
|
width: 100%;
|
margin: 10px 4px 0 4px;
|
background-color: #fff;
|
border: 1px solid #eee;
|
border-radius: 5px;
|
padding: 5px 2px;
|
flex-direction: row !important;
|
align-items: center;
|
}
|
|
.uni-panel-search-content:focus {
|
border: 1px solid blue;
|
}
|
|
.uni-panel-search-input {
|
flex: 1;
|
margin: 0px 4px;
|
}
|
|
.uni-panel-search-ico {
|
display: flex;
|
margin: 5px;
|
font-size: 18px;
|
|
}
|
}
|
|
.uni-searchbar__text-placeholder {
|
white-space: nowrap !important;
|
overflow: hidden !important;
|
text-overflow: ellipsis !important;
|
}
|
|
.uni-panel-search {
|
width: 100%;
|
min-width: 100px;
|
}
|
|
.uni-panel-search-left {
|
display: flex;
|
flex-direction: row !important;
|
justify-content: center;
|
}
|
|
.uni-down-arrow {
|
display: flex;
|
margin-left: -2px;
|
margin-top: 10px;
|
border: 7px solid #ffffff;
|
border-color: transparent;
|
border-top-color: #333
|
}
|
|
.uni-func-header-ico {
|
display: flex;
|
padding: 4px;
|
line-height: 20px;
|
font-size: 20px;
|
color: #007aff;
|
margin: 12px 0 0 0;
|
}
|
|
.uni-func-header-button {
|
display: flex;
|
font-size: 14px;
|
color: #fff;
|
line-height: 32px;
|
height: 32px;
|
background-color: #007aff;
|
margin: 11px 4px 2px;
|
}
|
|
.uni-panel-list {
|
flex: 1;
|
width: 100%;
|
flex-direction: column !important;
|
}
|
|
.uni-panel-center {
|
display: flex;
|
align-items: center;
|
margin: 100px 10px 10px;
|
width: calc(100% - 20px);
|
flex-direction: column !important;
|
}
|
|
.uni-panel-body {
|
height: 100%;
|
}
|
|
.uni-panel-item {
|
display: flex;
|
margin: 8px 12px 8px 10px;
|
padding: 2px 5px;
|
border: solid 1px #ddd;
|
background-color: white;
|
border-radius: 5px;
|
-webkit-box-shadow: 0 10px 6px -6px #ddd;
|
-moz-box-shadow: 0 10px 6px -6px #ddd;
|
box-shadow: 0 10px 6px -6px #ddd;
|
flex-direction: row;
|
}
|
|
.uni-panel-left {
|
display: flex;
|
font-size: 15px;
|
color: #000;
|
margin: 12px 4px;
|
}
|
|
.clearfix {
|
content: " ";
|
box-sizing: border-box;
|
}
|
|
/* loadmore */
|
.uni-loadmore {
|
height: 80rpx;
|
line-height: 80rpx;
|
text-align: center;
|
padding-bottom: 30rpx;
|
}
|
|
.uni-panel-right {
|
display: flex;
|
text-align: center;
|
align-items: center;
|
color: #808080;
|
line-height: 40px;
|
}
|
|
.popup-content {
|
display: flex;
|
justify-content: center;
|
flex-direction: column;
|
background-color: transparent;
|
|
}
|
|
.popup-content-menu {
|
margin-top: 50px;
|
margin-left: 32px;
|
max-height: 50vh;
|
width: 180px;
|
align-items: center;
|
justify-content: center;
|
flex-direction: column;
|
background-color: #fff;
|
border-radius: 5px;
|
border: 1px solid gray;
|
overflow: auto;
|
}
|
|
.popup-content-menu-group {
|
display: flex;
|
flex-wrap: nowrap;
|
flex-direction: row !important;
|
align-items: center;
|
font-size: 14px;
|
padding: 4px 8px;
|
background-color: #ddd;
|
}
|
|
.popup-content-menu-item {
|
display: flex;
|
flex-wrap: nowrap;
|
flex-direction: row !important;
|
align-items: center;
|
font-size: 14px;
|
height: 43px;
|
// padding: 4px 8px 4px 16px;
|
line-height: 43px;
|
}
|
|
.popup-content-menu-ico {
|
display: flex;
|
width: 20px;
|
height: 27px;
|
padding-top: 8px;
|
margin-right: 5px;
|
}
|
|
.popup-content-menu-checked {
|
display: flex;
|
width: 20px;
|
|
margin-right: 5px;
|
}
|
}
|
</style>
|