Commit bd652233 by 郁子恒

解决合并冲突

parents adf30c4e dc4630e1
......@@ -6,24 +6,32 @@
<span style="margin-left: 80px;" v-if="isSelectTable">表名:</span> <vxe-input v-if="isSelectTable" v-model="tableName" placeholder="请填写表名" size="mini"></vxe-input>
</div>
<!-- 全部表格信息 -->
<div style="width: 460px;overflow: auto;">
<vxe-table :data="SelectTableData" ref="xTableColumn" border class="mytable-scrollbar" height="240" v-if="isSelectTable" style="margin-bottom: 5px;">
<vxe-column field="" title="列配置">
<div style="width: 498px;overflow: auto;">
<vxe-table :data="SelectTableData" ref="xTableColumn" border class="mytable-scrollbar" height="270" v-if="isSelectTable" auto-resize style="margin-bottom: 5px;">
<vxe-column field="" title="列名" width="150">
<template v-slot="{ row }">
<!-- {{ row.text }} -->
<div style="display: flex;"> <span style="width: 68px;">列名:</span> <vxe-input v-model="row.title" placeholder="请填写列名" size="mini"></vxe-input>
<div style="display: flex;"> <span style="width: 68px;"></span> <vxe-input v-model="row.title" placeholder="请填写列名" size="mini"></vxe-input>
</div>
<div style="display: flex;"> <span style="width: 68px;">属性名:</span> <vxe-input v-model="row.name" placeholder="请填写属性名" size="mini"></vxe-input>
</template>
</vxe-column>
<vxe-column field="" title="属性名" width="150">
<template v-slot="{ row }">
<div style="display: flex;"> <span style="width: 68px;"></span> <vxe-input v-model="row.name" placeholder="请填写属性名" size="mini"></vxe-input>
</div>
</template>
</vxe-column>
<vxe-column field="" title="值类型" width="150">
<template v-slot="{ row }">
<div style="display: flex;"> <span style="width: 68px;line-height: 12px;">
类型:</span> <vxe-select v-model="row.type" placeholder="选择值类型" placement="top" v-if="row.typeOptions.length > 1">
</span> <vxe-select v-model="row.type" placeholder="选择值类型" placement="bottom" v-if="row.typeOptions.length > 1">
<vxe-option v-for="num in row.typeOptions" :key="num.xpath" :value="num.value" :label="num.label"></vxe-option>
</vxe-select>
<vxe-input v-model="row.type" :placeholder="row.typeOptions[0].label" size="mini" v-else disabled></vxe-input>
</div>
</template>
</vxe-column>
<vxe-column field="" title="当前选中单元格文本值">
<vxe-column field="" title="当前选中文本值" width="150">
<template v-slot="{ row }">
{{ row.contentText }}
</template>
......@@ -35,7 +43,7 @@
</vxe-column>
</vxe-table>
<vxe-table :data="tableData" ref="xTable" border class="mytable-scrollbar" height="220" v-else>
<vxe-table-column v-for="(config, index) in tableColumn" :key="index" v-bind="config"></vxe-table-column>
<vxe-table-column show-overflow="ellipsis" v-for="(config, index) in tableColumn" :key="index" v-bind="config"></vxe-table-column>
</vxe-table>
</div>
<div style="width: 100%;text-align: right;">
......@@ -108,7 +116,7 @@ export default {
if (targetElement.tagName === 'A') {
// 链接
info = {
// xPath:'xPath',
xPath: 'xPath',
url: 'href',
text: 'textContent'
};
......@@ -123,7 +131,7 @@ export default {
} else if (targetElement.tagName === 'IMG') {
// 图片
info = {
// xPath:'xPath',
xPath: 'xPath',
src: 'src',
alt: 'alt'
};
......@@ -154,7 +162,7 @@ export default {
info.type = ''
_this.SelectTableData.push(info)
_this.Xpaths.push(info)
// sdkTable--------------------------------------------------------------------------------------------------------
// sdkTable------------------------------
// 移除事件监听器
document.removeEventListener('contextmenu', contextMenuHandler);
_this.contextMenuListenerAdded = false;
......@@ -223,7 +231,7 @@ export default {
// 遍历 Xpaths
for (let i = 0; i < _this.Xpaths.length; i++) {
// _this.Xpaths[i].name = 'ID' + i
_this.table.newCell(_this.Xpaths[i].xpath, _this.Xpaths[i].name, _this.Xpaths[i].type, _this.Xpaths[i].title)
_this.table.newCell(_this.Xpaths[i].xpath, _this.Xpaths[i].name, _this.Xpaths[i].type, _this.Xpaths[i].typeOptions, _this.Xpaths[i].title)
}
_this.table.verify()
_this.table.name = _this.tableName
......@@ -237,6 +245,7 @@ export default {
let objs = {}
objs.field = _this.Xpaths[i].name
objs.title = _this.Xpaths[i].title
// objs.width = 150
_this.tableColumn.push(objs)
}
......@@ -244,10 +253,8 @@ export default {
_this.table.Name = this.actionName
_this.table.Alias = this.actionType
_this.$emit('dataChanged', _this.table);
console.log(this.tableData)
}
},
}
</script>
......
......@@ -14,9 +14,9 @@ function table () {
* 新生成一个单元格
* @param {any} xpath
*/
this.newCell = function (xpath,name,type,title) {
this.newCell = function (xpath, name, type, types,title) {
_isVerified = false;//加入了
let newCell = new cell(xpath,name,type,title);
let newCell = new cell(xpath, name, type,types, title);
this.cells.push(newCell);
}
/**
......@@ -62,7 +62,7 @@ function table () {
* 加载JSON格式,生成一个新的对象结构
* @param {table} obj 元素的XPath路径
*/
this.load = function (obj) {
this.name = obj.name;
this.xpath = obj.xpath;
......@@ -102,7 +102,7 @@ function table () {
* @param {string} type 元素取值类型,文本,链接,元素路径(点击动作用)
* @param {string} title 标题信息
*/
function cell (xpath, name , type , title ) {
function cell (xpath, name, type,types, title) {
/**当前单元格的绝对路径,存入Action时有用 */
this.xpath = xpath;
/**当前单元格存储数据时的属性名 */
......@@ -110,7 +110,7 @@ function cell (xpath, name , type , title ) {
/**单元格取值类型, 文本,链接,元素路径(点击动作用)*/
this.type = type;
/**当前单元格所具备的可以操作的类型集合 */
this.types = [];
this.types = types;
/** 单元格在表上的表头信息*/
this.title = title;
/**当表结构验证成功后,正确的表绝对路径,不包含下标 */
......@@ -167,7 +167,13 @@ function cell (xpath, name , type , title ) {
let cellXpath = this.tableXpath + "[" + index + "]" + '/' + this.relativeXpath;
let results = document.evaluate(cellXpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if (!!results.singleNodeValue) {
result[this.name] = results.singleNodeValue[this.type];
// console.log(results)
if (this.type == 'xPath') {
result[this.name] = this.xpath
} else {
result[this.name] = results.singleNodeValue[this.type];
}
}
};
return this;//返回当前对象
......
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