diff --git a/mock/modules/ycy.js b/mock/modules/ycy.js index 2ff4322..34581ae 100644 --- a/mock/modules/ycy.js +++ b/mock/modules/ycy.js @@ -3,8 +3,8 @@ const StockList = Mock.mock({ "list|20-30": [ { "id|+1": "0", - billserial: "@integer(10000000000,19999999999)", - billType: "@integer(0,5)", + billserial: "@integer(100000000,199999999)1", + billType: "@integer(0,4)", stockNum: "@integer(1,2)", unit: "@cword(张本,1)", stockDate: "@date", @@ -19,12 +19,9 @@ export default [ url: "/api/stockList", method: "get", response: () => { - const obj = { - list: StockList, - }; return { code: 200, - data: obj, + data: StockList, }; }, }, diff --git a/package.json b/package.json index e6303e4..c275677 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "less": "^4.2.0", "mockjs": "^1.1.0", "pinia": "^2.1.7", + "pinia-plugin-persistedstate": "^3.2.1", "tdesign-vue-next": "^1.9.3", "vite-plugin-mock": "^3.0.1", "vue": "^3.4.21", diff --git a/src/main.js b/src/main.js index 12a4bcf..90cd15a 100644 --- a/src/main.js +++ b/src/main.js @@ -1,16 +1,19 @@ -import './style/index.css' +import "./style/index.css"; -import { createApp } from 'vue' -import { createPinia } from 'pinia' -import TDesign from 'tdesign-vue-next'; +import { createApp } from "vue"; +import { createPinia } from "pinia"; +import piniaPluginPersistedstate from "pinia-plugin-persistedstate"; +import TDesign from "tdesign-vue-next"; -import App from './App.vue' -import router from './router' +import App from "./App.vue"; +import router from "./router"; -const app = createApp(App) +const app = createApp(App); -app.use(createPinia()) -app.use(router) +const pinia = createPinia(); +pinia.use(piniaPluginPersistedstate); +app.use(pinia); +app.use(router); app.use(TDesign); -app.mount('#app') +app.mount("#app"); diff --git a/src/pages/finance-bill-manage/billStock.vue b/src/pages/finance-bill-manage/billStock.vue index ed57b49..595b7d0 100644 --- a/src/pages/finance-bill-manage/billStock.vue +++ b/src/pages/finance-bill-manage/billStock.vue @@ -5,83 +5,277 @@ ref="form" :data="formData" label-width="calc(2em + 40px)" - :layout="formData.layout" + layout="inline" scroll-to-first-error="smooth" class="scarch-from" + @reset="resetting" + @submit="headerQuery" >
- - + + - - + + + + + + +
- - 查询 - 重置 + + 查询 + 重置
+
+
+

票据列表

+
+
+ + + 新增票据 + + + + +
+
+ :pagination="pagination" + class="table" + :max-height="650" + > + + +
+ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + 提交 + 重置 + + + +
+
+
+
@@ -132,8 +404,15 @@ onMounted(() => { height: 41rem; background-color: @base-white-color; padding: 1rem; + padding-top: 0; + .table-header { + height: 3rem; + display: flex; + justify-content: space-between; + align-items: center; + } } -/deep/ .t-form__controls-content { +:deep(.t-form__controls-content) { justify-content: space-between; } diff --git a/src/stores/billStock.js b/src/stores/billStock.js new file mode 100644 index 0000000..f4e1ba2 --- /dev/null +++ b/src/stores/billStock.js @@ -0,0 +1,31 @@ +import { defineStore } from "pinia"; +import { reqStockList } from "@/api/stockList"; + +export const useStock = defineStore("menuManagement", { + state: () => { + return { + stockList: [], + }; + }, + actions: { + async getStockList() { + let { data } = await reqStockList(); + this.stockList = data.list; + return this.stockList; + }, + addStockList(arr) { + const index = this.stockList.findIndex((item) => item.id === arr.id); + if (index !== -1) { + this.stockList[index] = arr; + } else { + arr.id = new Date().getTime(); + this.stockList.unshift(arr); + } + }, + deleteStockList(item) { + let arr = this.stockList.filter((i) => i.id !== item.id); + this.stockList = arr; + }, + }, + persist: true, +}); diff --git a/src/stores/index.js b/src/stores/index.js new file mode 100644 index 0000000..d0c3a50 --- /dev/null +++ b/src/stores/index.js @@ -0,0 +1,9 @@ +import { createPinia } from "pinia"; +import piniaPluginPersistedstate from "pinia-plugin-persistedstate"; + +const pinia = createPinia(); +pinia.use(piniaPluginPersistedstate); + +export { store }; + +export default store; diff --git a/vite.config.js b/vite.config.js index b8b7c4f..7f06cc0 100644 --- a/vite.config.js +++ b/vite.config.js @@ -8,6 +8,14 @@ import { viteMockServe } from "vite-plugin-mock"; // https://vitejs.dev/config/ export default defineConfig({ + server: { + proxy: { + "/api": { + target: "http://192.168.1.10:8000", + changeOrigin: true, + }, + }, + }, plugins: [ vue(), vueJsx(),