调整
This commit is contained in:
109
src/components/AiSelect.vue
Normal file
109
src/components/AiSelect.vue
Normal file
@@ -0,0 +1,109 @@
|
|||||||
|
<template>
|
||||||
|
<div class="ai-select">
|
||||||
|
<el-select
|
||||||
|
style="width: 100%;"
|
||||||
|
:clearable="clearable"
|
||||||
|
:value="value"
|
||||||
|
:size="$attrs.size || 'small'"
|
||||||
|
v-bind="$attrs"
|
||||||
|
v-on="$listeners">
|
||||||
|
<el-option
|
||||||
|
v-for="(item, index) in selectList"
|
||||||
|
:key="index"
|
||||||
|
:label="item.dictName"
|
||||||
|
:value="item.dictValue">
|
||||||
|
<slot :info="item"></slot>
|
||||||
|
</el-option>
|
||||||
|
</el-select>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'AiSelect',
|
||||||
|
|
||||||
|
model: {
|
||||||
|
prop: 'value',
|
||||||
|
event: 'change'
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
instance: {
|
||||||
|
deep: true,
|
||||||
|
handler(v) {
|
||||||
|
v && this.isAction && !this.options.toString() && this.getOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
value: {
|
||||||
|
type: [String, Number, Array]
|
||||||
|
},
|
||||||
|
|
||||||
|
clearable: {
|
||||||
|
type: Boolean,
|
||||||
|
default: true
|
||||||
|
},
|
||||||
|
|
||||||
|
selectList: {
|
||||||
|
type: Array
|
||||||
|
},
|
||||||
|
|
||||||
|
width: {
|
||||||
|
type: String,
|
||||||
|
default: '216'
|
||||||
|
},
|
||||||
|
instance: Function,
|
||||||
|
action: {default: ""},
|
||||||
|
prop: {
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
options: [],
|
||||||
|
filter: ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
selectWidth() {
|
||||||
|
if (this.width.indexOf('px') > -1) {
|
||||||
|
return this.width
|
||||||
|
}
|
||||||
|
return `${this.width}px`
|
||||||
|
},
|
||||||
|
isAction() {
|
||||||
|
return !!this.action
|
||||||
|
},
|
||||||
|
actionOps() {
|
||||||
|
return this.options.filter(e => !this.filter || e[this.actionProp.label].indexOf(this.filter) > -1)
|
||||||
|
},
|
||||||
|
actionProp() {
|
||||||
|
return {
|
||||||
|
label: 'label',
|
||||||
|
value: 'id',
|
||||||
|
...this.prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getOptions() {
|
||||||
|
this.instance?.post(this.action, null, {
|
||||||
|
params: {size: 999}
|
||||||
|
}).then(res => {
|
||||||
|
if (res?.data) {
|
||||||
|
this.options = res.data.records || res.data
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getOptions()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
::v-deep .ai-select .el-select {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"manifest_version": 3,
|
"manifest_version": 3,
|
||||||
"name": "TEMU助手",
|
"name": "TEMU助手",
|
||||||
"description": "TEMU助手 - 自动化提高生产效率",
|
"description": "TEMU助手 - 自动化提高生产效率",
|
||||||
"version": "2.0.3",
|
"version": "2.1.0",
|
||||||
"background": {
|
"background": {
|
||||||
"service_worker": "/background.js"
|
"service_worker": "/background.js"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import store from '../store'
|
|||||||
import { Message } from 'element-ui'
|
import { Message } from 'element-ui'
|
||||||
|
|
||||||
const dict = {
|
const dict = {
|
||||||
url: "/dictionary/queryValsByCodeList",
|
url: "/api/dictionary/queryValsByCodeList",
|
||||||
loading: [],
|
loading: [],
|
||||||
resolves: [],
|
resolves: [],
|
||||||
getStorage() {
|
getStorage() {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
<!--<el-button type="primary" :disabled="isBegin" @click="isShow = true">添加备货单</el-button>
|
<!--<el-button type="primary" :disabled="isBegin" @click="isShow = true">添加备货单</el-button>
|
||||||
<el-button type="primary" :disabled="isBegin" @click="loadAll">一键加载全部</el-button>-->
|
<el-button type="primary" :disabled="isBegin" @click="loadAll">一键加载全部</el-button>-->
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-button v-if="!isBegin" type="button" :class="'el-button el-button--primary'" @click="handleRobClick('normal')">开始抢仓</el-button>
|
<el-button v-if="!isBegin" type="button" :class="'el-button el-button--primary'" @click="robDlgShow = true">开始抢仓</el-button>
|
||||||
<!--<el-dropdown @command="handleRobClick" v-if="!isBegin">
|
<!--<el-dropdown @command="handleRobClick" v-if="!isBegin">
|
||||||
<el-button type="button" :class="'el-button el-button--primary'">开始抢仓</el-button>
|
<el-button type="button" :class="'el-button el-button--primary'">开始抢仓</el-button>
|
||||||
<el-dropdown-menu slot="dropdown">
|
<el-dropdown-menu slot="dropdown">
|
||||||
@@ -192,6 +192,38 @@
|
|||||||
<el-button @click="successDlgShow = false">关 闭</el-button>
|
<el-button @click="successDlgShow = false">关 闭</el-button>
|
||||||
</span>
|
</span>
|
||||||
</AiDialog>
|
</AiDialog>
|
||||||
|
|
||||||
|
<AiDialog
|
||||||
|
title="抢仓设置"
|
||||||
|
:visible.sync="robDlgShow"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
customFooter
|
||||||
|
width="600px">
|
||||||
|
<el-alert
|
||||||
|
title="抢仓速度 = 频率 + 0~变动值之间的随机数,如频率设置为1.5秒,变动值为500毫秒,则抢仓速度为1.5秒~2秒。"
|
||||||
|
type="success"
|
||||||
|
:closable="false">
|
||||||
|
</el-alert>
|
||||||
|
<el-form :model="robForm" ref="robForm" label-width="120px" class="form">
|
||||||
|
<el-form-item
|
||||||
|
prop="step"
|
||||||
|
label="频率:"
|
||||||
|
:rules="[{ required: true, message: '请选择抢仓频率', trigger: 'blur' }]">
|
||||||
|
<ai-select :selectList="$dict.getDict('rob_frequency')" v-model="robForm.step"></ai-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item
|
||||||
|
prop="randomValue"
|
||||||
|
label="变动值(毫秒):"
|
||||||
|
:rules="[{ required: true, message: '请输入变动值', trigger: 'blur' }]">
|
||||||
|
<el-input size="small" placeholder="请输入变动值" type="number" v-model="robForm.randomValue"></el-input>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<span slot="footer" class="dialog-footer">
|
||||||
|
<el-button @click="robDlgShow = false">关 闭</el-button>
|
||||||
|
<el-button type="primary" @click="beforeBegin">开 始</el-button>
|
||||||
|
</span>
|
||||||
|
</AiDialog>
|
||||||
</template>
|
</template>
|
||||||
</ai-list>
|
</ai-list>
|
||||||
</div>
|
</div>
|
||||||
@@ -240,8 +272,10 @@
|
|||||||
robTotal: 0,
|
robTotal: 0,
|
||||||
pageSize: 100,
|
pageSize: 100,
|
||||||
currentPage: 1,
|
currentPage: 1,
|
||||||
step: 500,
|
robForm: {
|
||||||
randomValue: 500,
|
step: "1000",
|
||||||
|
randomValue: 1000
|
||||||
|
},
|
||||||
timer: [],
|
timer: [],
|
||||||
loadMallIndex: 0,
|
loadMallIndex: 0,
|
||||||
loadMode: 0, // 加载模式,0表示单个店铺加载,1表示一键加载
|
loadMode: 0, // 加载模式,0表示单个店铺加载,1表示一键加载
|
||||||
@@ -254,6 +288,8 @@
|
|||||||
successDlgShow: false,
|
successDlgShow: false,
|
||||||
successMallId: '',
|
successMallId: '',
|
||||||
successList: [],
|
successList: [],
|
||||||
|
|
||||||
|
robDlgShow: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -270,6 +306,7 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
created () {
|
created () {
|
||||||
|
this.$dict.load('rob_frequency');
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
@@ -323,6 +360,14 @@
|
|||||||
this.loadAll()
|
this.loadAll()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
beforeBegin() {
|
||||||
|
this.$refs.robForm.validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
this.handleRobClick('normal')
|
||||||
|
this.robDlgShow = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
handleRobClick (e) {
|
handleRobClick (e) {
|
||||||
this.networkErrorCount = 0
|
this.networkErrorCount = 0
|
||||||
@@ -513,7 +558,7 @@
|
|||||||
// 继续抢
|
// 继续抢
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.rob()
|
this.rob()
|
||||||
}, this.step + Math.floor(Math.random() * this.randomValue))
|
}, parseInt(this.robForm.step) + Math.floor(Math.random() * parseInt(this.robForm.randomValue)))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user