import ImageUpload from '@/components/file-upload'
export default {
data() {
return {
// 事件组合
optionsEvensGroup: [
[
[
{
name: '新建',
isRole: true,
click: this.addData
}
],
],
],
// 表格属性
tableAttributes: {
// 启用勾选列
selectColumn: false
},
// 表格事件
tableEvents: {
'selection-change': this.selectionChange
},
recordSelected: [],
formDialog: false,
formDialogType: 0, // 0:新增, 1:编辑, 2:查看, 3:审核
formDialogTitles: ['新增', '编辑', '查看', '审核'],
pageType: this?.$route?.name,
}
},
computed: {
moreParameters() {
return [
{
name: '状态',
key: 'flag',
value: '',
conditions: [
{
label: `全部`,
value: ''
},
{
label: `已保存`,
value: "SAVE"
},
{
label: `已审核`,
value: "OK"
}, {
label: `失败`,
value: "FAIL"
},
]
},
]
},
columns() {
return [
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '大类名称',
prop: 'parentCategoryId',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
{[].map((item, index_) => )}
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '小类名称',
prop: 'goodsCategoryId',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
{[].map((item, index_) => )}
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '辅材名称',
prop: 'avatar',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
{[].map((item, index_) => )}
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '配件名称',
prop: 'avatar',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
{[].map((item, index_) => )}
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '单位',
prop: 'purchaseId',
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'partsStorage'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '数量',
prop: 'recQty',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '退货数量',
prop: 'retQty',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '退款金额',
prop: 'retValue',
},
render: (h, { row, column, index }) => {
return (
row.isEditRow ?
{ row[column.prop] = val }} placeholder="请选择">
:
{row[column.prop]}
)
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '商品代码',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '规格型号',
prop: 'goodsSpecification',
}
}]
}
return []
})(),
...(() => {
if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '配件编码',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '适用品牌',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '适用产品大类',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '采购数量',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '采购价格',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsStorage', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '采购金额',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~['auxiliaryMaterialsStorage', 'returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType)) {
return [{
columnAttributes: {
label: '库存数量',
prop: '',
}
}]
}
return []
})(),
...(() => {
if (!!~[0, 1].indexOf(this.formDialogType)) {
return [{
columnAttributes: {
label: '操作',
prop: '',
},
render: (h, { row, column, index }) => {
return (
{
this.formData.items.map((item, index_) => {
if (index_ == index) {
item.isEditRow = true
} else {
item.isEditRow = false
}
})
}}>编辑
{
this.formData.items.splice(index, 1)
}}>删除
)
}
}]
}
return []
})(),
]
},
formItems1() {
return [
{
md: 24,
isShow: true,
name: 'slot-component',
formItemAttributes: {
label: '',
prop: '',
'label-width': '0px'
},
render: (h, { props, onInput }) => {
var { value } = props
return (
{({ SAVE: "保存", OK: "通过", FAIL: "失败" })[this.formData.flag]}
{(!!~['auxiliaryMaterialsStorage', 'partsStorage'].indexOf(this.pageType) ? this.formData.purchaseId : this.formData.purchaseRetId) || ''}
{this.formData.companyWechatName}
{this.formData.websitName}
{this.formData.venderName}
{
!!~['returnAuxiliaryMaterials', 'partsReturn'].indexOf(this.pageType) ?
{this.formData.purchaseId}
{this.formData.purchaseId}
{this.formData.purchaseId}
: null
}
{this.formData.createBy}
{this.formData.createTime}
{this.formData.confirmBy}
{this.formData.confirmTime}
{ this.formData.remark = val }}
maxlength="200"
show-word-limit
autosize={{ minRows: 6, maxRows: 8 }}
>
)
}
},]
},
formItems2() {
return [
{
md: 24,
isShow: true,
name: 'slot-component',
formItemAttributes: {
label: '',
prop: '',
'label-width': '0px'
},
render: (h, { props, onInput }) => {
var { value } = props
return (
{!!~[0, 1].indexOf(this.formDialogType) ?
{
this.formData.items.push({
"brand": "",
"companyWechatId": "",
"cost": "",
"costValue": "",
"goodsCategoryId": "",
"goodsCategoryName": "",
"goodsId": "",
"goodsName": "",
"goodsSpecification": "",
"goodsStockUnit": "",
"goodsType": "",
"note": "",
"parentCategoryId": "",
"parentCategoryName": "",
"productCategory": "",
"purchaseId": "",
"recQty": "",
"retQty": "",
"stockQty": "",
"websitId": "",
"websitName": ""
})
// if (this.pageType == "auxiliaryMaterialsStorage") {
// } else if (this.pageType == "returnAuxiliaryMaterials") {
// } else if (this.pageType == "partsStorage") {
// } else if (this.pageType == "partsReturn") {
// }
}}>添加
: null}
)
}
},]
}
},
methods: {
// 表格列解析渲染数据更改
columnParsing(item, defaultData) {
return defaultData
},
// 监听勾选变化
selectionChange(data) {
this.recordSelected = data
},
// 打开
openForm() {
{/* Promise.all([
]).then(([res1]) => {
}) */}
this.formDialog = true
},
// 添加
addData() {
this.formDialogType = 0
this.openForm()
},
// 关闭弹窗
formCancel() {
this.$refs.formRef.$refs.inlineForm.clearValidate()
this.$data.formData = this.$options.data().formData
this.formDialog = false
},
},
}