提交 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,6 +229,15 @@ export default { ...@@ -220,6 +229,15 @@ export default {
} }
}, },
mounted() { mounted() {
this.init()
},
methods: {
init() {
pad_room_type.rows.forEach((item, index) => {
this.tabList[index].value = item.dictValue;
});
if (this.detailsInfo.inspectionType) { 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) => {
...@@ -232,13 +250,6 @@ export default { ...@@ -232,13 +250,6 @@ export default {
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) {
uni.showLoading(); uni.showLoading();
...@@ -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,47 +83,39 @@ export default { ...@@ -85,47 +83,39 @@ 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() {
return new Promise((resolve, reject) => {
try { try {
const value = uni.getStorageSync("user_data"); const value = uni.getStorageSync("user_data");
if (value) { if (value) {
this.personList = JSON.parse(value); // this.personList = JSON.parse(value);
// console.log("---this.personList", this.personList);
resolve(eval(value));
} else { } else {
uni.getStorage({ uni.getStorage({
key: "user_data", key: "user_data",
success: function (res) { success: function (res) {
this.personList = JSON.parse(res.data); // this.personList =;
// console.log("---this.personList", this.personList); // console.log("---this.personList", this.personList);
resolve(eval(value));
}, },
}); });
} }
} catch (e) {} } catch (e) {
// console.log(this.personList, "用户数据"); console.log("setUser--", e);
}
});
}, },
// 点击登录 // 点击登录
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;
...@@ -144,19 +134,38 @@ export default { ...@@ -144,19 +134,38 @@ export default {
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]; const userInfo = this.personList[key];
uni.setStorageSync("last_time", userInfo.loginTime || "");
// console.log("--last_time----",userInfo.loginTime)
// 更新用户登陆时间
const loginTime = moment().format("yyyy-MM-DD HH:mm:ss");
this.personList[key].loginTime = loginTime;
userInfo.loginTime = loginTime;
this.$store.commit("SET_USER", userInfo); this.$store.commit("SET_USER", userInfo);
uni.setStorageSync("now_user", userInfo); uni.setStorageSync("now_user", userInfo);
// const fileContent = JSON.stringify(Base64.encode(this.personList)); // console.log("--userInfo---", userInfo);
// createFileWithPlusIO( // console.log("写入用户数据内容---", this.personList);
// SYNCHRONIZE_DATA_PAD,
// USER_FILE_NAME, // 更新用户数据
// fileContent const fileContent = JSON.stringify(
// ); Base64.encode(JSON.stringify(personList))
);
uni.setStorage({
key: "user_data",
data: JSON.stringify(personList),
fail: (error) => {
console.log("APP.vue 存储数据失败", error);
},
});
createFileWithPlusIO(
SYNCHRONIZE_DATA_PAD,
USER_FILE_NAME,
fileContent
);
uni.navigateTo({ uni.navigateTo({
url: "/pages/home/home", url: "/pages/home/home",
...@@ -187,6 +196,14 @@ export default { ...@@ -187,6 +196,14 @@ export default {
}); });
return; 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);
}); });
// 密码不正确 // 密码不正确
...@@ -215,6 +232,7 @@ export default { ...@@ -215,6 +232,7 @@ export default {
duration: 2000, 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 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论