<template>
  <div class="formula_container">
    <div v-if="isAddPreSettingVisible">
      <AddPreSetting :hideSettingModal="hideAddSettingModal" />
    </div>
    <div v-else-if="isUpdatePreSettingVisible">
      <UpdatePreSetting
        :formulaInfo="formulaInfo"
        :hideSettingModal="hideUpdateSettingModal"
      />
    </div>
    <div v-else>
      <div class="header_wrap">
        <p>配方名称</p>
        <p>操作</p>
      </div>
      <div
        :class="
          formulaStore?.formulaList?.length == 0
            ? 'content_wrap layout'
            : 'content_wrap'
        "
      >
        <div
          class="line"
          v-for="item in formulaStore?.formulaList"
          :key="item.id"
        >
          <div class="username">{{ item?.formula_id }}</div>
          <div class="btns">
            <div class="btn" @click="delModalShow(item)">删除</div>
            <div class="btn mg" @click="showUpdateSetting(item)">配置</div>
            <div class="btn" @click="runConfig(item)">执行</div>
          </div>
        </div>
        <svg
          v-if="formulaStore?.formulaList?.length == 0"
          xmlns="http://www.w3.org/2000/svg"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          fill="none"
          version="1.1"
          width="129"
          height="148.6171875"
          viewBox="0 0 129 148.6171875"
        >
          <g>
            <g>
              <path
                d="M77.56318437499999,42.283203125L77.56318437499999,47.883203125C77.56318437499999,49.516503125,78.93818437499999,50.683203125,80.771484375,50.683203125L87.41728437500001,50.683203125L87.41728437500001,64.91650312499999C87.41728437500001,66.549903125,86.04228437500001,67.716503125,84.208984375,67.716503125L67.708984375,67.716503125C65.87568437499999,67.716503125,64.50068437499999,66.316503125,64.50068437499999,64.91650312499999L64.50068437499999,44.849903125C64.50068437499999,43.216503125,65.87568437499999,42.049903125,67.708984375,42.049903125L77.56318437499999,42.049903125L77.56318437499999,42.283203125ZM42.500651375,52.083203125C45.021484375,54.883203125,50.063154374999996,56.983203125,59.000684375,56.983203125L60.604784375,56.983203125L60.604784375,66.783203125L59.000684375,66.783203125C48.000654374999996,66.783203125,41.583984784782,63.516503125,41.583984784782,59.783203125L41.583984784782,54.183203125C41.583984784782,53.483203125,41.813151375,52.783203125,42.500651375,52.083203125ZM78.25068437499999,63.283203125L69.083984375,63.283203125L69.083984375,65.61650312500001L78.25068437499999,65.61650312500001L78.25068437499999,63.283203125ZM82.833984375,58.616503125L69.083984375,58.616503125L69.083984375,60.949903125L82.833984375,60.949903125L82.833984375,58.616503125ZM82.833984375,53.949903125L69.083984375,53.949903125L69.083984375,56.283203125L82.833984375,56.283203125L82.833984375,53.949903125ZM42.500651375,38.316503125C45.021484375,41.116503125,50.063154374999996,43.216503125,59.000684375,43.216503125L60.604784375,43.216503125L60.604784375,53.016503125L59.000684375,53.016503125C48.000654374999996,53.016503125,41.583984784782,49.749903125,41.583984784782,46.016503125L41.583984784782,40.416503125C41.583984784782,39.716503125,41.813151375,39.016503125,42.500651375,38.316503125ZM80.54228437500001,42.283203125L87.41728437500001,49.283203125L81.91728437500001,49.283203125C81.22978437500001,49.283203125,80.54228437500001,48.583203125,80.54228437500001,47.883203125L80.54228437500001,42.283203125ZM59.000684375,21.283203125C70.00068437499999,21.283203125,77.56318437499999,24.316533125,77.56318437499999,28.283203125L77.56318437499999,32.483203125C77.56318437499999,36.449903125,70.00068437499999,39.483203125,59.000684375,39.483203125C48.000654374999996,39.483203125,41.583984375,36.449903125,41.583984375,32.483203125L41.583984375,28.283203125C41.583984375,24.316533125,48.000654374999996,21.283202707767,59.000684375,21.283203125Z"
                fill="#999999"
                fill-opacity="1"
              />
            </g>
            <g>
              <path
                d="M63.989446875,0C39.391046875,0,19.373046875,20.2104,19.373046875,45.0454C19.373046875,69.8804,39.391046875,90.0908,63.989446875,90.0908C88.587846875,90.0908,108.605846875,69.8804,108.605846875,45.0454C108.605846875,20.2104,88.598046875,0,63.989446875,0ZM63.989446875,83.7231C42.864446875,83.7231,25.680076875,66.3735,25.680076875,45.0454C25.680076875,36.145,28.686326875,27.9419,33.703546875,21.3999L89.999646875,73.3975C83.17464687500001,79.7959,74.033946875,83.7231,63.989446875,83.7231ZM94.275346875,68.6909L37.969146875,16.6934C44.804246875000004,10.2949,53.955046875,6.36768,63.989446875,6.36768C85.114446875,6.36768,102.298846875,23.7173,102.298846875,45.0454C102.298846875,53.9458,99.302746875,62.1489,94.275346875,68.6909Z"
                fill="#999999"
                fill-opacity="1"
              />
            </g>
            <g>
              <path
                d="M16.89,116.8571875L16.89,121.2971875C16.89,123.7571875,16.68,126.9971875,14.73,129.3971875C15.33,129.6671875,16.44,130.4171875,16.89,130.8371875C18.45,128.9171875,19.08,126.2471875,19.32,123.8171875L22.71,123.8171875L22.71,130.6871875L25.32,130.6871875L25.32,123.8171875L28.62,123.8171875L28.62,121.5371875L19.41,121.5371875L19.41,121.3571875L19.41,118.7771875C22.41,118.5371875,25.62,118.0571875,27.96,117.3671875L26.58,115.2296875C24.21,116.0134875,20.25,116.5866875,16.89,116.8571875ZM7.77,137.4671875L22.23,137.4671875L22.23,139.53718750000002L7.77,139.53718750000002L7.77,137.4671875ZM7.77,135.5171875L7.77,133.4771875L22.23,133.4771875L22.23,135.5171875L7.77,135.5171875ZM5.07,131.3171875L5.07,142.72468750000002L7.77,142.72468750000002L7.77,141.7271875L22.23,141.7271875L22.23,142.6941875L25.05,142.6941875L25.05,131.3171875L5.07,131.3171875ZM1.56,126.6971875L1.77,129.03718750000002L8.55,128.3171875L8.55,130.6871875L11.16,130.6871875L11.16,128.0471875L15.39,127.5671875L15.36,125.5271875L11.16,125.8871875L11.16,124.0271875L15.66,124.0271875L15.66,121.8071875L11.16,121.8071875L11.16,119.9471875L8.55,119.9471875L8.55,121.8071875L5.16,121.8071875C5.91,120.9371875,6.69,119.9771875,7.44,118.9271875L15.57,118.9271875L15.57,116.7671875L8.88,116.7671875L9.6,115.5615675L6.75,114.8378175C6.48,115.4710975,6.15,116.1343875,5.82,116.7671875L1.53,116.7671875L1.53,118.9271875L4.53,118.9271875C3.99,119.7371875,3.54,120.3671875,3.3,120.6671875C2.7,121.3571875,2.22,121.8371875,1.71,121.9571875C2.01,122.6471875,2.43,123.9371875,2.58,124.4771875C2.85,124.2071875,3.87,124.0271875,5.1,124.0271875L8.55,124.0271875L8.55,126.1271875L1.56,126.6971875ZM36.33,116.82718750000001L36.33,119.6171875L46.02,119.6171875C45.96,121.5671875,45.87,123.57718750000001,45.6,125.5571875L34.47,125.5571875L34.47,128.3471875L45.06,128.3471875C43.83,133.2671875,40.95,137.7671875,34.05,140.3471875C34.77,140.94718749999998,35.58,141.9671875,35.97,142.7232875C43.68,139.5971875,46.71,134.1671875,48,128.3471875L48.24,128.3471875L48.24,137.94718749999998C48.24,141.0671875,49.14,141.9971875,52.56,141.9971875C53.25,141.9971875,56.94,141.9971875,57.66,141.9971875C60.72,141.9971875,61.59,140.7071875,61.92,135.7571875C61.11,135.5471875,59.82,135.0671875,59.19,134.5571875C59.04,138.5471875,58.83,139.2071875,57.45,139.2071875C56.61,139.2071875,53.55,139.2071875,52.89,139.2071875C51.45,139.2071875,51.21,139.0271875,51.21,137.9171875L51.21,128.3471875L61.65,128.3471875L61.65,125.5571875L48.48,125.5571875C48.75,123.57718750000001,48.84,121.5671875,48.93,119.6171875L59.97,119.6171875L59.97,116.82718750000001L36.33,116.82718750000001ZM79.05,115.3459375C78.54,116.4887875,77.61,118.2024875,76.89,119.2848875L78.72,120.1266875C79.53,119.1648875,80.49,117.6915875,81.42,116.3382875L79.05,115.3459375ZM68.37,116.3382875C69.15,117.5710875,69.9,119.2248875,70.14,120.2771875L72.3,119.3152875C72.03,118.2624875,71.22,116.66918749999999,70.41,115.4964075L68.37,116.3382875ZM77.82,132.69718749999998C77.19,134.0190875,76.35,135.1909875,75.36,136.1818875C74.37,135.6713875,73.35,135.1909875,72.36,134.7399875L73.5,132.69718749999998L77.82,132.69718749999998ZM68.91,135.6713875C70.32,136.2423875,71.91,136.9932875,73.38,137.77418749999998C71.55,139.0060875,69.39,139.87698749999998,67.05,140.3879875C67.53,140.92848750000002,68.07,141.91988750000002,68.34,142.5507875C71.07,141.7998875,73.59,140.6879875,75.69,139.0360875C76.65,139.6065875,77.49,140.1474875,78.15,140.6579875L79.86,138.7955875C79.2,138.3451875,78.39,137.8641875,77.52,137.3537875C79.08,135.6113875,80.28,133.4785875,81.03,130.8371875L79.5,130.2671875L79.05,130.3571875L74.64,130.3571875L75.21,128.9771875L72.72,128.4971875C72.48,129.0971875,72.24,129.7271875,71.94,130.3571875L67.98,130.3571875L67.98,132.69718749999998L70.74,132.69718749999998C70.14,133.8090875,69.48,134.8304875,68.91,135.6713875ZM73.38,114.8349975L73.38,120.3371875L67.41,120.3371875L67.41,122.6171875L72.51,122.6171875C71.04,124.3571875,68.91,125.9771875,66.96,126.7871875C67.5,127.32718750000001,68.13,128.28718750000002,68.46,128.9171875C70.14,127.9871875,71.94,126.5471875,73.38,124.9571875L73.38,128.1371875L76.02,128.1371875L76.02,124.3871875C77.34,125.3771875,78.87,126.6071875,79.59,127.2971875L81.12,125.2871875C80.49,124.8671875,78.3,123.4871875,76.8,122.6171875L81.96,122.6171875L81.96,120.3371875L76.02,120.3371875L76.02,114.8349975L73.38,114.8349975ZM84.63,115.0454675C83.94,120.3671875,82.59,125.4371875,80.22,128.5871875C80.82,128.9771875,81.9,129.9071875,82.32,130.3571875C82.98,129.3671875,83.61,128.2571875,84.15,127.0271875C84.78,129.6671875,85.56,132.0971875,86.58,134.2894875C84.93,136.9932875,82.65,139.0660875,79.5,140.53798749999999C80.01,141.0788875,80.76,142.2502875,81.03,142.8512875C84,141.2888875,86.25,139.3365875,87.96,136.87278750000002C89.4,139.21608750000001,91.2,141.1088875,93.42,142.4607875C93.84,141.7698875,94.65,140.7484875,95.28,140.2374875C92.88,138.9455875,90.99,136.87278750000002,89.49,134.2894875C91.02,131.2571875,91.98,127.5971875,92.61,123.1871875L94.59,123.1871875L94.59,120.57718750000001L86.25,120.57718750000001C86.64,118.9238875,86.97,117.1796875,87.24,115.4059375L84.63,115.0454675ZM89.97,123.1871875C89.55,126.2771875,88.95,128.94718749999998,88.05,131.28718750000002C87.06,128.8271875,86.31,126.0971875,85.8,123.1871875L89.97,123.1871875ZM113.52,133.1171875L113.52,142.72468750000002L116.01,142.72468750000002L116.01,141.6671875L124.38,141.6671875L124.38,142.6641875L126.96,142.6641875L126.96,133.1171875L121.35,133.1171875L121.35,129.7571875L127.77,129.7571875L127.77,127.3571875L121.35,127.3571875L121.35,124.32718750000001L126.84,124.32718750000001L126.84,116.1371875L110.67,116.1371875L110.67,125.2571875C110.67,129.9971875,110.43,136.5671875,107.34,141.1271875C108,141.3971875,109.17,142.2713875,109.68,142.7551875C112.08,139.2071875,112.98,134.19718749999998,113.28,129.7571875L118.65,129.7571875L118.65,133.1171875L113.52,133.1171875ZM113.43,118.5971875L124.14,118.5971875L124.14,121.8671875L113.43,121.8671875L113.43,118.5971875ZM113.43,124.32718750000001L118.65,124.32718750000001L118.65,127.3571875L113.4,127.3571875L113.43,125.2571875L113.43,124.32718750000001ZM116.01,139.3571875L116.01,135.4871875L124.38,135.4871875L124.38,139.3571875L116.01,139.3571875ZM103.68,114.8996875L103.68,120.7571875L100.2,120.7571875L100.2,123.3971875L103.68,123.3971875L103.68,129.4571875L99.78,130.5071875L100.44,133.2371875L103.68,132.2471875L103.68,139.2971875C103.68,139.7171875,103.53,139.8371875,103.17,139.8371875C102.81,139.8371875,101.7,139.8371875,100.5,139.8071875C100.86,140.5571875,101.19,141.7571875,101.25,142.4171875C103.17,142.4476875,104.4,142.3571875,105.21,141.9071875C106.02,141.4571875,106.29,140.7371875,106.29,139.2971875L106.29,131.4371875L109.59,130.4171875L109.23,127.8371875L106.29,128.7071875L106.29,123.3971875L109.53,123.3971875L109.53,120.7571875L106.29,120.7571875L106.29,114.8996875L103.68,114.8996875Z"
                fill="#9E9E9E"
                fill-opacity="1"
              />
            </g>
          </g>
        </svg>
      </div>
      <div class="bottom_btn">
        <svg
          @click="addNewPre"
          xmlns="http://www.w3.org/2000/svg"
          xmlns:xlink="http://www.w3.org/1999/xlink"
          fill="none"
          version="1.1"
          width="158"
          height="40"
          viewBox="0 0 158 40"
        >
          <g>
            <g>
              <g>
                <rect
                  x="0"
                  y="0"
                  width="158"
                  height="40"
                  rx="20"
                  fill="#06518B"
                  fill-opacity="1"
                />
              </g>
              <g>
                <path
                  d="M21.014699999999998,7Q23.694200000000002,7,26.0646,8.017009999999999Q28.4349,9.03401,30.2016,10.80272Q31.9683,12.57143,32.9841,14.94445Q34,17.317500000000003,34,20Q34,22.712,32.9841,25.0703Q31.9683,27.4286,30.2016,29.1973Q28.4349,30.966,26.0646,31.983Q23.694200000000002,33,21.014699999999998,33Q18.305799999999998,33,15.93545,31.983Q13.56512,30.966,11.79841,29.1973Q10.03171,27.4286,9.01585,25.0703Q7.999999670926,22.712,8,20Q8,17.317500000000003,9.01585,14.94445Q10.03171,12.57143,11.79841,10.80272Q13.56512,9.03401,15.93545,8.017009999999999Q18.305799999999998,6.999999231289,21.014699999999998,7ZM28.4349,21.7982Q29.2005,21.7982,29.7305,21.2528Q30.2605,20.7075,30.2605,19.941000000000003Q30.2605,19.174599999999998,29.7305,18.644Q29.2005,18.1134,28.4349,18.1134L22.8992,18.1134L22.8992,12.57143Q22.8992,11.80499,22.3545,11.259640000000001Q21.8097,10.71429,21.0442,10.71429Q20.2786,10.71429,19.7486,11.259640000000001Q19.218600000000002,11.80499,19.218600000000002,12.57143L19.218600000000002,18.1134L13.6829,18.1134Q12.91733,18.1134,12.387319999999999,18.644Q11.85731,19.174599999999998,11.85731,19.941000000000003Q11.85731,20.7075,12.387319999999999,21.2528Q12.91733,21.7982,13.6829,21.7982L19.218600000000002,21.7982L19.218600000000002,27.3107Q19.218600000000002,28.0771,19.7486,28.6225Q20.2786,29.1678,21.0442,29.1678Q21.8097,29.1678,22.3545,28.6225Q22.8992,28.0771,22.8992,27.3107L22.8992,21.7982L28.4349,21.7982Z"
                  fill="#FFFFFF"
                  fill-opacity="1"
                />
              </g>
              <g>
                <path
                  d="M53.512,21.852C53.144,23.067999999999998,52.472,24.46,51.480000000000004,25.276L52.36,25.932C53.4,25.004,54.056,23.5,54.456,22.22L53.512,21.852ZM57.288,22.412C57.752,23.484,58.216,24.892,58.344,25.836L59.32,25.468C59.16,24.556,58.712,23.164,58.184,22.108L57.288,22.412ZM59.256,21.98C60.168,23.195999999999998,61.128,24.876,61.512,25.98L62.519999999999996,25.468C62.104,24.364,61.144,22.747999999999998,60.2,21.532L59.256,21.98ZM55.528,20.124000000000002L55.528,26.428C55.528,26.62,55.464,26.684,55.24,26.684C55.032,26.684,54.344,26.7,53.544,26.668C53.688,27.004,53.832,27.436,53.88,27.756C54.952,27.756,55.656,27.74,56.088,27.564C56.519999999999996,27.388,56.647999999999996,27.068,56.647999999999996,26.444L56.647999999999996,20.124000000000002L55.528,20.124000000000002ZM48.36,14.044C49.288,14.508,50.408,15.26025,50.936,15.80475L51.656,14.828C51.096000000000004,14.3,49.976,13.6105,49.064,13.17625L48.36,14.044ZM47.608,18.3823C48.568,18.7985,49.72,19.486800000000002,50.28,19.999299999999998L50.968,19.0225C50.392,18.5103,49.24,17.88575,48.264,17.50175L47.608,18.3823ZM47.96,26.8833L49.032,27.5555C49.736,26.1308,50.536,24.2578,51.144,22.6568L50.184,21.984299999999998C49.512,23.7133,48.6,25.6985,47.96,26.8833ZM52.232,13.948L52.232,15.068L55.768,15.068C55.592,15.804,55.352000000000004,16.524,55.048,17.212L51.496,17.212L51.496,18.348L54.456,18.348C53.656,19.6453,52.552,20.766,51.064,21.5028C51.288,21.7268,51.64,22.1593,51.8,22.4155C53.624,21.4708,54.903999999999996,20.0295,55.8,18.348L57.816,18.348C58.712,19.9495,60.216,21.4225,61.752,22.1593C61.928,21.871000000000002,62.296,21.4545,62.536,21.2305C61.208,20.67,59.912,19.5813,59.064,18.348L62.263999999999996,18.348L62.263999999999996,17.212L56.344,17.212C56.616,16.524,56.84,15.804,57.032,15.068L61.72,15.068L61.72,13.948L52.232,13.948ZM73.752,15.02L73.752,27.5208L74.904,27.5208L74.904,26.332L78.008,26.332L78.008,27.3923L79.208,27.3923L79.208,15.02L73.752,15.02ZM74.904,25.18L74.904,16.188000000000002L78.008,16.188000000000002L78.008,25.18L74.904,25.18ZM67.72,13.238L67.70400000000001,16.076L65.44800000000001,16.076L65.44800000000001,17.244L67.672,17.244C67.56,21.276,67.064,24.828,65.048,26.94C65.352,27.132,65.78399999999999,27.5,65.976,27.7745C68.136,25.42,68.696,21.58,68.84,17.244L71.27199999999999,17.244C71.144,23.404,71,25.596,70.664,26.06C70.52,26.268,70.36,26.332,70.12,26.316C69.832,26.316,69.144,26.316,68.392,26.252C68.6,26.588,68.712,27.1,68.744,27.452C69.464,27.5,70.2,27.5163,70.648,27.452C71.112,27.388,71.416,27.244,71.70400000000001,26.828C72.2,26.14,72.312,23.804000000000002,72.44,16.683999999999997C72.44,16.508,72.44,16.076,72.44,16.076L68.872,16.076L68.904,13.238L67.72,13.238ZM87.96000000000001,23.067999999999998C88.44,23.868000000000002,89.01599999999999,24.956,89.27199999999999,25.66L90.12,25.148C89.88,24.476,89.304,23.436,88.77600000000001,22.636L87.96000000000001,23.067999999999998ZM84.36,22.716C84.03999999999999,23.692,83.512,24.684,82.856,25.388C83.096,25.532,83.512,25.836,83.70400000000001,25.996C84.328,25.244,84.968,24.076,85.336,22.956L84.36,22.716ZM91.048,14.57175L91.048,20.076C91.048,22.204,90.92,24.956,89.56,26.876C89.816,27.02,90.29599999999999,27.388,90.488,27.6138C91.96000000000001,25.5375,92.168,22.3828,92.168,20.0768L92.168,19.564L94.6,19.564L94.6,27.6835L95.768,27.6835L95.768,19.564L97.52799999999999,19.564L97.52799999999999,18.444000000000003L92.168,18.444000000000003L92.168,15.368C93.864,15.11175,95.688,14.69525,97.032,14.1985L96.056,13.31725C94.904,13.801,92.84,14.28275,91.048,14.57175ZM85.624,13.239C85.88,13.688500000000001,86.136,14.2345,86.328,14.716000000000001L83.176,14.716000000000001L83.176,15.724L90.24799999999999,15.724L90.24799999999999,14.716000000000001L87.576,14.716000000000001C87.368,14.186250000000001,87.01599999999999,13.496,86.712,12.966000000000001L85.624,13.239ZM88.232,15.804C88.03999999999999,16.54,87.672,17.628,87.368,18.364L82.936,18.364L82.936,19.387999999999998L86.21600000000001,19.387999999999998L86.21600000000001,21.052L83,21.052L83,22.108L86.21600000000001,22.108L86.21600000000001,26.188C86.21600000000001,26.348,86.184,26.396,86.024,26.396C85.848,26.412,85.352,26.412,84.792,26.396C84.952,26.684,85.112,27.132,85.144,27.42C85.928,27.42,86.47200000000001,27.404,86.84,27.228C87.208,27.052,87.32,26.764,87.32,26.204L87.32,22.108L90.312,22.108L90.312,21.052L87.32,21.052L87.32,19.387999999999998L90.50399999999999,19.387999999999998L90.50399999999999,18.364L88.456,18.364C88.75999999999999,17.69125,89.064,16.826,89.352,16.041L88.232,15.804ZM84.21600000000001,16.060499999999998C84.536,16.780749999999998,84.77600000000001,17.741500000000002,84.84,18.3658L85.88,18.0778C85.8,17.469250000000002,85.52799999999999,16.524749999999997,85.19200000000001,15.83625L84.21600000000001,16.060499999999998ZM108.664,13.756L108.664,14.908000000000001L113.528,14.908000000000001L113.528,18.796L108.712,18.796L108.712,25.74C108.712,27.212,109.16,27.596,110.648,27.596C110.952,27.596,113,27.596,113.336,27.596C114.792,27.596,115.144,26.86,115.288,24.252C114.952,24.172,114.456,23.948,114.168,23.740000000000002C114.088,26.044,113.976,26.46,113.256,26.46C112.808,26.46,111.112,26.46,110.77600000000001,26.46C110.03999999999999,26.46,109.896,26.348,109.896,25.74L109.896,19.948L113.528,19.948L113.528,21.036L114.68,21.036L114.68,13.756L108.664,13.756ZM102.088,23.948L106.52000000000001,23.948L106.52000000000001,25.612L102.088,25.612L102.088,23.948ZM102.088,23.052L102.088,17.628L103.176,17.628L103.176,18.892C103.176,19.756,103.01599999999999,20.796,102.088,21.612000000000002C102.24799999999999,21.708,102.50399999999999,21.948,102.616,22.092C103.624,21.164,103.848,19.884,103.848,18.908L103.848,17.628L104.744,17.628L104.744,20.652C104.744,21.42,104.936,21.564,105.576,21.564C105.688,21.564,106.232,21.564,106.36,21.564L106.52000000000001,21.564L106.52000000000001,23.052L102.088,23.052ZM100.712,13.66L100.712,14.732L103.01599999999999,14.732L103.01599999999999,16.588L101.112,16.588L101.112,27.697L102.088,27.697L102.088,26.588L106.52000000000001,26.588L106.52000000000001,27.472L107.512,27.472L107.512,16.588L105.70400000000001,16.588L105.70400000000001,14.732L107.88,14.732L107.88,13.66L100.712,13.66ZM103.88,16.588L103.88,14.732L104.824,14.732L104.824,16.588L103.88,16.588ZM105.432,17.628L106.52000000000001,17.628L106.52000000000001,20.86L106.47200000000001,20.828C106.44,20.86,106.408,20.875999999999998,106.232,20.875999999999998C106.12,20.875999999999998,105.72,20.875999999999998,105.64,20.875999999999998C105.44800000000001,20.875999999999998,105.432,20.844,105.432,20.636L105.432,17.628ZM124.44,13.3825C124.856,14.13625,125.336,15.1625,125.528,15.804L118.488,15.804L118.488,16.972L122.856,16.972C122.664,20.652,122.264,24.796,118.136,26.844C118.456,27.068,118.84,27.484,119.016,27.7905C122.056,26.204,123.256,23.548000000000002,123.768,20.7L129.49599999999998,20.7C129.24,24.316,128.92000000000002,25.868,128.45600000000002,26.284C128.248,26.444,128.04000000000002,26.476,127.688,26.476C127.256,26.476,126.136,26.46,124.984,26.364C125.224,26.684,125.384,27.18,125.416,27.532C126.488,27.6128,127.544,27.629,128.10399999999998,27.5805C128.728,27.5483,129.128,27.436,129.49599999999998,27.02C130.12,26.396,130.44,24.652,130.76,20.108C130.792,19.932000000000002,130.808,19.532,130.808,19.532L123.96,19.532C124.056,18.683999999999997,124.12,17.82,124.168,16.972L132.376,16.972L132.376,15.804L125.624,15.804L126.76,15.307C126.536,14.6655,126.04,13.687249999999999,125.592,12.9335L124.44,13.3825Z"
                  fill="#FFFFFF"
                  fill-opacity="1"
                />
              </g>
            </g>
          </g>
        </svg>
      </div>
    </div>
    <DelPreModal v-if="delPreModalVisible" :hideDelModal="hideDelModal" />
  </div>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import DelPreModal from 'cpns/dialogs/DelPreModal'
