|
@@ -132,7 +132,7 @@
|
|
|
v-hasPermi="['basicdata:goods:export']"
|
|
|
>导出</el-button>
|
|
|
</el-col>
|
|
|
- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
+ <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
|
|
</el-row>
|
|
|
|
|
|
<el-table v-loading="loading" :data="goodsList" @selection-change="handleSelectionChange">
|
|
@@ -168,7 +168,7 @@
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
</el-table>
|
|
|
-
|
|
|
+
|
|
|
<pagination
|
|
|
v-show="total>0"
|
|
|
:total="total"
|
|
@@ -228,178 +228,178 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { listGoods, getGoods, delGoods, addGoods, updateGoods, exportGoods } from "@/api/basicdata/goods";
|
|
|
+ import { listGoods, getGoods, delGoods, addGoods, updateGoods, exportGoods } from "@/api/basicdata/goods";
|
|
|
|
|
|
-export default {
|
|
|
- name: "Goods",
|
|
|
- components: {
|
|
|
- },
|
|
|
- data() {
|
|
|
- return {
|
|
|
- // 遮罩层
|
|
|
- loading: true,
|
|
|
- // 选中数组
|
|
|
- ids: [],
|
|
|
- // 非单个禁用
|
|
|
- single: true,
|
|
|
- // 非多个禁用
|
|
|
- multiple: true,
|
|
|
- // 显示搜索条件
|
|
|
- showSearch: true,
|
|
|
- // 总条数
|
|
|
- total: 0,
|
|
|
- // 商品详情表格数据
|
|
|
- goodsList: [],
|
|
|
- // 弹出层标题
|
|
|
- title: "",
|
|
|
- // 是否显示弹出层
|
|
|
- open: false,
|
|
|
- // 备注字典
|
|
|
- fIdOptions: [],
|
|
|
- // 删除状态字典
|
|
|
- delFlagOptions: [],
|
|
|
- // 查询参数
|
|
|
- queryParams: {
|
|
|
- pageNum: 1,
|
|
|
- pageSize: 10,
|
|
|
- fTypeid: null,
|
|
|
- fNo: null,
|
|
|
- fName: null,
|
|
|
- fEnam: null,
|
|
|
- fSpecs: null,
|
|
|
- fPackagespecs: null,
|
|
|
- fColor: null,
|
|
|
- fHscode: null,
|
|
|
- fPackageid: null,
|
|
|
- fStatus: null,
|
|
|
- },
|
|
|
- // 表单参数
|
|
|
- form: {},
|
|
|
- // 表单校验
|
|
|
- rules: {
|
|
|
- fTypeid: [
|
|
|
- { required: true, message: "存储id 显示名称 下拉选择类别,一个商品名称对应一个类别,对应t_goodtype的f_id不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- fNo: [
|
|
|
- { required: true, message: "编号不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- fName: [
|
|
|
- { required: true, message: "名称不能为空", trigger: "blur" }
|
|
|
- ],
|
|
|
- }
|
|
|
- };
|
|
|
- },
|
|
|
- created() {
|
|
|
- this.getList();
|
|
|
- this.getDicts("data_customer_category").then(response => {
|
|
|
- this.fIdOptions = response.data;
|
|
|
- });
|
|
|
- this.getDicts("data_delete_state").then(response => {
|
|
|
- this.delFlagOptions = response.data;
|
|
|
- });
|
|
|
- },
|
|
|
- methods: {
|
|
|
- /** 查询商品详情列表 */
|
|
|
- getList() {
|
|
|
- this.loading = true;
|
|
|
- listGoods(this.queryParams).then(response => {
|
|
|
- this.goodsList = response.rows;
|
|
|
- this.total = response.total;
|
|
|
- this.loading = false;
|
|
|
- });
|
|
|
+ export default {
|
|
|
+ name: "Goods",
|
|
|
+ components: {
|
|
|
},
|
|
|
- // 名称字典翻译
|
|
|
- fIdFormat(row, column) {
|
|
|
- return this.selectDictLabel(this.fIdOptions, row.fId);
|
|
|
- },
|
|
|
- // 删除状态字典翻译
|
|
|
- delFlagFormat(row, column) {
|
|
|
- return this.selectDictLabel(this.delFlagOptions, row.delFlag);
|
|
|
- },
|
|
|
- // 取消按钮
|
|
|
- cancel() {
|
|
|
- this.open = false;
|
|
|
- this.reset();
|
|
|
- },
|
|
|
- // 表单重置
|
|
|
- reset() {
|
|
|
- this.form = {
|
|
|
- fId: null,
|
|
|
- fTypeid: null,
|
|
|
- fNo: null,
|
|
|
- fName: null,
|
|
|
- fEnam: null,
|
|
|
- fSpecs: null,
|
|
|
- fPackagespecs: null,
|
|
|
- fColor: null,
|
|
|
- fHscode: null,
|
|
|
- fPackageid: null,
|
|
|
- fStatus: "0",
|
|
|
- delFlag: null,
|
|
|
- createBy: null,
|
|
|
- createTime: null,
|
|
|
- updateBy: null,
|
|
|
- updateTime: null,
|
|
|
- remark: null
|
|
|
+ data() {
|
|
|
+ return {
|
|
|
+ // 遮罩层
|
|
|
+ loading: true,
|
|
|
+ // 选中数组
|
|
|
+ ids: [],
|
|
|
+ // 非单个禁用
|
|
|
+ single: true,
|
|
|
+ // 非多个禁用
|
|
|
+ multiple: true,
|
|
|
+ // 显示搜索条件
|
|
|
+ showSearch: true,
|
|
|
+ // 总条数
|
|
|
+ total: 0,
|
|
|
+ // 商品详情表格数据
|
|
|
+ goodsList: [],
|
|
|
+ // 弹出层标题
|
|
|
+ title: "",
|
|
|
+ // 是否显示弹出层
|
|
|
+ open: false,
|
|
|
+ // 备注字典
|
|
|
+ fIdOptions: [],
|
|
|
+ // 删除状态字典
|
|
|
+ delFlagOptions: [],
|
|
|
+ // 查询参数
|
|
|
+ queryParams: {
|
|
|
+ pageNum: 1,
|
|
|
+ pageSize: 10,
|
|
|
+ fTypeid: null,
|
|
|
+ fNo: null,
|
|
|
+ fName: null,
|
|
|
+ fEnam: null,
|
|
|
+ fSpecs: null,
|
|
|
+ fPackagespecs: null,
|
|
|
+ fColor: null,
|
|
|
+ fHscode: null,
|
|
|
+ fPackageid: null,
|
|
|
+ fStatus: null,
|
|
|
+ },
|
|
|
+ // 表单参数
|
|
|
+ form: {},
|
|
|
+ // 表单校验
|
|
|
+ rules: {
|
|
|
+ fTypeid: [
|
|
|
+ { required: true, message: "存储id 显示名称 下拉选择类别,一个商品名称对应一个类别,对应t_goodtype的f_id不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ fNo: [
|
|
|
+ { required: true, message: "编号不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ fName: [
|
|
|
+ { required: true, message: "名称不能为空", trigger: "blur" }
|
|
|
+ ],
|
|
|
+ }
|
|
|
};
|
|
|
- this.resetForm("form");
|
|
|
},
|
|
|
- /** 搜索按钮操作 */
|
|
|
- handleQuery() {
|
|
|
- this.queryParams.pageNum = 1;
|
|
|
+ created() {
|
|
|
this.getList();
|
|
|
- },
|
|
|
- /** 重置按钮操作 */
|
|
|
- resetQuery() {
|
|
|
- this.resetForm("queryForm");
|
|
|
- this.handleQuery();
|
|
|
- },
|
|
|
- // 多选框选中数据
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.ids = selection.map(item => item.fId)
|
|
|
- this.single = selection.length!==1
|
|
|
- this.multiple = !selection.length
|
|
|
- },
|
|
|
- /** 新增按钮操作 */
|
|
|
- handleAdd() {
|
|
|
- this.reset();
|
|
|
- this.open = true;
|
|
|
- this.title = "添加商品详情";
|
|
|
- },
|
|
|
- /** 修改按钮操作 */
|
|
|
- handleUpdate(row) {
|
|
|
- this.reset();
|
|
|
- const fId = row.fId || this.ids
|
|
|
- getGoods(fId).then(response => {
|
|
|
- this.form = response.data;
|
|
|
- this.open = true;
|
|
|
- this.title = "修改商品详情";
|
|
|
+ this.getDicts("data_customer_category").then(response => {
|
|
|
+ this.fIdOptions = response.data;
|
|
|
});
|
|
|
- },
|
|
|
- /** 提交按钮 */
|
|
|
- submitForm() {
|
|
|
- this.$refs["form"].validate(valid => {
|
|
|
- if (valid) {
|
|
|
- if (this.form.fId != null) {
|
|
|
- updateGoods(this.form).then(response => {
|
|
|
- this.msgSuccess("修改成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- } else {
|
|
|
- addGoods(this.form).then(response => {
|
|
|
- this.msgSuccess("新增成功");
|
|
|
- this.open = false;
|
|
|
- this.getList();
|
|
|
- });
|
|
|
- }
|
|
|
- }
|
|
|
+ this.getDicts("data_delete_state").then(response => {
|
|
|
+ this.delFlagOptions = response.data;
|
|
|
});
|
|
|
},
|
|
|
- /** 删除按钮操作 */
|
|
|
- handleDelete(row) {
|
|
|
- const fIds = row.fId || this.ids;
|
|
|
- this.$confirm('是否确认删除商品详情编号为"' + fIds + '"的数据项?', "警告", {
|
|
|
+ methods: {
|
|
|
+ /** 查询商品详情列表 */
|
|
|
+ getList() {
|
|
|
+ this.loading = true;
|
|
|
+ listGoods(this.queryParams).then(response => {
|
|
|
+ this.goodsList = response.rows;
|
|
|
+ this.total = response.total;
|
|
|
+ this.loading = false;
|
|
|
+ });
|
|
|
+ },
|
|
|
+ // 名称字典翻译
|
|
|
+ fIdFormat(row, column) {
|
|
|
+ return this.selectDictLabel(this.fIdOptions, row.fId);
|
|
|
+ },
|
|
|
+ // 删除状态字典翻译
|
|
|
+ delFlagFormat(row, column) {
|
|
|
+ return this.selectDictLabel(this.delFlagOptions, row.delFlag);
|
|
|
+ },
|
|
|
+ // 取消按钮
|
|
|
+ cancel() {
|
|
|
+ this.open = false;
|
|
|
+ this.reset();
|
|
|
+ },
|
|
|
+ // 表单重置
|
|
|
+ reset() {
|
|
|
+ this.form = {
|
|
|
+ fId: null,
|
|
|
+ fTypeid: null,
|
|
|
+ fNo: null,
|
|
|
+ fName: null,
|
|
|
+ fEnam: null,
|
|
|
+ fSpecs: null,
|
|
|
+ fPackagespecs: null,
|
|
|
+ fColor: null,
|
|
|
+ fHscode: null,
|
|
|
+ fPackageid: null,
|
|
|
+ fStatus: "0",
|
|
|
+ delFlag: null,
|
|
|
+ createBy: null,
|
|
|
+ createTime: null,
|
|
|
+ updateBy: null,
|
|
|
+ updateTime: null,
|
|
|
+ remark: null
|
|
|
+ };
|
|
|
+ this.resetForm("form");
|
|
|
+ },
|
|
|
+ /** 搜索按钮操作 */
|
|
|
+ handleQuery() {
|
|
|
+ this.queryParams.pageNum = 1;
|
|
|
+ this.getList();
|
|
|
+ },
|
|
|
+ /** 重置按钮操作 */
|
|
|
+ resetQuery() {
|
|
|
+ this.resetForm("queryForm");
|
|
|
+ this.handleQuery();
|
|
|
+ },
|
|
|
+ // 多选框选中数据
|
|
|
+ handleSelectionChange(selection) {
|
|
|
+ this.ids = selection.map(item => item.fId)
|
|
|
+ this.single = selection.length!==1
|
|
|
+ this.multiple = !selection.length
|
|
|
+ },
|
|
|
+ /** 新增按钮操作 */
|
|
|
+ handleAdd() {
|
|
|
+ this.reset();
|
|
|
+ this.open = true;
|
|
|
+ this.title = "添加商品详情";
|
|
|
+ },
|
|
|
+ /** 修改按钮操作 */
|
|
|
+ handleUpdate(row) {
|
|
|
+ this.reset();
|
|
|
+ const fId = row.fId || this.ids
|
|
|
+ getGoods(fId).then(response => {
|
|
|
+ this.form = response.data;
|
|
|
+ this.open = true;
|
|
|
+ this.title = "修改商品详情";
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 提交按钮 */
|
|
|
+ submitForm() {
|
|
|
+ this.$refs["form"].validate(valid => {
|
|
|
+ if (valid) {
|
|
|
+ if (this.form.fId != null) {
|
|
|
+ updateGoods(this.form).then(response => {
|
|
|
+ this.msgSuccess("修改成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ addGoods(this.form).then(response => {
|
|
|
+ this.msgSuccess("新增成功");
|
|
|
+ this.open = false;
|
|
|
+ this.getList();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ /** 删除按钮操作 */
|
|
|
+ handleDelete(row) {
|
|
|
+ const fIds = row.fId || this.ids;
|
|
|
+ this.$confirm('是否确认删除商品详情编号为"' + fIds + '"的数据项?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
@@ -409,11 +409,11 @@ export default {
|
|
|
this.getList();
|
|
|
this.msgSuccess("删除成功");
|
|
|
})
|
|
|
- },
|
|
|
- /** 导出按钮操作 */
|
|
|
- handleExport() {
|
|
|
- const queryParams = this.queryParams;
|
|
|
- this.$confirm('是否确认导出所有商品详情数据项?', "警告", {
|
|
|
+ },
|
|
|
+ /** 导出按钮操作 */
|
|
|
+ handleExport() {
|
|
|
+ const queryParams = this.queryParams;
|
|
|
+ this.$confirm('是否确认导出所有商品详情数据项?', "警告", {
|
|
|
confirmButtonText: "确定",
|
|
|
cancelButtonText: "取消",
|
|
|
type: "warning"
|
|
@@ -422,7 +422,7 @@ export default {
|
|
|
}).then(response => {
|
|
|
this.download(response.msg);
|
|
|
})
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
-};
|
|
|
+ };
|
|
|
</script>
|