diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/flowInstrument/flowInstrument.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/flowInstrument/flowInstrument.js index 20d3bde3..72a187c8 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/flowInstrument/flowInstrument.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/flowInstrument/flowInstrument.js @@ -1,5 +1,5 @@ import request from '@/utils/request' - +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 查询分页列表 @@ -9,7 +9,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -49,7 +50,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTank/oilTank.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTank/oilTank.js index 9b87d206..1c74307d 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTank/oilTank.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTank/oilTank.js @@ -1,5 +1,5 @@ import request from '@/utils/request' - +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 查询分页列表 @@ -9,7 +9,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -28,7 +29,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -71,7 +73,8 @@ export default { method: 'post', data: data, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }); }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilType/oilType.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilType/oilType.js index 09a34acd..58ab53c7 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilType/oilType.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilType/oilType.js @@ -1,5 +1,5 @@ import request from '@/utils/request' - +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 查询分页列表 @@ -9,7 +9,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTypeInAndOutBound/oilTypeInAndOutBound.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTypeInAndOutBound/oilTypeInAndOutBound.js index 9c82e36c..c9fbbe0c 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTypeInAndOutBound/oilTypeInAndOutBound.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/oilTypeInAndOutBound/oilTypeInAndOutBound.js @@ -1,5 +1,5 @@ import request from '@/utils/request' - +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 获取油罐 tankList: function(params) { @@ -8,7 +8,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -29,7 +30,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -51,7 +53,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -70,7 +73,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInAndOutBound/rawMaterialInAndOutBound.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInAndOutBound/rawMaterialInAndOutBound.js index c048e6b2..feffb8ab 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInAndOutBound/rawMaterialInAndOutBound.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInAndOutBound/rawMaterialInAndOutBound.js @@ -1,5 +1,5 @@ import request from '@/utils/request' - +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 获取原料 inventoryList: function(params) { @@ -8,7 +8,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -21,7 +22,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -44,7 +46,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -63,7 +66,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInfo/rawMaterialInfo.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInfo/rawMaterialInfo.js index 18041138..ab4a0ea6 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInfo/rawMaterialInfo.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialInfo/rawMaterialInfo.js @@ -1,5 +1,5 @@ import request from '@/utils/request' - +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 查询分页列表 @@ -9,7 +9,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -28,7 +29,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialType/rawMaterialType.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialType/rawMaterialType.js index 5af15e7d..1003730f 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialType/rawMaterialType.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/rawMaterialType/rawMaterialType.js @@ -1,5 +1,6 @@ import request from '@/utils/request' +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 查询分页列表 @@ -9,7 +10,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/supplier/supplier.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/supplier/supplier.js index 50fac6ce..c9ac3283 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/supplier/supplier.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/supplier/supplier.js @@ -1,5 +1,6 @@ import request from '@/utils/request' +let tokens = window.sessionStorage.getItem('tokenValue') export default { // 查询分页列表 @@ -9,7 +10,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, @@ -51,7 +53,8 @@ export default { method: 'post', data: params, headers: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json', + 'token': tokens } }) }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/user.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/user.js index dba15f70..5ba06bd2 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/user.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/api/user.js @@ -2,6 +2,22 @@ import request from '@/utils/request' // eslint-disable-next-line no-unused-vars import qs from 'qs' +// 登录 +export function doLogin(data) { + return request({ + url: '/cyf/sys/doLogin', + method: 'post', + data: data, + headers: { 'Content-Type': 'application/json' } + }) +} +// 获取登录人员信息 + export function getUserById(sid) { + return request({ + url: '/cyf/sys/getUserById/' + sid + }) + + } // 登录 export function login(data) { return request({ diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/assets/home/bj.jpg b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/assets/home/bj.jpg new file mode 100644 index 00000000..209287ae Binary files /dev/null and b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/assets/home/bj.jpg differ diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/layout/components/Navbar.vue b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/layout/components/Navbar.vue index a15bb217..ce084f0d 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/layout/components/Navbar.vue +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/layout/components/Navbar.vue @@ -19,18 +19,12 @@ export default { data() { return { - Orgname: '', - departmentName: '', name: '', year:'', - pNameAndDepartmentNameAndPostName:'' } }, mounted() { - this.Orgname = window.sessionStorage.getItem('Orgname') - this.departmentName = window.sessionStorage.getItem('departmentName') - this.pNameAndDepartmentNameAndPostName = window.sessionStorage.getItem('defaultOrgPathName') - this.name = window.sessionStorage.getItem('name') + this.name = window.sessionStorage.getItem('userName') var nowDate = new Date() this.year = nowDate.getFullYear() }, diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/router/index.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/router/index.js index 85eee04e..a166b139 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/router/index.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/router/index.js @@ -20,7 +20,7 @@ export const constantRoutes = [{ }, { path: '/', - redirect: 'index' + redirect: 'login' }, { path: '/login', component: () => import('@/views/login/login.vue') diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/utils/request.js b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/utils/request.js index 12093fa6..194f41dc 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/utils/request.js +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/utils/request.js @@ -1,7 +1,13 @@ import axios from 'axios' -import { MessageBox, Message } from 'element-ui' +import { + MessageBox, + Message +} from 'element-ui' import store from '@/store' -import { getToken, getStorage } from '@/utils/auth' +import { + getToken, + getStorage +} from '@/utils/auth' // create an axios instance const service = axios.create({ @@ -51,7 +57,7 @@ service.interceptors.response.use( response => { const res = response.data const statusCode = response.status - + console.log('statusCode>>>' + statusCode) // if the custom code is not 20000, it is judged as an error. if (statusCode !== 200) { Message({ @@ -62,7 +68,8 @@ service.interceptors.response.use( }) // 50008: Illegal token; 50012: Other clients logged in; 50014: Token expired; - if (statusCode === 401 || res.code === '5000' || res.code === 5000 || res.code === 50012 || res.code === 50014) { + if (statusCode === 401 || res.code === '5000' || res.code === 5000 || res.code === 50012 || res.code === + 50014) { // to re-login MessageBox.confirm('登录状态已过期,您可以继续留在该页面,或者重新登录', '系统提示', { confirmButtonText: '重新登录', @@ -77,7 +84,7 @@ service.interceptors.response.use( } return Promise.reject(new Error(res.message || 'Error')) } else { - if (!res.success) { + if (!res.success && res.success !== null && res.success !== undefined) { Message({ message: res.msg || 'Error', type: 'error', diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/index.vue b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/index.vue index ea1e53d3..f2344a5f 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/index.vue +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/index.vue @@ -37,6 +37,7 @@ +
diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/oilTypeAdd.vue b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/oilTypeAdd.vue index 7cea240d..84678cce 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/oilTypeAdd.vue +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/baseInfo/oilType/oilTypeAdd.vue @@ -28,6 +28,11 @@ 原油Code:
+
+ 原油单价: + +
@@ -45,13 +50,31 @@ sid: "", name: "", number: "", - code: "" + code: "", + price: "", } } }, methods: { + /** + * 1、必须为数字 + * 2、只能有一个小数点 + * 3、小数点后保留两位小数 + * 4、当第一位输入小数点的时候自动补全,补为 0. + * 5、除非是小数,否则数字不能以0开头 + * @param {string} value - 输入的值 + * @param {string} name - 匹配的对象属性 [mkPrice | slPrice] + */ + limitInput(value, name) { + this.formobj.price = + ("" + value) // 第一步:转成字符串 + .replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉 + .replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字 + .replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全 + .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数 + }, saveOrUpdate() { - if(this.formobj.sid){ + if (this.formobj.sid) { req.updateData(this.formobj) .then(resp => { if (resp.success) { @@ -66,7 +89,7 @@ } }) .catch(() => {}) - }else{ + } else { req.addInfo(this.formobj) .then(resp => { if (resp.success) { @@ -90,7 +113,8 @@ sid: "", name: "", number: "", - code: "" + code: "", + price: "", } this.$emit('doback') }, @@ -99,7 +123,7 @@ }, showEdit(row) { - console.log("sid>>>>>>>>>",row.sid) + console.log("sid>>>>>>>>>", row.sid) req.fetchBySid(row.sid) .then(resp => { if (resp.success) { @@ -176,4 +200,4 @@ } } - + \ No newline at end of file diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/index.vue b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/index.vue index 32f742ca..52931c87 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/index.vue +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/index.vue @@ -11,8 +11,16 @@ name: '', data() { return { - token:'' + token1:'', + token2:'' } + + }, + created() { + this.token1 = window.sessionStorage.getItem('tokenName'); + this.token2 = window.sessionStorage.getItem('tokenValue'); + console.log("tokenName2222", this.token1) + console.log("tokenValue222222", this.token2) }, methods:{ // getToken(){ diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/login/login.vue b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/login/login.vue index 985a79b2..4c5749fe 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/login/login.vue +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/login/login.vue @@ -1,8 +1,9 @@ diff --git a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/supervise/recordOilTank/index.vue b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/supervise/recordOilTank/index.vue index 476cd48c..10c8cb1c 100644 --- a/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/supervise/recordOilTank/index.vue +++ b/yxt-supervise-cyf/yxt-supervise-cyf-ui/src/views/supervise/recordOilTank/index.vue @@ -24,7 +24,7 @@
油罐库存高度: - +
登记材料: @@ -65,6 +65,23 @@ this.getTankList() }, methods: { + /** + * 1、必须为数字 + * 2、只能有一个小数点 + * 3、小数点后保留两位小数 + * 4、当第一位输入小数点的时候自动补全,补为 0. + * 5、除非是小数,否则数字不能以0开头 + * @param {string} value - 输入的值 + * @param {string} name - 匹配的对象属性 [mkPrice | slPrice] + */ + limitInput(value, name) { + this.formobj.height = + ("" + value) // 第一步:转成字符串 + .replace(/[^\d^\.]+/g, "") // 第二步:把不是数字,不是小数点的过滤掉 + .replace(/^0+(\d)/, "$1") // 第三步:第一位0开头,0后面为数字,则过滤掉,取后面的数字 + .replace(/^\./, "0.") // 第四步:如果输入的第一位为小数点,则替换成 0. 实现自动补全 + .match(/^\d*(\.?\d{0,2})/g)[0] || ""; // 第五步:最终匹配得到结果 以数字开头,只有一个小数点,而且小数点后面只能有0到2位小数 + }, getTankList() { req2.tankList().then((res) => { if (res.success) {