import AddPreSetting from './AddPreSetting'
import UpdatePreSetting from './UpdatePreSetting'
import { getAllFormulaJSON } from '@/mock/command'
import { useWebSocketStore, useFormulaStore } from '@/store'
import { startFormulaJSON } from '@/mock/command'

const props = defineProps({
  changeTab: {
    type: Function,
  },
})

const webSocketStore = useWebSocketStore()
const formulaStore = useFormulaStore()

const delPreModalVisible = ref(false)

const delModalShow = item => {
  formulaStore.updateCurrentFormula(item)
  delPreModalVisible.value = true
}

const hideDelModal = () => {
  delPreModalVisible.value = false
}

const isAddPreSettingVisible = ref(false)
const isUpdatePreSettingVisible = ref(false)
const formulaInfo = ref({})
const showUpdateSetting = item => {
  formulaInfo.value = item
  console.log(item)
  formulaStore.updateCurrentFormula(item)
  isUpdatePreSettingVisible.value = true
}

const hideUpdateSettingModal = () => {
  formulaInfo.value = {}
  isUpdatePreSettingVisible.value = false
}

const hideAddSettingModal = () => {
  isAddPreSettingVisible.value = false
}

// 执行配置
const runConfig = item => {
  formulaStore.updateCurrentFormula(item)
  webSocketStore.sendCommandMsg(startFormulaJSON(item.id))
  props.changeTab(1)
}

