hongjli
2025-04-11 5ee9b9d9313a1cb5f205c9f575beef0e5df736a9
优化数据来源说明
已修改2个文件
109 ■■■■■ 文件已修改
src/components/DataPreviewDialog.tsx 107 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/SceneIntroDialog.tsx 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/DataPreviewDialog.tsx
@@ -10,13 +10,101 @@
  isOpen: boolean;
  onClose: () => void;
  markdownContent: string;
  sceneType?: 'chadan' | 'buliao';  // 添加场景类型属性
}
export default function DataPreviewDialog({
  isOpen,
  onClose,
  markdownContent
  markdownContent,
  sceneType
}: DataPreviewDialogProps) {
  // 根据场景类型获取对应的数据来源说明
  const getDataSourceDescription = () => {
    if (sceneType === 'chadan') {
      return (
        <div className="space-y-6">
          <div className="bg-white/50 rounded-lg p-4 backdrop-blur-sm border border-blue-100/50">
            <div className="flex items-center gap-3 mb-3">
              <div className="h-8 w-8 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 7v10c0 2 1 3 3 3h10c2 0 3-1 3-3V7c0-2-1-3-3-3H7C5 4 4 5 4 7z" />
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M8 12h8" />
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 16V8" />
                </svg>
              </div>
              <h4 className="text-lg font-semibold text-blue-900">ERP核心数据</h4>
            </div>
            <div className="ml-11">
              <p className="text-blue-800">BOM、需求、采购订单、供应商列表</p>
            </div>
          </div>
          <div className="bg-white/50 rounded-lg p-4 backdrop-blur-sm border border-blue-100/50">
            <div className="flex items-center gap-3 mb-3">
              <div className="h-8 w-8 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6V4m0 2a2 2 0 100 4m0-4a2 2 0 110 4m-6 8a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4m6 6v10m6-2a2 2 0 100-4m0 4a2 2 0 110-4m0 4v2m0-6V4" />
                </svg>
              </div>
              <h4 className="text-lg font-semibold text-blue-900">外部系统补充</h4>
            </div>
            <div className="ml-11">
              <p className="text-blue-800">插单需求通常由CRM、MES或人工输入触发,其他系统(PLM/SRM/SCM)可能提供补充或源头数据</p>
            </div>
          </div>
        </div>
      );
    } else if (sceneType === 'buliao') {
      return (
        <div className="space-y-6">
          <div className="bg-white/50 rounded-lg p-4 backdrop-blur-sm border border-blue-100/50">
            <div className="flex items-center gap-3 mb-3">
              <div className="h-8 w-8 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
                </svg>
              </div>
              <h4 className="text-lg font-semibold text-blue-900">工位信息</h4>
            </div>
            <div className="ml-11">
              <p className="text-blue-800">核心来源系统:MES、SCADA</p>
            </div>
          </div>
          <div className="bg-white/50 rounded-lg p-4 backdrop-blur-sm border border-blue-100/50">
            <div className="flex items-center gap-3 mb-3">
              <div className="h-8 w-8 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2" />
                </svg>
              </div>
              <h4 className="text-lg font-semibold text-blue-900">产线现场库存量</h4>
            </div>
            <div className="ml-11">
              <p className="text-blue-800">核心来源系统:MES、WMS(线边仓)</p>
            </div>
          </div>
          <div className="bg-white/50 rounded-lg p-4 backdrop-blur-sm border border-blue-100/50">
            <div className="flex items-center gap-3 mb-3">
              <div className="h-8 w-8 rounded-lg bg-gradient-to-br from-blue-500 to-blue-600 flex items-center justify-center">
                <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                  <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M20 7l-8-4-8 4m16 0l-8 4m8-4v10l-8 4m0-10L4 7m8 4v10M4 7v10l8 4" />
                </svg>
              </div>
              <h4 className="text-lg font-semibold text-blue-900">原材料库存</h4>
            </div>
            <div className="ml-11">
              <p className="text-blue-800">核心来源系统:ERP、WMS</p>
            </div>
          </div>
        </div>
      );
    }
    return null;
  };
  return (
    <Transition appear show={isOpen} as={Fragment}>
      <Dialog as="div" className="relative z-50" onClose={onClose}>
@@ -71,6 +159,23 @@
                </div>
                <div className="flex-1 overflow-y-auto p-6">
                  <div className="prose max-w-none">
                    <div className="mb-6 p-6 bg-gradient-to-br from-blue-50 to-blue-100/50 rounded-lg border border-blue-100">
                      <h3 className="text-xl font-semibold text-blue-900 mb-4 pb-3 border-b border-blue-200/50 flex items-center gap-2">
                        <svg xmlns="http://www.w3.org/2000/svg" className="h-6 w-6 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                          <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 10V3L4 14h7v7l9-11h-7z" />
                        </svg>
                        数据来源说明
                      </h3>
                      {getDataSourceDescription()}
                      <div className="mt-6 pt-3 border-t border-blue-200/50">
                        <p className="text-blue-800/90 text-sm flex items-center gap-2">
                          <svg xmlns="http://www.w3.org/2000/svg" className="h-5 w-5 text-blue-600/80" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                            <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
                          </svg>
                          注:以上为模拟演示数据,实际使用时将自动对接相关业务系统
                        </p>
                      </div>
                    </div>
                    <ReactMarkdown 
                      remarkPlugins={[remarkGfm]}
                      components={{
src/components/SceneIntroDialog.tsx
@@ -263,6 +263,8 @@
                                  isOpen={showDataPreview}
                                  onClose={() => setShowDataPreview(false)}
                                  markdownContent={scene.exampleData}
                                  sceneType={scene.chatbotId === 'DfH4cIzujVGvn5iR' || scene.chatbotId === 'zO9YQDEHdIApG9zC' ? 'chadan' :
                                           scene.chatbotId === 'JELkWpPLHQfRNhEH' ? 'buliao' : undefined}
                                />
                              )}
                            </div>