Commit 07182f75 by zhengxiaokui

zxk

parent cc0dca2b
<template>
<el-dialog :title="promptData.title" :visible.sync="show"
<el-dialog
:title="promptData.title"
:visible.sync="show"
custom-class="grid-ety"
:highlight-current-row="true"
width="60%"
:before-close="beforeClose">
<el-table :data="tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)"
:before-close="beforeClose"
>
<el-table
:data="
tableData.slice((currentPage - 1) * pageSize, currentPage * pageSize)
"
border
@row-dblclick="selectEty">
<el-table-column v-for="(item,idx) in tableColumn" :key="idx"
@row-dblclick="selectEty"
>
<el-table-column
v-for="(item, idx) in tableColumn"
:key="idx"
:property="item.prop"
:label="item.label"
:width="item.width">
:width="item.width"
>
</el-table-column>
</el-table>
<el-pagination
......@@ -33,108 +43,131 @@ export default {
type: Object,
default: () => {
return {
title: '',
columnStr: '',
title: "",
columnStr: "",
data: [],
rulePath: ''
}
}
}
rulePath: "",
modelUrl: "", //非机构处理需要回填的字段路劲信息,isPty为false时必输
};
},
},
isPty: {
//默认为机构处理
type: Boolean,
default: true,
},
},
data() {
return {
show: false,
currentPage: 1,
pageSizes: [5, 10, 20, 30, 40, 50, 100],
pageSize: 5
}
pageSize: 5,
};
},
computed: {
tableColumn() {
return this.dealExtKeyTableColumn()
return this.dealExtKeyTableColumn();
},
tableData() {
return this.dealExtKeyTableData()
}
return this.dealExtKeyTableData();
},
},
methods: {
dealExtKeyTableColumn() {
const columnArr = []
const lines = this.promptData.columnStr.split("\r\n")
const etyReg = /\"([^\"]*)\"/
const obj = {}
const columnArr = [];
const lines = this.promptData.columnStr.split("\r\n");
const etyReg = /\"([^\"]*)\"/;
const obj = {};
for (let i = 0; i < lines.length; i++) {
let line = lines[i];
if (etyReg.test(line)) {
const gs = line.match(etyReg)
const columnName = gs[1]
const newLine = line.replace(gs[0], " _ ")
const colPropArr = newLine.split(/\s+/)
const positionArr = colPropArr[1].split(":")
const gs = line.match(etyReg);
const columnName = gs[1];
const newLine = line.replace(gs[0], " _ ");
const colPropArr = newLine.split(/\s+/);
const positionArr = colPropArr[1].split(":");
if (!obj[positionArr[0]]) {
obj[positionArr[0]] = []
obj[positionArr[0]] = [];
}
obj[positionArr[0]].push({
idx: colPropArr[0],
prop: columnName,
width: colPropArr[3]
})
width: colPropArr[3],
});
}
}
for (const k in obj) {
if (Object.hasOwnProperty.call(obj, k)) {
const o = obj[k];
const tableColumn = o.map(item => item.prop).join("\n")
const tableColumn = o.map((item) => item.prop).join("\n");
columnArr.push({
prop: tableColumn,
label: tableColumn,
// width: o[0].width,
width: "auto",
index: k,
children: o
})
children: o,
});
}
}
return columnArr.sort((a,b) => {
return parseInt(a.index) - parseInt(b.index)
})
return columnArr.sort((a, b) => {
return parseInt(a.index) - parseInt(b.index);
});
},
dealExtKeyTableData() {
const arr = []
const arr = [];
for (let i = 0; i < this.promptData.data.length; i++) {
const d = this.promptData.data[i];
const items = d.split("\t")
const it = {}
const items = d.split("\t");
const it = {};
for (let j = 0; j < this.tableColumn.length; j++) {
const column = this.tableColumn[j];
it[column['prop']] = column.children.map(c => items[c['idx']] || " ").join("\n")
it[column["prop"]] = column.children
.map((c) => items[c["idx"]] || " ")
.join("\n");
}
it["IDX"] = i;
//隐藏列,便于取值
if(typeof this.promptData.shadow==='object'){
for(let k in this.promptData.shadow){
it[k]=items[this.promptData.shadow[k]]
}
}
it['IDX'] = i
arr.push(it)
arr.push(it);
}
return arr
return arr;
},
currentChange(currentPage) {
this.currentPage = currentPage;
},
selectEty(row, column, event) {
// 默认第一列
const v = row[this.tableColumn[0].prop].split("\n")[0]
this.$emit("select-ety", v, this.promptData.rulePath)
if (this.isPty) {
const v = row[this.tableColumn[0].prop].split("\n")[0];
this.$emit("select-ety", v, this.promptData.rulePath);
} else {
const { modelUrl,isCover, rulePath } = this.promptData;
let v = {};
for (let k in modelUrl) {
row[k] &&(v[k] = row[k]);
}
this.$emit("select-ety", v, modelUrl,isCover, rulePath);
}
this.show = false;
this.currentPage = 1;
},
beforeClose(done) {
this.show = false;
this.currentPage = 1;
done()
}
}
}
done();
},
},
};
</script>
<style>
.grid-ety .el-table .cell{
.grid-ety .el-table .cell {
white-space: pre-wrap;
}
</style>
\ No newline at end of file
import commonDeclare from "./commonDeclare"
import commonApi from "./commonApi"
import Utils from "~/utils"
import _ from "~/utils/Lodash.js";
export default {
mixins: [commonApi, commonDeclare],
......@@ -163,9 +164,13 @@ export default {
},
/**
* 弹出机构选择框
* @param {String} rulePath 路径
* @param {String} rulePath
* @param {String} columns 自定义需要展示列
* @param {String} shadow 自定义列后需要保留的影藏字段
* @param {String} modelUrl 非机构双击后需要回填的字段路劲,k:对应列,value:应用model路劲,如{TXT:'ledgrp.blk.lcrgod'}
* @param {String} isCover 非机构双击后需要回填的字段值是覆盖还是叠加,部分覆盖值为对象,false为叠加,如{TXT:false},k值为modelUrl的k,如全部覆盖则isCover='T',如全部叠加则isCover='',默认全部覆盖
*/
showGridPromptDialog(rulePath, columns) {
showGridPromptDialog(rulePath, columns, shadow, modelUrl, isCover = "T") {
this.executeRule(rulePath).then((res) => {
if (res.respCode = SUCCESS) {
if (res.data.params) {
......@@ -175,8 +180,11 @@ export default {
this.root.promptData = {
title: res.data.title,
columnStr: columns ? columns : res.data.columns,
shadow: shadow,
data: res.data.vals.rows,
rulePath: rulePath,
modelUrl: modelUrl,
isCover: isCover,
}
}
}
......@@ -198,6 +206,25 @@ export default {
}
});
},
/**
* 货物条款等非机构栏位回填
* @param {Object} val 选种行的值
* @param {Object} url 字段路劲 需要回填的字段路劲
* @param {Object} url 对应字段值是否覆盖 ,需要为true,否则合并叠加
* @param {String} rulePath 路径
*/
selectMsg(val, modelUrl, isCover, rulePath) {
for (let k in val) {
let msg = val[k]
if ((typeof isCover === 'string' && isCover === '') || !isCover[k]) {
let ms = _.get(this.model, modelUrl[k], '')
msg = (ms ? ms + '\r\n' : '') + msg
}
_.set(this.model, modelUrl[k], msg);
this[modelUrl[k]] = msg
}
},
/**
* 改变表单项的是否必填属性
* @param {String} property 属性
......
......@@ -161,7 +161,7 @@ export default {
}
},
async onLcrdocButtxmsel() {
let rtnmsg = await this.executeRule("lcrdoc.buttxmsel")
let rtnmsg = await this.executeRule("letp.lcrdoc.buttxmsel")
if (rtnmsg.respCode == SUCCESS) {
//TODO 处理数据逻辑
......
<template>
<c-row>
<c-blkTextarea :model="model" v-bind="blk"> </c-blkTextarea>
<!-- Description of Goods -->
<c-col :span="19">
<!-- <c-col :span="19">
<el-form-item label="货物说明" prop="ledgrp.blk.lcrgod">
<c-input
type="textarea"
......@@ -14,17 +15,16 @@
</el-form-item>
</c-col>
<c-col :span="2" class="letopn_dogp_button">
<!-- @click="onLcrgodButtxmsel" -->
<c-button
size="small"
type="primary"
icon="el-icon-search"
@click="showGridPromptDialog('letp.lcrgod.buttxmsel',columns)"
@click="showGridPromptDialog(...dialogArg)"
>
...
</c-button>
</c-col>
</c-col> -->
<!-- @click="onLcrgodButtxmsel" -->
<br />
<c-col :span="12">
<el-form-item label="货物类型" prop="ledgrp.rec.stagod">
......@@ -43,14 +43,23 @@ import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Letopn/Event";
import BlkTextarea from "~/views/Public/BlkTextarea";
export default {
inject: ["root"],
props: ["model", "codes"],
components: { "c-blkTextarea": BlkTextarea },
mixins: [CommonProcess],
data() {
return {
columns: "1 2 \"EXTKEY\" 410 50\r\n2 1 \"NAM\" 410 50\r\n3 3 \"TXT\" 410 50\r\nUIL\r\nVER\r\nETGEXTKEY\r\nP COLORED TRUE\r\nP VERTLINES TRUE\r\nP HORZLINES TRUE\r\nP MULTISELECT FALSE\r\nP COLUMNSIZING TRUE"
blk: {
blkMsg: {
title: "货物说明",
dataUrl: "ledgrp.blk.lcrgod", //字段所在model路劲
rows: 20,
},
rulePath: "letp.lcrgod.buttxmsel",
},
};
},
methods: { ...Event },
......
<template>
<div class="eibs-tab">
<c-col :span="19">
<c-blkTextarea :model="model" v-bind="blk"> </c-blkTextarea>
<!-- <c-col :span="19">
<el-form-item label="单据要求" prop="ledgrp.blk.lcrdoc">
<c-input
type="textarea"
......@@ -22,7 +23,7 @@
>
...
</c-button>
</c-col>
</c-col> -->
</div>
</template>
<script>
......@@ -30,13 +31,24 @@ import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import CodeTable from "~/config/CodeTable";
import Event from "~/model/Letopn/Event";
import BlkTextarea from "~/views/Public/BlkTextarea";
export default {
inject: ["root"],
props: ["model", "codes"],
components: { "c-blkTextarea": BlkTextarea },
mixins: [CommonProcess],
data() {
return {};
return {
blk: {
blkMsg: {
title: "单据要求",
dataUrl: "ledgrp.blk.lcrdoc", //字段所在model路劲
rows: 20,
},
rulePath: "letp.lcrdoc.buttxmsel",
},
};
},
methods: { ...Event },
created: function () {},
......
......@@ -13,9 +13,12 @@
</el-form-item>
</c-col>
<c-col :span="3">
<c-button size="small" type="primary" @click="onSeainf" icon="el-icon-search"
></c-button
>
<c-button
size="small"
type="primary"
@click="onSeainf"
icon="el-icon-search"
></c-button>
<c-button
size="small"
type="primary"
......@@ -158,10 +161,10 @@
<c-col :span="12">
<el-form-item label="" label-width="20px" prop="ledgrp.cbs.max.amt">
<c-input
<c-input-currency
v-model="model.ledgrp.cbs.max.amt"
placeholder="请输入最大金额"
></c-input>
></c-input-currency>
</el-form-item>
</c-col>
......
......@@ -7,8 +7,6 @@
:handleCheck="handleCheck"
:handleStash="handleStash"
>
<el-button size="small">流程附言</el-button>
<el-button size="small">交易历史</el-button>
<el-button size="small">备忘录</el-button>
<el-button size="small">影像信息</el-button>
<el-button size="small">保存模板</el-button>
......@@ -130,8 +128,9 @@
</el-form>
<c-grid-ety-prompt-dialog
ref="etyDialog"
:isPty="false"
:promptData="promptData"
v-on:select-ety="selectEty"
@select-ety="selectMsg"
>
</c-grid-ety-prompt-dialog>
</div>
......@@ -144,6 +143,7 @@ import Utils from "~/utils/index";
import CodeTable from "~/config/CodeTable";
import Letopn from "~/model/Letopn";
import CommonProcess from "~/mixin/CommonProcess";
import CommonFuncs from "~/mixin/CommonFuncs";
import Check from "~/model/Letopn/Check";
import Default from "~/model/Letopn/Default";
import Pattern from "~/model/Letopn/Pattern";
......@@ -195,7 +195,7 @@ export default {
root: this,
};
},
mixins: [CommonProcess], // 里面包含了Default、Check等的公共处理
mixins: [CommonProcess, CommonFuncs], // 里面包含了Default、Check等的公共处理
data() {
return {
tabVal: "ovwp",
......
<template>
<div>
<!-- Description of Goods -->
<c-col :span="19">
<el-form-item :label="blkMsg.title" :prop="blkMsg.dataUrl">
<c-input
type="textarea"
:rows="blkMsg.rows"
v-model="blkTextarea"
maxlength="2000"
show-word-limit
:placeholder="`请输入${blkMsg.title}`"
></c-input>
</el-form-item>
</c-col>
<c-col :span="2" class="BlkTextarea_button">
<c-button
size="small"
type="primary"
icon="el-icon-search"
@click="
showGridPromptDialog(rulePath, columns, shadow, modelUrl, isCover)
"
>
...
</c-button>
</c-col>
</div>
</template>
<script>
import Api from "~/service/Api";
import CommonProcess from "~/mixin/CommonProcess";
import _ from "~/utils/Lodash.js";
/**
*
* @param {String} rulePath 请求路径
* @param {String} columns 自定义需要展示列
* @param {String} shadow 自定义列后需要保留的影藏字段
* @param {String} modelUrl 非机构双击后需要回填的字段路劲,k:对应列,value:应用model路劲,如{TXT:'ledgrp.blk.lcrgod'}
* @param {String} isCover 非机构双击后需要回填的字段值是覆盖还是叠加,部分覆盖值为对象,false为叠加,如{TXT:false},k值为modelUrl的k,如全部覆盖则isCover='T',如全部叠加则isCover='',默认全部覆盖
*/
export default {
inject: ["root"],
props: {
model: {
type: Object,
default: undefined,
},
blkMsg: {
//大字段信息
type: Object,
default: function () {
return {
title: "货物说明",
dataUrl: "ledgrp.blk.lcrgod", //字段所在model路劲
rows: 20,
};
},
},
rulePath: {
type: String,
default: "",
},
columns: {
type: String,
default:'1 2 "EXTKEY" 410 50\r\n2 1 "NAM" 410 50\r\nTXT\r\nUIL\r\n5 3 "VER" 410 50\r\nETGEXTKEY\r\nP COLORED TRUE\r\nP VERTLINES TRUE\r\nP HORZLINES TRUE\r\nP MULTISELECT FALSE\r\nP COLUMNSIZING TRUE',
},
shadow: {
type: Object,
default: () => {
return { TXT: 3 };
},
},
modelUrl: {
type: Object,
default: function () {
let obj = { TXT: this.blkMsg.dataUrl };
return obj;
},
},
isCover: {
type: Object,
default: undefined,
},
},
mixins: [CommonProcess],
data() {
return {
blkTextarea: _.get(this.model, this.blkMsg.dataUrl, ""),
};
},
watch: {
getBlk: {
handler(val, oldVal) {
this.blkTextarea = _.get(this.model, this.blkMsg.dataUrl, "");
// console.log("blkTextarea is:", this.blkTextarea);
},
immediate: false,
},
blkTextarea: {
handler(val, oldVal) {
_.set(this.model, this.blkMsg.dataUrl, val);
// console.log("blkTextarea is 2:", this.blkTextarea);
},
immediate: false,
},
},
computed: {
getBlk() {
return _.get(this.model, this.blkMsg.dataUrl, "");
},
},
created: function () {},
};
</script>
<style>
.BlkTextarea_button {
margin: 20px 0 0 0px;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment