#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
@File    :   body_page_locator.py
@Time    :   2024/11/12 08:13:54
@Author  :   dulip3ng 
@Version :   1.0
@Desc    :   None
'''

class BodyPageLocator:
    SHEET_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//ul[@class  = 'k-tabstrip-items k-reset']//span[text()='%s'])[%d]"
    BUTTON_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text() = '%s']/.."
    BUTTON_ARROW_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text() = '%s']/../following-sibling::a/span[@class = 'k-icon k-i-arrow-s']"
    SUB_BUTTON_ARGS_LOC = "//div[@class = 'k-animation-container k-split-wrapper']/ul//span[text() = '%s']/.."
    #单据体存在相对位置相同，名称相同的字段，使用顺序号进行区分，顺序号从1开始
    ACTIVATE_FIELD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d'])[%d]"
    TEXT_FIELD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//*[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d']/ancestor::td/descendant::input[1])[%d]"
    SELECT_FIELD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//input[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d']/ancestor::td/span)[%d]"
    SELECT_ITEM_ARGS_LOC = "//div[@class = 'k-animation-container' and contains(@style, 'display: block') ]/div/div[2]/ul/li/span[text() = '%s']"
    BASE_FIELD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//div[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d']/descendant::input)[%d]"
    BASE_ITEM_ARGS_LOC ="//div[@class = 'k-animation-container']//table[@class = 'k-selectable']/descendant::td[text() = '%s']"
    FIELD_VALUE_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d'])[%d]"
    FIELD_HYPERLINK_VALUE_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d']/a"
    ROW_COUNT_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[@data-field=//th[@data-title='序号']/@data-field and @data-rowid='0']/ancestor::td/../../tr[last()]/td[1]//span"
    FIELD_ATTRIBUTE_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d']/ancestor::td/*"
    PARSE_FILED_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//*[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d'])[%d]"

    CHECKBOX_FIELD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//div[@data-field=//th[@data-title='%s']/@data-field and @data-rowid='%d']"
    TEXT_FIELD_IN_BODY_HEAD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//input"
    BASE_FIELD_IN_BODY_HEAD_SPAN_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//span[@class = 'ui-poplistedit-displayname']/preceding-sibling::input/following-sibling::span"
    BASE_FIELD_IN_BODY_HEAD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//span[@class = 'ui-poplistedit-displayname']/preceding-sibling::input"
    SELECT_FIELD_IN_BODY_HEAD_ARGS_LOC = "//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//span[@class = 'k-dropdown-wrap k-state-default']"
    TEXT_VALUE_IN_BODY_HEAD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//*[self::span[@class = 'ui-poplistedit-displayname'] or self::input[not(//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//span[@class = 'ui-poplistedit-displayname'])]])[%d]"
    BASE_VALUE_IN_BODY_HEAD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//span[@class = 'ui-poplistedit-displayname'])[%d]"
    SELECT_VALUE_IN_BODY_HEAD_ARGS_LOC = "(//div[contains(@id, '-FMAINTAB_c-') and @class='k-content k-state-active']//div[contains(@id, 'SPLITECONTAINER') and @splitter='two']//div[contains(@id, 'TAB') and @class='k-content k-state-active']//span[text()= '%s']/../following-sibling::div[1]//span[@class = 'k-dropdown-wrap k-state-default']/span[1])[%d]"
