master
lion 2 years ago
parent 60ec9e2bf7
commit 625669fcf9

@ -182,7 +182,7 @@ export default {
overflow-y: scroll;
overflow-y: auto;
}
::-webkit-scrollbar{display:none}
.ivu-modal-body::-webkit-scrollbar{display:none}
.xy-table-item{
display: flex;
align-items: center;

@ -814,7 +814,7 @@ export default {
sort-orders={item.sortOrders}
resizale={item.resizale}
formatter={item.formatter}
show-overflow-tooltip={item.showOverflowTooltip ?? true}
// show-overflow-tooltip={item.showOverflowTooltip ?? true}
align={item.align ?? "center"}
header-align={item.headerAlign ?? "center"}
class-name={`xy-table__row-fade ${item.className} body-cell-${index}`}
@ -1054,3 +1054,15 @@ export default {
}
}
</style>
<style scoped>
.el-table__fixed {
height: auto !important;
bottom: 5px;
position: absolute;
top: 0;
left: 0;
position: absolute;
top: 0;
left: 0;
}
</style>

@ -11,8 +11,14 @@ import {
let loading ;
// create an axios instance
let baseUrl = ''
if(window.location.origin.indexOf('localhost')>-1){
baseUrl = process.env.VUE_APP_BASE_API
}else{
baseUrl = window.location.origin + '/'
}
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API, // url = base url + request url
baseURL: baseUrl, // url = base url + request url
// withCredentials: true, // send cookies when cross-domain requests
timeout: 5000, // request timeout
isLoading:true

@ -0,0 +1,469 @@
<script>
import { save, show, index } from "@/api/system/baseForm";
import { getparameter } from "@/api/system/dictionary";
import { domMap } from "@/const/inputType";
import { addPropsMap } from "@/const/addProps";
export default {
props: {
formInfo: {
type: Array,
default: () => [],
},
tableName: String,
},
render(h) {
return h(
"el-dialog",
{
props: {
title: "新增",
visible: this.dialogVisible,
width: "600px",
},
on: {
"update:visible": (val) => {
this.dialogVisible = val;
},
},
},
[
h(
"el-form",
{
ref: "elForm",
props: {
model: this.form,
labelWidth: "80px",
rules: this.rules,
labelPosition: "right",
size: "small",
},
},
(() => {
let dom = [];
this.formInfo.forEach((i, index) => {
if (i.list_show) {
dom.push(
h(
"el-form-item",
{
ref: `elFormItem${i.field}`,
style: {
width: "100%",
},
props: {
label: i.name,
prop: i.field,
required:
i.validation instanceof Array
? !!i.validation.find((i) => i === "required")
: false,
},
},
[
h(
domMap.get(i.edit_input),
{
ref: `elEdit_${i.field}`,
style: {
width: "100%",
},
props: {
...addPropsMap.get(i.edit_input),
...this.extraProps(i),
placeholder: i.help,
value: this.form[i.field],
},
attrs: {
placeholder: i.help || `请填写${i.name}`,
},
on: {
[this.getEventType(i.edit_input)]: (e) => {
if (i.field) {
this.form[i.field] = e;
this.form = Object.assign({}, this.form);
}
},
},
scopedSlots:
i.edit_input === "file" || i.edit_input === "files"
? {
file: (scope) => {
console.log("scope",scope)
let { file } = scope;
return [
h("div", {}, [
h("i", {
class: {
"el-icon-circle-check":
file.status === "success",
"el-icon-loading":
file.status === "uploading",
},
style: {
"color": file.status === "success" ? "green" : ""
}
}),
h(
"a",
{
attrs: {
href: file.url,
download: file.name,
},
class: {
"uploaded-a":
file.status === "success",
}
},
file.name
)
]),
h("i", {
class: "el-icon-close",
on: {
["click"]: () =>
this.fileRemoveHandler(
file,
i.field
),
},
}),
];
},
}
: "",
},
this.optionsRender(h, i)
),
]
)
);
}
});
return dom;
})()
),
h("template", { slot: "footer" }, [
h(
"el-button",
{
on: {
click: () => (this.dialogVisible = false),
},
},
"取 消"
),
h(
"el-button",
{
props: {
type: "warning",
plain: true,
},
on: {
click: () => this.init(),
},
},
"重 置"
),
h(
"el-button",
{
props: {
type: "primary",
},
on: {
click: this.submit,
},
},
"确 定"
),
]),
]
);
},
data() {
return {
id: "",
type: "add",
dialogVisible: false,
form: {},
rules: {},
file: {},
};
},
methods: {
fileRemoveHandler(file, field) {
console.log(file,field,this.file)
this.file[field] = this.file[field].filter((item) => item !== file);
this.file = Object.assign({}, this.file);
},
//on
getEventType(info) {
if (info.type === "checkbox") {
return "change";
}
return "input";
},
//
optionsRender(h, info) {
if (info.edit_input === "checkbox" || info.edit_input === "radio") {
return info._paramters && info._paramters instanceof Array
? info._paramters.map((i) =>
h("el-option", {
props: {
label: i.name || i.no || i.value || i.id,
value: i.id,
},
})
)
: [];
}
if (info.edit_input === "file" || info.edit_input === "files") {
return [
h(
"el-button",
{
slot: "trigger",
props: {
size: "small",
type: "primary",
},
},
"选取文件"
),
h(
"el-button",
{
style: {
"margin-left": "10px",
},
props: {
size: "small",
type: "success",
},
on: {
["click"]: (e) => {
this.$refs[`elEdit_${info.field}`].submit();
},
},
},
"上传到服务器"
),
h(
"div",
{
class: "el-upload__tip",
slot: "tip",
},
"文件不超过500kb"
),
];
}
},
extraProps(info) {
let props = {};
if (info.edit_input === "file" || info.edit_input === "files") {
props.fileList = this.file[info.field];
props.beforeUpload = (file) => {
if (file.size / 1000 > 500) {
this.$message({
type: "warning",
message: "上传图片大小超过500kb",
});
return false;
}
};
props.onSuccess = (response, file, fileList) => {
console.log("this.file[info.field]",this.file[info.field])
console.log("file1111",this.file)
this.file[info.field] = fileList;
};
props.onRemove = (file, fileList) => {
this.file[info.field] = fileList;
};
props.onError = (err,file,fileList) => {
this.file[info.field] = fileList;
this.$message({
type: "warning",
message: err
})
}
}
return props;
},
init() {
for (let key in this.form) {
if (this.form[key] instanceof Array) {
this.form[key] = [];
} else {
this.form[key] = "";
}
}
this.$refs["elForm"].clearValidate();
},
show() {
this.dialogVisible = true;
},
hidden() {
this.dialogVisible = false;
},
setType(type = "add") {
let types = ["add", "editor"];
if (types.includes(type)) {
this.type = type;
} else {
console.warn("Unknown type: " + type);
}
},
setId(id) {
if (typeof id == "number") {
this.id = id;
} else {
console.error("error typeof id: " + typeof id);
}
},
async getDetail() {
const res = await show({ id: this.id, table_name: this.tableName });
this.$integrateData(this.form, res);
this.form = Object.assign({}, this.form);
console.log("thisform",this.form,this.formInfo)
this.formInfo.forEach((i) => {
if (i && i.edit_input === "file"|| i.edit_input === "files") {
console.log("res[i.field+'_uploads_id_relation']",res[i.field+'_uploads_id_relation'])
for(var k of res[i.field+'_uploads_id_relation']){
this.file[i.field].push({
name: k?.original_name,
url: "k?.url",
response:k,
})
}
console.log("this.file[i.field]",this.file)
// this.file[i.field] = [
// {
// name: res[i.field+'_uploads_id_relation']?.original_name,
// url: res[i.field+'_uploads_id_relation']?.url,
// response: res[i.field+'_uploads_id_relation'],
// },
// ];
}
});
},
submit() {
if (this.type === "add") {
if (this.form.hasOwnProperty("id")) {
delete this.form.id;
}
}
if (this.type === "editor") {
Object.defineProperty(this.form, "id", {
value: this.id,
enumerable: true,
configurable: true,
writable: true,
});
}
this.$refs["elForm"].validate((validate) => {
if (validate) {
console.log("this.formInfo",this.formInfo)
console.log("file",this.file)
this.formInfo.forEach((info) => {
if (info.edit_input === "files") {
console.log("info",info)
this.form[info.field] = this.file[info.field]?.map(
(i) => i?.response?.id
);
}
if (info.edit_input === "file") {
this.form[info.field] = this.file[info.field][0]?.response?.id;
}
});
console.log("file",this.file)
console.log(this.form);
// return
save(Object.assign(this.form, { table_name: this.tableName })).then(
(res) => {
this.$Message.success({
content: `${this.type === "add" ? "新增" : "编辑"}成功`,
});
this.$emit("refresh");
this.hidden();
}
);
}
});
},
},
computed: {},
watch: {
formInfo: {
handler: function (newVal) {
this.form = {};
this.rules = {};
this.file = {};
newVal.forEach((i) => {
if (i.field) {
this.form[i.field] = "";
if (
i.validation instanceof Array &&
i.validation.length > 0 &&
!!i.validation.find((i) => i === "required")
) {
this.rules[i.field] = [
{ required: true, message: `请填写${i.name}` },
];
}
if (i.edit_input === "files") {
this.form[i.field] = [];
}
if (i.edit_input === "files" || i.edit_input === "file") {
this.file[i.field] = [];
}
if (i.edit_input === "checkbox") {
this.form[i.field] = [];
}
}
});
},
//immediate: true,
},
dialogVisible(val) {
if (val) {
if (this.type === "editor") {
this.$nextTick(() => this.getDetail());
}
} else {
this.file = {};
this.id = "";
this.type = "";
this.init();
this.$refs["elForm"].clearValidate();
delete this.form.id;
}
},
},
};
</script>
<style scoped lang="scss">
.uploaded-a {
color: red;
text-decoration: none;
transition: all 0.2s;
}
.uploaded-a:hover {
color: red;
text-decoration: underline;
}
</style>

@ -71,6 +71,7 @@ export default {
props: {
...addPropsMap.get(i.edit_input),
...this.extraProps(i),
// fileList:this.file[i.field],
placeholder: i.help,
value: this.form[i.field],
},
@ -79,7 +80,6 @@ export default {
},
on: {
[this.getEventType(i.edit_input)]: (e) => {
console.log(1111, e);
if (i.field) {
this.form[i.field] = e;
this.form = Object.assign({}, this.form);
@ -90,9 +90,8 @@ export default {
i.edit_input === "file" || i.edit_input === "files"
? {
file: (scope) => {
console.log("scope",scope)
let { file } = scope;
console.log(111, file);
return [
h("div", {}, [
h("i", {
@ -112,6 +111,7 @@ export default {
attrs: {
href: file.url,
download: file.name,
target:'_blank'
},
class: {
"uploaded-a":
@ -197,6 +197,7 @@ export default {
},
methods: {
fileRemoveHandler(file, field) {
console.log(file,field,this.file)
this.file[field] = this.file[field].filter((item) => item !== file);
this.file = Object.assign({}, this.file);
},
@ -260,6 +261,7 @@ export default {
slot: "tip",
},
"文件不超过500kb"
// info.field
),
];
}
@ -268,7 +270,9 @@ export default {
extraProps(info) {
let props = {};
if (info.edit_input === "file" || info.edit_input === "files") {
props.fileList = this.file[info.field];
// props.fileList = this.file[info.field];
this.$set(props,'fileList',this.file[info.field])
// console.log("123",this.file[info.field],props.fileList)
props.beforeUpload = (file) => {
if (file.size / 1000 > 500) {
this.$message({
@ -295,6 +299,7 @@ export default {
})
}
}
console.log("props",info.field,props)
return props;
},
@ -309,7 +314,13 @@ export default {
this.$refs["elForm"].clearValidate();
},
show() {
this.dialogVisible = true;
if(this.type === "editor"){
this.getDetail()
}else{
this.dialogVisible = true;
}
// this.dialogVisible = true;
},
hidden() {
this.dialogVisible = false;
@ -334,18 +345,34 @@ export default {
const res = await show({ id: this.id, table_name: this.tableName });
this.$integrateData(this.form, res);
this.form = Object.assign({}, this.form);
this.file = {}
this.formInfo.forEach((i) => {
if (i && i.edit_input === "file") {
this.file[i.field] = [
{
name: res[i.link_with_name]?.original_name,
url: res[i.link_with_name]?.url,
response: res[i.link_with_name],
},
];
if(res[i.field+'_uploads_id_relation']){
this.file[i.field] = [
{
name: res[i.field+'_uploads_id_relation']?.original_name,
url: res[i.field+'_uploads_id_relation']?.url,
response: res[i.field+'_uploads_id_relation'],
},
];
}
}
if (i && i.edit_input === "files") {
if(res[i.field+'_upload_details']){
this.file[i.field] = []
for(var k of res[i.field+'_upload_details']){
this.file[i.field].push({
name: k?.original_name,
url: k?.url,
response: k,
})
}
}
}
});
this.dialogVisible = true
this.$forceUpdate()
},
submit() {
@ -364,9 +391,13 @@ export default {
}
this.$refs["elForm"].validate((validate) => {
if (validate) {
console.log("this.formInfo",this.formInfo)
console.log("file",this.file)
this.formInfo.forEach((info) => {
if (info.edit_input === "files") {
this.form[info.field] = info._fileList?.map(
console.log("info",info)
this.form[info.field] = this.file[info.field]?.map(
(i) => i?.response?.id
);
}
@ -374,7 +405,9 @@ export default {
this.form[info.field] = this.file[info.field][0]?.response?.id;
}
});
console.log("file",this.file)
console.log(this.form);
// return
save(Object.assign(this.form, { table_name: this.tableName })).then(
(res) => {
this.$Message.success({
@ -424,7 +457,8 @@ export default {
dialogVisible(val) {
if (val) {
if (this.type === "editor") {
this.$nextTick(() => this.getDetail());
// this.getDetail()
// this.$nextTick(() => this.getDetail());
}
} else {
this.file = {};

@ -321,11 +321,13 @@ export default {
width: i.width,
fixed: i.is_fixed
},linkOb)
})
this.table.unshift({
type: 'index',
width: 60,
label: '序号'
label: '序号',
fixed:'left'
})
}
},
@ -349,6 +351,7 @@ export default {
</script>
<style scoped lang="scss">
.select {
&__item {

@ -24,16 +24,17 @@
<template v-slot:btns>
<el-table-column fixed="right" label="操作" width="260" header-align="center">
<template slot-scope="scope">
<div v-if="scope.row.jilurenyuan==authName||roleName=='系统管理员'">
<Button type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'editor')"></Button>
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'outbounds')"></Button>
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="tofollow(scope.row.id,scope.row)"></Button>
<!-- v-if='scope.row.zhuangtai==="待处理"' -->
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="printChuku(scope.row.id,'print')"></Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteChuku(scope.row)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</div>
<template v-if="isCkName=='仓库管理员'||roleName=='系统管理员'">
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'outbounds')"></Button>
<Button type="primary" size="small" style="margin-left: 10px;" @click="printChuku(scope.row.id,'print')"></Button>
</template>
<template v-if="scope.row.jilurenyuan==authName||roleName=='系统管理员'">
<Button type="primary" size="small" style="margin-left: 10px;" @click="editorChuku(scope.row.id,'editor')"></Button>
<Button v-if='scope.row.zhuangtai===""' type="primary" size="small" style="margin-left: 10px;" @click="tofollow(scope.row.id,scope.row)"></Button>
<Poptip transfer confirm title="确认要删除吗?" @on-ok="deleteChuku(scope.row)">
<Button type="primary" style="margin-left: 10px;" size="small" ghost>删除</Button>
</Poptip>
</template>
</template>
</el-table-column>
@ -88,7 +89,8 @@
loading:false,
userName:'',
authName:'',
roleName:'',
roleName:'',
isCkName:'',
select: {
pageSize: 10,
pageIndex: 1,
@ -169,6 +171,9 @@
if(k.name=='系统管理员'){
this.roleName = k.name
}
if(k.name=='仓库管理员'){
this.isCkName = '仓库管理员'
}
}
}).catch(error => {})

@ -76,7 +76,20 @@
</div>
</div>
</template>
<template v-slot:pandianleixing v-if="rukuTypeName=='盘点'">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;">*</span>盘点类型
</div>
<div class="xy-table-item-content">
<el-select v-model="form.pandianleixing" filterable style="width: 300px;" placeholder="请选择盘点类型">
<el-option v-for="item in pandianList" :key="item.value" :label="item.value"
:value="item.value">
</el-option>
</el-select>
</div>
</div>
</template>
<template v-slot:jingbanren>
<div class="xy-table-item">
<div class="xy-table-item-label">
@ -117,6 +130,31 @@
style="width: 300px;"></el-input>
</div>
</div>
</template>
<template v-slot:zuozhengwenjian v-if="form.pandianleixing!='正常盘点'">
<div class="xy-table-item">
<div class="xy-table-item-label">
<span style="color: red;font-weight: 600;padding-right: 4px;"></span>佐证文件
</div>
<div class="xy-table-item-content">
<el-upload
class="upload-demo"
ref="upload"
:action="action"
multiple
:headers='headers'
:before-upload="beforeUpload"
:on-success='onSuccess'
:on-error='onError'
:on-remove="onRemove"
:file-list="fileList"
:auto-upload="false">
<el-button slot="trigger" size="small" type="primary">选取文件</el-button>
<el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload"></el-button>
<div slot="tip" class="el-upload__tip">上传文件不超过500kb</div>
</el-upload>
</div>
</div>
</template>
<template v-slot:rukumingxi>
<div class="xy-table-item">
@ -299,7 +337,8 @@
import imports from "@/views/component/imports.vue"
import {
index as fieldIndex
} from "@/api/system/customFormField";
} from "@/api/system/customFormField";
import {getToken} from "@/utils/auth";
export default {
components: {
detailContract,
@ -329,30 +368,38 @@
label: '回库',
value: '回库'
}],
rukupiciList: [],
rukupiciList: [],
pandianList:[{label:'正常盘点',value:'正常盘点'},{label:'外部调拨',value:'外部调拨'},{label:'其他',value:'其他'}],
form: {
caigouhetong: '',
qingshiliucheng:"",
gudingzichanbianhao: '',
rukushijian: '',
// caigouhetong:'',
rukuleixing: '',
rukuleixing: '',
pandianleixing:'',
rukucangku: '',
jingbanren: "",
jilurenyuan: '',
baoguanrenyuan: '',
beizhu: '',
beizhu: '',
zuozhengwenjian:'',
rukumingxi: ''
},
fileList:[],
action:process.env.VUE_APP_UPLOAD_API,
headers:{
token:''
},
rules: {
rukushijian: [{
required: true,
message: '请选择入库时间'
}],
pandianleixing: [{
required: true,
message: '请选择盘点类型'
}],
// caigouhetong: [{
// required: true,
// message: ''
// }],
jingbanren: [{
required: true,
message: '请填写经办人'
@ -566,11 +613,40 @@
},
created() {
this.getCangku()
this.headers.token = getToken()
getOatoken().then(res=>{
this.wuziguanli_oatoken =res.oatoken
})
},
methods: {
methods: {
beforeUpload(file){
if (file.size / 1000 > 500) {
this.$message({
type: "warning",
message: "上传文件大小超过500kb",
});
return false;
}
},
onSuccess(response, file, fileList){
console.log("fileList",fileList)
this.fileList = fileList;
},
onRemove(file, fileList){
this.fileList = fileList;
},
onError(err,file,fileList){
this.fileList = fileList;
this.$message({
type: "warning",
message: err
})
},
submitUpload() {
this.$refs.upload.submit();
},
//
importsRuku() {
this.$refs['imports'].show()
@ -633,7 +709,9 @@
async getQs() {
let res = await getQingShi({
table:'qingshi',
page:this.qsPageIndex
page:this.qsPageIndex,
status:1,
keyword:this.qskeyword
// page_size: 10,
// page: this.htPageIndex,
// keyword: this.htkeyword,
@ -903,28 +981,41 @@
qingshiliucheng:res?.qingshiliucheng,
gudingzichanbianhao: res?.gudingzichanbianhao,
rukushijian: res?.rukushijian,
rukuleixing: res?.rukuleixing,
rukuleixing: res?.rukuleixing,
pandianleixing:res?.pandianleixing,
rukucangku: res.rukucangku,
jingbanren: res?.jingbanren,
jilurenyuan: res?.jilurenyuan,
baoguanrenyuan: res?.baoguanrenyuan,
beizhu: res?.beizhu,
beizhu: res?.beizhu,
zuozhengwenjian:res?.zuozhengwenjian,
rukumingxi: ''
}
this.editHt = res?.caigouhetong
this.editQs = res?.qingshiliucheng
this.mingxiList = []
// this.mingxiList = res.id_stocks_items_stocks_id_relation
// if(res.rukuleixing==''){
for(var r of res.id_stocks_item_links_stocks_id_relation){
this.mingxiList.push(JSON.parse(r.yuanshishuju))
}
// }else{
// this.mingxiList = res.id_stocks_items_stocks_id_relation
// }
this.mingxiList = []
for(var r of res.id_stocks_item_links_stocks_id_relation){
this.mingxiList.push(JSON.parse(r.yuanshishuju))
}
this.fileList = []
for(var f of res.zuozhengwenjian_upload_details){
this.fileList.push({
name: f?.original_name,
url: f?.url,
response: f,
})
}
// this.isShow = true
},
submit() {
this.form.id_stocks_items_stocks_id_relation = this.mingxiList
// return
console.log('fileList',this.fileList)
this.form.zuozhengwenjian = []
for(var k of this.fileList){
this.form.zuozhengwenjian.push(k?.response?.id)
}
console.log(this.form.zuozhengwenjian)
// return
if (this.type === 'add') {
save({
@ -1002,7 +1093,11 @@
isShow(newVal) {
if (newVal) {
this.form.rukuleixing = this.rukuType
this.rukuTypeName = this.rukuType == '回库' ? '归还' : this.rukuType
this.rukuTypeName = this.rukuType == '回库' ? '归还' : this.rukuType
console.log(this.rukuTypeName)
if(this.rukuTypeName=='盘点'){
this.form.pandianleixing = '正常盘点'
}
if (this.rukuType == '采购') {
this.getHt()
}
@ -1019,7 +1114,8 @@
this.id = ''
this.type = ''
this.authName = ''
this.mingxiList = []
this.mingxiList = []
this.fileList = []
this.$refs['dialog'].reset()
}
}

@ -190,9 +190,10 @@
this.getindex()
},
editorRuku(id, type) {
this.$refs['addRuku'].id = id
this.$refs['addRuku'].isShow = true
this.$refs['addRuku'].type = type
this.$refs['addRuku'].id = id
this.$refs['addRuku'].type = type
this.$refs['addRuku'].isShow = true
// this.$refs['addRuku'].getDetail()
this.$refs['addRuku'].rukuType = this.rukuType
},
deleteRuku(row) {

Loading…
Cancel
Save