提交 a529e2fc authored 作者: 邓文彬's avatar 邓文彬

fix(功能走查): 功能走查60%

上级 5833726b
...@@ -68,7 +68,7 @@ export default { ...@@ -68,7 +68,7 @@ export default {
onHide: function () { onHide: function () {
// app关闭时将数据存储到本地缓存 // app关闭时将数据存储到本地缓存
uni.setStorageSync("now_user", this.$store.state.now_user); uni.setStorageSync("now_user", this.$store.state.now_user);
// uni.setStorageSync("last_time", this.$store.state.last_time); uni.setStorageSync("last_time", this.$store.state.now_user.loginTime);
}, },
onUnload() {}, onUnload() {},
...@@ -114,6 +114,7 @@ export default { ...@@ -114,6 +114,7 @@ export default {
}); });
}) })
.then((res) => { .then((res) => {
// console.log("-xxxxxxxxxxx---", res)
// 获取文件数据 // 获取文件数据
let userData = Base64.decode(res); let userData = Base64.decode(res);
......
...@@ -68,8 +68,6 @@ export default { ...@@ -68,8 +68,6 @@ export default {
this.isDisable ? 1 : 0 this.isDisable ? 1 : 0
}`; }`;
console.log(" this.details",url, this.details);
uni.navigateTo({ uni.navigateTo({
url: `${url}&uid=${this.details.uid}`, url: `${url}&uid=${this.details.uid}`,
}); });
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
>HI,欢迎回来{{ userInfo.name }}{{ userInfo.user }}</view >HI,欢迎回来{{ userInfo.name }}{{ userInfo.user }}</view
> >
<view class="unit">所属单位:{{ userInfo.unitName || "--" }}</view> <view class="unit">所属单位:{{ userInfo.unitName || "--" }}</view>
<view class="time">上次登录时间:{{ userInfo.last_time || "--" }}</view> <view class="time">上次登录时间:{{ lastTime || "--" }}</view>
<image <image
class="bg-img" class="bg-img"
...@@ -86,7 +86,6 @@ export default { ...@@ -86,7 +86,6 @@ export default {
}, },
data() { data() {
return { return {
isDialog: false, // isDialog: false, //
list: [], // 展示数据 list: [], // 展示数据
all_data: [], // 所有数据 all_data: [], // 所有数据
...@@ -96,11 +95,12 @@ export default { ...@@ -96,11 +95,12 @@ export default {
countNum: 0, // 统计查询总数 countNum: 0, // 统计查询总数
syncCount: 0, // 待同步条数 syncCount: 0, // 待同步条数
// lastTime: "", // 上次登陆时间 lastTime: "", // 上次登陆时间
}; };
}, },
created() { created() {
// this.lastTime = uni.getStorageSync("last_time") || ""; this.lastTime = uni.getStorageSync("last_time") || "";
// uni.getStorageSync("last_time", this.$store.state.now_user.loginTime || "");
}, },
mounted() { mounted() {
this.init(); this.init();
...@@ -110,6 +110,7 @@ export default { ...@@ -110,6 +110,7 @@ export default {
userInfo() { userInfo() {
return this.$store.state.now_user || {}; return this.$store.state.now_user || {};
}, },
}, },
methods: { methods: {
init() { init() {
...@@ -135,7 +136,7 @@ export default { ...@@ -135,7 +136,7 @@ export default {
}); });
}, },
toSyncPage() { toSyncPage() {
this.$emit("changeTab", {}, 2) this.$emit("changeTab", {}, 2);
}, },
// 待同步数据 // 待同步数据
...@@ -217,8 +218,6 @@ export default { ...@@ -217,8 +218,6 @@ export default {
this.init(); this.init();
}, },
toIndex() { toIndex() {
uni.navigateTo({ uni.navigateTo({
url: "/pages/index/index", url: "/pages/index/index",
...@@ -226,13 +225,7 @@ export default { ...@@ -226,13 +225,7 @@ export default {
}, },
toPage() { toPage() {
// if (this.userInfo.isAdmin) {
// uni.showToast({
// title: "暂无权限",
// icon: "none",
// });
// return;
// }
uni.showLoading(); uni.showLoading();
......
...@@ -119,15 +119,16 @@ export default { ...@@ -119,15 +119,16 @@ export default {
//退出--弹出对话框 //退出--弹出对话框
dialogInputConfirm2() { dialogInputConfirm2() {
let _this = this;
uni.redirectTo({ uni.redirectTo({
url: "/pages/login/login", url: "/pages/login/login",
success() { success: () =>{
_this.$store.commit("SET_USER", {});
// uni.clearStorage(); //测试将所有缓存清除
// console.log("-退出---",this.$store.state.now_user.loginTime)
uni.setStorageSync("now_user", this.$store.state.now_user); uni.setStorageSync("now_user", this.$store.state.now_user);
// uni.setStorageSync("last_time", this.$store.state.last_time); uni.setStorageSync("last_time", this.$store.state.now_user.loginTime || "");
uni.clearStorage(); //测试将所有缓存清除
}, },
}); });
}, },
......
...@@ -108,6 +108,7 @@ export default { ...@@ -108,6 +108,7 @@ export default {
inspectionTime: moment().format("yyyy-MM-DD HH:mm:ss"), inspectionTime: moment().format("yyyy-MM-DD HH:mm:ss"),
inspectionBy: this.$store.state.now_user.name, inspectionBy: this.$store.state.now_user.name,
inspectionById: this.$store.state.now_user.id, inspectionById: this.$store.state.now_user.id,
cureatByName: this.$store.state.now_user.user,
isException: "", // 是否有异常 isException: "", // 是否有异常
position: "", // 位置 position: "", // 位置
isSubmit: "", // 0 是草稿态; 1 是正式提交 isSubmit: "", // 0 是草稿态; 1 是正式提交
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<block slot="right"> <block slot="right">
<view class="nav-right"> <view class="nav-right">
<view class="uni-nav-bar-text" @click="deleteClick"> <view v-if="isOperationPermissions" class="uni-nav-bar-text" @click="deleteClick">
<text class="iconfont icon-delete"></text <text class="iconfont icon-delete"></text
></view> ></view>
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
></DutyHandover> ></DutyHandover>
</view> </view>
<view v-if="!isDisable" class="fixed-btns"> <view v-if=" isOperationPermissions && !isDisable" class="fixed-btns">
<view class="button-group"> <view class="button-group">
<!-- isSubmit 标识: 0 是草稿态; 1 是正式提交 --> <!-- isSubmit 标识: 0 是草稿态; 1 是正式提交 -->
<view <view
...@@ -187,10 +187,18 @@ export default { ...@@ -187,10 +187,18 @@ export default {
isDisable: false, // 禁用 isDisable: false, // 禁用
}; };
}, },
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
isOperationPermissions(){ // 是否有操作权限
const {uid, cureatByName} = this.detailsInfo;
return !uid || (uid && cureatByName == this.userInfo.user)
}
},
onLoad(options) { onLoad(options) {
this.isDisable = options.isDisable == 1 ? true : false; this.isDisable = options.isDisable == 1 ? true : false;
this.init();
if (options.uid) { if (options.uid) {
// 获取详情 // 获取详情
this.getDetails(options.uid); this.getDetails(options.uid);
...@@ -206,6 +214,7 @@ export default { ...@@ -206,6 +214,7 @@ export default {
this.tempForm = darf_data.originData.tempForm; this.tempForm = darf_data.originData.tempForm;
console.log("获取草稿数据---", darf_data); console.log("获取草稿数据---", darf_data);
this.detailsInfo = darf_data; this.detailsInfo = darf_data;
this.init()
uni.hideLoading(); uni.hideLoading();
}) })
...@@ -220,7 +229,16 @@ export default { ...@@ -220,7 +229,16 @@ export default {
} }
}, },
mounted() { mounted() {
if (this.detailsInfo.inspectionType) { this.init()
},
methods: {
init() {
pad_room_type.rows.forEach((item, index) => {
this.tabList[index].value = item.dictValue;
});
if (this.detailsInfo.inspectionType) {
const fillCheck = this.detailsInfo.fillCheck.split(","); const fillCheck = this.detailsInfo.fillCheck.split(",");
this.tabList.forEach((item, index) => { this.tabList.forEach((item, index) => {
item.isVaild = fillCheck.includes(item.value); item.isVaild = fillCheck.includes(item.value);
...@@ -231,13 +249,6 @@ export default { ...@@ -231,13 +249,6 @@ export default {
} else { } else {
this.baseInfo = this.$store.state.temp_data; this.baseInfo = this.$store.state.temp_data;
} }
},
methods: {
init() {
pad_room_type.rows.forEach((item, index) => {
this.tabList[index].value = item.dictValue;
});
}, },
// 回显数据 // 回显数据
getDetails(uid) { getDetails(uid) {
...@@ -254,6 +265,9 @@ export default { ...@@ -254,6 +265,9 @@ export default {
this.isDisable = this.isDisable || detailsInfo.synchronization == 1; this.isDisable = this.isDisable || detailsInfo.synchronization == 1;
uni.hideLoading(); uni.hideLoading();
this.init()
}) })
.catch((error) => { .catch((error) => {
uni.showToast({ uni.showToast({
......
...@@ -35,7 +35,9 @@ ...@@ -35,7 +35,9 @@
</view> </view>
<!-- 开始巡检 --> <!-- 开始巡检 -->
<view class="inspection-button" @click="toPage">开始巡检</view> <view class="inspection-button" @click="toPage"
>开始巡检</view
>
</view> </view>
</template> </template>
...@@ -84,6 +86,12 @@ export default { ...@@ -84,6 +86,12 @@ export default {
uni.hideLoading(); uni.hideLoading();
}); });
}, },
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
methods: { methods: {
init() { init() {
const all_data = this.all_data || []; const all_data = this.all_data || [];
...@@ -141,7 +149,6 @@ export default { ...@@ -141,7 +149,6 @@ export default {
} = this.searchForm; } = this.searchForm;
return arr.filter((item) => { return arr.filter((item) => {
return ( return (
(!isException || item.isException == isException) && (!isException || item.isException == isException) &&
(!inspectionType || item.inspectionType == inspectionType) && (!inspectionType || item.inspectionType == inspectionType) &&
......
...@@ -63,9 +63,7 @@ export default { ...@@ -63,9 +63,7 @@ export default {
}; };
}, },
created() {}, created() {},
onShow() { onShow() {},
this.setUser();
},
mounted() {}, mounted() {},
// 定义返回退出 // 定义返回退出
onBackPress(options) { onBackPress(options) {
...@@ -74,7 +72,7 @@ export default { ...@@ -74,7 +72,7 @@ export default {
uni.setStorageSync("oper_record", this.$store.state.oper_record); uni.setStorageSync("oper_record", this.$store.state.oper_record);
uni.setStorageSync("all_data", this.$store.state.all_data); uni.setStorageSync("all_data", this.$store.state.all_data);
uni.setStorageSync("now_user", this.$store.state.now_user); uni.setStorageSync("now_user", this.$store.state.now_user);
// uni.setStorageSync("last_time", this.$store.state.last_time); uni.setStorageSync("last_time", this.$store.state.now_user.loginTime);
plus.runtime.quit(); plus.runtime.quit();
} else { } else {
plus.nativeUI.toast("再划一次退出应用"); plus.nativeUI.toast("再划一次退出应用");
...@@ -85,136 +83,156 @@ export default { ...@@ -85,136 +83,156 @@ export default {
return true; return true;
}, },
methods: { methods: {
setSm2(data) {
const sm2 = require("sm-crypto").sm2; // 获取sm2对象
const cipherMode = 1; // 选择加密策略,1 - C1C3C2,0 - C1C2C3,默认为1
const sysPublicKey =
"042580b43bad40cc813a032ef3a4c3c38fc58796e0684dd9b5087195a305f4241f9bbefcc92a10e7296ffc167d22a921c164b8cbbbdbcf91ddc3f15202b993f03b"; // 系统后台公钥
if (data) {
return sm2.doEncrypt(JSON.stringify(data), sysPublicKey, cipherMode);
} else {
return null;
}
},
setUser() { setUser() {
try { return new Promise((resolve, reject) => {
const value = uni.getStorageSync("user_data"); try {
if (value) { const value = uni.getStorageSync("user_data");
this.personList = JSON.parse(value); if (value) {
} else { // this.personList = JSON.parse(value);
uni.getStorage({ // console.log("---this.personList", this.personList);
key: "user_data", resolve(eval(value));
success: function (res) { } else {
this.personList = JSON.parse(res.data); uni.getStorage({
// console.log("---this.personList", this.personList); key: "user_data",
}, success: function (res) {
}); // this.personList =;
// console.log("---this.personList", this.personList);
resolve(eval(value));
},
});
}
} catch (e) {
console.log("setUser--", e);
} }
} catch (e) {} });
// console.log(this.personList, "用户数据");
}, },
// 点击登录 // 点击登录
login() { login() {
// uni.navigateTo({ this.setUser().then((personList) => {
// url: "/pages/home/home", this.personList = personList;
// }); console.log("111", personList);
// return;
// 是否输入账号密码 // 是否输入账号密码
if (this.person.user && this.person.pd) { if (this.person.user && this.person.pd) {
let key = null; let key = null;
console.log("-this.personList--", this.personList); const obj = this.personList.some((item, index) => {
const obj = this.personList.some((item, index) => { if (item.user == this.person.user) {
if (item.user == this.person.user) { key = index;
key = index; return true;
return true; }
} });
});
uni.showLoading({ uni.showLoading({
title: "加载中", title: "加载中",
}); });
// 存在该账号 // 存在该账号
if (obj) { if (obj) {
// 判断账号密码是否正确 // 判断账号密码是否正确
if ( if (
this.person.user == this.personList[key].user && this.person.user == this.personList[key].user &&
this.person.pd == this.personList[key].passWord this.person.pd == this.personList[key].passWord
) { ) {
const last_time = moment().format("yyyy-MM-DD HH:mm:ss"); // 存储最近一次登陆时间
this.personList[key].last_time = last_time; const userInfo = this.personList[key];
uni.setStorageSync("last_time", userInfo.loginTime || "");
// console.log("--last_time----",userInfo.loginTime)
const userInfo = this.personList[key]; // 更新用户登陆时间
this.$store.commit("SET_USER", userInfo); const loginTime = moment().format("yyyy-MM-DD HH:mm:ss");
uni.setStorageSync("now_user", userInfo); this.personList[key].loginTime = loginTime;
userInfo.loginTime = loginTime;
// const fileContent = JSON.stringify(Base64.encode(this.personList)); this.$store.commit("SET_USER", userInfo);
// createFileWithPlusIO( uni.setStorageSync("now_user", userInfo);
// SYNCHRONIZE_DATA_PAD,
// USER_FILE_NAME,
// fileContent
// );
uni.navigateTo({ // console.log("--userInfo---", userInfo);
url: "/pages/home/home", // console.log("写入用户数据内容---", this.personList);
});
uni.showToast({
title: "登录成功",
icon: "none",
duration: 2000,
});
readLogData() // 更新用户数据
.then((res) => { const fileContent = JSON.stringify(
const log_list = res; Base64.encode(JSON.stringify(personList))
// 更新日志信息 );
const logContent = getLogContent(LOG_TYPE_ENUM.login); uni.setStorage({
log_list.push(logContent); key: "user_data",
this.$store.commit("SET_LOG_LIST", log_list); data: JSON.stringify(personList),
addLog(log_list); fail: (error) => {
console.log("APP.vue 存储数据失败", error);
},
});
createFileWithPlusIO(
SYNCHRONIZE_DATA_PAD,
USER_FILE_NAME,
fileContent
);
uni.hideLoading(); uni.navigateTo({
}) url: "/pages/home/home",
.catch((error) => { });
if (error.code == 0) { uni.showToast({
uni.showToast({ title: "登录成功",
title: error.msg, icon: "none",
icon: "none", duration: 2000,
duration: 2000,
});
return;
}
}); });
// 密码不正确 readLogData()
.then((res) => {
const log_list = res;
// 更新日志信息
const logContent = getLogContent(LOG_TYPE_ENUM.login);
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list);
uni.hideLoading();
})
.catch((error) => {
if (error.code == 0) {
uni.showToast({
title: error.msg,
icon: "none",
duration: 2000,
});
return;
}
const log_list = [];
// 更新日志信息
const logContent = getLogContent(LOG_TYPE_ENUM.login);
log_list.push(logContent);
this.$store.commit("SET_LOG_LIST", log_list);
addLog(log_list);
});
// 密码不正确
} else {
uni.showToast({
title: "密码错误",
icon: "none",
duration: 2000,
});
uni.hideLoading();
}
// 不存在该账号
} else { } else {
uni.showToast({ uni.showToast({
title: "密码错误", title: "账号不存在",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
uni.hideLoading(); uni.hideLoading();
} }
// 不存在该账号 // 未输入账号或者密码
} else { } else {
uni.showToast({ uni.showToast({
title: "账号不存在", title: "账号密码不能为空",
icon: "none", icon: "none",
duration: 2000, duration: 2000,
}); });
uni.hideLoading();
} }
// 未输入账号或者密码 });
} else {
uni.showToast({
title: "账号密码不能为空",
icon: "none",
duration: 2000,
});
}
}, },
}, },
}; };
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<block slot="right"> <block slot="right">
<view class="nav-right"> <view class="nav-right">
<view class="uni-nav-bar-text" @click="deleteClick"> <view v-if="isOperationPermissions" class="uni-nav-bar-text" @click="deleteClick">
<text class="iconfont icon-delete"></text <text class="iconfont icon-delete"></text
></view> ></view>
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
></TabContentItem> ></TabContentItem>
</view> </view>
<view v-if="!isDisable" class="fixed-btns"> <view v-if="isOperationPermissions && !isDisable" class="fixed-btns">
<view class="button-group"> <view class="button-group">
<!-- 保存草稿 0:草稿 1:提交 --> <!-- 保存草稿 0:草稿 1:提交 -->
<view <view
...@@ -123,6 +123,16 @@ export default { ...@@ -123,6 +123,16 @@ export default {
isDisable: false, // 禁用 isDisable: false, // 禁用
}; };
}, },
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
isOperationPermissions(){ // 是否有操作权限
const {uid, cureatByName} = this.detailsInfo;
return !uid || (uid && cureatByName == this.userInfo.user)
}
},
onLoad(options) { onLoad(options) {
this.isDisable = options.isDisable == 1 ? true : false; this.isDisable = options.isDisable == 1 ? true : false;
...@@ -139,6 +149,8 @@ export default { ...@@ -139,6 +149,8 @@ export default {
console.log("获取草稿数据---", darf_data); console.log("获取草稿数据---", darf_data);
this.detailsInfo = darf_data; this.detailsInfo = darf_data;
uni.hideLoading(); uni.hideLoading();
this.init();
}) })
.catch((error) => { .catch((error) => {
uni.showToast({ uni.showToast({
...@@ -152,21 +164,7 @@ export default { ...@@ -152,21 +164,7 @@ export default {
} }
}, },
mounted() { mounted() {
this.init().then(() => { this.init();
if (this.detailsInfo.inspectionType) {
const fillCheck = this.detailsInfo.fillCheck.split(",");
setTimeout(() => {
this.tabList.forEach((item, index) => {
item.isVaild = fillCheck.includes(item.value);
this.tempForm[index] &&
this.setComponentData(item.refName, this.tempForm[index]);
});
}, 500);
} else {
this.baseInfo = this.$store.state.temp_data;
}
});
}, },
methods: { methods: {
...@@ -182,6 +180,21 @@ export default { ...@@ -182,6 +180,21 @@ export default {
refName: `TabContentItem_${index}`, refName: `TabContentItem_${index}`,
}; };
}); });
if (this.detailsInfo.inspectionType) {
const fillCheck = this.detailsInfo.fillCheck.split(",");
setTimeout(() => {
this.tabList.forEach((item, index) => {
item.isVaild = fillCheck.includes(item.value);
this.tempForm[index] &&
this.setComponentData(item.refName, this.tempForm[index]);
});
}, 500);
} else {
this.baseInfo = this.$store.state.temp_data;
}
resolve(); resolve();
}); });
}, },
...@@ -200,6 +213,8 @@ export default { ...@@ -200,6 +213,8 @@ export default {
this.isDisable = this.isDisable || detailsInfo.synchronization == 1; // 是否禁用 1:已同步数据 0: 未同步数据 this.isDisable = this.isDisable || detailsInfo.synchronization == 1; // 是否禁用 1:已同步数据 0: 未同步数据
uni.hideLoading(); uni.hideLoading();
this.init();
}) })
.catch((error) => { .catch((error) => {
uni.showToast({ uni.showToast({
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<!-- 数据打包 --> <!-- 数据打包 -->
<view <view
v-show="isPackedDataBtn" v-show="isPackedDataBtn "
class="synchronous-button" class="synchronous-button"
@click="openDialog(true)" @click="openDialog(true)"
>数据打包</view >数据打包</view
...@@ -77,6 +77,12 @@ export default { ...@@ -77,6 +77,12 @@ export default {
mounted() { mounted() {
this.init(); this.init();
}, },
computed: {
userInfo() {
return this.$store.state.now_user || {};
},
},
methods: { methods: {
init() { init() {
...@@ -84,7 +90,7 @@ export default { ...@@ -84,7 +90,7 @@ export default {
getAllInspections() getAllInspections()
.then((res) => { .then((res) => {
this.all_data = res.filter(item => item.synchronization == 0); this.all_data = res.filter((item) => item.synchronization == 0);
this.getList(); this.getList();
uni.hideLoading(); uni.hideLoading();
......
...@@ -61,7 +61,7 @@ export const USER_LiST = [ ...@@ -61,7 +61,7 @@ export const USER_LiST = [
{ {
id: 1, // 有用 id: 1, // 有用
user: "hzsgjy", // 有用 user: "hzsgjy", // 有用 谁创建,谁有权限编辑和删除
passWord: "JFXJ85250920", // 有用 passWord: "JFXJ85250920", // 有用
areaName: "市本级", // 有用 areaName: "市本级", // 有用
permission: 1, permission: 1,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论