<template>
  <tui-input disabled
             :required="required"
             :label="label"
             textRight
             :value="value"
             @click="!disabled && useParts()"
             :placeholder="disabled ? '' : '请选择'">
    <template v-if="!disabled"
              #right>
      <tui-icon name="arrowright"
                :size="24"></tui-icon>
    </template>
  </tui-input>
</template>
<script>
export default {
  props: ["value", "required", "label", "disabled"],
  methods: {
    mounted() {
      console.log("value", value);
      console.log("required:", required);
      console.log("label:", label);
      console.log("disabled:", disabled);
    },
    useParts() {
      // 跳转页面
      uni.navigateTo({
        url: "/pages/common/selectJobNumber/SelectJobNumber",
        events: {
          back: (row) => {
            console.log("input传递数据:", row);
            this.$emit("input", row);
          },
        },
      });
      // // 跳转页面
      // uni.navigateTo({
      //     url: "/pages/common/selectBlank/selectBlank",
      //     events: {
      //         rowClick: row => {
      //             console.log(row);
      //             this.$emit("input", row);
      //         },
      //     },
      //     success: res => {
      //         // 通过eventChannel向被打开页面传送数据
      //         res.eventChannel.emit("acceptDataFromOpenerPage", {
      //             navigationBarTitleText: "选择使用部位",
      //             cardProps: {
      //                 renderText: {
      //                     title: row => row.name,
      //                     footer: row => row.full_name,
      //                 },
      //             },
      //             inputProps: {
      //                 placeholder: "请输入使用部位名称检索",
      //             },
      //             fetchUrl: "common/usePart",
      //         });
      //     },
      // });
    },
  },
};
</script>
