From 0497d62499e95103f83c78a77a2ec7784e992732 Mon Sep 17 00:00:00 2001 From: gaoshp <291585735@qq.com> Date: 星期日, 12 五月 2024 13:43:56 +0800 Subject: [PATCH] 仓库 --- src/components/scTable/index.vue | 10 +- src/utils/request.js | 10 +- src/views/console/basic-data/material-warehousing-data/Material-warehousing-data.vue | 31 +++++ src/views/console/basic-data/material-warehousing-data/Material-warehousing-dataComp.vue | 218 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 255 insertions(+), 14 deletions(-) diff --git a/src/components/scTable/index.vue b/src/components/scTable/index.vue index 737b797..6416bf1 100644 --- a/src/components/scTable/index.vue +++ b/src/components/scTable/index.vue @@ -4,16 +4,16 @@ * @Author: sakuya * @Date: 2021骞�11鏈�29鏃�21:51:15 * @LastEditors: Sneed - * @LastEditTime: 2024-05-12 13:00:03 + * @LastEditTime: 2024-05-12 13:35:21 --> <template> <div class="scTable" :style="{ 'height': _height }" ref="scTableMain" v-loading="loading"> <div class="scTable-table" :style="{ 'height': _table_height }"> <el-table v-bind="$attrs" :data="tableData" :row-key="rowKey" :key="toggleIndex" ref="scTable" - :height="height == 'auto' ? null : '100%'" :size="config.size" :border="config.border" :stripe="config.stripe" - :summary-method="remoteSummary ? remoteSummaryMethod : summaryMethod" @sort-change="sortChange" - @filter-change="filterChange"> + :height="height == 'auto' ? null : '100%'" :size="config.size" :border="config.border" + :stripe="config.stripe" :summary-method="remoteSummary ? remoteSummaryMethod : summaryMethod" + @sort-change="sortChange" @filter-change="filterChange"> <slot></slot> <template v-for="(item, index) in userColumn" :key="index"> <el-table-column v-if="!item.hide" :column-key="item.prop" :label="item.label" :prop="item.prop" @@ -200,7 +200,7 @@ var res = await this.apiObj.get(reqData); } catch (error) { this.loading = false; - this.emptyText = error.statusText; + this.emptyText = error?.statusText; return false; } try { diff --git a/src/utils/request.js b/src/utils/request.js index 0519da1..e680a48 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -35,11 +35,11 @@ axios.interceptors.response.use( (response) => { if (response.data.code && response.data.code !== 200) { - ElMessage({ - message: response.data.msg, - type: 'warning', - }) - return new Error() + // ElMessage({ + // message: response.data.msg, + // type: 'warning', + // }) + // return new Error() // return new Error(); } return response; diff --git a/src/views/console/basic-data/material-warehousing-data/Material-warehousing-data.vue b/src/views/console/basic-data/material-warehousing-data/Material-warehousing-data.vue index 20f7f6c..681f941 100644 --- a/src/views/console/basic-data/material-warehousing-data/Material-warehousing-data.vue +++ b/src/views/console/basic-data/material-warehousing-data/Material-warehousing-data.vue @@ -1,18 +1,41 @@ <!-- * @Date: 2024-05-07 22:52:01 * @LastEditors: Sneed - * @LastEditTime: 2024-05-07 22:52:21 + * @LastEditTime: 2024-05-12 13:40:56 * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/basic-data/material-warehousing-data/Material-warehousing-data.vue --> <template> - <div> - 鍑哄叆搴撶被鍨� - </div> + <el-main style="height: 100%;"> + <el-card shadow="never" style="height: 100%;" body-style="height: 100%"> + <el-tabs v-model="activeName" type="card" @tab-click="handleClick"> + <el-tab-pane label="鍑哄簱绫诲瀷" name="1"> + <MaterialWarehousingDataCompVue name="鍑哄簱" tableUrl="/api/blade-cps/stock-out-type/page" + insertUrl="/api/blade-cps/stock-out-type/insert" + removeUrl="/api/blade-cps/stock-out-type/remove" + updateUrl="/api/blade-cps/stock-out-type/update" /> + </el-tab-pane> + <el-tab-pane label="鍏ュ簱绫诲瀷" name="2"> + <MaterialWarehousingDataCompVue name="鍏ュ簱" tableUrl="/api/blade-cps/stock-in-type/page" + insertUrl="/api/blade-cps/stock-in-type/insert" removeUrl="/api/blade-cps/stock-in-type/remove" + updateUrl="/api/blade-cps/stock-in-type/update" /> + </el-tab-pane> + </el-tabs> + </el-card> + </el-main> </template> <script> +import MaterialWarehousingDataCompVue from './Material-warehousing-dataComp.vue' export default { + components: { + MaterialWarehousingDataCompVue, + }, + data() { + return { + activeName: '1', + } + }, } </script> diff --git a/src/views/console/basic-data/material-warehousing-data/Material-warehousing-dataComp.vue b/src/views/console/basic-data/material-warehousing-data/Material-warehousing-dataComp.vue new file mode 100644 index 0000000..89eef03 --- /dev/null +++ b/src/views/console/basic-data/material-warehousing-data/Material-warehousing-dataComp.vue @@ -0,0 +1,218 @@ +<!-- + * @Date: 2024-05-08 21:29:53 + * @LastEditors: Sneed + * @LastEditTime: 2024-05-12 13:43:21 + * @FilePath: /belleson-frontend/Users/mache/Documents/demo/cps-web/src/views/console/basic-data/material-warehousing-data/Material-warehousing-dataComp.vue +--> +<template> + <el-containter> + <el-header> + <el-button @click="table_add" type="primary" icon="el-icon-plus"></el-button> + <el-popconfirm width="220" cancel-button-text="鍋滅敤" confirm-button-text="鍒犻櫎" + title="鍒犻櫎鏁版嵁浼氬奖鍝嶅凡鍏宠仈鐨勪笟鍔� ,鑻ユ偍鎯冲湪宸插叧鑱旂殑涓氬姟涓緷鐒舵樉绀鸿繖浜涙暟鎹�, 鎮ㄥ彲浠ラ�夋嫨 鍋滅敤 鎿嶄綔銆傚仠鐢ㄥ悗姝ゆ暟鎹皢涓嶈兘鍐嶈鏂颁笟鍔′娇鐢ㄣ��" + @confirm="table_del(selection, '0')" @cancel="table_del(selection, '1')"> + <template #reference> + <el-button :disabled="selection.length == 0" type="danger" plain icon="el-icon-delete" + @click="batchDel"></el-button> + </template> + </el-popconfirm> + + <el-select v-model="params.status" style="width: 240px;margin-left: auto;" :prefix-icon="Search"> + <template #prefix> + 鐘舵�� + </template> + <el-option v-for="item in options.status" :key="item.value" :label="item.label" :value="item.value" /> + </el-select> + <el-input style="width: 240px;margin-left: 8px;" v-model="params.keyWord" placeholder="璇疯緭鍏ユ绱㈠唴瀹�"></el-input> + <el-button @click="search" style="margin-left: 8px;" type="primary" icon="el-icon-search"></el-button> + </el-header> + <el-main> + <scTable ref="table" @selection-change="handleSelectionChange" row-key="id" border :params="params" + :apiObj="apiObj" stripe @dataChange="dataChange"> + <el-table-column type="selection" width="55" /> + <el-table-column prop="code" :label="`${name}绫诲瀷缂栧彿`" /> + <el-table-column prop="name" :label="`${name}绫诲瀷鍚嶇О`" /> + <el-table-column prop="remark" label="澶囨敞" /> + <el-table-column prop="status" label="鐘舵��"> + <template #default="scope"> + {{ this.options.status.find(v => v.value == scope.row.status)?.label }} + </template> + </el-table-column> + <el-table-column label="鎿嶄綔" fixed="right" align="left" width="160"> + <template #default="scope"> + <el-button-group> + <el-button text type="primary" size="small" + @click="table_edit(scope.row, scope.$index)">缂栬緫</el-button> + <el-popconfirm v-if="scope.row == 1" width="220" cancel-button-text="鍋滅敤" + confirm-button-text="鍒犻櫎" + title="鍒犻櫎鏁版嵁浼氬奖鍝嶅凡鍏宠仈鐨勪笟鍔� ,鑻ユ偍鎯冲湪宸插叧鑱旂殑涓氬姟涓緷鐒舵樉绀鸿繖浜涙暟鎹�, 鎮ㄥ彲浠ラ�夋嫨 鍋滅敤 鎿嶄綔銆傚仠鐢ㄥ悗姝ゆ暟鎹皢涓嶈兘鍐嶈鏂颁笟鍔′娇鐢ㄣ��" + @confirm="table_del([scope.row], '0')" @cancel="table_del([scope.row], '1')"> + <template #reference> + <el-button text type="primary" size="small">鍒犻櫎</el-button> + </template> + </el-popconfirm> + <el-popconfirm v-else width="220" title="纭畾灏嗛�夋嫨鐨勬暟鎹垹闄�" @confirm="table_del([scope.row], '0')"> + <template #reference> + <el-button text type="primary" size="small">鍒犻櫎</el-button> + </template> + </el-popconfirm> + </el-button-group> + </template> + </el-table-column> + </scTable> + </el-main> + <el-drawer v-model="drawer" title="鐗╂枡绫诲瀷"> + <el-form :model="form" :rules="rules" ref="dialogForm" label-width="120px" label-position="center"> + <el-row> + <el-col :span="24"> + <el-form-item label="缂栫爜" prop="code"> + <el-input style="width: 240px" v-model="form.code" placeholder=""></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鍚嶇О" prop="name"> + <el-input style="width: 240px" v-model="form.name" placeholder=""></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="澶囨敞" prop="remark"> + <el-input type="textarea" style="width: 240px" v-model="form.remark" + placeholder=""></el-input> + </el-form-item> + </el-col> + <el-col :span="24"> + <el-form-item label="鐘舵��" prop="status"> + <el-select v-model="form.status" style="width: 240px;"> + <el-option v-for="item in options.status" :key="item.value" :label="item.label" + :value="item.value" /> + </el-select> + </el-form-item> + </el-col> + </el-row> + </el-form> + <template #footer> + <el-button type="primary" @click="save">淇濆瓨</el-button> + </template> + </el-drawer> + </el-containter> +</template> + +<script> +export default { + props: { + tableUrl: { type: String }, + insertUrl: { type: String }, + removeUrl: { type: String }, + updateUrl: { type: String }, + name: { type: String }, + }, + data() { + return { + activeName: '1', + options: { + status: [ + { + label: '鍚敤', + value: 1 + }, + { + label: '鍋滅敤', + value: 0 + }, + ], + }, + params: { + keyWord: '', + status: 1 + }, + apiObj: { + get: async (data) => { + let params = { + ...data + } + return await this.$HTTP.get(this.tableUrl, params).then(res => { + return res + }) + } + }, + selection: [], + drawer: false, + form: { + id: '', + status: 1, + remark: '', + name: '', + code: '', + }, + rules: { + name: [ + { required: true, message: '蹇呭~' } + ], + code: [ + { required: true, message: '蹇呭~' } + ], + }, + } + }, + created() { + }, + methods: { + search() { + this.$refs.table.reload(this.params) + }, + handleSelectionChange(selection) { + this.selection = selection + }, + table_add() { + this.drawer = true + this.form = { + status: 1 + } + }, + table_edit(row) { + this.drawer = true + this.form = { + ...row + } + }, + batchDel() { + + }, + dataChange() { + + }, + table_del(rowArr, type) { + this.$HTTP.delete(`${this.removeUrl}?type=${type}`, {}, { data: rowArr.map(v => v.id) }).then(res => { + if (res.code === 200) { + this.$message.success("鎿嶄綔鎴愬姛"); + this.$refs.table.reload(this.params) + } + }) + }, + save() { + this.$refs.dialogForm.validate(async (valid) => { + if (valid) { + if (this.form.id) { + this.$HTTP.put(this.updateUrl, { + ...this.form + }).then(res => { + this.drawer = false + this.$refs.table.reload(this.params) + }) + } else { + this.$HTTP.post(this.insertUrl, { + ...this.form + }).then(res => { + this.drawer = false + this.$refs.table.reload(this.params) + }) + } + } + }) + + } + } +} +</script> + +<style lang="scss" scoped></style> \ No newline at end of file -- Gitblit v1.9.3