<template>
|
<div class="page-list-container">
|
<!--数据Table-->
|
<yrt-data-list :ref="dataListRef" :editor-ref="editorRef" :data-options="dataOptions" :fields.sync="dataListOptions.fields" :buttons="dataListOptions.buttons" :button-click="buttonClick" :data-list-selections.sync="dataListSelections" :auth-nodes="authNodes">
|
<template slot="common-column-slot" slot-scope="{row, col}">
|
<template v-if="col.prop=='productAttribute'">
|
<template v-if="row[col.prop]!='正常'">
|
<el-tag color="yellow" style="color:black;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</el-tag>
|
</template>
|
<template v-else>
|
<el-tag color="green" style="color:white;border:0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop]||0, col.dropdown_Id) }}
|
</el-tag>
|
</template>
|
</template>
|
<template v-else-if="col.dropdown_Id>0">
|
{{ $refs[dataListRef].translateText(col.prop, row[col.prop], col.dropdown_Id) }}
|
</template>
|
<template v-else>
|
<template v-if="col.prop==dataOptions.linkColumn">
|
<el-link type="primary" @click.native="()=>{linkEditor(row[dataOptions.idField]);}">{{ row[col.prop] }}</el-link>
|
</template>
|
<template v-else>
|
<template v-if="['date', 'datetime'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatDate(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else-if="['byte', 'int32', 'int64', 'decimal', 'double'].indexOf(col.dataType)>=0 && col.formatter">
|
{{ common.formatNumber(row[col.prop], col.formatter) }}
|
</template>
|
<template v-else>
|
{{ row[col.prop] }}
|
</template>
|
</template>
|
</template>
|
</template>
|
</yrt-data-list>
|
|
<!--数据编辑器Editor-->
|
<yrt-editor :ref="editorRef" :data-list-ref="dataListRef" v-bind="editorOptions" :data-options="dataOptions" :action.sync="editorOptions.action" :top.sync="editorOptions.top" :visible.sync="editorOptions.config.visible" :detail-button-click="detailButtonClick" :auth-nodes="authNodes"></yrt-editor>
|
|
<el-dialog :visible.sync="dialogFormAttribute" title="属性转换" width="25%">
|
<el-form :model="transferAttrForm">
|
<el-form-item :label-width="formLabelWidth" label="目标属性">
|
<el-select v-model="transferAttrForm.destAttr" placeholder="请选择目标属性">
|
<el-option v-for="(item, index) in dropDownList_DestAttr" :key="index" :label="item.Value02" :value="item"></el-option>
|
</el-select>
|
</el-form-item>
|
<el-form-item v-if="dataListSelections.length===1" :label-width="formLabelWidth" label="数量">
|
<el-input v-model="transferAttrForm.productStorage" autocomplete="off"></el-input>
|
</el-form-item>
|
</el-form>
|
<div slot="footer" class="dialog-footer">
|
<el-button @click="dialogFormAttribute = false">取 消</el-button>
|
<el-button type="primary" @click="sSZH()">确 定</el-button>
|
</div>
|
</el-dialog>
|
</div>
|
</template>
|
<script>
|
import baseLayout from "@/components/common/base-layout.vue";
|
|
export default {
|
name: "storage-base-product-position-name",
|
components: {},
|
// 自定义表名
|
tableName: "vBase_ProductPositionGroup",
|
mixins: [baseLayout],
|
data() {
|
return {
|
dialogFormAttribute: false,
|
dropDownList_DestAttr: ["残品", "次品", "即将过期", "正常"],
|
transferAttrForm: {
|
destAttr: [],
|
productStorage: 0
|
},
|
formLabelWidth: "120px"
|
};
|
},
|
created() {
|
this.loadDropDown_DestAttr();
|
},
|
methods: {
|
// 列表工具栏点击事件
|
buttonClick(authNode) {
|
switch (authNode) {
|
case "lock":
|
// 锁定
|
this.lock();
|
break;
|
case "unlock":
|
// 解锁
|
this.unlocak();
|
break;
|
case "sSZH":
|
// 属性转换
|
var the = this;
|
if (the.dataListSelections.length === 1) {
|
the.transferAttrForm.productStorage = the.dataListSelections[0].productStorage;
|
}
|
this.dialogFormAttribute = true;
|
break;
|
}
|
},
|
// 锁定
|
lock() {
|
var the = this;
|
var selectedIds = the.dataListSelections
|
.map((item, index, array) => {
|
return item.productPosition_Id;
|
})
|
.join(",");
|
if (!selectedIds.length) {
|
this.$message.error("请至少选择一行数据!");
|
return false;
|
}
|
if (selectedIds) {
|
this.$confirm("您确定要[锁定]选中的数据吗?", "批量锁定", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
const url = "api/storage/positionName/lock";
|
const params = {
|
openNodeApi: true,
|
selectedIds: selectedIds
|
};
|
var ref = the.dataList;
|
this.common.ajax(url, params, res => {
|
if (res.result) {
|
the.common.showMsg(res);
|
ref.loadData();
|
}
|
});
|
})
|
.catch(() => {
|
the.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
}
|
},
|
// 解锁
|
unlocak() {
|
var the = this;
|
var selectedIds = the.dataListSelections
|
.map((item, index, array) => {
|
return item.productPosition_Id;
|
})
|
.join(",");
|
if (selectedIds) {
|
this.$confirm("您确定要[解锁]选中的数据吗?", "批量解锁", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
var url = "api/storage/positionName/UnLock";
|
var params = {
|
openNodeApi: true,
|
selectedIds: selectedIds
|
};
|
var ref = the.dataList;
|
var callBack = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
ref.loadData();
|
}
|
};
|
this.common.ajax(url, params, callBack);
|
})
|
.catch(() => {
|
the.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
}
|
},
|
// 属性转换
|
sSZH() {
|
var the = this;
|
if (!the.transferAttrForm.destAttr) {
|
this.$message.error("请选择目标属性");
|
return;
|
}
|
|
if (the.dataListSelections && the.dataListSelections.length === 1) {
|
if (!the.transferAttrForm.productStorage) {
|
this.$message.error("请输入数量");
|
return;
|
}
|
}
|
|
var selectedItem = [];
|
the.dataListSelections.forEach(element => {
|
selectedItem.push({
|
storage_Id: element.storage_Id,
|
positionName: element.positionName,
|
product_Id: element.product_Id,
|
storageStatus: element.storageStatus,
|
productAttribute: element.productAttribute
|
});
|
});
|
|
if (!selectedItem && selectedItem.length > 0) {
|
this.$message.error("请选择需要转换的物料");
|
return;
|
}
|
|
this.$confirm("您确定要将选中的数据进行属性转换吗?", "属性转换", {
|
confirmButtonText: "确定",
|
cancelButtonText: "取消",
|
type: "warning"
|
})
|
.then(() => {
|
var url = "api/storage/positionName/ChangeAttr";
|
var params = {
|
openNodeApi: true,
|
selectedItem: selectedItem,
|
toAttr: the.transferAttrForm.destAttr,
|
productStorage: the.transferAttrForm.productStorage
|
};
|
var ref = the.dataList;
|
var callBack = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
the.dialogFormAttribute = false;
|
ref.loadData();
|
}
|
};
|
this.common.ajax(url, params, callBack);
|
})
|
.catch(() => {
|
the.$message({
|
type: "info",
|
message: "已取消"
|
});
|
});
|
},
|
// 加载仓库下拉框
|
loadDropDown_DestAttr() {
|
var the = this;
|
var url = "/api/common/loadDropDown";
|
var params = {
|
openNodeApi: true,
|
where: "834",
|
data: JSON.stringify(this.formData)
|
};
|
var callBack = res => {
|
the.common.showMsg(res);
|
if (res.result) {
|
if (res.data && res.data["dropdown" + params.Where] && res.data["dropdown" + params.Where].length > 0) {
|
the.dropDownList_DestAttr = res.data["dropdown" + params.Where];
|
}
|
}
|
};
|
the.common.ajax(url, params, callBack);
|
}
|
}
|
};
|
</script>
|