Browse Source

151551

master
lc18518571399 9 months ago
parent
commit
05c34a76f7
  1. 4
      api/app/service/chanpin.js
  2. 2
      api/app/service/dingdan.js
  3. 4
      api/app/service/user.js
  4. 32
      front/src/renderer/src/views/chanpin.vue
  5. 32
      front/src/renderer/src/views/user.vue

4
api/app/service/chanpin.js

@ -26,6 +26,10 @@ class ChanpinService extends Service {
let res = await modelLocal.updateMany({ _id: { $in: paramsLocal.ids } }, { isExit: 0, update_at: Date.now() })
returnData.hasError = false
returnData.msg = "数据删除成功"
} else if (subType === "delAll") {
await modelLocal.deleteMany({ "update_at": { $lt: Date.now() + 1000 * 60 * 60 * 24 } })
returnData.hasError = false
returnData.msg = "数据已全部删除"
} else if (subType === "edit") {
paramsLocal = paramsLocal.list[0]
paramsLocal["update_at"] = Date.now();

2
api/app/service/dingdan.js

@ -167,6 +167,7 @@ class DingdanService extends Service {
item["xiangtiaoma"] = _.get(chanpinItemA, [0, "xiangtiaoxingma"], "")
item["zuidaxiangtiaoma"] = _.get(chanpinItemA, [0, "zuidaxiangzhuangtiaoma"], "")
} else if (chanpinItemB.length) {
item.isNotSale = false
item["huohao"] = _.get(chanpinItemB, [0, "daima"], "")
item["chanpindaima"] = _.get(chanpinItemB, [0, "daima"], "")
item["zuixiaodanweitiaoma"] = _.get(chanpinItemB, [0, "tiaoxingma"], "")
@ -182,6 +183,7 @@ class DingdanService extends Service {
item["xiangtiaoma"] = _.get(chanpinItemB, [0, "xiangtiaoxingma"], "")
item["zuidaxiangtiaoma"] = _.get(chanpinItemB, [0, "zuidaxiangzhuangtiaoma"], "")
} else if (chanpinItemC.length) {
item.isNotSale = false
item["huohao"] = _.get(chanpinItemC, [0, "daima"], "")
item["chanpindaima"] = _.get(chanpinItemC, [0, "daima"], "")
item["zuixiaodanweitiaoma"] = _.get(chanpinItemC, [0, "tiaoxingma"], "")

4
api/app/service/user.js

@ -26,6 +26,10 @@ class UserService extends Service {
let res = await modelLocal.updateMany({ _id: { $in: paramsLocal.ids } }, { isExit: 0, update_at: Date.now() })
returnData.hasError = false
returnData.msg = "数据删除成功"
} else if (subType === "delAll") {
await modelLocal.deleteMany({ "update_at": { $lt: Date.now() + 1000 * 60 * 60 * 24 } })
returnData.hasError = false
returnData.msg = "数据已全部删除"
} else if (subType === "edit") {
paramsLocal = paramsLocal.list[0]
paramsLocal["update_at"] = Date.now();

32
front/src/renderer/src/views/chanpin.vue

@ -13,6 +13,12 @@
</el-icon>
<span>删除</span>
</el-button>
<el-button type="danger" @click="delAll">
<el-icon>
<Delete />
</el-icon>
<span>清空</span>
</el-button>
<div class="inputClass uploadClass">
<el-upload :show-file-list="false" v-model="fileOriData" :before-upload="beforeAvatarUpload"
:http-request="successSubmit" accept=".xls,.xlsx,.csv">
@ -328,7 +334,33 @@ export default {
})
})
},
//
delAll() {
ElMessageBox.confirm(
`是否删除全部数据?此操作不可逆!`,
'危险操作',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'danger',
}
)
.then(async () => {
let params = {
subType: "delAll",
url: "/api/chanpinInfo",
}
await this.updateSeach(params)
await this.searchData()
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消删除',
})
})
},
},
async mounted() {
this.tableHeader = _.filter(tableHeaderLocal, o => o.tableShow)

32
front/src/renderer/src/views/user.vue

@ -13,6 +13,12 @@
</el-icon>
<span>删除</span>
</el-button>
<el-button type="danger" @click="delAll">
<el-icon>
<Delete />
</el-icon>
<span>清空</span>
</el-button>
<div class="inputClass uploadClass">
<el-upload :show-file-list="false" v-model="fileOriData" :before-upload="beforeAvatarUpload"
:http-request="successSubmit" accept=".xls,.xlsx,.csv">
@ -329,7 +335,33 @@ export default {
})
})
},
//
delAll() {
ElMessageBox.confirm(
`是否删除全部数据?此操作不可逆!`,
'危险操作',
{
confirmButtonText: '确认',
cancelButtonText: '取消',
type: 'danger',
}
)
.then(async () => {
let params = {
subType: "delAll",
url: "/api/userInfo",
}
await this.updateSeach(params)
await this.searchData()
})
.catch(() => {
ElMessage({
type: 'info',
message: '取消删除',
})
})
},
},
async mounted() {
this.tableHeader = _.filter(tableHeaderLocal, o => o.tableShow)

Loading…
Cancel
Save