Commit 0bc94680 by linjinhong

fix:修改dtf设置问题

parent ac5c92d4
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"name": "JomallProductionAssistant", "name": "JomallProductionAssistant",
"productName": "JomallProductionAssistant", "productName": "JomallProductionAssistant",
"description": "", "description": "",
"version": "1.0.38", "version": "1.0.4",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
......
...@@ -58,9 +58,9 @@ service.interceptors.response.use( ...@@ -58,9 +58,9 @@ service.interceptors.response.use(
showClose: true, showClose: true,
message: res.msg || res.message || "Error" message: res.msg || res.message || "Error"
}); });
// setTimeout(() => { setTimeout(() => {
// location.reload(); location.reload();
// }, 500); }, 500);
return Promise.reject(new Error(res.msg || res.message || "Error")); return Promise.reject(new Error(res.msg || res.message || "Error"));
} }
......
...@@ -87,6 +87,7 @@ export default { ...@@ -87,6 +87,7 @@ export default {
} }
}, },
async getCardList(value) { async getCardList(value) {
this.selection = [];
let params = { let params = {
currentPage: this.pageInfo.currentPage, currentPage: this.pageInfo.currentPage,
pageSize: this.pageInfo.pageSize, pageSize: this.pageInfo.pageSize,
......
...@@ -96,8 +96,8 @@ export default { ...@@ -96,8 +96,8 @@ export default {
v-model="searchForm.startTime" v-model="searchForm.startTime"
type="datetime" type="datetime"
placeholder="选择创建时间" placeholder="选择创建时间"
format="yyyy 年 MM 月 dd 日" format="yyyy-MM-dd HH:mm:ss"
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss"
> >
</el-date-picker </el-date-picker
></el-form-item> ></el-form-item>
......
...@@ -140,9 +140,13 @@ export default { ...@@ -140,9 +140,13 @@ export default {
}, },
methods: { methods: {
async loadLocalConfig() { async loadLocalConfig() {
console.log(getDTFSetting());
try { try {
if (!getDTFSetting().downloadDir) { if (!getDTFSetting().downloadDir) {
const path = ipcRenderer.sendSync("get-install-path"); const path = ipcRenderer.sendSync("get-install-path");
console.log(111111);
setDTFSetting({ downloadDir: path }); setDTFSetting({ downloadDir: path });
} }
} catch (error) { } catch (error) {
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
v-model.number="form.materialCount" v-model.number="form.materialCount"
placeholder="请输入素材数" placeholder="请输入素材数"
style="width: 180px; margin-left: 8px" style="width: 180px; margin-left: 8px"
:disabled="form.materialStrategy !== '2'" :disabled="form.materialStrategy !== 2"
/> />
</div> </div>
</el-radio-group> </el-radio-group>
...@@ -66,9 +66,9 @@ ...@@ -66,9 +66,9 @@
</div> </div>
</div> </div>
<div class="btn-wrap"> <!-- <div class="btn-wrap">
<el-button type="primary" @click="saveConfig">保存设置</el-button> <el-button type="primary" @click="saveConfig">保存设置</el-button>
</div> </div> -->
</el-card> </el-card>
</div> </div>
</div> </div>
...@@ -78,18 +78,36 @@ ...@@ -78,18 +78,36 @@
const { ipcRenderer } = require("electron"); const { ipcRenderer } = require("electron");
const { setDTFSetting, getDTFSetting } = require("@/server/utils/store"); const { setDTFSetting, getDTFSetting } = require("@/server/utils/store");
const { pathMap } = require("@/config/index.js"); const { pathMap } = require("@/config/index.js");
import debounce from "lodash/debounce";
export default { export default {
name: "dtf-setting", name: "dtf-setting",
data() { data() {
return { return {
// 表单配置,可从本地配置文件读取初始化 // 表单配置,可从本地配置文件读取初始化
form: { ...getDTFSetting() } form: {},
isInitLoad: true
}; };
}, },
mounted() { mounted() {
// 页面加载读取本地配置回填表单 // 页面加载读取本地配置回填表单
this.loadLocalConfig(); this.loadLocalConfig();
this.debounceSaveConfig = debounce(() => {
this.saveConfig();
}, 300);
},
watch: {
form: {
handler() {
console.log(999);
if (this.isInitLoad) return;
this.debounceSaveConfig();
},
deep: true
}
},
beforeDestroy() {
// 组件销毁清除防抖,防止内存泄漏
this.debounceSaveConfig.cancel();
}, },
methods: { methods: {
// 返回上一页 // 返回上一页
...@@ -98,29 +116,40 @@ export default { ...@@ -98,29 +116,40 @@ export default {
}, },
// 读取本地配置 // 读取本地配置
async loadLocalConfig() { async loadLocalConfig() {
this.isFist = true;
try { try {
const { data } = await this.$api.post(pathMap["productionConfig"]); const { data } = await this.$api.post(pathMap["productionConfig"]);
this.form = { ...data }; this.form = { ...getDTFSetting(), ...data };
console.log(94, this.form); console.log(94, this.form);
if (!this.form.downloadDir) { // if (!this.form.downloadDir) {
const path = ipcRenderer.sendSync("get-install-path"); // const path = ipcRenderer.sendSync("get-install-path");
this.form.downloadDir = path; // this.form.downloadDir = path;
} // }
setDTFSetting({ ...this.form }); setDTFSetting({ ...this.form });
this.$nextTick(() => (this.isInitLoad = false));
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }
}, },
// 选择文件夹弹窗 // 选择文件夹弹窗
selectFolder() { selectFolder() {
ipcRenderer.removeAllListeners("select-folder-result");
ipcRenderer.send("request-select-folder", this.form.downloadDir); ipcRenderer.send("request-select-folder", this.form.downloadDir);
ipcRenderer.once("select-folder-result", (_, path) => { ipcRenderer.once("select-folder-result", (_, path) => {
if (path) this.form.downloadDir = path; if (path) {
this.form = {
...this.form,
downloadDir: path
};
}
}); });
console.log("selectFolder", this.form); // console.log("selectFolder", this.form);
}, },
// 保存配置到本地文件 // 保存配置到本地文件
async saveConfig() { async saveConfig() {
console.log(999);
if (this.form.autoLayoutStrategy == 2 && this.form.widthStrategy == 3) { if (this.form.autoLayoutStrategy == 2 && this.form.widthStrategy == 3) {
await this.$confirm( await this.$confirm(
"由于排版设置中选择“按更大规格排版”仅适用于40+2,选60时,默认超60的规格不排版", "由于排版设置中选择“按更大规格排版”仅适用于40+2,选60时,默认超60的规格不排版",
...@@ -133,6 +162,9 @@ export default { ...@@ -133,6 +162,9 @@ export default {
} }
await this.$api.post(pathMap["productionConfigUpdate"], this.form); await this.$api.post(pathMap["productionConfigUpdate"], this.form);
setDTFSetting({ ...this.form }); setDTFSetting({ ...this.form });
console.log(getDTFSetting());
console.log(this.form);
this.$message.success("排版设置保存成功!"); this.$message.success("排版设置保存成功!");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment