代码优化

dev2
Panzihang 2023-08-01 16:32:50 +08:00
parent 9daa1cb4b2
commit 710a105632
6 changed files with 86 additions and 70 deletions

View File

@ -81,7 +81,7 @@ module.exports = {
createShipmentShipLoadPlansRespList() {
console.log("创建作业查询表");
let sql =
'CREATE TABLE if not exists shipmentShipLoadPlansRespList ("webId" text NOT NULL,"agentId" text,"agentName" text,"amount" text,"brdId" text,"brdName" text,"bvdId" text,"bvdName" text,"bvmId" text,"bvmName" text,"carHeight" text,"carLength" text,"carWidth" text,"customsDeclareNo" text,"customsDeclareStatus" text,"mnfBl" text,"potId" text,"potName" text,"sourceType" text,"vvyId" text,"vvyName" text,"yardPos" text, PRIMARY KEY("webId"));'
'CREATE TABLE if not exists shipmentShipLoadPlansRespList ("webId" text NOT NULL,"agentId" text,"agentName" text,"amount" text,"brdId" text,"brdName" text,"bvdId" text,"bvdName" text,"bvmId" text,"bvmName" text,"carHeight" text,"carLength" text,"carWidth" text,"customsDeclareNo" text,"customsDeclareStatus" text,"mnfBl" text,"potId" text,"potName" text,"sourceType" text,"vvyId" text,"vvyName" text,"yardPos" text,"webStatus" text,"webDate" text, PRIMARY KEY("webId"));'
this.executeSql(sql)
},
executeSql(sql) {

View File

@ -34,6 +34,7 @@
</template>
<script>
import sqlite from "../../common/sqlite.js"
export default {
data() {
return {
@ -46,7 +47,7 @@
}
},
mounted() {
this.initData()
this.executeSql1('shipmentShipLoadPlansRespList')
setTimeout(() => {
this.menuList = [{
'title': '按港口',
@ -168,50 +169,17 @@
}, 2000)
},
methods: {
initData() {
this.listInfo = [{
brdName: "特斯拉",
mnfBl: "TD85875876",
sourceType: "新能源",
yardPos: "C4区15道*2,16道*2",
vvyName: "HC8595986",
customsDeclareStatus: "未报关",
bvmName: "轿车",
amount: "100",
potName: "巴塞罗那",
customsDeclareNo: "BG09759724",
bvdName: "无动力半挂车",
agentName: "华图供应链管理(天津)有限公司",
},
{
brdName: "比亚迪",
mnfBl: "TD85875876A",
sourceType: "新能源",
yardPos: "C4区15道*2,16道*2",
vvyName: "HC8595986",
customsDeclareStatus: "未报关",
bvmName: "轿车",
amount: "100",
potName: "巴塞罗那",
customsDeclareNo: "BG09759724",
bvdName: "无动力半挂车",
agentName: "华图供应链管理(天津)有限公司",
},
{
brdName: "比亚迪",
mnfBl: "TD85875876A",
sourceType: "新能源",
yardPos: "C4区15道*2,16道*2",
vvyName: "HC8595986",
customsDeclareStatus: "未报关",
bvmName: "轿车",
amount: "100",
potName: "巴塞罗那",
customsDeclareNo: "BG09759724",
bvdName: "无动力半挂车",
agentName: "华图供应链管理(天津)有限公司",
}
]
//
executeSql1(tableName) {
let sql = `select * from ${tableName}`
sqlite.executeSqlCeshi(sql).then((value) => {
// resolve
this.listInfo = value
console.log(this.listInfo)
}).catch((error) => {
// reject
console.error(error);
});
},
//
iconClick() {
@ -243,7 +211,6 @@
resultConditon(obj) {
this.$refs.condition.visibleDrawer = false;
this.hasChoose = obj.hasChoose;
console.log(obj);
},
//
togoCar(item) {

View File

@ -97,6 +97,7 @@
import HeadInfo from '@/components/head-info/head-info';
import sqlite from "../../common/sqlite.js"
import tableList from "../../common/createDataTable.js"
import api from "../../common/api.js"
export default {
data() {
return {
@ -114,11 +115,55 @@
pageSize: 4,
current: 1,
shipInfo: {}
shipInfo: {},
workList: [{
agentId: "1",
agentName: "华图供应链管理(天津)有限公司",
amount: "100",
brdId: "1",
brdName: "特斯拉1",
bvdId: "1",
bvdName: "无动力半挂车",
bvmId: "1",
bvmName: "轿车",
carHeight: "100",
carLength: "111",
carWidth: "123",
customsDeclareNo: "BG09759724",
customsDeclareStatus: "未报关",
mnfBl: "TD85875876",
potId: "1",
potName: "巴塞罗那",
sourceType: "新能源",
vvyId: "1",
vvyName: "HC8595986",
yardPos: "C4区15道*2,16道*2",
},
{
agentId: "1",
agentName: "华图供应链管理(天津)有限公司",
amount: "100",
brdId: "1",
brdName: "特斯拉2",
bvdId: "1",
bvdName: "无动力半挂车",
bvmId: "1",
bvmName: "轿车",
carHeight: "100",
carLength: "111",
carWidth: "123",
customsDeclareNo: "BG09759724",
customsDeclareStatus: "未报关",
mnfBl: "TD85875876",
potId: "1",
potName: "巴塞罗那",
sourceType: "新能源",
vvyId: "1",
vvyName: "HC8595986",
yardPos: "C4区15道*2,16道*2",
}
]
}
},
onLoad() {
},
components: {
SideBar,
@ -165,11 +210,11 @@
},
dropTable() {
console.log('删除表');
let sql = 'DROP TABLE attachUnmoorRespList;'
let sql = 'DROP TABLE shipmentShipLoadPlansRespList;'
this.executeSql(sql)
},
dropData() {
let sql = "delete from messageRespList"
let sql = "delete from shipmentShipLoadPlansRespList"
this.executeSql(sql)
},
add() {
@ -282,6 +327,22 @@
download(item) {
//
tableList.createAllTable()
let webStatus = 0
let sql = ""
for (let i = 0; i < this.workList.length; i++) {
let date = new Date().getTime()
let str = String(date)
let webId = Number(str.slice(str.length - 5))
let webDate = api.getDate(date)
sql =
`insert into shipmentShipLoadPlansRespList values('${webId}','${this.workList[i].agentId}','${this.workList[i].agentName}',
'${this.workList[i].amount}','${this.workList[i].brdId}','${this.workList[i].brdName}','${this.workList[i].bvdId}','${this.workList[i].bvdName}','${this.workList[i].bvmId}',
'${this.workList[i].bvmName}','${this.workList[i].carHeight}','${this.workList[i].carLength}','${this.workList[i].carWidth}',
'${this.workList[i].customsDeclareNo}','${this.workList[i].customsDeclareStatus}','${this.workList[i].mnfBl}','${this.workList[i].potId}','${this.workList[i].potName}',
'${this.workList[i].sourceType}','${this.workList[i].vvyId}','${this.workList[i].vvyName}','${this.workList[i].yardPos}',
'${webStatus}','${webDate}')`
this.executeSql(sql)
}
// let ids = []
// if (item.inVvyId != null && item.outVvyId == null) {
// ids.push(item.inVvyId)

View File

@ -39,7 +39,8 @@
},
methods: {
//
executeSql(sql) {
executeSql1(tableName) {
let sql = `select * from ${tableName}`
sqlite.executeSqlCeshi(sql).then((value) => {
// resolve
this.infoList = value
@ -49,10 +50,6 @@
console.error(error);
});
},
executeSql1(tableName) {
let sql = `select * from ${tableName}`
this.executeSql(sql)
},
//
sign() {
uni.navigateTo({

View File

@ -65,6 +65,7 @@
<script>
import sqlite from "../../common/sqlite.js"
import api from "../../common/api.js"
export default {
data() {
return {
@ -208,7 +209,7 @@
let str = String(date)
let webId = Number(str.slice(str.length - 5))
let webStatus = 0
let webDate = this.getDate(date)
let webDate = api.getDate(date)
if (this.obj.state == "edit") {
let sql =
`UPDATE shipmentQualityConsultationRespList SET vvyId = '${this.vvyId}', vvyName = '${this.vvyName}',
@ -265,17 +266,6 @@
url: `/pages/shipWork/opinionAdd?params=${params}`
})
},
//
getDate(date) {
var date = new Date(date);
var YY = date.getFullYear() + '-';
var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
return YY + MM + DD + " " + hh + mm + ss;
},
executeSql(sql) {
sqlite.executeSqlCeshi(sql).then((value) => {
// resolve

View File

@ -167,6 +167,7 @@
}
});
}
}
};
</script>