const addNewPre = () => {
  // 添加新预设
  isAddPreSettingVisible.value = true
}

onMounted(() => {
  webSocketStore.sendCommandMsg(getAllFormulaJSON)
})
</script>

<style lang="scss" scoped>
.formula_container {
  margin-bottom: 19px;
  height: 580px;
  box-sizing: border-box;
  border-radius: 16px;
  background: #fff;
  .header_wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 80.29px;
    background: #f6f6f6;
    border-radius: 16px 16px 0px 0px;
    padding: 0 130px;
    box-sizing: border-box;
    font-family: Source Han Sans CN;
    font-size: 18px;
    font-weight: normal;
    line-height: normal;
    letter-spacing: 0.07em;
    color: #999999;
    padding-right: 192px;
  }
  .content_wrap {
    height: 446px;
    overflow: scroll;
    box-sizing: border-box;
    .line {
      padding: 12px;
      padding-left: 40px;
      padding-right: 60px;
      font-family: Source Han Sans CN;
      font-size: 18px;
      font-weight: normal;
      line-height: normal;
      letter-spacing: 0.07em;
      color: #191919;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid #f6f6f6;
      box-sizing: border-box;
      .username {
        width: 251px;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        text-align: center;
      }
      .btns {
        display: flex;
        align-items: center;
        .btn {
          width: 87px;
          height: 45px;
          border-radius: 23px;
          background: #06518b;
          display: flex;
          align-items: center;
          justify-content: center;
          font-family: Source Han Sans CN;
          font-size: 20px;
          font-weight: normal;
          line-height: normal;
          letter-spacing: 0.1em;
          color: #ffffff;
        }
        .mg {
          margin: 0 20px;
        }
      }
    }
  }
  .layout {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .bottom_btn {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 20px;
  }
}
</style>
