Merge branch 'master' of http://122.51.230.86:3000/dianliang/lanan-system-vue
This commit is contained in:
commit
b68b9de81a
2
.env.dev
2
.env.dev
@ -6,6 +6,8 @@ VUE_APP_TITLE = "车联通"后台管理系统
|
||||
|
||||
# 芋道管理系统/开发环境
|
||||
VUE_APP_BASE_API = 'http://localhost:48080'
|
||||
# 附件请求地址前缀
|
||||
VUE_APP_FILE_API = 'http://122.51.230.86:9000/'
|
||||
|
||||
# 路由懒加载
|
||||
VUE_CLI_BABEL_TRANSPILE_MODULES = true
|
||||
|
@ -9,6 +9,8 @@ VUE_APP_BASE_API = '/prod-api'
|
||||
|
||||
# 根据服务器或域名修改
|
||||
PUBLIC_PATH = 'http://my-pi.com:8888/yudao-admin/'
|
||||
# 附件请求地址前缀
|
||||
VUE_APP_FILE_API = 'http://122.51.230.86:9000/'
|
||||
# 二级部署路径
|
||||
VUE_APP_APP_NAME ='yudao-admin'
|
||||
|
||||
|
@ -1 +1,20 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
const preUrl = "/repair/so"
|
||||
|
||||
// 采购单\领料单 新增
|
||||
export function createRepairSo(data){
|
||||
return request({
|
||||
url: preUrl + "/create",
|
||||
method: "post",
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function getRepairSoPage(params){
|
||||
return request({
|
||||
url: preUrl + "/page",
|
||||
method: "get",
|
||||
params
|
||||
})
|
||||
}
|
||||
|
@ -72,6 +72,7 @@ export default {
|
||||
return {
|
||||
number: 0,
|
||||
uploadList: [],
|
||||
viewFileUrl: process.env.VUE_APP_FILE_API,
|
||||
baseUrl: process.env.VUE_APP_BASE_API,
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/upload", // 请求地址
|
||||
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
||||
@ -88,7 +89,7 @@ export default {
|
||||
// 然后将数组转为对象数组
|
||||
this.fileList = list.map(item => {
|
||||
if (typeof item === "string") {
|
||||
item = { name: item, url: item };
|
||||
item = { name: item, url: this.viewFileUrl+item };
|
||||
}
|
||||
item.uid = item.uid || new Date().getTime() + temp++;
|
||||
return item;
|
||||
|
@ -88,6 +88,7 @@ export default {
|
||||
number: 0,
|
||||
uploadList: [],
|
||||
baseUrl: "",
|
||||
viewFileUrl: process.env.VUE_APP_FILE_API,
|
||||
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
||||
fileList: [],
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/uploadDetail", // 请求地址
|
||||
@ -110,7 +111,7 @@ export default {
|
||||
const list = Array.isArray(val)? val : this.value.split(",");
|
||||
this.fileList = list.map((item) => {
|
||||
if (typeof item === "string") {
|
||||
item = { name: item, url: item };
|
||||
item = { name: item, url: this.viewFileUrl+item };
|
||||
}
|
||||
item.uid = item.uid || new Date().getTime() + temp++;
|
||||
return item;
|
||||
@ -134,7 +135,7 @@ export default {
|
||||
const list = Array.isArray(this.value)? this.value : this.value.split(",");
|
||||
this.fileList = list.map((item) => {
|
||||
if (typeof item === "string") {
|
||||
item = { name: item, url: item };
|
||||
item = { name: item, url: this.viewFileUrl+item };
|
||||
}
|
||||
item.uid = item.uid || new Date().getTime() + temp++;
|
||||
return item;
|
||||
|
@ -76,6 +76,7 @@ export default {
|
||||
dialogImageUrl: "",
|
||||
dialogVisible: false,
|
||||
hideUpload: false,
|
||||
viewFileUrl: process.env.VUE_APP_FILE_API,
|
||||
uploadFileUrl: process.env.VUE_APP_BASE_API + "/admin-api/infra/file/upload", // 请求地址
|
||||
headers: { Authorization: "Bearer " + getAccessToken() }, // 设置上传的请求头部
|
||||
fileList: []
|
||||
@ -91,7 +92,7 @@ export default {
|
||||
this.fileList = list.map(item => {
|
||||
if (typeof item === "string") {
|
||||
// edit by 芋道源码
|
||||
item = { name: item, url: item };
|
||||
item = { name: item, url: this.viewFileUrl+item };
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
@ -2,17 +2,17 @@
|
||||
<el-select v-model="partSelected" ref="selectTable" clearable style="width: 45rem">
|
||||
<el-option style="display: none" v-for="part in partList" :key="part.id" :label="part.name" :value="part.id"/>
|
||||
<el-table :data="partList" style="width: 100%" @row-click="handleSelectionChange">
|
||||
<el-table-column label="序号" align="center">
|
||||
<el-table-column label="序号" align="center" width="80">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" prop="name" />
|
||||
<el-table-column label="规格" prop="name" />
|
||||
<el-table-column label="商品编码" prop="name" />
|
||||
<el-table-column label="可用库存" prop="name" />
|
||||
<el-table-column label="成本" prop="name" />
|
||||
<el-table-column label="仓库" prop="name" />
|
||||
<el-table-column label="商品名称" prop="name" width="120"/>
|
||||
<el-table-column label="规格" prop="model" width="120"/>
|
||||
<el-table-column label="商品编码" prop="code" width="120"/>
|
||||
<el-table-column label="可用库存" prop="stock" width="80"/>
|
||||
<el-table-column label="成本" prop="price" width="80"/>
|
||||
<el-table-column label="仓库" prop="warehouse" width="80"/>
|
||||
</el-table>
|
||||
<pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize"
|
||||
/>
|
||||
@ -26,8 +26,48 @@ export default {
|
||||
return{
|
||||
partSelected: null,
|
||||
partList: [
|
||||
{id: 1, name: '张胜男', age:20, gender: 1},
|
||||
{id: 2, name: '张胜妇', age:20, gender: 1}
|
||||
{
|
||||
id: 1,
|
||||
tenantId: 1,
|
||||
barCode: "12344564632463",
|
||||
code: "12312312",
|
||||
name: "测试1",
|
||||
model: "12321",
|
||||
price: "100",
|
||||
type: "不知道",
|
||||
unit: "个",
|
||||
warehouse: "d1",
|
||||
miniStock: 100,
|
||||
maxStock: 100,
|
||||
stock: 20,
|
||||
img: '',
|
||||
attribute: "123213123",
|
||||
corpId: 1,
|
||||
coverImage: '',
|
||||
carModel: "大车",
|
||||
remark: "没有",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
tenantId: 1,
|
||||
barCode: "12344564632463",
|
||||
code: "12312312",
|
||||
name: "测试2",
|
||||
model: "12321",
|
||||
price: "10",
|
||||
type: "不知道",
|
||||
unit: "个",
|
||||
warehouse: "d2",
|
||||
miniStock: 10,
|
||||
maxStock: 10,
|
||||
stock: 5,
|
||||
img: '',
|
||||
attribute: "123213123",
|
||||
corpId: 1,
|
||||
coverImage: '',
|
||||
carModel: "大车",
|
||||
remark: "没有",
|
||||
}
|
||||
],
|
||||
queryParams:{
|
||||
pageNo: 1,
|
||||
|
@ -10,6 +10,12 @@ import {getStaffList} from "@/api/company/staff";
|
||||
|
||||
export default {
|
||||
name: "StaffChoose",
|
||||
props:{
|
||||
value: {
|
||||
type: Object,
|
||||
defaultValue: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
staffList: [],
|
||||
@ -19,7 +25,14 @@ export default {
|
||||
watch:{
|
||||
staffSelected(val) {
|
||||
const staff = this.staffList.find(item => item.id === val);
|
||||
this.$emit("selected", staff);
|
||||
this.$emit("input", staff);
|
||||
},
|
||||
value(newVal){
|
||||
if (newVal){
|
||||
this.staffSelected = newVal.id
|
||||
}else {
|
||||
this.staffSelected = null
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -11,6 +11,12 @@ import {getBaseSupplierList} from "@/api/repair/supplier";
|
||||
|
||||
export default {
|
||||
name: "SupplierChoose",
|
||||
props: {
|
||||
value: {
|
||||
type: Object,
|
||||
defaultValue: null
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
supplierSelected: undefined,
|
||||
@ -19,8 +25,15 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
supplierSelected(val) {
|
||||
const supplier = this.supplierList.find(item => item.id === val);
|
||||
this.$emit("selected", supplier);
|
||||
const supplier = this.supplierList.find(item => item.id === val)
|
||||
this.$emit("input", supplier);
|
||||
},
|
||||
value(newVal) {
|
||||
if (newVal) {
|
||||
this.supplierSelected = newVal.id
|
||||
} else {
|
||||
this.supplierSelected = null
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
|
@ -51,7 +51,8 @@ export default {
|
||||
return JSON.parse(JSON.stringify(result))
|
||||
},
|
||||
handleNodeClick(node){
|
||||
this.$emit("selected", node)
|
||||
this.$emit("input", node.name)
|
||||
this.$emit("change")
|
||||
this.warehouseSelected = node.name
|
||||
this.$refs.selectTree.blur()
|
||||
}
|
||||
|
@ -117,6 +117,7 @@ import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue";
|
||||
import CorpChoose from "@/views/repair/Components/CorpChoose.vue";
|
||||
import StaffChoose from "@/views/repair/Components/StaffChoose.vue";
|
||||
import {DICT_TYPE} from "@/utils/dict";
|
||||
import {getRepairSoPage} from "@/api/repair/stockOperate/stockOperate";
|
||||
|
||||
export default {
|
||||
name: "SoIndex",
|
||||
@ -155,7 +156,8 @@ export default {
|
||||
soStatus: null,
|
||||
corpId: null,
|
||||
userId: null,
|
||||
userName: null
|
||||
userName: null,
|
||||
soType: this.soByType ? "01" : "02"
|
||||
},
|
||||
showSearch: true,
|
||||
list: [],
|
||||
@ -163,9 +165,24 @@ export default {
|
||||
total: 0
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.pageSo();
|
||||
},
|
||||
methods: {
|
||||
// 分页
|
||||
async pageSo() {
|
||||
try {
|
||||
this.loading = true
|
||||
const res = await getRepairSoPage(this.queryParams)
|
||||
this.list = res.data.records
|
||||
this.total = res.data.total
|
||||
}finally {
|
||||
this.loading = false
|
||||
}
|
||||
},
|
||||
// 搜索按钮
|
||||
handleQuery(){},
|
||||
handleQuery() {
|
||||
},
|
||||
// 搜索重置
|
||||
resetQuery() {
|
||||
this.resetForm('queryForm')
|
||||
|
@ -4,8 +4,8 @@
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<!-- 供应商 组件 -->
|
||||
<el-form-item v-if="soByType" label="供应商" prop="supplierId">
|
||||
<SupplierChoose @selected="getSupplier"/>
|
||||
<el-form-item v-if="soByType" label="供应商" prop="supplier">
|
||||
<SupplierChoose v-model="formData.supplier"/>
|
||||
</el-form-item>
|
||||
<!-- 日期 内嵌 -->
|
||||
<el-form-item label="日期" prop="soTime">
|
||||
@ -20,8 +20,8 @@
|
||||
<el-input disabled v-model="formData.soNo" style="width: 20rem"/>
|
||||
</el-form-item>
|
||||
<!-- 采购员/领料人 组件 -->
|
||||
<el-form-item :label="staffRole" prop="userId">
|
||||
<StaffChoose @selected="getStaff"/>
|
||||
<el-form-item :label="staffRole" prop="user">
|
||||
<StaffChoose v-model="formData.user"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@ -36,20 +36,25 @@
|
||||
<!-- 商品表格 组件 -->
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="24">
|
||||
<SoTable :part-list="partList" :so-by-type="soByType" @deleteItem="deleteItem"/>
|
||||
<SoTable @tableData="tableData" :part-list="partList" :so-by-type="soByType" @deleteItem="deleteItem"/>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row :gutter="2" style="margin-top: 1rem">
|
||||
<el-row :gutter="4" style="margin-top: 1rem">
|
||||
<el-col :span="6">
|
||||
<el-form-item label="应付金额" prop="totalPrice">
|
||||
<el-input disabled v-model="formData.totalPrice"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 备注 -->
|
||||
<el-col :span="12">
|
||||
<el-form-item label="备注">
|
||||
<el-input style="width: 45rem"/>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input style="width: 40rem" v-model="formData.remark"/>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<!-- 按钮操作 -->
|
||||
<el-col :span="12" style="text-align: right">
|
||||
<el-button v-if="soByType" type="danger">结算</el-button>
|
||||
<el-button v-else type="primary">确定</el-button>
|
||||
<el-col :span="6" style="text-align: right">
|
||||
<el-button v-if="soByType" type="danger" @click="handleSubmit">结算</el-button>
|
||||
<el-button v-else type="primary" @click="handleSubmit">确定</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
</el-form>
|
||||
@ -63,6 +68,7 @@ import PartChoose from "@/views/repair/Components/PartChoose.vue";
|
||||
import SoTable from "@/views/repair/stockOperate/Components/SoTable.vue";
|
||||
import SupplierChoose from "@/views/repair/Components/SupplierChoose.vue";
|
||||
import {createUniqueCodeByHead} from "@/utils/createUniqueCode";
|
||||
import {createRepairSo} from "@/api/repair/stockOperate/stockOperate";
|
||||
|
||||
export default {
|
||||
name: "SoInfo",
|
||||
@ -77,26 +83,29 @@ export default {
|
||||
type: Boolean,
|
||||
defaultValue: true,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
formData: {
|
||||
soNo: null,
|
||||
supplierId: null,
|
||||
supplierName: null,
|
||||
supplier: null,
|
||||
soTime: Date.now(),
|
||||
userId: null,
|
||||
userName: null,
|
||||
partList: []
|
||||
user: null,
|
||||
goodsList: [],
|
||||
totalPrice: null,
|
||||
soType: this.soByType ? "01" : "02",
|
||||
purchaseType: "01",
|
||||
itemCount: 0,
|
||||
soStatus: this.soByType ? "01" : "04",
|
||||
remark: null,
|
||||
},
|
||||
staffRole: "采购员",
|
||||
partList: [],
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL")
|
||||
this.staffRole = this.soByType ? this.staffRole : "领料人"
|
||||
this.init()
|
||||
},
|
||||
methods: {
|
||||
// 得到选择的员工
|
||||
@ -106,7 +115,8 @@ export default {
|
||||
},
|
||||
// 得到选择的供应商
|
||||
getSupplier(data) {
|
||||
console.log(data)
|
||||
this.formData.supplierId = data.id
|
||||
this.formData.supplierName = data.name
|
||||
},
|
||||
// 得到选择的商品
|
||||
async getPart(data) {
|
||||
@ -124,6 +134,66 @@ export default {
|
||||
// 删除数据
|
||||
deleteItem(index) {
|
||||
this.partList.splice(index, 1)
|
||||
},
|
||||
// 表格的数据
|
||||
tableData(data){
|
||||
this.formData.totalPrice = data.reduce((x, y) => {return x + y.totalPrice}, 0)
|
||||
this.formData.itemCount = data.reduce((x, y) => {return x + y.count}, 0)
|
||||
this.formData.goodsList = data.map(item => {
|
||||
return {
|
||||
goodsId: item.id,
|
||||
goodsType: "0",
|
||||
wareId: "0",
|
||||
goodsCount: item.count,
|
||||
goodsPrice: item.newPrice,
|
||||
remark: item.remark
|
||||
}
|
||||
})
|
||||
},
|
||||
// 提交
|
||||
async handleSubmit(){
|
||||
try {
|
||||
this.createInit()
|
||||
await createRepairSo(this.formData)
|
||||
this.$modal.msgSuccess("新增成功")
|
||||
this.init()
|
||||
}catch{
|
||||
}
|
||||
},
|
||||
// 初始化
|
||||
init(){
|
||||
this.formData = {
|
||||
soNo: null,
|
||||
supplier: null,
|
||||
soTime: Date.now(),
|
||||
user: null,
|
||||
goodsList: [],
|
||||
totalPrice: null,
|
||||
soType: this.soByType ? "01" : "02",
|
||||
purchaseType: "01",
|
||||
itemCount: 0,
|
||||
soStatus: this.soByType ? "01" : "04",
|
||||
remark: null,
|
||||
}
|
||||
this.formData.soNo = createUniqueCodeByHead(this.soByType ? "CG" : "LL")
|
||||
this.staffRole = this.soByType ? this.staffRole : "领料人"
|
||||
this.partList = []
|
||||
},
|
||||
// 提交前的构建
|
||||
createInit(){
|
||||
const data = this.formData
|
||||
this.formData = {
|
||||
...data,
|
||||
userId: data.user.id,
|
||||
userName: data.user.name,
|
||||
}
|
||||
if (this.soByType){
|
||||
this.formData = {
|
||||
...data,
|
||||
supplierId: data.supplier.id,
|
||||
supplierName: data.supplier.name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,62 @@
|
||||
<template>
|
||||
<el-table v-loading="loading" :data="partList" :stripe="true" :show-overflow-tooltip="true">
|
||||
<el-table v-loading="loading"
|
||||
:data="list"
|
||||
:stripe="true"
|
||||
:show-overflow-tooltip="true"
|
||||
show-summary
|
||||
:summary-method="getSummaries"
|
||||
:key="randomKey"
|
||||
@cell-dblclick="editData"
|
||||
>
|
||||
<el-table-column label="序号" align="center">
|
||||
<template scope="scope">
|
||||
<span>{{ scope.$index + 1 }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" align="center" prop="name" width="200"/>
|
||||
<el-table-column label="规格" align="center" width="180"/>
|
||||
<el-table-column label="商品编码" align="center" width="180"/>
|
||||
<el-table-column label="仓库" align="center" width="150"/>
|
||||
<el-table-column label="库存" align="center" width="150" />
|
||||
<el-table-column label="单位" align="center" width="150"/>
|
||||
<el-table-column label="数量" align="center" width="150"/>
|
||||
<el-table-column :label="soByType ? '上次进价' : '成本'" align="center" width="150"/>
|
||||
<el-table-column v-if="soByType" label="采购进价" align="center" width="150"/>
|
||||
<el-table-column :label="soByType ? '采购金额' : '合计'" align="center" width="150"/>
|
||||
<el-table-column label="备注" align="center" width="180"/>
|
||||
<el-table-column label="规格" align="center" width="180" prop="model"/>
|
||||
<el-table-column label="商品编码" align="center" width="180" prop="code"/>
|
||||
<el-table-column label="仓库" align="center" width="150" prop="warehouse">
|
||||
<template slot-scope="scope">
|
||||
<WarehouseChoose v-if="scope.row[scope.column.property + 'isShow'] && soByType"
|
||||
:ref="scope.column.property"
|
||||
v-model="scope.row.warehouse"
|
||||
@change="alterData(scope.row,scope.column)"
|
||||
/>
|
||||
<span v-else>{{ scope.row.warehouse }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="库存" align="center" width="150" prop="stock"/>
|
||||
<el-table-column label="单位" align="center" width="150" prop="unit"/>
|
||||
<el-table-column label="数量" align="center" width="150" prop="count">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-if="scope.row[scope.column.property + 'isShow']"
|
||||
:ref="scope.column.property"
|
||||
v-model="scope.row.count"
|
||||
@blur="alterData(scope.row,scope.column)"></el-input>
|
||||
<span v-else>{{ scope.row.count }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="soByType ? '上次进价' : '成本'" align="center" width="150" prop="price"/>
|
||||
<el-table-column v-if="soByType" label="采购单价" align="center" width="150" prop="newPrice">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-if="scope.row[scope.column.property + 'isShow'] && soByType"
|
||||
:ref="scope.column.property"
|
||||
v-model="scope.row.newPrice"
|
||||
@blur="alterData(scope.row,scope.column)"></el-input>
|
||||
<span v-else>{{ scope.row.newPrice }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column :label="soByType ? '采购金额' : '合计'" align="center" width="150" prop="totalPrice"/>
|
||||
<el-table-column label="备注" align="center" width="180" prop="remark">
|
||||
<template slot-scope="scope">
|
||||
<el-input v-if="scope.row[scope.column.property + 'isShow']"
|
||||
:ref="scope.column.property"
|
||||
v-model="scope.row.remark"
|
||||
@blur="alterData(scope.row,scope.column)"></el-input>
|
||||
<span v-else>{{ scope.row.remark }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" fixed="right" align="center" width="150">
|
||||
<template v-slot="scope">
|
||||
<el-button size="mini" type="text" icon="el-icon-delete" @click="deleteItem(scope.$index)"
|
||||
@ -27,8 +68,11 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import WarehouseChoose from "@/views/repair/Components/WarehouseChoose.vue";
|
||||
|
||||
export default {
|
||||
name: "SoTable",
|
||||
components: {WarehouseChoose},
|
||||
props: {
|
||||
soByType: {
|
||||
type: Boolean,
|
||||
@ -45,13 +89,80 @@ export default {
|
||||
return {
|
||||
loading: false,
|
||||
list: [],
|
||||
includeColumn: ['count', 'totalPrice'],
|
||||
randomKey: Math.random(),
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
partList(val) {
|
||||
if (val && val.length > 0) {
|
||||
const data = val[val.length - 1]
|
||||
const newData = {
|
||||
...data,
|
||||
count: 1,
|
||||
totalPrice: data.price * 1,
|
||||
remark: '',
|
||||
newPrice: data.price,
|
||||
}
|
||||
this.list.push(newData)
|
||||
}else {
|
||||
this.list = []
|
||||
this.refreshTable()
|
||||
}
|
||||
},
|
||||
list: {
|
||||
handler(newVal, oldVal) {
|
||||
this.$emit("tableData", newVal)
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
// 通知父组件,删除数据
|
||||
deleteItem(index) {
|
||||
this.$emit("deleteItem", index)
|
||||
},
|
||||
// 设置不统计的字段
|
||||
getSummaries(param) {
|
||||
const {columns, data} = param
|
||||
const sums = []
|
||||
columns.forEach((column, index) => {
|
||||
if (index === 0) {
|
||||
sums[index] = '合计';
|
||||
return;
|
||||
}
|
||||
const values = data.map(item => Number(item[column.property]));
|
||||
if (this.includeColumn.includes(column.property)) {
|
||||
sums[index] = values.reduce((prev, curr) => {
|
||||
const value = Number(curr);
|
||||
if (!isNaN(value)) {
|
||||
return prev + curr;
|
||||
} else {
|
||||
return prev;
|
||||
}
|
||||
}, 0);
|
||||
sums[index];
|
||||
}
|
||||
});
|
||||
return sums
|
||||
},
|
||||
editData(row, column) {
|
||||
row[column.property + "isShow"] = true
|
||||
//refreshTable是table数据改动时,刷新table的
|
||||
this.refreshTable()
|
||||
// this.$nextTick(() => {
|
||||
// this.$refs[column.property] && this.$refs[column.property].focus()
|
||||
// })
|
||||
},
|
||||
alterData(row, column) {
|
||||
row[column.property + "isShow"] = false
|
||||
const data = this.list.find(item => item.id === row.id)
|
||||
data.totalPrice = data.newPrice * data.count
|
||||
this.refreshTable()
|
||||
},
|
||||
refreshTable() {
|
||||
this.randomKey = Math.random()
|
||||
},
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
44
src/views/system/appBase/appSwiper/api.js
Normal file
44
src/views/system/appBase/appSwiper/api.js
Normal file
@ -0,0 +1,44 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
// 查询app轮播图列表
|
||||
export function listSwiper(query) {
|
||||
return request({
|
||||
url: '/system/appSwiper/list',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
// 查询app轮播图详细
|
||||
export function getSwiper(swiperId) {
|
||||
return request({
|
||||
url: '/system/appSwiper/' + swiperId,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
// 新增app轮播图
|
||||
export function addSwiper(data) {
|
||||
return request({
|
||||
url: '/system/appSwiper/add',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 修改app轮播图
|
||||
export function updateSwiper(data) {
|
||||
return request({
|
||||
url: '/system/appSwiper/edit',
|
||||
method: 'post',
|
||||
data: data
|
||||
})
|
||||
}
|
||||
|
||||
// 删除app轮播图
|
||||
export function delSwiper(swiperId) {
|
||||
return request({
|
||||
url: '/system/appSwiper/del?idList=' + swiperId,
|
||||
method: 'post'
|
||||
})
|
||||
}
|
266
src/views/system/appBase/appSwiper/index.vue
Normal file
266
src/views/system/appBase/appSwiper/index.vue
Normal file
@ -0,0 +1,266 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="板块名称" prop="moudleName">
|
||||
<el-select v-model="queryParams.moudleName" placeholder="请选择板块名称" clearable>
|
||||
<el-option
|
||||
v-for="dict in dict.type.app_module_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row :gutter="10" class="mb8">
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="primary"
|
||||
plain
|
||||
icon="el-icon-plus"
|
||||
size="mini"
|
||||
@click="handleAdd"
|
||||
>新增</el-button>
|
||||
</el-col>
|
||||
<el-col :span="1.5">
|
||||
<el-button
|
||||
type="danger"
|
||||
plain
|
||||
icon="el-icon-delete"
|
||||
size="mini"
|
||||
:disabled="multiple"
|
||||
@click="handleDelete"
|
||||
>删除</el-button>
|
||||
</el-col>
|
||||
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||
</el-row>
|
||||
|
||||
<el-table v-loading="loading" :data="swiperList" @selection-change="handleSelectionChange">
|
||||
<el-table-column type="selection" width="55" align="center" />
|
||||
<el-table-column label="板块名称" align="center" prop="moudleName">
|
||||
<template slot-scope="scope">
|
||||
<dict-tag :options="dict.type.app_module_type" :value="scope.row.moudleName"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="轮播图照片" align="center" prop="swiperPicture" width="100">
|
||||
<template slot-scope="scope">
|
||||
<image-preview :src="scope.row.swiperPicture" :width="50" :height="50"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="排序" align="center" prop="listOrder" />
|
||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-edit"
|
||||
@click="handleUpdate(scope.row)"
|
||||
>修改</el-button>
|
||||
<el-button
|
||||
size="mini"
|
||||
type="text"
|
||||
icon="el-icon-delete"
|
||||
@click="handleDelete(scope.row)"
|
||||
>删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<pagination
|
||||
v-show="total>0"
|
||||
:total="total"
|
||||
:page.sync="queryParams.pageNum"
|
||||
:limit.sync="queryParams.pageSize"
|
||||
@pagination="getList"
|
||||
/>
|
||||
|
||||
<!-- 添加或修改app轮播图对话框 -->
|
||||
<el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
|
||||
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||
<el-form-item label="板块名称" prop="moudleName">
|
||||
<el-select v-model="form.moudleName" placeholder="请选择板块名称">
|
||||
<el-option
|
||||
v-for="dict in dict.type.app_module_type"
|
||||
:key="dict.value"
|
||||
:label="dict.label"
|
||||
:value="dict.value"
|
||||
></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="轮播图名称" prop="swiperName">
|
||||
<el-input v-model="form.swiperName" placeholder="请输入轮播图名称" />
|
||||
</el-form-item>
|
||||
<el-form-item label="轮播图照片" prop="swiperPicture">
|
||||
<image-upload :limit="5" v-model="form.swiperPicture"/>
|
||||
</el-form-item>
|
||||
<el-form-item label="跳转地址" prop="jumpUrl">
|
||||
<el-input v-model="form.jumpUrl" placeholder="请输入跳转地址" />
|
||||
</el-form-item>
|
||||
<el-form-item label="排序" prop="listOrder">
|
||||
<el-input v-model="form.listOrder" placeholder="请输入排序" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listSwiper, getSwiper, delSwiper, addSwiper, updateSwiper } from "./api";
|
||||
import request from "@/utils/request";
|
||||
import DictTag from '@/components/DictTagOld/index.vue'
|
||||
export default {
|
||||
name: "Swiper",
|
||||
components:{DictTag},
|
||||
dicts: ['app_module_type'],
|
||||
data() {
|
||||
return {
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
// 选中数组
|
||||
ids: [],
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
// 非多个禁用
|
||||
multiple: true,
|
||||
// 显示搜索条件
|
||||
showSearch: true,
|
||||
// 总条数
|
||||
total: 0,
|
||||
// app轮播图表格数据
|
||||
swiperList: [],
|
||||
// 弹出层标题
|
||||
title: "",
|
||||
// 是否显示弹出层
|
||||
open: false,
|
||||
// 查询参数
|
||||
queryParams: {
|
||||
pageNum: 1,
|
||||
pageSize: 10,
|
||||
moudleName: null,
|
||||
},
|
||||
// 表单参数
|
||||
form: {},
|
||||
// 表单校验
|
||||
rules: {
|
||||
}
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.dict = {type:{}}
|
||||
for (let i = 0; i < this.$options.dicts.length; i++) {
|
||||
request({
|
||||
url: '/rescue/dict/data/type/'+this.$options.dicts[i],
|
||||
method: 'get'
|
||||
}).then(res=>{
|
||||
this.$set(this.dict.type,this.$options.dicts[i],res.data)
|
||||
})
|
||||
}
|
||||
this.getList();
|
||||
},
|
||||
methods: {
|
||||
/** 查询app轮播图列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
listSwiper(this.queryParams).then(response => {
|
||||
this.swiperList = response.rows;
|
||||
this.total = response.total;
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 取消按钮
|
||||
cancel() {
|
||||
this.open = false;
|
||||
this.reset();
|
||||
},
|
||||
// 表单重置
|
||||
reset() {
|
||||
this.form = {
|
||||
swiperId: null,
|
||||
moudleName: null,
|
||||
swiperName: null,
|
||||
swiperPicture: null,
|
||||
jumpUrl: null,
|
||||
listOrder: 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.swiperId)
|
||||
this.single = selection.length!==1
|
||||
this.multiple = !selection.length
|
||||
},
|
||||
/** 新增按钮操作 */
|
||||
handleAdd() {
|
||||
this.reset();
|
||||
this.open = true;
|
||||
this.title = "添加app轮播图";
|
||||
},
|
||||
/** 修改按钮操作 */
|
||||
handleUpdate(row) {
|
||||
this.reset();
|
||||
const swiperId = row.swiperId || this.ids
|
||||
getSwiper(swiperId).then(response => {
|
||||
this.form = response.data;
|
||||
this.open = true;
|
||||
this.title = "修改app轮播图";
|
||||
});
|
||||
},
|
||||
/** 提交按钮 */
|
||||
submitForm() {
|
||||
this.$refs["form"].validate(valid => {
|
||||
if (valid) {
|
||||
if (this.form.swiperId != null) {
|
||||
updateSwiper(this.form).then(response => {
|
||||
this.$modal.msgSuccess("修改成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
} else {
|
||||
addSwiper(this.form).then(response => {
|
||||
this.$modal.msgSuccess("新增成功");
|
||||
this.open = false;
|
||||
this.getList();
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
/** 删除按钮操作 */
|
||||
handleDelete(row) {
|
||||
const swiperIds = row.swiperId || this.ids;
|
||||
this.$modal.confirm('是否确认删除app轮播图编号为"' + swiperIds + '"的数据项?').then(function() {
|
||||
return delSwiper(swiperIds);
|
||||
}).then(() => {
|
||||
this.getList();
|
||||
this.$modal.msgSuccess("删除成功");
|
||||
}).catch(() => {});
|
||||
},
|
||||
/** 导出按钮操作 */
|
||||
handleExport() {
|
||||
this.download('system/swiper/export', {
|
||||
...this.queryParams
|
||||
}, `swiper_${new Date().getTime()}.xlsx`)
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user